[
  {
    "path": ".github/workflows/kumuluzee-ci.yml",
    "content": "name: KumuluzEE CI\n\non: [push, pull_request]\n\njobs:\n  test:\n    name: Build and test\n    runs-on: 'ubuntu-latest'\n\n    strategy:\n      matrix:\n        java-version: ['11', '17', '18']\n\n    steps:\n      - name: Checkout code\n        uses: actions/checkout@v2\n\n      - name: Set up JDK ${{ matrix.java-version }}\n        uses: actions/setup-java@v1\n        with:\n          java-version: ${{ matrix.java-version }}\n\n      - name: Cache Maven packages\n        uses: actions/cache@v2\n        with:\n          path: ~/.m2\n          key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}\n          restore-keys: ${{ runner.os }}-m2\n\n      - name: Install\n        run: mvn --show-version --update-snapshots --batch-mode clean install -DskipTests=true\n\n      - name: Test\n        run: mvn --batch-mode test\n\n  publish:\n    name: Publish to OSSRH\n    runs-on: 'ubuntu-latest'\n\n    needs: test\n    if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')\n\n    steps:\n      - name: Checkout code\n        uses: actions/checkout@v2\n\n      - name: Set up JDK 11\n        uses: actions/setup-java@v1\n        with:\n          java-version: 11\n\n      - name: Restore cache\n        uses: actions/cache@v2\n        with:\n          path: ~/.m2\n          key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}\n          restore-keys: ${{ runner.os }}-m2\n\n      - name: Restore GPG keys\n        env:\n          GPG_KEY: ${{ secrets.OSSRH_GPG_KEY }}\n          GPG_PUB: ${{ secrets.OSSRH_GPG_PUB }}\n        run: 'printf \"$GPG_KEY\" | base64 --decode > \"$GITHUB_WORKSPACE/gpg.key\" && printf \"$GPG_PUB\" | base64 --decode > \"$GITHUB_WORKSPACE/gpg.pub\" && gpg --batch --import \"$GITHUB_WORKSPACE/gpg.pub\" \"$GITHUB_WORKSPACE/gpg.key\"'\n\n      - name: Publish to OSSRH\n        env:\n          OSSRH_USERNAME: Kumuluz\n          OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}\n          GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_PASSPHRASE }}\n        run: mvn --batch-mode source:jar javadoc:jar deploy -Pdeploy -DskipTests=true --settings ./settings.xml;\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing to KumuluzEE\n\n♥ [KumuluzEE](https://github.com/kumuluz/KumuluzEE) and want to get involved?\nThanks! There are plenty of ways you can help!\n\n## Bugs\n\nA bug is a _demonstrable problem_ that is caused by the code in the\nrepository. Good bug reports are extremely helpful - thank you!\n\nGuidelines for bug reports:\n\n1. **Use the GitHub issue search** &mdash; check if the issue has already been\n   reported.\n\n2. **Check if the issue has been fixed** &mdash; try to reproduce it using the\n   latest `master` branch in the repository.\n\n3. **Isolate the problem** &mdash; ideally create a [reduced test\n   case](http://css-tricks.com/6263-reduced-test-cases/) and a live example.\n\nA good bug report shouldn't leave others needing to chase you up for more\ninformation. Please try to be as detailed as possible in your report. What is\nyour environment? What steps will reproduce the issue? What OS versions\nexperience the problem? What would you expect to be the outcome? All these\ndetails will help people to fix any potential bugs.\n\nExample:\n\n> Short and descriptive example bug report title\n>\n> A summary of the issue and the OS environment in which it occurs. If\n> suitable, include the steps required to reproduce the bug.\n>\n> 1. This is the first step\n> 2. This is the second step\n> 3. Further steps, etc.\n>\n> `<url>` (a link to the reduced test case)\n>\n> Any other information you want to share that is relevant to the issue being\n> reported. This might include the lines of code that you have identified as\n> causing the bug, and potential solutions (and your opinions on their\n> merits).\n\n**[File a bug report](https://github.com/kumuluz/KumuluzEE/issues/)**\n\n\n## Pull requests\n\nGood pull requests - patches, improvements, new features - are a fantastic\nhelp. They should remain focused in scope and avoid containing unrelated\ncommits. If your contribution involves a significant amount of work or substantial\nchanges to any part of the project, please open an issue to discuss it first.\n\nMake sure to adhere to the coding conventions used throughout a project\n(indentation, accurate comments, etc.). Please update any documentation that is\nrelevant to the change you're making.\n\nPlease follow this process; it's the best way to get your work included in the\nproject:\n\n1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork,\n   and configure the remotes:\n\n   ```bash\n   # Clones your fork of the repo into the current directory in terminal\n   git clone https://github.com/<your-username>/KumuluzEE.git\n   # Navigate to the newly cloned directory\n   cd KumuluzEE\n   # Assigns the original repo to a remote called \"upstream\"\n   git remote add upstream https://github.com/kumuluz/KumuluzEE.git\n   ```\n\n2. If you cloned a while ago, get the latest changes from upstream:\n\n   ```bash\n   git checkout master\n   git pull upstream master\n   ```\n\n3. Create a new topic branch to contain your feature, change, or fix:\n\n   ```bash\n   git checkout -b <topic-branch-name>\n   ```\n\n4. Commit your changes in logical chunks. Please adhere to these [git commit\n   message\n   guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)\n   or your pull request is unlikely be merged into the main project. Use git's\n   [interactive rebase](https://help.github.com/articles/interactive-rebase)\n   feature to tidy up your commits before making them public.\n\n5. Locally merge (or rebase) the upstream development branch into your topic branch:\n\n   ```bash\n   git pull [--rebase] upstream master\n   ```\n\n6. Push your topic branch up to your fork:\n\n   ```bash\n   git push origin <topic-branch-name>\n   ```\n\n10. [Open a Pull Request](https://help.github.com/articles/using-pull-requests) with a\n    clear title and description.\n\n\n## Do not…\n\nPlease **do not** use the issue tracker for personal support requests.\n\nPlease **do not** derail or troll issues. Keep the\ndiscussion on topic and respect the opinions of others."
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2015 Sunesis d.o.o. and Tilen Faganel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE."
  },
  {
    "path": "README.md",
    "content": "# KumuluzEE\n![KumuluzEE CI](https://github.com/kumuluz/kumuluzee/workflows/KumuluzEE%20CI/badge.svg)\n\n> Lightweight open-source framework for developing microservices using standard Java/JakartaEE technologies, extending them with Node.js, Go and other languages, and migrating to cloud-native architecture.\n\nKumuluzEE is a lightweight framework for developing microservices using standard Java/JakartaEE technologies, extending them with Node.js, Go and other languages, and migrating existing applications to microservices and cloud-native architecture. KumuluzEE packages microservices as standalone JARs. KumuluzEE microservices are lightweight and optimized for size and start-up time.\nThey fit perfectly with Docker containers. KumuluzEE microservices are fully compatible with Kubernetes and enable Kubernetes-native development. KumuluzEE will also provide support for Serverless Functions on Azure, AWS and Google. \n\nKumuluzEE also provides extensions for developing common patterns in cloud-native architectures, including configuration, logging, discovery, fault tolerance with circuit-breakers, metrics, security, event streaming and more.\n\nKumuluzEE has been designed to use the standard Java/JakartaEE technologies and APIs with optional extensions for easier development of cloud-native microservices. Therefore, it is particularly suitable for existing enterprise Java developers, who would like to leverage their skills, but progressively move from monolithic to microservice design patterns.\n\nKumuluzEE provides full support for **Java** latest versions (check each release for specific information). In addition to Java, KumuluzEE supports several programming languages, including **Node.js** and **Go**. Support for additional languages will be added soon. For these languages, KumuluzEE also provides support for service configuration and discovery. \n\nKumuluzEE is Eclipse MicroProfile compliant and provides support for MicroProfile 1.0, 1.1, 1.2, 1.3, 1.4, 2.0, 2.1, 3.0, 3.1, 3.2 and 3.3. Support for 4.x and 5.x is coming soon. KumuluzEE provides support for all MicroProfile specifications, including MicroProfile Config, MicroProfile Health, MicroProfile Fault Tolerance, MicroProfile Metrics, MicroProfile JWT Authentication, MicroProfile Rest Client, MicroProfile OpenAPI and MicroProfile Open Tracing APIs.\n\n## Getting started\n\nIf you already know how to use Java/JakartaEE, then you already know how to use KumuluzEE. It is simple and straightforward. \n\nSee the [getting started](https://github.com/kumuluz/KumuluzEE/wiki/Getting-started) wiki section to create your first light-weight standalone Java microservice in 5 minutes. \n\nRead [tutorials](https://ee.kumuluz.com/tutorials/) at our home page.\n\nRefer to [samples](https://github.com/kumuluz/kumuluzee-samples) for more examples.\n\n## Features\n\nPrimary features:\n- Lightweight, cloud-native Java microservices with full support for Docker, Kubernetes and Serverless (coming soon).\n- Support for all major cloud-native patterns, minimal footprint, quick start-up time, perfect for scaling in the cloud.\n- No need for a traditional application server. Run your app anywhere Java runs as well as in PaaS\nand Docker-like environments.\n- Allows you to develop microservices using standard Java technologies and extend them with Node.js, Go and other languages.\n- Allows you to gradually migrate existing Java applications to microservices and cloud-native architecture.\n- Complete control over what Java/JakartaEE components and its implementations are included. Only include what you need and make your app lightweight.\n- Minimal to no configuration settings up the base server. Develop like any other Java application.\n- Quick startup time, low resource consumption and stateless scalability accelerates development.\n- Extend your microservices with common cloud-native patterns, such as config, discovery, logging, fault tolerance, circuit-breakers, etc. KumuluzEE provides all the building blocks.\n\nKumuluzEE provides support for various Java/JakartaEE APIs and components. The goal is to support as many Java components as possible (contributions welcome). \n\n## Java/JavaEE/JakartaEE components\n\nCurrently the following components are supported with more being added over time:\n\n- Servlet (Jetty)\n- CDI (RI Weld)\n- JAX-RS (RI Jersey)\n- JSON-P (RI JSONP)\n- JSON-B (RI Yasson)\n- JSP (Jetty Apache Jasper)\n- JPA (RI EclipseLink)\n- JPA (RI Hibernate)\n- EL (RI UEL)\n- JAX-WS (RI Metro)\n- JAX-WS (Apache CXF)\n- JSF (RI Mojarra)\n- WebSocket (Jetty)\n- Bean Validation (RI Hibernate validator)\n- JTA (Narayana)\n- Java Mail (RI JavaMail)\nPlease check each specific KumuluzEE version for specific versions of these components. \n\n## Additional features\n\nKumuluzEE provides additional features, which are described on the [project Wiki]( https://github.com/kumuluz/kumuluzee/wiki), particularly:\n- [Configuration framework](https://github.com/kumuluz/kumuluzee/wiki/Configuration) for easy and efficient configuration of microservices from various sources, such as environment variables, configuration files (yaml), properties, etc.\n- [TLS/SSL support](https://github.com/kumuluz/kumuluzee/wiki/TLS-SSL-support) for configuring TLS/SSL, including support for **HTTP/2**.\n\nKumuluzEE also provides support for [**Uber JARs**](https://github.com/kumuluz/kumuluzee/wiki/Uber-JAR-support). With the KumuluzEE Maven plugin, you can pack and run each microservice as a single, self-contained Uber-JAR. Details are described later in this document.\n\n## KumuluzEE projects\n\nIn addition to the standard Java EE components, KumuluzEE also comes with several projects that complement and extend its functionality. The projects follow the same modular concept as the Java components in which you can chose if you want to use it as well as the underlying implementation of the project. Most projects are geared towards creating cloud-native microservices including configuration, logging, discovery, fault tolerance including circuit-breakers, metrics, security, event streaming and more. Projects also extend KumuluzEE with technologies, such as Ethereum for blockchain microservices, gRPC, GraphQL, and others. \nThe following projects are available with more planned soon:\n\n- [KumuluzEE Config](https://github.com/kumuluz/kumuluzee/wiki/Configuration) (File and environment variables)\n- [KumuluzEE Config with config server](https://github.com/kumuluz/kumuluzee-config) (Config server etcd/Consul)\n- [KumuluzEE REST](https://github.com/kumuluz/kumuluzee-rest) (For implementation of common, advanced and flexible REST API functionalities and patterns. Includes support for exposing JPA entities through REST)\n- [KumuluzEE Logs](https://github.com/kumuluz/kumuluzee-logs) (For advanced microservice framework for logging)\n- [KumuluzEE Discovery](https://github.com/kumuluz/kumuluzee-discovery) (For dynamic service discovery (etcd or Consul). Fully compatible with Kubernetes)\n- [KumuluzEE Metrics](https://github.com/kumuluz/kumuluzee-metrics) (For easy collection and reporting of performance metrics)\n- [KumuluzEE Security](https://github.com/kumuluz/kumuluzee-security) (For easy integration with OAuth2/OpenID identity and access management providers)\n- [KumuluzEE Health](https://github.com/kumuluz/kumuluzee-health) (For implementing health checks and exposing microservice health information)\n- [KumuluzEE Fault Tolerance](https://github.com/kumuluz/kumuluzee-fault-tolerance) (For implementing fault tolerance patterns with microservices including circuit breakers and decoupling microservices)\n- [KumuluzEE Event Streaming](https://github.com/kumuluz/kumuluzee-streaming) (For event streaming support using Apache Kafka)\n- [KumuluzEE Reactive](https://github.com/kumuluz/kumuluzee-reactive) (For developing reactive microservices and integration with reactive streams (Vert.x and similar))\n- [KumuluzEE CORS](https://github.com/kumuluz/kumuluzee-cors) (For Cross-Origin Resource Sharing (CORS) support)\n- [KumuluzEE Swagger](https://github.com/kumuluz/kumuluzee-swagger) (For Swagger (OpenAPI 2) support and visualization)\n- [KumuluzEE OpenAPI](https://github.com/kumuluz/kumuluzee-openapi) (For OpenAPI 3 support, interface generation and visualization)\n- [KumuluzEE Testing](https://github.com/kumuluz/kumuluzee-testing) (Tools and utilities for testing KumuluzEE microservices)\n- [KumuluzEE gRPC](https://github.com/kumuluz/kumuluzee-grpc) (Native support for gRPC based services)\n- [KumuluzEE GraphQL](https://github.com/kumuluz/kumuluzee-graphql) (Native support for GraphQL)\n- [KumuluzEE Ethereum](https://github.com/kumuluz/kumuluzee-ethereum) (For Ethereum-enabled blockchain microservices)\n- [KumuluzEE AMQP](https://github.com/kumuluz/kumuluzee-amqp) (Support for Advanced Message Queueing Protocol)\n- [KumuluzEE Feature Flags](https://github.com/kumuluz/kumuluzee-feature-flags) (Support for development with feature flags.)\n- [KumuluzEE JCache](https://github.com/kumuluz/kumuluzee-jcache) (Support for caching using JCache annotations.)\n- [KumuluzEE Version](https://github.com/kumuluz/kumuluzee-version) (Support for exposing version details of microservice.)\n\n\n## MicroProfile\n\nKumuluzEE is Eclipse MicroProfile compliant and provides support for:\n- MicroProfile 1.0 \n- MicroProfile 1.1\n- MicroProfile 1.2\n- MicroProfile 1.3\n- MicroProfile 1.4\n- MicroProfile 2.0\n- MicroProfile 2.1\n- MicroProfile 3.0\n- MicroProfile 3.1\n- MicroProfile 3.2\n- MicroProfile 3.3\n\nIt implements the following MicroProfile APIs:\n- [MicroProfile Config](https://github.com/kumuluz/kumuluzee-config-mp)\n- [MicroProfile Health Check](https://github.com/kumuluz/kumuluzee-health)\n- [MicroProfile Fault Tolerance](https://github.com/kumuluz/kumuluzee-fault-tolerance)\n- [MicroProfile Metrics](https://github.com/kumuluz/kumuluzee-metrics)\n- [MicroProfile JWT Authentication](https://github.com/kumuluz/kumuluzee-jwt-auth)\n- [MicroProfile Rest Client](https://github.com/kumuluz/kumuluzee-rest-client)\n- [MicroProfile OpenAPI](https://github.com/kumuluz/kumuluzee-openapi-mp)\n- [MicroProfile Open Tracing](https://github.com/kumuluz/kumuluzee-opentracing)\n\n## Usage\n\nKumuluzEE ships with a BOM (bill of materials) which you can use to easily add the various components you need without worrying about the versions and their compatibility as it is required that all components are the same version. \n\nUsing maven add the BOM module of the library as a dependency to your project. The `${kumuluzee.version}` variables represents the most current minor version. You can see the available version on the\n[Release Page](https://github.com/kumuluz/KumuluzEE/releases).\n\n```xml\n<dependencyManagement>\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-bom</artifactId>\n            <version>${kumuluzee.version}</version>\n            <type>pom</type>\n            <scope>import</scope>\n        </dependency>\n    </dependencies>\n</dependencyManagement>\n```\n\nNow you can choose either any single combinations of Java components or use one of the common pre-built profiles that ship as part of KumuluzEE. You can chose any of the following profiles:\n\nMicroProfile 1.0\n```xml\n<!-- MicroProfile 1.0 -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-microProfile-1.0</artifactId>\n</dependency>\n```\n\nMicroProfile 1.1\n```xml\n<!-- MicroProfile 1.1 -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-microProfile-1.1</artifactId>\n</dependency>\n```\n\nMicroProfile 1.2\n```xml\n<!-- MicroProfile 1.2 -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-microProfile-1.2</artifactId>\n</dependency>\n```\n\nMicroProfile 1.3\n```xml\n<!-- MicroProfile 1.3 -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-microProfile-1.3</artifactId>\n</dependency>\n```\n\nMicroProfile 1.4\n```xml\n<!-- MicroProfile 1.4 -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-microProfile-1.4</artifactId>\n</dependency>\n```\n\nMicroProfile 2.0\n```xml\n<!-- MicroProfile 2.0 -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-microProfile-2.0</artifactId>\n</dependency>\n```\n\nMicroProfile 2.1\n```xml\n<!-- MicroProfile 2.1 -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-microProfile-2.1</artifactId>\n</dependency>\n```\n\nMicroProfile 3.0\n```xml\n<!-- MicroProfile 3.0 -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-microProfile-3.0</artifactId>\n</dependency>\n```\n\nMicroProfile 3.1\n```xml\n<!-- MicroProfile 3.1 -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-microProfile-3.1</artifactId>\n</dependency>\n```\n\nMicroProfile 3.2\n```xml\n<!-- MicroProfile 3.2 -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-microProfile-3.2</artifactId>\n</dependency>\n```\n\nMicroProfile 3.3\n```xml\n<!-- MicroProfile 3.3 -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-microProfile-3.3</artifactId>\n</dependency>\n```\n\nTo choose your Java components with fine grain control include them as your dependencies. You can chose any of the following artifacts:\n\n```xml\n<!-- Servlet (Jetty) -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-servlet-jetty</artifactId>\n</dependency>\n\n<!-- WebSocket (Jetty) -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-websocket-jetty</artifactId>\n</dependency>\n\n<!-- JSP (Jetty Apache Jasper) -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-jsp-jetty</artifactId>\n</dependency>\n\n<!-- EL (UEL) -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-el-uel</artifactId>\n</dependency>\n\n<!-- CDI (Weld) -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-cdi-weld</artifactId>\n</dependency>\n\n<!-- JPA (EclipseLink) -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-jpa-eclipselink</artifactId>\n</dependency>\n\n<!-- or -->\n\n<!-- JPA (Hibernate) -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-jpa-hibernate</artifactId>\n</dependency>\n\n<!-- JAX-RS (Jersey) -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-jax-rs-jersey</artifactId>\n</dependency>\n\n<!-- JAX-WS (RI Metro) -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-jax-ws-metro</artifactId>\n</dependency>\n\n<!-- or -->\n\n<!-- JAX-WS (Apache CXF) -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-jax-ws-cxf</artifactId>\n</dependency>\n\n<!-- JSF (Mojarra) -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-jsf-mojarra</artifactId>\n</dependency>\n\n<!-- Bean Validation (Hibernate validator) -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-bean-validation-hibernate-validator</artifactId>\n</dependency>\n\n<!-- JSON-P -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-json-p-jsonp</artifactId>\n</dependency>\n\n<!-- JSON-B -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-json-b-yasson</artifactId>\n</dependency>\n\n<!-- JTA -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-jta-narayana</artifactId>\n</dependency>\n\n<!-- JavaMail -->\n<dependency>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-javamail-ri</artifactId>\n</dependency>\n```\n\nTo choose your KumuluzEE project, you simply include it as your dependency. You can find the available implementations and options at their respected project pages.\n\n## Pack and run microservice as Uber JAR\n\nKumuluzEE (version 2.4 and higher) provides support for packing and running microservices as Uber JARs. It also includes a Maven plugin that correctly packages the microservice. \n\nTo package a Kumuluz EE microservice into an Uber JAR, you need to add the following plugin declaration into your \nREST module pom.xml:\n\n```xml\n<plugin>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-maven-plugin</artifactId>\n    <version>${kumuluzee.version}</version>\n    <executions>\n        <execution>\n            <id>package</id>\n            <goals>\n                <goal>repackage</goal>\n            </goals>\n            <configuration>\n                <finalName/>\n                <outputDirectory/>\n                <mainClass/>\n                <webappDir/>\n            </configuration>\n        </execution>\n    </executions>\n</plugin>\n```\n\n#### Parameters\n\n* __finalName__\n\n    Final name of the generated \"uber\" JAR.\n    \n    __Default value is__: `${project.build.finalName}` or `${project.artifactId}-${project.version}`\n    \n* __outputDirectory__\n\n    Directory containing the generated JAR.\n    \n    __Default value is__: `${project.build.directory}`\n\n\n### Run\nStart the application using the following command:\n```cmd\njava -jar ${project.build.finalName}.jar\n```\nExample:\n```cmd\njava -jar my-app-1.0.0-SNAPSHOT.jar\n```\n\n## Getting started\n\nYou can find the getting started guide on the projects [wiki](https://github.com/kumuluz/KumuluzEE/wiki/Getting-started).\nYou can find samples [for Java EE and KumuluzEE]( https://github.com/kumuluz/kumuluzee-samples)\n\n## Building\n\nEnsure you have JDK 8 (or newer), Maven 3.2.1 (or newer) and Git installed\n\n```bash\njava -version\nmvn -version\ngit --version\n```\n\nFirst clone the KumuluzEE repository:\n\n```bash\ngit clone https://github.com/kumuluz/KumuluzEE.git\ncd KumuluzEE\n```\n    \nTo build KumuluzEE run:\n\n```bash\nmvn clean package\n```\n\nThis will build all modules and run the testsuite. \n    \nOnce completed you will find the build archives in the modules respected `target` folder.\n\n## Changelog\n\nRecent changes can be viewed on Github on the [Releases Page](https://github.com/kumuluz/KumuluzEE/releases)\n\n## Contribute\n\nSee the [contributing docs](https://github.com/kumuluz/KumuluzEE/blob/master/CONTRIBUTING.md)\n\nWhen submitting an issue, please follow the [guidelines](https://github.com/kumuluz/KumuluzEE/blob/master/CONTRIBUTING.md#bugs).\n\nWhen submitting a bugfix, write a test that exposes the bug and fails before applying your fix. Submit the test alongside the fix.\n\nWhen submitting a new feature, add tests that cover the feature.\n\n## License\n\nMIT\n"
  },
  {
    "path": "bom/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n    <packaging>pom</packaging>\n\n    <name>KumuluzEE BOM</name>\n    <description>Bill of materials for all the KumuluzEE components</description>\n\n    <artifactId>kumuluzee-bom</artifactId>\n\n    <dependencyManagement>\n        <dependencies>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-micro-profile</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-microProfile-1.0</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-microProfile-1.1</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-microProfile-1.2</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-microProfile-1.3</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-microProfile-1.4</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-microProfile-2.0</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-microProfile-2.1</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-microProfile-2.2</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-microProfile-3.0</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-microProfile-3.1</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-microProfile-3.2</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-microProfile-3.3</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-core</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-servlet-jetty</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-jsp-jetty</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-el-uel</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-cdi-weld</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-jpa-eclipselink</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-jpa-hibernate</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-jax-rs-jersey</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-jax-ws-metro</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-jax-ws-cxf</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-jsf-mojarra</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-websocket-jetty</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-bean-validation-hibernate-validator</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-json-p-jsonp</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-json-b-yasson</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-jta-narayana</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-javamail-ri</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n        </dependencies>\n    </dependencyManagement>\n\n</project>\n"
  },
  {
    "path": "common/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE Common</name>\n    <description>\n        KumuluzEE common utilities, configs, exceptions and Java EE component interfaces\n    </description>\n\n    <artifactId>kumuluzee-common</artifactId>\n\n    <dependencies>\n        <dependency>\n            <groupId>jakarta.annotation</groupId>\n            <artifactId>jakarta.annotation-api</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>jakarta.servlet</groupId>\n            <artifactId>jakarta.servlet-api</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>jakarta.transaction</groupId>\n            <artifactId>jakarta.transaction-api</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>io.agroal</groupId>\n            <artifactId>agroal-api</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>io.agroal</groupId>\n            <artifactId>agroal-hikari</artifactId>\n            <version>${agroal.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>io.agroal</groupId>\n            <artifactId>agroal-pool</artifactId>\n            <version>${agroal.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.yaml</groupId>\n            <artifactId>snakeyaml</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>junit</groupId>\n            <artifactId>junit</artifactId>\n            <scope>test</scope>\n        </dependency>\n    </dependencies>\n\n    <build>\n        <resources>\n            <resource>\n                <directory>src/main/resources</directory>\n                <filtering>true</filtering>\n            </resource>\n        </resources>\n    </build>\n\n</project>"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/Component.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common;\n\nimport com.kumuluz.ee.common.config.EeConfig;\nimport com.kumuluz.ee.common.wrapper.KumuluzServerWrapper;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\npublic interface Component {\n\n    void init(KumuluzServerWrapper server, EeConfig eeConfig);\n\n    void load();\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/ConfigExtension.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common;\n\nimport com.kumuluz.ee.configuration.ConfigurationSource;\n\nimport java.util.Collections;\nimport java.util.List;\n\n/**\n * @author Tilen Faganel\n * @since 2.3.0\n */\npublic interface ConfigExtension extends Extension {\n\n    /**\n     * @deprecated Use {@link #getConfigurationSources()} instead.\n     */\n    @Deprecated\n    default ConfigurationSource getConfigurationSource() {\n        return null;\n    }\n\n    default List<ConfigurationSource> getConfigurationSources() {\n        return Collections.emptyList();\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/Extension.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common;\n\nimport com.kumuluz.ee.common.config.EeConfig;\nimport com.kumuluz.ee.common.wrapper.KumuluzServerWrapper;\n\nimport java.util.Collections;\nimport java.util.List;\n\n/**\n * @author Tilen Faganel\n * @since 2.3.0\n */\npublic interface Extension {\n\n    void load();\n\n    void init(KumuluzServerWrapper server, EeConfig eeConfig);\n\n    default boolean isEnabled() {\n        return true;\n    }\n\n    default List<String> scanLibraries() {\n        return Collections.emptyList();\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/KumuluzServer.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common;\n\nimport com.kumuluz.ee.common.config.ServerConfig;\n\nimport java.util.EventListener;\nimport java.util.Map;\n\nimport javax.servlet.Servlet;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\npublic interface KumuluzServer {\n\n    void initServer();\n\n    void startServer();\n\n    void stopServer();\n\n    void setServerConfig(ServerConfig serverConfig);\n\n    ServerConfig getServerConfig();\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/LogsExtension.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common;\n\nimport java.util.Optional;\nimport java.util.logging.Handler;\nimport java.util.logging.LogManager;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic interface LogsExtension extends Extension {\n\n    Optional<Class<? extends LogManager>> getJavaUtilLogManagerClass();\n\n    Optional<Handler> getJavaUtilLogHandler();\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/ServletServer.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common;\n\nimport com.kumuluz.ee.common.servlet.ServletWrapper;\n\nimport javax.servlet.DispatcherType;\nimport javax.servlet.Filter;\nimport javax.servlet.Servlet;\nimport javax.sql.DataSource;\nimport javax.transaction.UserTransaction;\nimport java.util.*;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\npublic interface ServletServer extends KumuluzServer {\n\n    void registerServlet(Class<? extends Servlet> servletClass, String mapping);\n\n    void registerServlet(Class<? extends Servlet> servletClass, String mapping, Map<String, String> parameters);\n\n    void registerServlet(Class<? extends Servlet> servletClass, String mapping, Map<String, String> parameters, int initOrder);\n\n    void registerListener(EventListener listener);\n\n    void registerFilter(Class<? extends Filter> filterClass, String pathSpec);\n\n    void registerFilter(Class<? extends Filter> filterClass, String pathSpec, Map<String, String> parameters);\n\n    void registerFilter(Class<? extends Filter> filterClass, String pathSpec, EnumSet<DispatcherType> dispatches);\n\n    void registerFilter(Class<? extends Filter> filterClass, String pathSpec, EnumSet<DispatcherType> dispatches, Map<String, String> parameters);\n\n    void registerResource(Object o, String jndiName);\n\n    void registerDataSource(DataSource ds, String jndiName);\n\n    void registerTransactionManager(UserTransaction userTransaction);\n\n    void initWebContext(List<String> scanLibraries);\n\n    List<ServletWrapper> getRegisteredServlets();\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/attributes/ClasspathAttributes.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.common.attributes;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\npublic class ClasspathAttributes {\n\n    public static final String jar = \"^((?!lib\\\\_[^\\\\/]*\\\\.jar\\\\.[^\\\\/]*\\\\.tmp|/lib\\\\_[^\\\\/]*\\\\.jar\\\\.[^\\\\/]*\\\\.tmp|.*\\\\/jre\\\\/lib\\\\/.*).)*$\";\n\n    public static final String exploded = \"^.*/classes/.*$\";\n\n    public static final String exploded_test = \".*/test-classes/.*\";\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/config/DataSourceConfig.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.config;\n\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.Map;\n\n/**\n * @author Tilen Faganel\n * @since 2.1.0\n */\npublic class DataSourceConfig {\n\n    public static class Builder {\n\n        private String jndiName;\n        private String driverClass;\n        private String dataSourceClass;\n        private String connectionUrl;\n        private String username;\n        private String password;\n\n        private DataSourcePoolConfig.Builder pool = new DataSourcePoolConfig.Builder();\n\n        private Map<String, String> props = new HashMap<>();\n\n        public Builder jndiName(String jndiName) {\n            this.jndiName = jndiName;\n            return this;\n        }\n\n        public Builder driverClass(String driverClass) {\n            this.driverClass = driverClass;\n            return this;\n        }\n\n        public Builder dataSourceClass(String dataSourceClass) {\n            this.dataSourceClass = dataSourceClass;\n            return this;\n        }\n\n        public Builder connectionUrl(String connectionUrl) {\n            this.connectionUrl = connectionUrl;\n            return this;\n        }\n\n        public Builder username(String username) {\n            this.username = username;\n            return this;\n        }\n\n        public Builder password(String password) {\n            this.password = password;\n            return this;\n        }\n\n        public Builder pool(DataSourcePoolConfig.Builder pool) {\n            this.pool = pool;\n            return this;\n        }\n\n        public Builder prop(String key, String value) {\n            this.props.put(key, value);\n            return this;\n        }\n\n        public DataSourceConfig build() {\n\n            DataSourceConfig dataSourceConfig = new DataSourceConfig();\n            dataSourceConfig.jndiName = jndiName;\n            dataSourceConfig.driverClass = driverClass;\n            dataSourceConfig.dataSourceClass = dataSourceClass;\n            dataSourceConfig.connectionUrl = connectionUrl;\n            dataSourceConfig.username = username;\n            dataSourceConfig.password = password;\n\n            dataSourceConfig.pool = pool.build();\n\n            dataSourceConfig.props = Collections.unmodifiableMap(props);\n\n            return dataSourceConfig;\n        }\n    }\n\n    private String jndiName;\n    private String driverClass;\n    private String dataSourceClass;\n    private String connectionUrl;\n    private String username;\n    private String password;\n\n    private DataSourcePoolConfig pool;\n\n    private Map<String, String> props;\n\n    private DataSourceConfig() {\n    }\n\n    public String getJndiName() {\n        return jndiName;\n    }\n\n    public String getDriverClass() {\n        return driverClass;\n    }\n\n    public String getDataSourceClass() {\n        return dataSourceClass;\n    }\n\n    public String getConnectionUrl() {\n        return connectionUrl;\n    }\n\n    public String getUsername() {\n        return username;\n    }\n\n    public String getPassword() {\n        return password;\n    }\n\n    public DataSourcePoolConfig getPool() {\n        return pool;\n    }\n\n    public Map<String, String> getProps() {\n        return props;\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/config/DataSourcePoolConfig.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.config;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic class DataSourcePoolConfig {\n\n    public static class Builder {\n\n        private Boolean autoCommit = true;\n        private Boolean flushOnClose = false;\n        private Long connectionTimeout = 30000L;\n        private Long idleTimeout = 600000L;\n\n        private Long maxLifetime = 1800000L;\n\n        @Deprecated\n        private Integer minIdle;\n\n        private Integer initialSize = 0;\n        private Integer minSize = 0;\n        private Integer maxSize = 10;\n\n        @Deprecated\n        private String name;\n\n        @Deprecated\n        private Long initializationFailTimeout;\n\n        @Deprecated\n        private Boolean isolateInternalQueries;\n\n        @Deprecated\n        private Boolean allowPoolSuspension;\n\n        @Deprecated\n        private Boolean readOnly;\n\n        @Deprecated\n        private Boolean registerMbeans;\n        private String connectionInitSql;\n        private String connectionValidSql;\n        private String transactionIsolation;\n        private Long validationTimeout = 5000L;\n        private Long leakDetectionThreshold = 0L;\n        private Long idleValidationTimeout = 0L;\n\n        public Builder autoCommit(Boolean autoCommit) {\n            this.autoCommit = autoCommit;\n            return this;\n        }\n\n        public Builder flushOnClose(Boolean flushOnClose) {\n            this.flushOnClose = flushOnClose;\n            return this;\n        }\n\n        public Builder connectionTimeout(Long connectionTimeout) {\n            this.connectionTimeout = connectionTimeout;\n            return this;\n        }\n\n        public Builder idleTimeout(Long idleTimeout) {\n            this.idleTimeout = idleTimeout;\n            return this;\n        }\n\n        public Builder maxLifetime(Long maxLifetime) {\n            this.maxLifetime = maxLifetime;\n            return this;\n        }\n\n        @Deprecated\n        public Builder minIdle(Integer minIdle) {\n            this.minIdle = minIdle;\n            return this;\n        }\n\n        public Builder initialSize(Integer initialSize) {\n            this.initialSize = initialSize;\n            return this;\n        }\n\n        public Builder minSize(Integer minSize) {\n            this.minSize = minSize;\n            return this;\n        }\n\n        public Builder maxSize(Integer maxSize) {\n            this.maxSize = maxSize;\n            return this;\n        }\n\n        @Deprecated\n        public Builder name(String name) {\n            this.name = name;\n            return this;\n        }\n\n        @Deprecated\n        public Builder initializationFailTimeout(Long initializationFailTimeout) {\n            this.initializationFailTimeout = initializationFailTimeout;\n            return this;\n        }\n\n        @Deprecated\n        public Builder isolateInternalQueries(Boolean isolateInternalQueries) {\n            this.isolateInternalQueries = isolateInternalQueries;\n            return this;\n        }\n\n        @Deprecated\n        public Builder allowPoolSuspension(Boolean allowPoolSuspension) {\n            this.allowPoolSuspension = allowPoolSuspension;\n            return this;\n        }\n\n        @Deprecated\n        public Builder readOnly(Boolean readOnly) {\n            this.readOnly = readOnly;\n            return this;\n        }\n\n        @Deprecated\n        public Builder registerMbeans(Boolean registerMbeans) {\n            this.registerMbeans = registerMbeans;\n            return this;\n        }\n\n        public Builder connectionInitSql(String connectionInitSql) {\n            this.connectionInitSql = connectionInitSql;\n            return this;\n        }\n\n        public Builder connectionValidSql(String connectionValidSql) {\n            this.connectionValidSql = connectionValidSql;\n            return this;\n        }\n\n        public Builder transactionIsolation(String transactionIsolation) {\n            this.transactionIsolation = transactionIsolation;\n            return this;\n        }\n\n        public Builder validationTimeout(Long validationTimeout) {\n            this.validationTimeout = validationTimeout;\n            return this;\n        }\n\n        public Builder leakDetectionThreshold(Long leakDetectionThreshold) {\n            this.leakDetectionThreshold = leakDetectionThreshold;\n            return this;\n        }\n\n        public Builder idleValidationTimeout (Long idleValidationTimeout ) {\n            this.idleValidationTimeout  = idleValidationTimeout ;\n            return this;\n        }\n\n        public DataSourcePoolConfig build() {\n\n            DataSourcePoolConfig dataSourcePoolConfig = new DataSourcePoolConfig();\n            dataSourcePoolConfig.autoCommit = autoCommit;\n            dataSourcePoolConfig.flushOnClose = flushOnClose;\n            dataSourcePoolConfig.connectionTimeout = connectionTimeout;\n            dataSourcePoolConfig.idleTimeout = idleTimeout;\n            dataSourcePoolConfig.maxLifetime = maxLifetime;\n            dataSourcePoolConfig.minIdle = minIdle;\n            dataSourcePoolConfig.initialSize = initialSize;\n            dataSourcePoolConfig.minSize = minSize;\n            dataSourcePoolConfig.maxSize = maxSize;\n            dataSourcePoolConfig.name = name;\n            dataSourcePoolConfig.initializationFailTimeout = initializationFailTimeout;\n            dataSourcePoolConfig.isolateInternalQueries = isolateInternalQueries;\n            dataSourcePoolConfig.allowPoolSuspension = allowPoolSuspension;\n            dataSourcePoolConfig.readOnly = readOnly;\n            dataSourcePoolConfig.registerMbeans = registerMbeans;\n            dataSourcePoolConfig.connectionInitSql = connectionInitSql;\n            dataSourcePoolConfig.connectionValidSql = connectionValidSql;\n            dataSourcePoolConfig.transactionIsolation = transactionIsolation;\n            dataSourcePoolConfig.validationTimeout = validationTimeout;\n            dataSourcePoolConfig.leakDetectionThreshold = leakDetectionThreshold;\n            dataSourcePoolConfig.idleValidationTimeout = idleValidationTimeout;\n\n            return dataSourcePoolConfig;\n        }\n    }\n\n    private Boolean autoCommit;\n    private Boolean flushOnClose;\n    private Long connectionTimeout;\n    private Long idleTimeout;\n\n    private Long maxLifetime;\n\n    @Deprecated\n    private Integer minIdle;\n\n    private Integer initialSize = 0;\n    private Integer minSize = 0;\n    private Integer maxSize;\n\n    @Deprecated\n    private String name;\n\n    @Deprecated\n    private Long initializationFailTimeout;\n\n    @Deprecated\n    private Boolean isolateInternalQueries;\n\n    @Deprecated\n    private Boolean allowPoolSuspension;\n\n    @Deprecated\n    private Boolean readOnly;\n\n    @Deprecated\n    private Boolean registerMbeans;\n    private String connectionInitSql;\n    private String connectionValidSql;\n    private String transactionIsolation;\n    private Long validationTimeout;\n    private Long leakDetectionThreshold;\n    private Long idleValidationTimeout;\n\n    private DataSourcePoolConfig() {\n    }\n\n    public Boolean getFlushOnClose() {\n        return flushOnClose;\n    }\n\n    public Boolean getAutoCommit() {\n        return autoCommit;\n    }\n\n    public Long getConnectionTimeout() {\n        return connectionTimeout;\n    }\n\n    public Long getIdleTimeout() {\n        return idleTimeout;\n    }\n\n    public Long getMaxLifetime() {\n        return maxLifetime;\n    }\n\n    @Deprecated\n    public Integer getMinIdle() {\n        return minIdle;\n    }\n\n    public Integer getInitialSize() {\n        return initialSize;\n    }\n\n    public Integer getMinSize() {\n        return minSize;\n    }\n\n    public Integer getMaxSize() {\n        return maxSize;\n    }\n\n    @Deprecated\n    public String getName() {\n        return name;\n    }\n\n    @Deprecated\n    public Long getInitializationFailTimeout() {\n        return initializationFailTimeout;\n    }\n\n    @Deprecated\n    public Boolean getIsolateInternalQueries() {\n        return isolateInternalQueries;\n    }\n\n    @Deprecated\n    public Boolean getAllowPoolSuspension() {\n        return allowPoolSuspension;\n    }\n\n    @Deprecated\n    public Boolean getReadOnly() {\n        return readOnly;\n    }\n\n    @Deprecated\n    public Boolean getRegisterMbeans() {\n        return registerMbeans;\n    }\n\n    public String getConnectionInitSql() {\n        return connectionInitSql;\n    }\n\n    public String getConnectionValidSql() {\n        return connectionValidSql;\n    }\n\n    public String getTransactionIsolation() {\n        return transactionIsolation;\n    }\n\n    public Long getValidationTimeout() {\n        return validationTimeout;\n    }\n\n    public Long getLeakDetectionThreshold() {\n        return leakDetectionThreshold;\n    }\n\n    public Long getIdleValidationTimeout() {\n        return idleValidationTimeout;\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/config/DevConfig.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.config;\n\nimport java.util.List;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic class DevConfig {\n\n    public static class Builder {\n\n        private String webappDir;\n        private List<String> scanLibraries;\n        private Boolean runningTests = false;\n\n        public Builder scanLibraries(List<String> scanLibraries) {\n            this.scanLibraries = scanLibraries;\n            return this;\n        }\n\n        public Builder webappDir(String webappDir) {\n            this.webappDir = webappDir;\n            return this;\n        }\n\n        public Builder runningTests(Boolean runningTests) {\n            this.runningTests = runningTests;\n            return this;\n        }\n\n        public DevConfig build() {\n\n            DevConfig devConfig = new DevConfig();\n            devConfig.webappDir = webappDir;\n            devConfig.scanLibraries = scanLibraries;\n            devConfig.runningTests = runningTests;\n\n            return devConfig;\n        }\n    }\n\n    private String webappDir;\n    private List<String> scanLibraries;\n    private Boolean runningTests;\n\n    private DevConfig() {\n    }\n\n    public String getWebappDir() {\n        return webappDir;\n    }\n\n    public List<String> getScanLibraries() {\n        return scanLibraries;\n    }\n\n    public Boolean getRunningTests() {\n        return runningTests;\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/config/EeConfig.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.config;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.stream.Collectors;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\npublic class EeConfig {\n\n    public static class Builder {\n\n        private String name;\n        private String version = \"1.0.0\";\n        private Boolean debug = false;\n\n        private EnvConfig.Builder env = new EnvConfig.Builder();\n        private DevConfig.Builder dev = new DevConfig.Builder();\n        private ServerConfig.Builder server = new ServerConfig.Builder();\n        private List<DataSourceConfig.Builder> datasources = new ArrayList<>();\n        private List<XaDataSourceConfig.Builder> xaDatasources = new ArrayList<>();\n        private List<MailSessionConfig.Builder> mailSessions = new ArrayList<>();\n\n        public Builder name(String name) {\n            this.name = name;\n            return this;\n        }\n\n        public Builder version(String version) {\n            this.version = version;\n            return this;\n        }\n\n        public Builder debug(Boolean debug) {\n            this.debug = debug;\n            return this;\n        }\n\n        public Builder env(EnvConfig.Builder env) {\n            this.env = env;\n            return this;\n        }\n\n        public Builder dev(DevConfig.Builder dev) {\n            this.dev = dev;\n            return this;\n        }\n\n        public Builder server(ServerConfig.Builder server) {\n            this.server = server;\n            return this;\n        }\n\n        public Builder datasource(DataSourceConfig.Builder datasource) {\n            this.datasources.add(datasource);\n            return this;\n        }\n\n        public Builder xaDatasource(XaDataSourceConfig.Builder xaDatasource) {\n            this.xaDatasources.add(xaDatasource);\n            return this;\n        }\n\n        public Builder mailSession(MailSessionConfig.Builder mailSession) {\n            this.mailSessions.add(mailSession);\n            return this;\n        }\n\n        public EeConfig build() {\n\n            List<DataSourceConfig> constructedDatasources =\n                    datasources.stream().map(DataSourceConfig.Builder::build).collect(Collectors.toList());\n\n            List<XaDataSourceConfig> constructedXaDatasources =\n                    xaDatasources.stream().map(XaDataSourceConfig.Builder::build).collect(Collectors.toList());\n\n            List<MailSessionConfig> constructedMailSessions =\n                    mailSessions.stream().map(MailSessionConfig.Builder::build).collect(Collectors.toList());\n\n            EeConfig eeConfig = new EeConfig();\n            eeConfig.name = name;\n            eeConfig.version = version;\n            eeConfig.debug = debug;\n            eeConfig.env = env.build();\n            eeConfig.dev = dev.build();\n            eeConfig.server = server.build();\n            eeConfig.datasources = Collections.unmodifiableList(constructedDatasources);\n            eeConfig.xaDatasources = Collections.unmodifiableList(constructedXaDatasources);\n            eeConfig.mailSessions = Collections.unmodifiableList(constructedMailSessions);\n\n            return eeConfig;\n        }\n    }\n\n    private static EeConfig instance;\n\n    private String name;\n    private String version;\n    private Boolean debug;\n\n    private EnvConfig env;\n    private DevConfig dev;\n    private ServerConfig server;\n    private List<DataSourceConfig> datasources;\n    private List<XaDataSourceConfig> xaDatasources;\n    private List<MailSessionConfig> mailSessions;\n\n    private EeConfig() {\n    }\n\n    public static void initialize(EeConfig eeConfig) {\n\n        if (instance != null) {\n            throw new IllegalStateException(\"The EeConfig was already initialized.\");\n        }\n\n        instance = eeConfig;\n    }\n\n    public static EeConfig getInstance() {\n\n        if (instance == null) {\n            throw new IllegalStateException(\"The EeConfig was not yet initialized.\");\n        }\n\n        return instance;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public String getVersion() {\n        return version;\n    }\n\n    public Boolean getDebug() {\n        return debug;\n    }\n\n    public EnvConfig getEnv() {\n        return env;\n    }\n\n    public DevConfig getDev() {\n        return dev;\n    }\n\n    public ServerConfig getServer() {\n        return server;\n    }\n\n    public List<DataSourceConfig> getDatasources() {\n        return datasources;\n    }\n\n    public List<XaDataSourceConfig> getXaDatasources() {\n        return xaDatasources;\n    }\n\n    public List<MailSessionConfig> getMailSessions() {\n        return mailSessions;\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/config/EnvConfig.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.config;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic class EnvConfig {\n\n    public static class Builder {\n\n        private String name;\n\n        public Builder name(String name) {\n            this.name = name;\n            return this;\n        }\n\n        public EnvConfig build() {\n\n            EnvConfig envConfig = new EnvConfig();\n            envConfig.name = name;\n\n            return envConfig;\n        }\n    }\n\n    private String name;\n\n    private EnvConfig() {\n    }\n\n    public String getName() {\n        return name;\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/config/GzipConfig.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.common.config;\n\nimport java.util.List;\n\npublic class GzipConfig {\n\n    public static class Builder {\n\n        private Boolean enabled = false;\n        private Integer minGzipSize;\n        private List<String> includedMethods;\n        private List<String> includedMimeTypes;\n        private List<String> excludedMimeTypes;\n        private List<String> excludedAgentPatterns;\n        private List<String> excludedPaths;\n        private List<String> includedPaths;\n\n        public Builder enabled(Boolean enabled) {\n            this.enabled = enabled;\n            return this;\n        }\n\n        public Builder minGzipSize(Integer minGzipSize) {\n            this.minGzipSize = minGzipSize;\n            return this;\n        }\n\n        public Builder includedMethods(List<String> includedMethods) {\n            this.includedMethods = includedMethods;\n            return this;\n        }\n\n        public Builder includedMimeTypes(List<String> includedMimeTypes) {\n            this.includedMimeTypes = includedMimeTypes;\n            return this;\n        }\n\n        public Builder excludedMimeTypes(List<String> excludedMimeTypes) {\n            this.excludedMimeTypes = excludedMimeTypes;\n            return this;\n        }\n\n        public Builder excludedAgentPatterns(List<String> excludedAgentPatterns) {\n            this.excludedAgentPatterns = excludedAgentPatterns;\n            return this;\n        }\n\n        public Builder excludedPaths(List<String> excludedPaths) {\n            this.excludedPaths = excludedPaths;\n            return this;\n        }\n\n        public Builder includedPaths(List<String> includedPaths) {\n            this.includedPaths = includedPaths;\n            return this;\n        }\n\n        public GzipConfig build() {\n\n            GzipConfig gzipConfig = new GzipConfig();\n            gzipConfig.enabled = enabled;\n            gzipConfig.minGzipSize = minGzipSize;\n            gzipConfig.includedMethods = includedMethods;\n            gzipConfig.includedMimeTypes = includedMimeTypes;\n            gzipConfig.excludedMimeTypes = excludedMimeTypes;\n            gzipConfig.excludedAgentPatterns = excludedAgentPatterns;\n            gzipConfig.excludedPaths = excludedPaths;\n            gzipConfig.includedPaths = includedPaths;\n\n            return gzipConfig;\n        }\n    }\n\n    private Boolean enabled;\n    private Integer minGzipSize;\n    private List<String> includedMethods;\n    private List<String> includedMimeTypes;\n    private List<String> excludedMimeTypes;\n    private List<String> excludedAgentPatterns;\n    private List<String> excludedPaths;\n    private List<String> includedPaths;\n\n    private GzipConfig() {\n    }\n\n    public Boolean getEnabled() {\n        return enabled;\n    }\n\n    public void setEnabled(Boolean enabled) {\n        this.enabled = enabled;\n    }\n\n    public Integer getMinGzipSize() {\n        return minGzipSize;\n    }\n\n    public void setMinGzipSize(Integer minGzipSize) {\n        this.minGzipSize = minGzipSize;\n    }\n\n    public List<String> getIncludedMethods() {\n        return includedMethods;\n    }\n\n    public void setIncludedMethods(List<String> includedMethods) {\n        this.includedMethods = includedMethods;\n    }\n\n    public List<String> getIncludedMimeTypes() {\n        return includedMimeTypes;\n    }\n\n    public void setIncludedMimeTypes(List<String> includedMimeTypes) {\n        this.includedMimeTypes = includedMimeTypes;\n    }\n\n    public List<String> getExcludedMimeTypes() {\n        return excludedMimeTypes;\n    }\n\n    public void setExcludedMimeTypes(List<String> excludedMimeTypes) {\n        this.excludedMimeTypes = excludedMimeTypes;\n    }\n\n    public List<String> getExcludedPaths() {\n        return excludedPaths;\n    }\n\n    public void setExcludedPaths(List<String> excludedPaths) {\n        this.excludedPaths = excludedPaths;\n    }\n\n    public List<String> getIncludedPaths() {\n        return includedPaths;\n    }\n\n    public void setIncludedPaths(List<String> includedPaths) {\n        this.includedPaths = includedPaths;\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/config/MailServiceConfig.java",
    "content": "package com.kumuluz.ee.common.config;\n\npublic class MailServiceConfig {\n\n    public static class Builder {\n\n        private String protocol;\n        private String host;\n        private Integer port;\n        private Boolean starttls;\n        private String username;\n        private String password;\n        private Long connectionTimeout;\n        private Long timeout;\n\n        public Builder protocol(String protocol) {\n            this.protocol = protocol;\n            return this;\n        }\n\n        public Builder host(String host) {\n            this.host = host;\n            return this;\n        }\n\n        public Builder port(Integer port) {\n            this.port = port;\n            return this;\n        }\n\n        public Builder starttls(Boolean starttls) {\n            this.starttls = starttls;\n            return this;\n        }\n\n        public Builder username(String username) {\n            this.username = username;\n            return this;\n        }\n\n        public Builder password(String password) {\n            this.password = password;\n            return this;\n        }\n\n        public Builder connectionTimeout(Long connectionTimeout) {\n            this.connectionTimeout = connectionTimeout;\n            return this;\n        }\n\n        public Builder timeout(Long timeout) {\n            this.timeout = timeout;\n            return this;\n        }\n\n        public MailServiceConfig build() {\n\n            MailServiceConfig mailServiceConfig = new MailServiceConfig();\n            mailServiceConfig.protocol = protocol;\n            mailServiceConfig.host = host;\n            mailServiceConfig.port = port;\n            mailServiceConfig.starttls = starttls;\n            mailServiceConfig.username = username;\n            mailServiceConfig.password = password;\n            mailServiceConfig.connectionTimeout = connectionTimeout;\n            mailServiceConfig.timeout = timeout;\n\n            return mailServiceConfig;\n        }\n    }\n\n    private String protocol;\n    private String host;\n    private Integer port;\n    private Boolean starttls;\n    private String username;\n    private String password;\n    private Long connectionTimeout;\n    private Long timeout;\n\n    private MailServiceConfig(){\n    }\n\n    public String getProtocol() {\n        return protocol;\n    }\n\n    public String getHost() {\n        return host;\n    }\n\n    public Integer getPort() {\n        return port;\n    }\n\n    public Boolean getStarttls() {\n        return starttls;\n    }\n\n    public String getUsername() {\n        return username;\n    }\n\n    public String getPassword() {\n        return password;\n    }\n\n    public Long getConnectionTimeout() {\n        return connectionTimeout;\n    }\n\n    public Long getTimeout() {\n        return timeout;\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/config/MailSessionConfig.java",
    "content": "package com.kumuluz.ee.common.config;\n\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic class MailSessionConfig {\n\n    public static class Builder {\n\n        private String jndiName;\n        private Boolean debug;\n\n        private MailServiceConfig.Builder transport;\n        private MailServiceConfig.Builder store;\n\n        private Map<String, String> props = new HashMap<>();\n\n        public Builder jndiName(String jndiName) {\n            this.jndiName = jndiName;\n            return this;\n        }\n\n        public Builder debug(Boolean debug) {\n            this.debug = debug;\n            return this;\n        }\n\n        public Builder transport(MailServiceConfig.Builder transport) {\n            this.transport = transport;\n            return this;\n        }\n\n        public Builder store(MailServiceConfig.Builder store) {\n            this.store = store;\n            return this;\n        }\n\n        public Builder prop(String key, String value) {\n            this.props.put(key, value);\n            return this;\n        }\n\n        public MailSessionConfig build() {\n\n            MailSessionConfig mailSessionConfig = new MailSessionConfig();\n            mailSessionConfig.jndiName = jndiName;\n            mailSessionConfig.debug = debug;\n\n            if (transport != null) mailSessionConfig.transport = transport.build();\n            if (store != null)  mailSessionConfig.store = store.build();\n\n            mailSessionConfig.props = Collections.unmodifiableMap(props);\n\n            return mailSessionConfig;\n        }\n    }\n\n    private String jndiName;\n    private Boolean debug;\n\n    private MailServiceConfig transport;\n    private MailServiceConfig store;\n\n    private Map<String, String> props;\n\n    private MailSessionConfig() {\n\n    }\n\n    public String getJndiName() {\n        return jndiName;\n    }\n\n    public Boolean getDebug() {\n        return debug;\n    }\n\n    public MailServiceConfig getTransport() {\n        return transport;\n    }\n\n    public MailServiceConfig getStore() {\n        return store;\n    }\n\n    public Map<String, String> getProps() {\n        return props;\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/config/ServerConfig.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.config;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\npublic class ServerConfig {\n\n    public static class Builder {\n\n        private String baseUrl;\n        private String contextPath = \"/\";\n        private Boolean dirBrowsing = false;\n        private Boolean etags = false;\n        private Integer minThreads = 5;\n        private Integer maxThreads = 100;\n        private Boolean forceHttps = false;\n        private Boolean showServerInfo = true;\n        private Boolean forwardStartupException;\n\n        private ServerConnectorConfig.Builder http = new ServerConnectorConfig.Builder();\n        private ServerConnectorConfig.Builder https;\n\n        private GzipConfig.Builder gzip;\n\n        public Builder baseUrl(String baseUrl) {\n            this.baseUrl = baseUrl;\n            return this;\n        }\n\n        public Builder contextPath(String contextPath) {\n            this.contextPath = contextPath;\n            return this;\n        }\n\n        public Builder dirBrowsing(Boolean dirBrowsing) {\n            this.dirBrowsing = dirBrowsing;\n            return this;\n        }\n\n        public Builder etags(Boolean etags) {\n            this.etags = etags;\n            return this;\n        }\n\n        public Builder minThreads(Integer minThreads) {\n            this.minThreads = minThreads;\n            return this;\n        }\n\n        public Builder maxThreads(Integer maxThreads) {\n            this.maxThreads = maxThreads;\n            return this;\n        }\n\n        public Builder forceHttps(Boolean forceHttps) {\n            this.forceHttps = forceHttps;\n            return this;\n        }\n\n        public Builder http(ServerConnectorConfig.Builder http) {\n            this.http = http;\n            return this;\n        }\n\n        public Builder https(ServerConnectorConfig.Builder https) {\n            this.https = https;\n            return this;\n        }\n\n        public Builder gzip(GzipConfig.Builder gzip) {\n            this.gzip = gzip;\n            return this;\n        }\n\n        public Builder showServerInfo(Boolean showServerInfo) {\n            this.showServerInfo = showServerInfo;\n            return this;\n        }\n\n        public Builder forwardStartupException(Boolean forwardStartupException) {\n            this.forwardStartupException = forwardStartupException;\n            return this;\n        }\n\n        public ServerConfig build() {\n\n            ServerConfig serverConfig = new ServerConfig();\n            serverConfig.baseUrl = baseUrl;\n            serverConfig.contextPath = contextPath;\n            serverConfig.dirBrowsing = dirBrowsing;\n            serverConfig.etags = etags;\n            serverConfig.minThreads = minThreads;\n            serverConfig.maxThreads = maxThreads;\n            serverConfig.forceHttps = forceHttps;\n            serverConfig.showServerInfo = showServerInfo;\n            serverConfig.forwardStartupException = forwardStartupException;\n\n            serverConfig.http = http.build();\n            if (https != null) serverConfig.https = https.build();\n\n            if (gzip != null) serverConfig.gzip = gzip.build();\n\n            return serverConfig;\n        }\n    }\n\n    private String baseUrl;\n    private String contextPath;\n    private Boolean dirBrowsing;\n    private Boolean etags;\n    private Integer minThreads;\n    private Integer maxThreads;\n    private Boolean forceHttps;\n    private Boolean showServerInfo;\n    private Boolean forwardStartupException;\n\n    private ServerConnectorConfig http;\n    private ServerConnectorConfig https;\n\n    private GzipConfig gzip;\n\n    private ServerConfig() {\n    }\n\n    public String getBaseUrl() {\n        return baseUrl;\n    }\n\n    public String getContextPath() {\n        return contextPath;\n    }\n\n    public Boolean getDirBrowsing() {\n        return dirBrowsing;\n    }\n\n    public Boolean getEtags() {\n        return etags;\n    }\n\n    public Integer getMinThreads() {\n        return minThreads;\n    }\n\n    public Integer getMaxThreads() {\n        return maxThreads;\n    }\n\n    public Boolean getForceHttps() {\n        return forceHttps;\n    }\n\n    public Boolean getShowServerInfo(){\n        return showServerInfo;\n    }\n\n    public Boolean getForwardStartupException() {\n        return forwardStartupException;\n    }\n\n    public ServerConnectorConfig getHttp() {\n        return http;\n    }\n\n    public ServerConnectorConfig getHttps() {\n        return https;\n    }\n\n    public GzipConfig getGzip() {\n        return gzip;\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/config/ServerConnectorConfig.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.config;\n\nimport java.util.Collections;\nimport java.util.List;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic class ServerConnectorConfig {\n\n    public final static Integer DEFAULT_HTTP_PORT = 8080;\n    public final static Integer DEFAULT_HTTPS_PORT = 8443;\n\n    public static class Builder {\n\n        private Integer port;\n        private String address;\n        private Boolean enabled;\n        private Boolean http2 = false;\n        private Boolean proxyForwarding = false;\n        private Integer requestHeaderSize = 8 * 1024;\n        private Integer responseHeaderSize = 8 * 1024;\n        private Integer idleTimeout = 30 * 1000;\n\n        private String keystorePath;\n        private String keystorePassword;\n        private String keyAlias;\n        private String keyPassword;\n        private List<String> sslProtocols;\n        private List<String> sslCiphers;\n\n        public Builder port(Integer port) {\n            this.port = port;\n            return this;\n        }\n\n        public Builder address(String address) {\n            this.address = address;\n            return this;\n        }\n\n        public Builder enabled(Boolean enabled) {\n            this.enabled = enabled;\n            return this;\n        }\n\n        public Builder http2(Boolean http2) {\n            this.http2 = http2;\n            return this;\n        }\n\n        public Builder proxyForwarding(Boolean proxyForwarding) {\n            this.proxyForwarding = proxyForwarding;\n            return this;\n        }\n\n        public Builder requestHeaderSize(Integer requestHeaderSize) {\n            this.requestHeaderSize = requestHeaderSize;\n            return this;\n        }\n\n        public Builder responseHeaderSize(Integer responseHeaderSize) {\n            this.responseHeaderSize = responseHeaderSize;\n            return this;\n        }\n\n        public Builder idleTimeout(Integer idleTimeout) {\n            this.idleTimeout = idleTimeout;\n            return this;\n        }\n\n        public Builder keystorePath(String keystorePath) {\n            this.keystorePath = keystorePath;\n            return this;\n        }\n\n        public Builder keystorePassword(String keystorePassword) {\n            this.keystorePassword = keystorePassword;\n            return this;\n        }\n\n        public Builder keyAlias(String keyAlias) {\n            this.keyAlias = keyAlias;\n            return this;\n        }\n\n        public Builder keyPassword(String keyPassword) {\n            this.keyPassword = keyPassword;\n            return this;\n        }\n\n        public Builder sslProtocols(List<String> sslProtocols) {\n            this.sslProtocols = Collections.unmodifiableList(sslProtocols);\n            return this;\n        }\n\n        public Builder sslCiphers(List<String> sslCiphers) {\n            this.sslCiphers = Collections.unmodifiableList(sslCiphers);\n            return this;\n        }\n\n        public ServerConnectorConfig build() {\n\n            ServerConnectorConfig serverConnectorConfig = new ServerConnectorConfig();\n            serverConnectorConfig.port = port;\n            serverConnectorConfig.address = address;\n            serverConnectorConfig.enabled = enabled;\n            serverConnectorConfig.http2 = http2;\n            serverConnectorConfig.proxyForwarding = proxyForwarding;\n            serverConnectorConfig.requestHeaderSize = requestHeaderSize;\n            serverConnectorConfig.responseHeaderSize = responseHeaderSize;\n            serverConnectorConfig.idleTimeout = idleTimeout;\n            serverConnectorConfig.keystorePath = keystorePath;\n            serverConnectorConfig.keystorePassword = keystorePassword;\n            serverConnectorConfig.keyAlias = keyAlias;\n            serverConnectorConfig.keyPassword = keyPassword;\n            serverConnectorConfig.sslProtocols = sslProtocols;\n            serverConnectorConfig.sslCiphers = sslCiphers;\n\n            return serverConnectorConfig;\n        }\n    }\n\n    private Integer port;\n    private String address;\n    private Boolean enabled;\n    private Boolean http2;\n    private Boolean proxyForwarding;\n    private Integer requestHeaderSize;\n    private Integer responseHeaderSize;\n    private Integer idleTimeout;\n\n    private String keystorePath;\n    private String keystorePassword;\n    private String keyAlias;\n    private String keyPassword;\n    private List<String> sslProtocols;\n    private List<String> sslCiphers;\n\n    private ServerConnectorConfig() {\n    }\n\n    public Integer getPort() {\n        return port;\n    }\n\n    public String getAddress() {\n        return address;\n    }\n\n    public Boolean getEnabled() {\n        return enabled;\n    }\n\n    public Boolean getHttp2() {\n        return http2;\n    }\n\n    public Boolean getProxyForwarding() {\n        return proxyForwarding;\n    }\n\n    public Integer getRequestHeaderSize() {\n        return requestHeaderSize;\n    }\n\n    public Integer getResponseHeaderSize() {\n        return responseHeaderSize;\n    }\n\n    public Integer getIdleTimeout() {\n        return idleTimeout;\n    }\n\n    public String getKeystorePath() {\n        return keystorePath;\n    }\n\n    public String getKeystorePassword() {\n        return keystorePassword;\n    }\n\n    public String getKeyAlias() {\n        return keyAlias;\n    }\n\n    public String getKeyPassword() {\n        return keyPassword;\n    }\n\n    public List<String> getSslProtocols() {\n        return sslProtocols;\n    }\n\n    public List<String> getSslCiphers() {\n        return sslCiphers;\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/config/XaDataSourceConfig.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.config;\n\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.Map;\n\n/**\n * @author Tilen Faganel\n * @since 2.3.0\n */\npublic class XaDataSourceConfig {\n\n    public static class Builder {\n\n        private String jndiName;\n        private String xaDatasourceClass;\n        private String username;\n        private String password;\n\n        private DataSourcePoolConfig.Builder pool = new DataSourcePoolConfig.Builder();\n\n        private Map<String, String> props = new HashMap<>();\n\n        public Builder jndiName(String jndiName) {\n            this.jndiName = jndiName;\n            return this;\n        }\n\n        public Builder xaDatasourceClass(String xaDatasourceClass) {\n            this.xaDatasourceClass = xaDatasourceClass;\n            return this;\n        }\n\n        public Builder username(String username) {\n            this.username = username;\n            return this;\n        }\n\n        public Builder password(String password) {\n            this.password = password;\n            return this;\n        }\n\n        public Builder pool(DataSourcePoolConfig.Builder pool) {\n            this.pool = pool;\n            return this;\n        }\n\n        public Builder prop(String key, String value) {\n            this.props.put(key, value);\n            return this;\n        }\n\n        public XaDataSourceConfig build() {\n\n            XaDataSourceConfig xaDataSourceConfig = new XaDataSourceConfig();\n            xaDataSourceConfig.jndiName = jndiName;\n            xaDataSourceConfig.xaDatasourceClass = xaDatasourceClass;\n            xaDataSourceConfig.username = username;\n            xaDataSourceConfig.password = password;\n\n            xaDataSourceConfig.pool = pool.build();\n\n            xaDataSourceConfig.props = Collections.unmodifiableMap(props);\n\n            return xaDataSourceConfig;\n        }\n    }\n\n    private String jndiName;\n    private String xaDatasourceClass;\n    private String username;\n    private String password;\n\n    private DataSourcePoolConfig pool;\n\n    private Map<String, String> props;\n\n    private XaDataSourceConfig() {\n    }\n\n    public String getJndiName() {\n        return jndiName;\n    }\n\n    public String getXaDatasourceClass() {\n        return xaDatasourceClass;\n    }\n\n    public String getUsername() {\n        return username;\n    }\n\n    public String getPassword() {\n        return password;\n    }\n\n    public DataSourcePoolConfig getPool() {\n        return pool;\n    }\n\n    public Map<String, String> getProps() {\n        return props;\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/datasources/NonJtaXAConnectionWrapper.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.datasources;\n\nimport javax.sql.XAConnection;\nimport java.sql.*;\nimport java.util.Collections;\nimport java.util.Map;\nimport java.util.Properties;\nimport java.util.concurrent.Executor;\n\n/**\n * @author Tilen Faganel\n * @since 2.3.0\n */\n@Deprecated\npublic class NonJtaXAConnectionWrapper implements Connection {\n\n    private Boolean isClosed = false;\n\n    private XAConnection xaConnection;\n\n    public NonJtaXAConnectionWrapper(XAConnection xaConnection) {\n        this.xaConnection = xaConnection;\n    }\n\n    @Override\n    public Statement createStatement() throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().createStatement();\n    }\n\n    @Override\n    public PreparedStatement prepareStatement(String sql) throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().prepareStatement(sql);\n    }\n\n    @Override\n    public CallableStatement prepareCall(String sql) throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().prepareCall(sql);\n    }\n\n    @Override\n    public String nativeSQL(String sql) throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().nativeSQL(sql);\n    }\n\n    @Override\n    public void setAutoCommit(boolean autoCommit) throws SQLException {\n\n        checkIfValid();\n\n        xaConnection.getConnection().setAutoCommit(autoCommit);\n    }\n\n    @Override\n    public boolean getAutoCommit() throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().getAutoCommit();\n    }\n\n    @Override\n    public void commit() throws SQLException {\n\n        checkIfValid();\n\n        xaConnection.getConnection().commit();\n    }\n\n    @Override\n    public void rollback() throws SQLException {\n\n        checkIfValid();\n\n        xaConnection.getConnection().rollback();\n    }\n\n    @Override\n    public void close() throws SQLException {\n\n        if (isClosed) return;\n\n        isClosed = true;\n\n        if (xaConnection != null) {\n\n            xaConnection.close();\n            xaConnection = null;\n        }\n    }\n\n    @Override\n    public boolean isClosed() throws SQLException {\n\n        return isClosed;\n    }\n\n    @Override\n    public DatabaseMetaData getMetaData() throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().getMetaData();\n    }\n\n    @Override\n    public void setReadOnly(boolean readOnly) throws SQLException {\n\n        checkIfValid();\n\n        xaConnection.getConnection().setReadOnly(readOnly);\n    }\n\n    @Override\n    public boolean isReadOnly() throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().isReadOnly();\n    }\n\n    @Override\n    public void setCatalog(String catalog) throws SQLException {\n\n        checkIfValid();\n\n        xaConnection.getConnection().setCatalog(catalog);\n    }\n\n    @Override\n    public String getCatalog() throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().getCatalog();\n    }\n\n    @Override\n    public void setTransactionIsolation(int level) throws SQLException {\n\n        checkIfValid();\n\n        xaConnection.getConnection().setTransactionIsolation(level);\n    }\n\n    @Override\n    public int getTransactionIsolation() throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().getTransactionIsolation();\n    }\n\n    @Override\n    public SQLWarning getWarnings() throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().getWarnings();\n    }\n\n    @Override\n    public void clearWarnings() throws SQLException {\n\n        checkIfValid();\n\n        xaConnection.getConnection().clearWarnings();\n    }\n\n    @Override\n    public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().createStatement(resultSetType, resultSetConcurrency);\n    }\n\n    @Override\n    public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().prepareStatement(sql, resultSetType, resultSetConcurrency);\n    }\n\n    @Override\n    public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().prepareCall(sql, resultSetType, resultSetConcurrency);\n    }\n\n    @Override\n    public Map<String, Class<?>> getTypeMap() throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().getTypeMap();\n    }\n\n    @Override\n    public void setTypeMap(Map<String, Class<?>> map) throws SQLException {\n\n        checkIfValid();\n\n        xaConnection.getConnection().setTypeMap(map);\n    }\n\n    @Override\n    public void setHoldability(int holdability) throws SQLException {\n\n        checkIfValid();\n\n        xaConnection.getConnection().setHoldability(holdability);\n    }\n\n    @Override\n    public int getHoldability() throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().getHoldability();\n    }\n\n    @Override\n    public Savepoint setSavepoint() throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().setSavepoint();\n    }\n\n    @Override\n    public Savepoint setSavepoint(String name) throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().setSavepoint(name);\n    }\n\n    @Override\n    public void rollback(Savepoint savepoint) throws SQLException {\n\n        checkIfValid();\n\n        xaConnection.getConnection().rollback();\n    }\n\n    @Override\n    public void releaseSavepoint(Savepoint savepoint) throws SQLException {\n\n        checkIfValid();\n\n        xaConnection.getConnection().releaseSavepoint(savepoint);\n    }\n\n    @Override\n    public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);\n    }\n\n    @Override\n    public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability);\n    }\n\n    @Override\n    public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability);\n    }\n\n    @Override\n    public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().prepareStatement(sql, autoGeneratedKeys);\n    }\n\n    @Override\n    public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().prepareStatement(sql, columnIndexes);\n    }\n\n    @Override\n    public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().prepareStatement(sql, columnNames);\n    }\n\n    @Override\n    public Clob createClob() throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().createClob();\n    }\n\n    @Override\n    public Blob createBlob() throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().createBlob();\n    }\n\n    @Override\n    public NClob createNClob() throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().createNClob();\n    }\n\n    @Override\n    public SQLXML createSQLXML() throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().createSQLXML();\n    }\n\n    @Override\n    public boolean isValid(int timeout) throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().isValid(timeout);\n    }\n\n    @Override\n    public void setClientInfo(String name, String value) throws SQLClientInfoException {\n\n        try {\n            checkIfValid();\n\n            xaConnection.getConnection().setClientInfo(name, value);\n        } catch (SQLException e) {\n            throw new SQLClientInfoException(Collections.emptyMap(), e);\n        }\n    }\n\n    @Override\n    public void setClientInfo(Properties properties) throws SQLClientInfoException {\n\n        try {\n            checkIfValid();\n\n            xaConnection.getConnection().setClientInfo(properties);\n        } catch (SQLException e) {\n            throw new SQLClientInfoException(Collections.emptyMap(), e);\n        }\n    }\n\n    @Override\n    public String getClientInfo(String name) throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().getClientInfo(name);\n    }\n\n    @Override\n    public Properties getClientInfo() throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().getClientInfo();\n    }\n\n    @Override\n    public Array createArrayOf(String typeName, Object[] elements) throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().createArrayOf(typeName, elements);\n    }\n\n    @Override\n    public Struct createStruct(String typeName, Object[] attributes) throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().createStruct(typeName, attributes);\n    }\n\n    @Override\n    public void setSchema(String schema) throws SQLException {\n\n        checkIfValid();\n\n        xaConnection.getConnection().setSchema(schema);\n    }\n\n    @Override\n    public String getSchema() throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().getSchema();\n    }\n\n    @Override\n    public void abort(Executor executor) throws SQLException {\n\n        checkIfValid();\n\n        xaConnection.getConnection().abort(executor);\n    }\n\n    @Override\n    public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {\n\n        checkIfValid();\n\n        xaConnection.getConnection().setNetworkTimeout(executor, milliseconds);\n    }\n\n    @Override\n    public int getNetworkTimeout() throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().getNetworkTimeout();\n    }\n\n    @Override\n    public <T> T unwrap(Class<T> iface) throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().unwrap(iface);\n    }\n\n    @Override\n    public boolean isWrapperFor(Class<?> iface) throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.getConnection().isWrapperFor(iface);\n    }\n\n    private void checkIfValid() throws SQLException {\n\n        if (isClosed) throw new SQLException(\"The connection is closed\");\n        if (xaConnection == null) throw new SQLException(\"The connection is invalid\");\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/datasources/NonJtaXADataSourceWrapper.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.datasources;\n\nimport javax.sql.DataSource;\nimport javax.sql.XAConnection;\nimport javax.sql.XADataSource;\nimport java.io.PrintWriter;\nimport java.sql.Connection;\nimport java.sql.SQLException;\nimport java.sql.SQLFeatureNotSupportedException;\nimport java.sql.Wrapper;\nimport java.util.logging.Logger;\n\n/**\n * @author Tilen Faganel\n * @since 2.3.0\n */\n@Deprecated\npublic class NonJtaXADataSourceWrapper implements XADataSourceWrapper {\n\n    protected XADataSource xaDataSource;\n\n    public NonJtaXADataSourceWrapper(XADataSource xaDataSource) {\n        this.xaDataSource = xaDataSource;\n    }\n\n    @Override\n    public Connection getConnection() throws SQLException {\n\n        checkIfValid();\n\n        XAConnection xaConnection = xaDataSource.getXAConnection();\n\n        return new NonJtaXAConnectionWrapper(xaConnection);\n    }\n\n    @Override\n    public Connection getConnection(String username, String password) throws SQLException {\n\n        checkIfValid();\n\n        XAConnection xaConnection = xaDataSource.getXAConnection(username, password);\n\n        return new NonJtaXAConnectionWrapper(xaConnection);\n    }\n\n    @Override\n    public <T> T unwrap(Class<T> iface) throws SQLException {\n\n        if (xaDataSource == null) {\n            throw new SQLException(\"The underlying XADataSource is invalid or cannot be found\");\n        } else if (iface.isInstance(xaDataSource)) {\n            return iface.cast(xaDataSource);\n        } else if (xaDataSource instanceof Wrapper) {\n            return ((java.sql.Wrapper) xaDataSource).unwrap(iface);\n        } else {\n            throw new SQLException(\"The requested interface cannot be unwrapped\");\n        }\n    }\n\n    @Override\n    public boolean isWrapperFor(Class<?> iface) throws SQLException {\n\n        if (xaDataSource == null) {\n            throw new SQLException(\"The underlying XADataSource is invalid or cannot be found\");\n        } else if (iface.isInstance(xaDataSource)) {\n            return true;\n        } else if (xaDataSource instanceof Wrapper) {\n            return ((java.sql.Wrapper) xaDataSource).isWrapperFor(iface);\n        }\n\n        return false;\n    }\n\n    @Override\n    public PrintWriter getLogWriter() throws SQLException {\n\n        checkIfValid();\n\n        return xaDataSource.getLogWriter();\n    }\n\n    @Override\n    public void setLogWriter(PrintWriter out) throws SQLException {\n\n        checkIfValid();\n\n        xaDataSource.setLogWriter(out);\n    }\n\n    @Override\n    public void setLoginTimeout(int seconds) throws SQLException {\n\n        checkIfValid();\n\n        xaDataSource.setLoginTimeout(seconds);\n    }\n\n    @Override\n    public int getLoginTimeout() throws SQLException {\n\n        checkIfValid();\n\n        return xaDataSource.getLoginTimeout();\n    }\n\n    @Override\n    public Logger getParentLogger() throws SQLFeatureNotSupportedException {\n\n        checkIfValid();\n\n        return xaDataSource.getParentLogger();\n    }\n\n    protected void checkIfValid() {\n\n        if (xaDataSource == null) throw new IllegalStateException(\"The XADataSource is invalid or cannot be found\");\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/datasources/XADataSourceBuilder.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.datasources;\n\nimport com.kumuluz.ee.common.config.XaDataSourceConfig;\nimport com.kumuluz.ee.common.exceptions.KumuluzServerException;\n\nimport javax.sql.XADataSource;\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Method;\n\n/**\n * @author Tilen Faganel\n * @since 2.3.0\n */\n@Deprecated\npublic class XADataSourceBuilder {\n\n    private XaDataSourceConfig xaDataSourceConfig;\n\n    public XADataSourceBuilder(XaDataSourceConfig xaDataSourceConfig) {\n        this.xaDataSourceConfig = xaDataSourceConfig;\n    }\n\n    public XADataSource constructXaDataSource() {\n\n        if (xaDataSourceConfig == null) {\n\n            throw new KumuluzServerException(\"The XADataSource configuration object for creating a XADataSource cannot be null.\");\n        }\n\n        if (xaDataSourceConfig.getXaDatasourceClass() == null) {\n\n            throw new KumuluzServerException(\"The XADataSource class config property 'xa-datasource-class' for creating a XADataSource must be provided.\");\n        }\n\n        XADataSource xaDataSource = createXaDataSourceObject();\n\n        setProperty(xaDataSource, \"user\", xaDataSourceConfig.getUsername());\n        setProperty(xaDataSource, \"password\", xaDataSourceConfig.getPassword());\n\n        xaDataSourceConfig.getProps().forEach((k, v) -> setProperty(xaDataSource, k, v));\n\n        return xaDataSource;\n    }\n\n    private XADataSource createXaDataSourceObject() {\n\n        try {\n            return (XADataSource) Class.forName(xaDataSourceConfig.getXaDatasourceClass()).newInstance();\n        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | ClassCastException e) {\n\n            String msg = \"The XADataSource class '\" + xaDataSourceConfig.getXaDatasourceClass() +\n                    \"' is either incorrect or is not present in the classpath.\";\n\n            throw new KumuluzServerException(msg, e);\n        }\n    }\n\n    private void setProperty(Object object, String name, String value) {\n\n        name = \"set\" + name.substring(0, 1).toUpperCase() + name.substring(1);\n\n        Method[] methods = object.getClass().getMethods();\n\n        Method matchingMethod = null;\n\n        for (Method method : methods) {\n\n            if (method.getName().equalsIgnoreCase(name) && method.getParameterTypes().length == 1) {\n                // ignores overloading, just takes the first match it finds.\n                matchingMethod = method;\n                break;\n            }\n        }\n\n        if (matchingMethod == null) {\n\n            String msg = \"The XADataSource configuration property '\" + name + \"' is either incorrect or doesn't exist.\";\n\n            throw new KumuluzServerException(msg);\n        }\n\n        Class type = matchingMethod.getParameterTypes()[0];\n        Object argument = value;\n\n        if (type == Integer.TYPE) {\n            argument = Integer.valueOf(value);\n        }\n        if (type == Boolean.TYPE) {\n            argument = Boolean.valueOf(value);\n        }\n\n        try {\n            matchingMethod.invoke(object, argument);\n        } catch (IllegalAccessException | InvocationTargetException e) {\n\n            String msg = \"The XADataSource configuration property '\" + name + \"' is either incorrect or doesn't exist.\";\n\n            throw new KumuluzServerException(msg, e);\n        }\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/datasources/XADataSourceWrapper.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.datasources;\n\nimport javax.sql.DataSource;\n\n/**\n * @author Tilen Faganel\n * @since 2.3.0\n */\n@Deprecated\npublic interface XADataSourceWrapper extends DataSource {\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/dependencies/EeComponentDef.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.dependencies;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * @author Tilen Faganel\n * @since 2.0.0\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE})\npublic @interface EeComponentDef {\n\n    String name();\n\n    EeComponentType type();\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/dependencies/EeComponentDependencies.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.dependencies;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * @author Tilen Faganel\n * @since 2.0.0\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE})\npublic @interface EeComponentDependencies {\n\n    EeComponentDependency[] value();\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/dependencies/EeComponentDependency.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.dependencies;\n\nimport java.lang.annotation.*;\n\n/**\n * @author Tilen Faganel\n * @since 2.0.0\n */\n@Repeatable(EeComponentDependencies.class)\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE})\npublic @interface EeComponentDependency {\n\n    EeComponentType value();\n\n    String[] implementations() default {};\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/dependencies/EeComponentOptional.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.dependencies;\n\nimport java.lang.annotation.*;\n\n/**\n * @author Tilen Faganel\n * @since 2.0.0\n */\n@Repeatable(EeComponentOptionals.class)\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE})\npublic @interface EeComponentOptional {\n\n    EeComponentType value();\n\n    String[] implementations() default {};\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/dependencies/EeComponentOptionals.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.dependencies;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * @author Tilen Faganel\n * @since 2.0.0\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE})\npublic @interface EeComponentOptionals {\n\n    EeComponentOptional[] value();\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/dependencies/EeComponentType.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.dependencies;\n\n/**\n * @author Tilen Faganel\n * @since 2.0.0\n */\npublic enum EeComponentType {\n\n    SERVLET(\"Servlet\"),\n\n    WEBSOCKET(\"WebSocket\"),\n\n    JSP(\"JSP\"),\n\n    EL(\"EL\"),\n\n    JSF(\"JSF\"),\n\n    JPA(\"JPA\"),\n\n    CDI(\"CDI\"),\n\n    JAX_RS(\"JAX-RS\"),\n\n    JAX_WS(\"JAX-WS\"),\n\n    BEAN_VALIDATION(\"Bean Validation\"),\n\n    JSON_P(\"JSON-P\"),\n\n    JSON_B(\"JSON-B\"),\n\n    JTA(\"JTA\"),\n\n    EJB(\"EJB\"),\n\n    BATCH(\"Batch\"),\n\n    MAIL(\"JavaMail\");\n\n    private final String name;\n\n    EeComponentType(String name) {\n        this.name = name;\n    }\n\n    public String getName() {\n        return name;\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/dependencies/EeExtensionDef.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.dependencies;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * @author Tilen Faganel\n * @since 2.3.0\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE})\npublic @interface EeExtensionDef {\n\n    String name();\n\n    String group();\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/dependencies/EeExtensionGroup.java",
    "content": "package com.kumuluz.ee.common.dependencies;\n\npublic class EeExtensionGroup {\n\n    public final static String CONFIG = \"config\";\n    public final static String LOGS = \"logs\";\n\n    public final static String DISCOVERY = \"discovery\";\n    public final static String SECURITY = \"security\";\n    public final static String FAULT_TOLERANCE = \"fault.tolerance\";\n    public final static String STREAMING = \"streaming\";\n    public final static String METRICS = \"metrics\";\n    public final static String HEALTH = \"health\";\n    public final static String CORS = \"cors\";\n    public final static String REST_CLIENT = \"rest.client\";\n    public final static String AMQP = \"amqp\";\n    public final static String CACHING = \"caching\";\n    public final static String GRAPHQL = \"graphql\";\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/dependencies/ServerDef.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.dependencies;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * @author Tilen Faganel\n * @since 2.0.0\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE})\npublic @interface ServerDef {\n\n    String value();\n\n    EeComponentType[] provides() default {};\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/exceptions/ComponentsException.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.exceptions;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\npublic class ComponentsException extends RuntimeException {\n\n    public ComponentsException(String msg) {\n\n        super(msg);\n    }\n\n    public ComponentsException(String msg, Throwable cause) {\n\n        super(msg, cause);\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/exceptions/KumuluzServerException.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.exceptions;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\npublic class KumuluzServerException extends RuntimeException {\n\n    public KumuluzServerException(String msg) {\n\n        super(msg);\n    }\n\n    public KumuluzServerException(String msg, Throwable cause) {\n\n        super(msg, cause);\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/filters/PoweredByFilter.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.filters;\n\nimport javax.servlet.*;\nimport javax.servlet.http.HttpServletResponse;\nimport java.io.IOException;\n\npublic class PoweredByFilter implements Filter {\n\n    private String name;\n\n    @Override\n    public void init(FilterConfig filterConfig) throws ServletException {\n        this.name = filterConfig.getInitParameter(\"name\");\n    }\n\n    @Override\n    public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)\n            throws IOException,\n            ServletException {\n\n        ((HttpServletResponse) response).addHeader(\"X-Powered-By\", name);\n\n        chain.doFilter(request, response);\n    }\n\n    @Override\n    public void destroy() {\n    }\n}"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/runtime/EeRuntime.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.runtime;\n\nimport java.util.List;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic class EeRuntime {\n\n    private EeRuntimeInternal internalRuntime;\n\n    private static EeRuntime instance;\n\n    protected EeRuntime() {\n    }\n\n    private EeRuntime(EeRuntimeInternal internalRuntime) {\n        this.internalRuntime = internalRuntime;\n    }\n\n    public static void initialize(EeRuntimeInternal runtimeInternal) {\n\n        if (instance != null) {\n            throw new IllegalStateException(\"The EeRuntime was already initialized.\");\n        }\n\n        instance = new EeRuntime(runtimeInternal);\n    }\n\n    public static EeRuntime getInstance() {\n\n        if (instance == null) {\n            throw new IllegalStateException(\"The EeRuntime was not yet initialized.\");\n        }\n\n        return instance;\n    }\n\n    public String getInstanceId() {\n        return internalRuntime.getInstanceId();\n    }\n\n    public String getVersion() {\n        return internalRuntime.getVersion();\n    }\n\n    public List<EeRuntimeComponent> getEeComponents() {\n        return internalRuntime.getEeComponents();\n    }\n\n    public List<EeRuntimeExtension> getEeExtensions() {\n        return internalRuntime.getEeExtensions();\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/runtime/EeRuntimeComponent.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.runtime;\n\nimport com.kumuluz.ee.common.dependencies.EeComponentType;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic class EeRuntimeComponent {\n\n    private EeComponentType type;\n    private String implementationName;\n\n    public EeRuntimeComponent(EeComponentType type, String implementationName) {\n        this.type = type;\n        this.implementationName = implementationName;\n    }\n\n    public EeComponentType getType() {\n        return type;\n    }\n\n    public String getImplementationName() {\n        return implementationName;\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/runtime/EeRuntimeExtension.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.runtime;\n\n/**\n * @author Jan Meznarič\n * @since 2.5.0\n */\npublic class EeRuntimeExtension {\n\n    private String group;\n    private String implementationName;\n\n    public EeRuntimeExtension(String group, String implementationName) {\n        this.group = group;\n        this.implementationName = implementationName;\n    }\n\n    public String getGroup() {\n        return group;\n    }\n\n    public String getImplementationName() {\n        return implementationName;\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/runtime/EeRuntimeInternal.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.runtime;\n\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.ResourceBundle;\nimport java.util.UUID;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic class EeRuntimeInternal {\n\n    private String instanceId = UUID.randomUUID().toString();\n    private String version = ResourceBundle.getBundle(\"META-INF/kumuluzee/versions\").getString(\"version\");\n    private List<EeRuntimeComponent> eeComponents = Collections.emptyList();\n    private List<EeRuntimeExtension> eeExtensions = Collections.emptyList();\n\n    public String getInstanceId() {\n        return instanceId;\n    }\n\n    public void setInstanceId(String instanceId) {\n        this.instanceId = instanceId;\n    }\n\n    public String getVersion() {\n        return version;\n    }\n\n    public void setVersion(String version) {\n        this.version = version;\n    }\n\n    public List<EeRuntimeComponent> getEeComponents() {\n        return eeComponents;\n    }\n\n    public void setEeComponents(List<EeRuntimeComponent> eeComponents) {\n        this.eeComponents = Collections.unmodifiableList(eeComponents);\n    }\n\n    public List<EeRuntimeExtension> getEeExtensions() {\n        return eeExtensions;\n    }\n\n    public void setEeExtensions(List<EeRuntimeExtension> eeExtensions) {\n        this.eeExtensions = Collections.unmodifiableList(eeExtensions);\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/servlet/ServletWrapper.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.common.servlet;\n\n/**\n * @author Urban Malc\n * @since 2.6.0\n */\npublic class ServletWrapper {\n\n    private String name;\n    private String contextPath;\n\n    public ServletWrapper(String name, String contextPath) {\n        this.name = name;\n        this.contextPath = contextPath;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public String getContextPath() {\n        return contextPath;\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/utils/ClassUtils.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.utils;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\npublic class ClassUtils {\n\n    public static boolean isPresent(String className) {\n\n        return loadClass(className) != null;\n    }\n\n    public static Class<?> loadClass(String className) {\n\n        try {\n            return Class.forName(className);\n        } catch (Throwable ex) {\n            return null;\n        }\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/utils/EnvUtils.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.utils;\n\nimport com.kumuluz.ee.common.exceptions.KumuluzServerException;\n\nimport java.util.Optional;\nimport java.util.function.Consumer;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\npublic class EnvUtils {\n\n    public static void getEnv(String var, Consumer<String> consumer) {\n\n        Optional.ofNullable(System.getenv(var))\n                .filter(s -> !s.isEmpty())\n                .ifPresent(consumer);\n    }\n\n    public static void getEnvAsInteger(String var, Consumer<Integer> consumer) {\n\n        try {\n\n            Optional.ofNullable(System.getenv(var))\n                    .filter(s -> !s.isEmpty())\n                    .ifPresent(s -> consumer.accept(Integer.parseInt(s)));\n        } catch (NumberFormatException e) {\n\n            throw new KumuluzServerException(var + \"is in the incorrect format\", e);\n        }\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/utils/ResourceUtils.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.utils;\n\nimport com.kumuluz.ee.common.config.DevConfig;\nimport com.kumuluz.ee.common.config.EeConfig;\nimport com.kumuluz.ee.common.exceptions.KumuluzServerException;\n\nimport java.io.IOException;\nimport java.net.URISyntaxException;\nimport java.net.URL;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\npublic class ResourceUtils {\n\n    public static String getProjectWebResources() {\n\n        // First check the `webapp` directory in the compiled resources\n        URL webApp = ResourceUtils.class.getClassLoader().getResource(\"webapp\");\n\n        if (webApp != null) {\n\n            return webApp.toString();\n        }\n\n        // Next check if running inside an IDE and try to find the `src/main/webapp` dir\n        URL resourceRoot = ResourceUtils.class.getClassLoader().getResource(\".\");\n\n        if (resourceRoot != null) {\n\n            try {\n\n                Path resourceRootPath = Paths.get(resourceRoot.toURI());\n\n                // If running with maven\n                if (Files.isDirectory(resourceRootPath) && resourceRootPath.getFileName().toString().equals(\"classes\")\n                        && resourceRootPath.getParent() != null && resourceRootPath.getParent().getFileName().toString().equals(\"target\")) {\n\n                    DevConfig devConfig = EeConfig.getInstance().getDev();\n\n                    Path sibling = devConfig.getWebappDir() == null ?\n                            Paths.get( \"src\", \"main\", \"webapp\") :\n                            Paths.get(devConfig.getWebappDir());\n\n                    Path sourceWebApp = resourceRootPath.getParent().resolveSibling(sibling);\n\n                    if (Files.isDirectory(sourceWebApp)) {\n\n                        return sourceWebApp.toString();\n                    }\n                }\n            } catch (URISyntaxException e) {\n\n                throw new KumuluzServerException(\"Could not retrieve the class loaders' resource dir.\", e);\n            }\n        }\n\n        // Finally if nothing is found, create a temp directory and delete it on shutdown\n        try {\n\n            final Path tempWebApp = Files.createTempDirectory(\"kumuluzee-tmp-webapp\");\n\n            Runtime.getRuntime().addShutdownHook(new Thread(() -> {\n\n                try {\n                    Files.delete(tempWebApp);\n                } catch (IOException ignored) {\n                }\n            }));\n\n            return tempWebApp.toString();\n        } catch (IOException e) {\n\n            throw new KumuluzServerException(\"Could not initialize a temporary webapp directory.\", e);\n        }\n    }\n\n    public static boolean isRunningInJar() {\n\n        URL jar = ResourceUtils.class.getClassLoader().getResource(\"webapp\");\n\n        return (jar == null || jar.toString().toLowerCase().startsWith(\"jar:\"))\n                && ResourceUtils.class.getClassLoader().getClass().getName().equals(\"com.kumuluz.ee.loader.EeClassLoader\");\n    }\n\n    public static boolean isRunningTests() {\n        return EeConfig.getInstance().getDev().getRunningTests();\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/utils/StringUtils.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.utils;\n\nimport java.util.List;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\n/**\n * @author Tilen Faganel\n * @since 2.3.0\n */\npublic class StringUtils {\n\n    /**\n     * Parse upper camel case to lower hyphen case.\n     *\n     * @param s string in upper camel case format\n     * @return string in lower hyphen case format\n     */\n    public static String camelCaseToHyphenCase(String s) {\n\n        StringBuilder parsedString = new StringBuilder(s.substring(0, 1).toLowerCase());\n\n        for (char c : s.substring(1).toCharArray()) {\n\n            if (Character.isUpperCase(c)) {\n                parsedString.append(\"-\").append(Character.toLowerCase(c));\n            } else {\n                parsedString.append(c);\n            }\n        }\n\n        return parsedString.toString();\n    }\n\n    /**\n     * Parse lower hyphen case to upper camel case.\n     *\n     * @param s string in lower hyphen case format\n     * @return string in upper camel case format\n     */\n    public static String hyphenCaseToCamelCase(String s) {\n\n        List<String> words = Stream.of(s.split(\"-\")).filter(w -> !\"\".equals(w)).collect(Collectors.toList());\n\n        if (words.size() < 2) {\n            return s;\n        }\n\n        StringBuilder parsedString = new StringBuilder(words.get(0));\n\n        for (int i = 1; i < words.size(); i++) {\n\n            parsedString.append(Character.toUpperCase(words.get(i).charAt(0))).append(words.get(i).substring(1));\n        }\n\n        return parsedString.toString();\n    }\n\n    /**\n     * Check whether the string is null or empty\n     *\n     * @param s string to check.\n     * @return 'true' if string is null or empty, 'false' otherwise.\n     */\n    public static boolean isNullOrEmpty(String s) {\n        return s == null || s.isEmpty();\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/wrapper/ComponentWrapper.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.wrapper;\n\nimport com.kumuluz.ee.common.Component;\nimport com.kumuluz.ee.common.dependencies.EeComponentDependency;\nimport com.kumuluz.ee.common.dependencies.EeComponentOptional;\n\n/**\n * @author Tilen Faganel\n * @since 2.0.0\n */\npublic class ComponentWrapper {\n\n    private Component component;\n    private String name;\n    private EeComponentDependency[] dependencies;\n    private EeComponentOptional[] optionalDependencies;\n\n    public ComponentWrapper(Component component, String name,\n                            EeComponentDependency[] dependencies,\n                            EeComponentOptional[] optionalDependencies) {\n        this.component = component;\n        this.name = name;\n        this.dependencies = dependencies;\n        this.optionalDependencies = optionalDependencies;\n    }\n\n    public Component getComponent() {\n        return component;\n    }\n\n    public void setComponent(Component component) {\n        this.component = component;\n    }\n\n\n    public EeComponentDependency[] getDependencies() {\n        return dependencies;\n    }\n\n    public void setDependencies(EeComponentDependency[] dependencies) {\n        this.dependencies = dependencies;\n    }\n\n    public EeComponentOptional[] getOptionalDependencies() {\n        return optionalDependencies;\n    }\n\n    public void setOptionalDependencies(EeComponentOptional[] optionalDependencies) {\n        this.optionalDependencies = optionalDependencies;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/wrapper/EeComponentWrapper.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.wrapper;\n\nimport com.kumuluz.ee.common.Component;\nimport com.kumuluz.ee.common.dependencies.EeComponentDependency;\nimport com.kumuluz.ee.common.dependencies.EeComponentOptional;\nimport com.kumuluz.ee.common.dependencies.EeComponentType;\n\nimport java.util.List;\n\n/**\n * @author Tilen Faganel\n * @since 2.0.0\n */\npublic class EeComponentWrapper extends ComponentWrapper {\n\n    private EeComponentType type;\n\n    public EeComponentWrapper(Component component, String name,\n                              EeComponentDependency[] dependencies,\n                              EeComponentOptional[] optionalDependencies) {\n\n        super(component, name, dependencies, optionalDependencies);\n    }\n\n    public EeComponentWrapper(Component component, String name, EeComponentType type,\n                              EeComponentDependency[] dependencies,\n                              EeComponentOptional[] optionalDependencies) {\n\n        super(component, name, dependencies, optionalDependencies);\n        this.type = type;\n    }\n\n    public EeComponentType getType() {\n        return type;\n    }\n\n    public void setType(EeComponentType type) {\n        this.type = type;\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/wrapper/ExtensionWrapper.java",
    "content": "package com.kumuluz.ee.common.wrapper;\n\nimport com.kumuluz.ee.common.Extension;\nimport com.kumuluz.ee.common.dependencies.EeComponentDependency;\nimport com.kumuluz.ee.common.dependencies.EeComponentOptional;\n\npublic class ExtensionWrapper<T extends Extension> {\n\n    private T extension;\n    private String name;\n    private String group;\n    private EeComponentDependency[] dependencies;\n    private EeComponentOptional[] optionalDependencies;\n\n    public ExtensionWrapper(T extension, String name, String group, EeComponentDependency[] dependencies, EeComponentOptional[] optionalDependencies) {\n        this.extension = extension;\n        this.name = name;\n        this.group = group;\n        this.dependencies = dependencies;\n        this.optionalDependencies = optionalDependencies;\n    }\n\n    public T getExtension() {\n        return extension;\n    }\n\n    public void setExtension(T extension) {\n        this.extension = extension;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public String getGroup() {\n        return group;\n    }\n\n    public void setGroup(String group) {\n        this.group = group;\n    }\n\n    public EeComponentDependency[] getDependencies() {\n        return dependencies;\n    }\n\n    public void setDependencies(EeComponentDependency[] dependencies) {\n        this.dependencies = dependencies;\n    }\n\n    public EeComponentOptional[] getOptionalDependencies() {\n        return optionalDependencies;\n    }\n\n    public void setOptionalDependencies(EeComponentOptional[] optionalDependencies) {\n        this.optionalDependencies = optionalDependencies;\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/common/wrapper/KumuluzServerWrapper.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.common.wrapper;\n\nimport com.kumuluz.ee.common.KumuluzServer;\nimport com.kumuluz.ee.common.dependencies.EeComponentType;\n\nimport java.util.List;\n\n/**\n * @author Tilen Faganel\n * @since 2.0.0\n */\npublic class KumuluzServerWrapper {\n\n    private KumuluzServer server;\n    private String name;\n    private EeComponentType[] providedEeComponents;\n\n    public KumuluzServerWrapper(KumuluzServer server, String name, EeComponentType[] providedEeComponents) {\n\n        this.server = server;\n        this.name = name;\n        this.providedEeComponents = providedEeComponents;\n    }\n\n    public KumuluzServer getServer() {\n        return server;\n    }\n\n    public void setServer(KumuluzServer server) {\n        this.server = server;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public EeComponentType[] getProvidedEeComponents() {\n        return providedEeComponents;\n    }\n\n    public void setProvidedEeComponents(EeComponentType[] providedEeComponents) {\n        this.providedEeComponents = providedEeComponents;\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/configuration/ConfigurationDecoder.java",
    "content": "/*\n *  Copyright (c) 2014-2019 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.configuration;\n\n/**\n * Optional implementation of this interface can be registered as\n * a service provider to implement decoding of certain configuration keys' values.\n *\n * @author Jan Meznarič\n * @since 3.2.1\n */\npublic interface ConfigurationDecoder {\n\n    /**\n     * Check if key's value should be decoded.\n     *\n     * @param key configuration key to be checked for decoding\n     * @return returns true if key's value should be decoded with the decode(String key, String value) method\n     */\n    boolean shouldDecode(String key);\n\n    /**\n     * Decode values of encoded keys.\n     *\n     * @param key   encoded key\n     * @param value encoded value\n     * @return decoded value\n     */\n    String decode(String key, String value);\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/configuration/ConfigurationListener.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.configuration;\n\n/**\n * @author Tilen Faganel\n * @since 2.3.0\n */\n@FunctionalInterface\npublic interface ConfigurationListener {\n\n    void onChange(String key, String value);\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/configuration/ConfigurationSource.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.configuration;\n\nimport com.kumuluz.ee.configuration.utils.ConfigurationDispatcher;\n\nimport java.util.List;\nimport java.util.Optional;\n\n/**\n * @author Tilen Faganel\n * @since 2.1.0\n */\npublic interface ConfigurationSource {\n\n    String CONFIG_ORDINAL = \"config_ordinal\";\n\n    void init(ConfigurationDispatcher configurationDispatcher);\n\n    Optional<String> get(String key);\n\n    default Optional<Boolean> getBoolean(String key) {\n\n        Optional<String> value = get(key);\n\n        return value.map(Boolean::valueOf);\n    }\n\n    default Optional<Integer> getInteger(String key) {\n\n        Optional<String> value = get(key);\n\n        if (value.isPresent()) {\n\n            try {\n                return Optional.of(Integer.valueOf(value.get()));\n            } catch (NumberFormatException e) {\n                return Optional.empty();\n            }\n        } else {\n            return Optional.empty();\n        }\n    }\n\n    default Optional<Long> getLong(String key) {\n\n        Optional<String> value = get(key);\n\n        if (value.isPresent()) {\n\n            try {\n                return Optional.of(Long.valueOf(value.get()));\n            } catch (NumberFormatException e) {\n                return Optional.empty();\n            }\n        } else {\n            return Optional.empty();\n        }\n    }\n\n    default Optional<Double> getDouble(String key) {\n\n        Optional<String> value = get(key);\n\n        if (value.isPresent()) {\n\n            try {\n                return Optional.of(Double.valueOf(value.get()));\n            } catch (NumberFormatException e) {\n                return Optional.empty();\n            }\n        } else {\n            return Optional.empty();\n        }\n    }\n\n    default Optional<Float> getFloat(String key) {\n\n        Optional<String> value = get(key);\n\n        if (value.isPresent()) {\n\n            try {\n                return Optional.of(Float.valueOf(value.get()));\n            } catch (NumberFormatException e) {\n                return Optional.empty();\n            }\n\n        } else {\n            return Optional.empty();\n        }\n    }\n\n    Optional<Integer> getListSize(String key);\n\n    Optional<List<String>> getMapKeys(String key);\n\n    void watch(String key);\n\n    void set(String key, String value);\n\n    void set(String key, Boolean value);\n\n    void set(String key, Integer value);\n\n    void set(String key, Double value);\n\n    void set(String key, Float value);\n\n    default Integer getOrdinal() {\n        return getInteger(CONFIG_ORDINAL).orElse(100);\n    }\n\n    default void postInit() {}\n\n    default void initProfile(String profileName) {}\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/configuration/enums/ConfigurationValueType.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.configuration.enums;\n\n/**\n * @author Jan Meznarič\n * @since 2.3.0\n */\npublic enum ConfigurationValueType {\n    STRING,\n    INTEGER,\n    LONG,\n    DOUBLE,\n    FLOAT,\n    BOOLEAN,\n    LIST,\n    MAP\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/configuration/sources/EnvironmentConfigurationSource.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.configuration.sources;\n\nimport com.kumuluz.ee.configuration.ConfigurationSource;\nimport com.kumuluz.ee.configuration.utils.ConfigurationDispatcher;\n\nimport java.util.*;\n\n/**\n * @author Tilen Faganel\n * @since 2.1.0\n */\npublic class EnvironmentConfigurationSource implements ConfigurationSource {\n\n    @Override\n    public void init(ConfigurationDispatcher configurationDispatcher) {\n    }\n\n    @Override\n    public Optional<String> get(String key) {\n\n        String value = null;\n\n        for (String possibleName : getPossibleEnvNames(key)) {\n            value = System.getenv(possibleName);\n\n            if (value != null) {\n                break;\n            }\n        }\n\n        return Optional.ofNullable(value);\n    }\n\n    @Override\n    public Optional<Integer> getListSize(String key) {\n\n        for (String possibleKeyName : getPossibleEnvNames(key)) {\n            int maxIndex = -1;\n\n            for (String envName : System.getenv().keySet()) {\n\n                if (envName.startsWith(possibleKeyName)) {\n\n                    int openingIndex = possibleKeyName.length();\n                    int closingIndex = envName.indexOf(\"_\", openingIndex + 1);\n\n                    if (closingIndex < 0) {\n                        closingIndex = envName.length();\n                    }\n\n                    try {\n                        int idx = Integer.parseInt(envName.substring(openingIndex, closingIndex));\n                        maxIndex = Math.max(maxIndex, idx);\n                    } catch (NumberFormatException ignored) {\n                    }\n                }\n            }\n\n            if (maxIndex != -1) {\n                return Optional.of(maxIndex + 1);\n            }\n\n            // retry for legacy key names\n            for (String envName : System.getenv().keySet()) {\n\n                if (envName.startsWith(possibleKeyName)) {\n\n                    int openingIndex = possibleKeyName.length() + 1;\n                    int closingIndex = envName.indexOf(\"]\", openingIndex + 1);\n\n                    if (closingIndex < 0) {\n                        closingIndex = envName.indexOf(\"_\", openingIndex + 1);\n                    }\n\n                    if (closingIndex < 0) {\n                        closingIndex = envName.length() - 1;\n                    }\n\n                    if (openingIndex >= closingIndex) {\n                        continue;\n                    }\n\n                    try {\n                        int idx = Integer.parseInt(envName.substring(openingIndex, closingIndex));\n                        maxIndex = Math.max(maxIndex, idx);\n                    } catch (NumberFormatException ignored) {\n                    }\n                }\n            }\n\n            if (maxIndex != -1) {\n                return Optional.of(maxIndex + 1);\n            }\n        }\n\n        return Optional.empty();\n    }\n\n    @Override\n    public Optional<List<String>> getMapKeys(String key) {\n\n        Set<String> mapKeys = new HashSet<>();\n        Set<String> envKeys = new HashSet<>(System.getenv().keySet());\n\n        List<String> possibleKeyNames = (key.equals(\"\")) ? Collections.singletonList(\"\") : getPossibleEnvNames(key);\n        for (String possibleKeyName : possibleKeyNames) {\n            Set<String> toRemove = new HashSet<>();\n            for (String envKey : envKeys) {\n                if (!possibleKeyName.equals(\"\") && possibleKeyName.length() + 1 > envKey.length()) {\n                    continue;\n                }\n                if (envKey.startsWith(possibleKeyName)) {\n                    int separatorIdx;\n                    int startIdx;\n                    if (possibleKeyName.equals(\"\")) {\n                        int dotIdx = envKey.indexOf('.');\n                        int underscoreIdx = envKey.indexOf('_');\n\n                        if (dotIdx > 0 && underscoreIdx > 0) {\n                            // both defined, pick earliest\n                            separatorIdx = Math.min(dotIdx, underscoreIdx);\n                        } else {\n                            // at least one is -1\n                            separatorIdx = Math.max(dotIdx, underscoreIdx);\n                        }\n                        startIdx = 0;\n                    } else {\n                        char separator = envKey.charAt(possibleKeyName.length());\n\n                        if (separator != '.' && separator != '_') {\n                            continue;\n                        }\n\n                        startIdx = possibleKeyName.length() + 1;\n\n                        separatorIdx = envKey.indexOf(separator, startIdx);\n                    }\n\n                    if (separatorIdx < 0) {\n                        // no separators left, use full key\n                        separatorIdx = envKey.length();\n                    }\n\n                    String mapKey = envKey.substring(startIdx, separatorIdx);\n\n                    if (!mapKey.isEmpty()) {\n                        int bracketIndex = mapKey.indexOf(\"[\");\n                        if (bracketIndex > 0) {\n                            // list bracket present, cut it off\n                            mapKey = mapKey.substring(0, bracketIndex);\n                        }\n\n                        mapKeys.add(mapKey.toLowerCase());\n                        toRemove.add(envKey);\n                    }\n                }\n            }\n            envKeys.removeAll(toRemove);\n        }\n\n        if (mapKeys.size() == 0) {\n            return Optional.empty();\n        } else {\n            return Optional.of(new ArrayList<>(mapKeys));\n        }\n    }\n\n    @Override\n    public void watch(String key) {\n    }\n\n    @Override\n    public void set(String key, String value) {\n    }\n\n    @Override\n    public void set(String key, Boolean value) {\n    }\n\n    @Override\n    public void set(String key, Integer value) {\n    }\n\n    @Override\n    public void set(String key, Double value) {\n    }\n\n    @Override\n    public void set(String key, Float value) {\n    }\n\n    @Override\n    public Integer getOrdinal() {\n        return getInteger(CONFIG_ORDINAL).orElse(300);\n    }\n\n    private List<String> getPossibleEnvNames(String key) {\n        List<String> possibleNames = new LinkedList<>();\n\n        // MP Config 1.3: raw key\n        possibleNames.add(key);\n        // MP Config 1.3: replaces non alpha-numeric characters with '_'\n        possibleNames.add(replaceNonAlphaNum(key));\n        // MP Config 1.3: replaces non alpha-numeric characters with '_', to uppercase\n        possibleNames.add(replaceNonAlphaNum(key).toUpperCase());\n        // legacy 1: removes characters '[]-' and replaces dots with '_', to uppercase\n        possibleNames.add(parseKeyNameForEnvironmentVariables(key));\n        // legacy 2: replaces dots with '_', to uppercase\n        possibleNames.add(parseKeyNameForEnvironmentVariablesLegacy(key));\n\n        return possibleNames;\n    }\n\n    private String replaceNonAlphaNum(String s) {\n        return s.replaceAll(\"[^a-zA-Z0-9]\", \"_\");\n    }\n\n    private String parseKeyNameForEnvironmentVariables(String key) {\n\n        return key.toUpperCase().replaceAll(\"\\\\[\", \"\").replaceAll(\"]\", \"\")\n                .replaceAll(\"-\", \"\").replaceAll(\"\\\\.\", \"_\");\n\n    }\n\n    private String parseKeyNameForEnvironmentVariablesLegacy(String key) {\n\n        return key.toUpperCase().replaceAll(\"\\\\.\", \"_\");\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/configuration/sources/FileConfigurationSource.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.configuration.sources;\n\nimport com.kumuluz.ee.configuration.ConfigurationSource;\nimport com.kumuluz.ee.configuration.utils.ConfigurationDispatcher;\nimport com.kumuluz.ee.configuration.utils.ConfigurationSourceUtils;\nimport com.kumuluz.ee.logs.LogDeferrer;\nimport org.yaml.snakeyaml.Yaml;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport java.util.*;\nimport java.util.logging.Logger;\nimport java.util.stream.Collectors;\n\n/**\n * @author Tilen Faganel\n * @since 2.1.0\n */\npublic class FileConfigurationSource implements ConfigurationSource {\n\n    private enum Mode {\n        YAML,\n        PROPERTIES\n    }\n\n    private Logger log;\n    private LogDeferrer<Logger> logDeferrer;\n\n    private String ymlFileName;\n    private String yamlFileName;\n    private String propertiesFileName;\n    private final String microProfilePropertiesFileName;\n    private final List<Map<String, Object>> yamlConfigs = new ArrayList<>();\n    private final List<Properties> properties = new ArrayList<>();\n\n    private Mode mode;\n\n    public FileConfigurationSource() {\n\n        this.ymlFileName = \"config.yml\";\n        this.yamlFileName = \"config.yaml\";\n        this.propertiesFileName = \"config.properties\";\n        this.microProfilePropertiesFileName = \"META-INF/microprofile-config.properties\";\n\n        String configurationFileName = System.getProperty(\"com.kumuluz.ee.configuration.file\");\n\n        if (configurationFileName != null && !configurationFileName.isEmpty()) {\n            this.ymlFileName = configurationFileName;\n            this.yamlFileName = null;\n            this.propertiesFileName = configurationFileName;\n        }\n\n        this.logDeferrer = new LogDeferrer<>();\n\n        this.logDeferrer.init(() -> Logger.getLogger(FileConfigurationSource.class.getName()));\n    }\n\n    public void postInit() {\n\n        logDeferrer.execute();\n        logDeferrer = null;\n\n        log = Logger.getLogger(FileConfigurationSource.class.getName());\n    }\n\n    @Override\n    public void init(ConfigurationDispatcher configurationDispatcher) {\n\n        // read yaml file to Map<String, Object>\n        Map<String, Object> yamlConfig = loadYamlFile(this.ymlFileName, this.yamlFileName);\n\n        if (yamlConfig != null) {\n            this.yamlConfigs.add(yamlConfig);\n            this.mode = Mode.YAML;\n        } else {\n            // parse properties file\n            Properties p = loadProperties(propertiesFileName);\n            if (p == null) {\n                p = loadProperties(microProfilePropertiesFileName);\n            }\n\n            if (p != null) {\n                this.properties.add(p);\n                this.mode = Mode.PROPERTIES;\n            }\n        }\n\n        if (!yamlConfigs.isEmpty() || !properties.isEmpty()) {\n            logDeferrer.defer(l -> l.info(\"Configuration successfully read.\"));\n        } else {\n            logDeferrer.defer(l -> l.info(\"Unable to load configuration from file. \" +\n                    \"No configuration files were found.\"));\n        }\n    }\n\n    @Override\n    public void initProfile(String profileName) {\n\n        if (mode == Mode.YAML) {\n\n            Map<String, Object> yamlConfig = loadYamlFile(\"config-\" + profileName + \".yml\", \"config-\" + profileName + \".yaml\");\n            if (yamlConfig != null) {\n                this.yamlConfigs.add(0, yamlConfig);\n            }\n        } else if (mode == Mode.PROPERTIES) {\n            Properties p = loadProperties(\"config-\" + profileName + \".properties\");\n            if (p == null) {\n                p = loadProperties(\"META-INF/microprofile-config-\" + profileName + \".properties\");\n            }\n            if (p != null) {\n                this.properties.add(0, p);\n            }\n        }\n    }\n\n    @Override\n    public Optional<String> get(String key) {\n\n        // get key value from yaml configuration\n        if (mode == Mode.YAML) {\n\n            Object value;\n            for (var config : this.yamlConfigs) {\n                value = getYamlValue(key, config);\n\n                if (value != null && !(value instanceof Map) && !(value instanceof List)) {\n                    return Optional.of(value.toString());\n                }\n            }\n\n            return Optional.empty();\n\n            // get value from .properties configuration\n        } else if (mode == Mode.PROPERTIES) {\n\n            for (Properties properties : this.properties) {\n                String value = properties.getProperty(key);\n                if (value != null) {\n                    return Optional.of(value);\n                }\n            }\n\n            return Optional.empty();\n        }\n\n        return Optional.empty();\n    }\n\n    @Override\n    public Optional<Integer> getListSize(String key) {\n\n        if (mode == Mode.YAML) {\n\n            Integer maxSize = null;\n\n            for (var config : this.yamlConfigs) {\n                Object value = getYamlValue(key, config);\n\n                if (value instanceof List) {\n                    if (maxSize == null) {\n                        maxSize = ((List<?>) value).size();\n                    } else {\n                        maxSize = Math.max(((List<?>) value).size(), maxSize);\n                    }\n                }\n            }\n\n            return Optional.ofNullable(maxSize);\n\n        } else if (mode == Mode.PROPERTIES) {\n\n            Integer maxSize = null;\n\n            for (Properties properties : this.properties) {\n                Optional<Integer> propertyListSize = ConfigurationSourceUtils.getListSize(key, properties.stringPropertyNames());\n\n                if (propertyListSize.isPresent()) {\n                    if (maxSize == null) {\n                        maxSize = propertyListSize.get();\n                    } else {\n                        maxSize = Math.max(propertyListSize.get(), maxSize);\n                    }\n                }\n            }\n\n            return Optional.ofNullable(maxSize);\n        }\n\n        return Optional.empty();\n\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public Optional<List<String>> getMapKeys(String key) {\n\n        if (mode == Mode.YAML) {\n\n            boolean found = false;\n            Set<String> mergedKeys = new HashSet<>();\n\n            for (var config : this.yamlConfigs) {\n                Object o = (key.equals(\"\")) ? config : getYamlValue(key, config);\n                Map<String, Object> map = null;\n\n                if (o instanceof Map) {\n                    map = (Map<String, Object>) o;\n                }\n\n                if (map != null && !map.isEmpty()) {\n                    found = true;\n                    mergedKeys.addAll(map.keySet());\n                }\n            }\n\n            if (found) {\n                return Optional.of(new ArrayList<>(mergedKeys));\n            } else {\n                return Optional.empty();\n            }\n\n        } else if (mode == Mode.PROPERTIES) {\n\n            boolean found = false;\n            Set<String> mergedKeys = new HashSet<>();\n\n            for (Properties properties : this.properties) {\n                Optional<List<String>> propertyMapKeys = ConfigurationSourceUtils.getMapKeys(key,\n                        properties.stringPropertyNames());\n\n                if (propertyMapKeys.isPresent()) {\n                    found = true;\n                    mergedKeys.addAll(propertyMapKeys.get());\n                }\n            }\n\n            if (found) {\n                return Optional.of(new ArrayList<>(mergedKeys));\n            } else {\n                return Optional.empty();\n            }\n        }\n\n        return Optional.empty();\n    }\n\n    @Override\n    public void watch(String key) {\n    }\n\n    @Override\n    public void set(String key, String value) {\n    }\n\n    @Override\n    public void set(String key, Boolean value) {\n    }\n\n    @Override\n    public void set(String key, Integer value) {\n    }\n\n    @Override\n    public void set(String key, Double value) {\n    }\n\n    @Override\n    public void set(String key, Float value) {\n    }\n\n    @Override\n    public Integer getOrdinal() {\n        return getInteger(CONFIG_ORDINAL).orElse(100);\n    }\n\n    /**\n     * Returns true, if key represents an array.\n     *\n     * @param key configuration key\n     * @return true if the config key represents an array, false otherwise.\n     */\n    private boolean representsArray(String key) {\n\n        int openingBracket = key.indexOf(\"[\");\n        int closingBracket = key.indexOf(\"]\");\n\n        return closingBracket == key.length() - 1 && openingBracket != -1;\n\n    }\n\n    /**\n     * Parses configuration map, returns value for given key.\n     *\n     * @param key configuration key\n     * @return Value for given key.\n     */\n    private Object getYamlValue(String key, Object value) {\n\n        // iterate over configuration tree\n        String[] splittedKeys = key.split(\"\\\\.\");\n\n        for (int i = 0; i < splittedKeys.length; i++) {\n\n            String splittedKey = splittedKeys[i];\n\n            if (value == null) {\n                return null;\n            }\n\n            // parse arrays\n            if (representsArray(splittedKey)) {\n\n                // value array support\n                int arrayIndex;\n                int openingBracket = splittedKey.indexOf(\"[\");\n                int closingBracket = splittedKey.indexOf(\"]\");\n\n                try {\n                    arrayIndex = Integer.parseInt(splittedKey.substring(openingBracket + 1, closingBracket));\n                } catch (NumberFormatException e) {\n\n                    if (log != null) {\n                        log.severe(\"Cannot cast array index.\");\n                    }\n\n                    return null;\n                }\n\n                splittedKey = splittedKey.substring(0, openingBracket);\n\n                if (value instanceof Map) {\n                    value = ((Map<?, ?>) value).get(splittedKey);\n                } else {\n                    return null;\n                }\n\n                if (value instanceof List) {\n                    value = (arrayIndex < ((List<?>) value).size()) ? ((List<?>) value).get(arrayIndex) : null;\n                }\n\n            } else {\n                if (value instanceof Map) {\n\n                    Object tmpValue = ((Map<?, ?>) value).get(splittedKey);\n\n                    if (tmpValue == null && i != splittedKeys.length - 1) {\n\n                        String postfixKey = Arrays.stream(splittedKeys).skip(i)\n                                .collect(Collectors.joining(\".\"));\n\n                        return ((Map<?, ?>) value).get(postfixKey);\n                    } else {\n\n                        value = tmpValue;\n                    }\n                } else {\n                    return null;\n                }\n            }\n        }\n\n        return value;\n    }\n\n    private Map<String, Object> loadYamlFile(String fileNameYml, String fileNameYaml) {\n\n        InputStream file = null;\n        Yaml yaml = new Yaml();\n        try {\n            file = getClass().getClassLoader().getResourceAsStream(fileNameYml);\n\n            if (file == null && fileNameYaml != null) {\n                file = getClass().getClassLoader().getResourceAsStream(fileNameYaml);\n            }\n\n            if (file == null) {\n                try {\n                    file = Files.newInputStream(Paths.get(fileNameYml));\n                } catch (IOException ignored) {\n                }\n            }\n\n            if (file == null && fileNameYaml != null) {\n                try {\n                    file = Files.newInputStream(Paths.get(fileNameYaml));\n                } catch (IOException ignored) {\n                }\n            }\n\n            if (file != null) {\n\n                logDeferrer.defer(l -> l.info(\"Loading configuration from YAML file.\"));\n\n                Object yamlParsed = yaml.load(file);\n\n                if (yamlParsed instanceof Map) {\n                    //noinspection unchecked\n                    return (Map<String, Object>) yamlParsed;\n                } else {\n\n                    logDeferrer.defer(l -> l.info(\"Configuration YAML is malformed as it contains an array at the \" +\n                            \"root level. Skipping.\"));\n                }\n            }\n\n            return null;\n        } catch (Exception e) {\n            logDeferrer.defer(l ->\n                    l.info(\"Couldn't successfully process the YAML configuration file. \" +\n                            \"All your properties may not be correctly loaded.\"));\n\n            return null;\n        } finally {\n            if (file != null) {\n                try {\n                    file.close();\n                } catch (IOException ignored) {\n                }\n            }\n        }\n    }\n\n    private Properties loadProperties(String fileName) {\n\n        InputStream inputStream = null;\n        try {\n            inputStream = getClass().getClassLoader().getResourceAsStream(fileName);\n\n            if (inputStream == null) {\n                try {\n                    inputStream = Files.newInputStream(Paths.get(fileName));\n                } catch (IOException ignored) {\n                }\n            }\n\n            if (inputStream != null) {\n\n                logDeferrer.defer(l -> l.info(\"Loading configuration from .properties file: \" + fileName));\n\n                Properties p = new Properties();\n                p.load(inputStream);\n                return p;\n            }\n        } catch (Exception e) {\n            logDeferrer.defer(l -> l.info(\"Properties file: \" + fileName + \" not found.\"));\n        } finally {\n            if (inputStream != null) {\n                try {\n                    inputStream.close();\n                } catch (IOException ignored) {\n                }\n            }\n        }\n\n        return null;\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/configuration/sources/SystemPropertyConfigurationSource.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.configuration.sources;\n\nimport com.kumuluz.ee.configuration.ConfigurationSource;\nimport com.kumuluz.ee.configuration.utils.ConfigurationDispatcher;\nimport com.kumuluz.ee.configuration.utils.ConfigurationSourceUtils;\n\nimport java.util.List;\nimport java.util.Optional;\n\n/**\n * @author Urban Malc\n * @since 2.4.0\n */\npublic class SystemPropertyConfigurationSource implements ConfigurationSource {\n\n    @Override\n    public void init(ConfigurationDispatcher configurationDispatcher) {\n    }\n\n    @Override\n    public Optional<String> get(String key) {\n        return Optional.ofNullable(System.getProperty(key));\n    }\n\n    @Override\n    public Optional<Integer> getListSize(String key) {\n\n        return ConfigurationSourceUtils.getListSize(key, System.getProperties().stringPropertyNames());\n    }\n\n    @Override\n    public Optional<List<String>> getMapKeys(String key) {\n\n        return ConfigurationSourceUtils.getMapKeys(key, System.getProperties().stringPropertyNames());\n    }\n\n    @Override\n    public void watch(String key) {\n    }\n\n    @Override\n    public void set(String key, String value) {\n    }\n\n    @Override\n    public void set(String key, Boolean value) {\n    }\n\n    @Override\n    public void set(String key, Integer value) {\n    }\n\n    @Override\n    public void set(String key, Double value) {\n    }\n\n    @Override\n    public void set(String key, Float value) {\n    }\n\n    @Override\n    public Integer getOrdinal() {\n        return getInteger(CONFIG_ORDINAL).orElse(400);\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/configuration/utils/ConfigurationDecoderUtils.java",
    "content": "/*\n *  Copyright (c) 2014-2019 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.configuration.utils;\n\nimport com.kumuluz.ee.configuration.ConfigurationDecoder;\n\n/**\n * Util methods for decoding encoded configuration keys.\n *\n * @author Jan Meznarič\n * @since 3.2.1\n */\npublic class ConfigurationDecoderUtils {\n\n    public static String decodeConfigValueIfEncoded(String key, String value) {\n\n        ConfigurationDecoder configurationDecoder = ConfigurationUtil.getInstance().getConfigurationDecoder();\n\n        if (configurationDecoder != null && configurationDecoder.shouldDecode(key)) {\n            return configurationDecoder.decode(key, value);\n        }\n\n        return value;\n    }\n\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/configuration/utils/ConfigurationDispatcher.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.configuration.utils;\n\nimport com.kumuluz.ee.configuration.ConfigurationListener;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\n\n/**\n * @author Tilen Faganel\n * @since 2.3.0\n */\n// Fire configuration events and notify subscription\npublic class ConfigurationDispatcher {\n\n    private List<ConfigurationListener> subscriptions = new ArrayList<>();\n\n    public void notifyChange(String key, String value) {\n\n        for (ConfigurationListener subscription : subscriptions) {\n            subscription.onChange(key, value);\n        }\n    }\n\n    public void subscribe(ConfigurationListener listener) {\n        subscriptions.add(listener);\n    }\n\n    public void unsubscribe(ConfigurationListener listener) {\n        subscriptions.remove(listener);\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/configuration/utils/ConfigurationImpl.java",
    "content": "/*\n *  Copyright (c) 2014-2019 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.configuration.utils;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.ServiceLoader;\nimport java.util.logging.Logger;\n\nimport com.kumuluz.ee.configuration.ConfigurationDecoder;\nimport com.kumuluz.ee.configuration.ConfigurationSource;\n\n/**\n * @author Tilen Faganel\n * @since 2.1.0\n */\npublic class ConfigurationImpl {\n\n    private Logger utilLogger;\n    private ConfigurationDispatcher dispatcher;\n    private List<ConfigurationSource> configurationSources;\n    private ConfigurationDecoder configurationDecoder;\n\n    public ConfigurationImpl() {\n        init();\n    }\n\n    private void init() {\n        // specify sources\n        configurationSources = new ArrayList<>();\n\n        ServiceLoader.load(ConfigurationSource.class).forEach(configurationSources::add);\n\n        dispatcher = new ConfigurationDispatcher();\n\n        configurationSources.forEach(configurationSource -> configurationSource.init(dispatcher));\n\n        // initialise configuration decoder\n        List<ConfigurationDecoder> configurationDecoders = new ArrayList<>();\n        ServiceLoader.load(ConfigurationDecoder.class).forEach(configurationDecoders::add);\n        if (configurationDecoders.size() > 1) {\n            throw new IllegalStateException(\n                \"There is more than one service provider defined for the ConfigurationDecoder interface.\");\n        } else if (configurationDecoders.size() == 1) {\n            configurationDecoder = configurationDecoders.get(0);\n        }\n    }\n\n    public void postInit() {\n        configurationSources.forEach(ConfigurationSource::postInit);\n        utilLogger = Logger.getLogger(ConfigurationUtil.class.getName());\n    }\n\n    public Boolean isUtilLoggerAvailable() {\n        return utilLogger != null;\n    }\n\n    public Logger getUtilLogger() {\n        return utilLogger;\n    }\n\n    public ConfigurationDispatcher getDispatcher() {\n        return dispatcher;\n    }\n\n    public List<ConfigurationSource> getConfigurationSources() {\n        return configurationSources;\n    }\n\n    public ConfigurationDecoder getConfigurationDecoder() {\n        return configurationDecoder;\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/configuration/utils/ConfigurationInterpolationUtil.java",
    "content": "package com.kumuluz.ee.configuration.utils;\n\nimport java.util.NoSuchElementException;\nimport java.util.Optional;\nimport java.util.function.Function;\nimport java.util.regex.Matcher;\n\n/**\n * Utility for performing configuration value interpolation. Independent from the actual config resolver, since it can\n * be used in kumuluzee-config-mp. The interpolation (syntax, default values, etc.) is performed according to the\n * MicroProfile Config specification.\n *\n * @author Urban Malc\n * @since 4.1.0\n */\npublic class ConfigurationInterpolationUtil {\n\n    public static String interpolateString(String value, Function<String, Optional<String>> configResolver) {\n\n        int numberOfReplacements = 0;\n\n        InterpolationLocation interpolationLocation = getInnermostInterpolation(value);\n        while (interpolationLocation != null) {\n\n            if (numberOfReplacements > 10) {\n                throw new IllegalArgumentException(\"Reached maximum limit of interpolations when interpolating value: \" + value);\n            }\n\n            String interpolationKey = value.substring(interpolationLocation.startIndex + 2,\n                    interpolationLocation.endIndex);\n            String defaultValue = null;\n\n            if (interpolationKey.contains(\":\")) {\n                String[] tokens = interpolationKey.split(\":\", 2);\n                interpolationKey = tokens[0];\n                defaultValue = tokens[1];\n            }\n\n            String finalDefaultValue = defaultValue;\n            Optional<String> replacement = configResolver\n                    .apply(interpolationKey)\n                    .or(() -> Optional.ofNullable(finalDefaultValue));\n\n            if (replacement.isEmpty()) {\n                throw new NoSuchElementException(\"Could not resolve interpolation: \" + interpolationKey);\n            }\n\n            value = value.substring(0, interpolationLocation.startIndex) + replacement.get() +\n                    value.substring(interpolationLocation.endIndex + 1);\n\n            numberOfReplacements++;\n\n            interpolationLocation = getInnermostInterpolation(value);\n        }\n\n        return value.replaceAll(\"\\\\\\\\\\\\$\\\\{\", Matcher.quoteReplacement(\"${\")); // replace \\${ with ${\n    }\n\n    private static InterpolationLocation getInnermostInterpolation(String value) {\n\n        Integer startIndex = null;\n\n        for (int i = 0; i < value.length(); i++) {\n\n            if (value.charAt(i) == '}' && startIndex != null) {\n                return new InterpolationLocation(startIndex, i);\n            }\n\n            if (i < value.length() - 1 &&\n                    value.charAt(i) == '$' && value.charAt(i + 1) == '{' &&\n                    (i == 0 || value.charAt(i - 1) != '\\\\')) {\n\n                startIndex = i;\n            }\n        }\n\n        return null;\n    }\n\n    private static class InterpolationLocation {\n\n        private final int startIndex;\n        private final int endIndex;\n\n        public InterpolationLocation(int startIndex, int endIndex) {\n            this.startIndex = startIndex;\n            this.endIndex = endIndex;\n        }\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/configuration/utils/ConfigurationSourceUtils.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.configuration.utils;\n\nimport java.util.*;\n\n/**\n * @author Urban Malc\n * @since 2.5.0\n */\npublic class ConfigurationSourceUtils {\n\n\n    public static Optional<Integer> getListSize(String key, Collection<String> allKeys) {\n\n        int maxIndex = -1;\n\n        for (String propertyKey : allKeys) {\n\n            if (propertyKey.startsWith(key + \"[\")) {\n\n                int openingIndex = key.length() + 1;\n                int closingIndex = propertyKey.indexOf(\"]\", openingIndex + 1);\n\n                try {\n                    int idx = Integer.parseInt(propertyKey.substring(openingIndex, closingIndex));\n                    maxIndex = Math.max(maxIndex, idx);\n                } catch (NumberFormatException ignored) {\n                }\n            }\n        }\n\n        if (maxIndex != -1) {\n            return Optional.of(maxIndex + 1);\n        }\n\n        return Optional.empty();\n    }\n\n    public static Optional<List<String>> getMapKeys(String key, Collection<String> allKeys) {\n\n        Set<String> mapKeys = new HashSet<>();\n\n        for (String propertyKey : allKeys) {\n\n            String mapKey = \"\";\n\n            if (key.isEmpty()) {\n                mapKey = propertyKey;\n            } else if (propertyKey.startsWith(key)) {\n\n                int index = key.length() + 1;\n\n                if (index < propertyKey.length() && propertyKey.charAt(index - 1) == '.') {\n                    mapKey = propertyKey.substring(index);\n                }\n            }\n\n            if (!mapKey.isEmpty()) {\n\n                int endIndex = mapKey.indexOf(\".\");\n\n                if (endIndex > 0) {\n                    mapKey = mapKey.substring(0, endIndex);\n                }\n\n                int bracketIndex = mapKey.indexOf(\"[\");\n                if (bracketIndex > 0) {\n                    mapKey = mapKey.substring(0, bracketIndex);\n                }\n\n                mapKeys.add(mapKey);\n            }\n        }\n\n        if (mapKeys.isEmpty()) {\n\n            return Optional.empty();\n        }\n\n        return Optional.of(new ArrayList<>(mapKeys));\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/configuration/utils/ConfigurationUtil.java",
    "content": "/*\n *  Copyright (c) 2014-2019 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.configuration.utils;\n\nimport com.kumuluz.ee.configuration.ConfigurationDecoder;\nimport com.kumuluz.ee.configuration.ConfigurationListener;\nimport com.kumuluz.ee.configuration.ConfigurationSource;\nimport com.kumuluz.ee.configuration.enums.ConfigurationValueType;\n\nimport java.util.*;\n\n/**\n * @author Tilen Faganel\n * @since 2.1.0\n */\npublic class ConfigurationUtil {\n\n    private static ConfigurationUtil instance;\n\n    private ConfigurationImpl config;\n\n    protected ConfigurationUtil() {\n    }\n\n    private ConfigurationUtil(ConfigurationImpl config) {\n        this.config = config;\n    }\n\n    public static void initialize(ConfigurationImpl config) {\n\n        if (instance != null) {\n            throw new IllegalStateException(\"The ConfigurationUtil was already initialized.\");\n        }\n\n        instance = new ConfigurationUtil(config);\n    }\n\n    public static ConfigurationUtil getInstance() {\n\n        if (instance == null) {\n            throw new IllegalStateException(\"The ConfigurationUtil was not yet initialized.\");\n        }\n\n        return instance;\n    }\n\n    public Optional<String> get(String key) {\n\n        for (ConfigurationSource configurationSource : config.getConfigurationSources()) {\n\n            Optional<String> value = configurationSource.get(key);\n\n            if (value.isPresent()) {\n\n                return Optional.of(ConfigurationInterpolationUtil.interpolateString(\n                        ConfigurationDecoderUtils.decodeConfigValueIfEncoded(key, value.get()), this::get));\n            }\n        }\n\n        return Optional.empty();\n    }\n\n    public Optional<String> getRaw(String key) {\n\n        for (ConfigurationSource configurationSource : config.getConfigurationSources()) {\n\n            Optional<String> value = configurationSource.get(key);\n\n            if (value.isPresent()) {\n\n                return value;\n            }\n        }\n\n        return Optional.empty();\n    }\n\n    public Optional<Boolean> getBoolean(String key) {\n\n        for (ConfigurationSource configurationSource : config.getConfigurationSources()) {\n\n            Optional<Boolean> value = configurationSource.getBoolean(key);\n\n            if (value.isPresent()) {\n                return value;\n            }\n        }\n        return Optional.empty();\n    }\n\n    public Optional<Integer> getInteger(String key) {\n\n        for (ConfigurationSource configurationSource : config.getConfigurationSources()) {\n\n            Optional<Integer> value = configurationSource.getInteger(key);\n\n            if (value.isPresent()) {\n                return value;\n            }\n        }\n        return Optional.empty();\n    }\n\n    public Optional<Long> getLong(String key) {\n\n        for (ConfigurationSource configurationSource : config.getConfigurationSources()) {\n\n            Optional<Long> value = configurationSource.getLong(key);\n\n            if (value.isPresent()) {\n                return value;\n            }\n        }\n        return Optional.empty();\n    }\n\n    public Optional<Double> getDouble(String key) {\n\n        for (ConfigurationSource configurationSource : config.getConfigurationSources()) {\n\n            Optional<Double> value = configurationSource.getDouble(key);\n\n            if (value.isPresent()) {\n                return value;\n            }\n        }\n        return Optional.empty();\n    }\n\n    public Optional<Float> getFloat(String key) {\n\n        for (ConfigurationSource configurationSource : config.getConfigurationSources()) {\n\n            Optional<Float> value = configurationSource.getFloat(key);\n\n            if (value.isPresent()) {\n                return value;\n            }\n        }\n        return Optional.empty();\n    }\n\n    public Optional<Integer> getListSize(String key) {\n\n        int listSize = -1;\n\n        for (ConfigurationSource configurationSource : config.getConfigurationSources()) {\n\n            Optional<Integer> currentListSize = configurationSource.getListSize(key);\n\n            if (currentListSize.isPresent() && currentListSize.get() > listSize) {\n                listSize = currentListSize.get();\n            }\n        }\n        if (listSize == -1) {\n            return Optional.empty();\n        } else {\n            return Optional.of(listSize);\n        }\n    }\n\n    public Optional<List<String>> getList(String key) {\n\n        Optional<Integer> listSize = getListSize(key);\n\n        if (!listSize.isPresent()) {\n            return Optional.empty();\n        }\n\n        List<String> list = new ArrayList<>();\n        for (int i = 0; i < listSize.get(); i++) {\n            Optional<String> value = get(key + \"[\" + i + \"]\");\n            value.ifPresent(list::add);\n        }\n\n        return Optional.of(list);\n\n    }\n\n    public void set(String key, String value) {\n        config.getConfigurationSources().get(0).set(key, value);\n    }\n\n    public void set(String key, Boolean value) {\n        config.getConfigurationSources().get(0).set(key, value);\n    }\n\n    public void set(String key, Integer value) {\n        config.getConfigurationSources().get(0).set(key, value);\n    }\n\n    public void set(String key, Double value) {\n        config.getConfigurationSources().get(0).set(key, value);\n    }\n\n    public void set(String key, Float value) {\n        config.getConfigurationSources().get(0).set(key, value);\n    }\n\n    public Optional<ConfigurationValueType> getType(String key) {\n\n        // check if key type is a list or a map\n        if (getListSize(key).isPresent()) {\n            return Optional.of(ConfigurationValueType.LIST);\n        }\n\n        if (getMapKeys(key).isPresent()) {\n            return Optional.of(ConfigurationValueType.MAP);\n        }\n\n        // get the key value from sources according to priorities and determine its type\n        Optional<String> value = get(key);\n\n        if (!value.isPresent()) {\n            return Optional.empty();\n        }\n\n        if (\"true\".equals(value.get().toLowerCase()) || \"false\".equals(value.get().toLowerCase())) {\n            return Optional.of(ConfigurationValueType.BOOLEAN);\n        }\n\n        try {\n            Integer.valueOf(value.get());\n            return Optional.of(ConfigurationValueType.INTEGER);\n        } catch (NumberFormatException ignored) {\n        }\n\n        try {\n            Long.valueOf(value.get());\n            return Optional.of(ConfigurationValueType.LONG);\n        } catch (NumberFormatException ignored) {\n        }\n\n        try {\n            Float f = Float.valueOf(value.get());\n            if (!f.isInfinite()) {\n                return Optional.of(ConfigurationValueType.FLOAT);\n            }\n        } catch (NumberFormatException ignored) {\n        }\n\n        try {\n            Double.valueOf(value.get());\n            return Optional.of(ConfigurationValueType.DOUBLE);\n        } catch (NumberFormatException ignored) {\n        }\n\n        return Optional.of(ConfigurationValueType.STRING);\n\n    }\n\n    public Optional<List<String>> getMapKeys(String key) {\n\n        Set<String> mapKeys = new HashSet<>();\n\n        for (ConfigurationSource configurationSource : config.getConfigurationSources()) {\n\n            Optional<List<String>> value = configurationSource.getMapKeys(key);\n\n            if (value.isPresent()) {\n\n                for (String s : value.get()) {\n\n                    if (!mapKeys.contains(s.replace(\"-\", \"\"))) {\n                        mapKeys.add(s);\n                    }\n                }\n            }\n        }\n\n        if (mapKeys.isEmpty()) {\n            return Optional.empty();\n        }\n\n        return Optional.of(new ArrayList<>(mapKeys));\n    }\n\n    public void subscribe(String key, ConfigurationListener listener) {\n\n        config.getDispatcher().subscribe(listener);\n\n        for (ConfigurationSource configurationSource : config.getConfigurationSources()) {\n            configurationSource.watch(key);\n        }\n    }\n\n    public void unsubscribe(ConfigurationListener listener) {\n        config.getDispatcher().unsubscribe(listener);\n    }\n\n    public List<ConfigurationSource> getConfigurationSources() {\n        return Collections.unmodifiableList(this.config.getConfigurationSources());\n    }\n\n    public ConfigurationDecoder getConfigurationDecoder() {\n        return config.getConfigurationDecoder();\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/logs/LogDeferrer.java",
    "content": "package com.kumuluz.ee.logs;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.function.Consumer;\nimport java.util.function.Supplier;\n\npublic class LogDeferrer<T> {\n\n    private Supplier<T> logger;\n    private List<Consumer<T>> logs = new ArrayList<>();\n    private Boolean finished = false;\n\n    public void init(Supplier<T> logger) {\n\n        if (this.logger != null) {\n\n            throw new IllegalStateException(\"The LogDeferrer was already initiated with a logger instance\");\n        }\n\n        this.logger = logger;\n    }\n\n    public void defer(Consumer<T> log) {\n\n        this.logs.add(log);\n    }\n\n    public void execute() {\n\n        if (finished) {\n\n            throw new IllegalStateException(\"The LogDeferrer was already executed. Please create a new one.\");\n        }\n\n        T loggerInstance = logger.get();\n\n        for (Consumer<T> log : logs) {\n\n            log.accept(loggerInstance);\n        }\n\n        this.logger = null;\n        this.logs.clear();\n        this.finished = true;\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/logs/impl/JavaUtilConsoleHandler.java",
    "content": "package com.kumuluz.ee.logs.impl;\n\nimport java.io.UnsupportedEncodingException;\nimport java.util.logging.*;\n\npublic class JavaUtilConsoleHandler extends StreamHandler {\n\n    /**\n     * Create a {@link JavaUtilConsoleHandler} for {@link System#out}.\n     */\n    public JavaUtilConsoleHandler() {\n\n        setLevel(Level.INFO);\n        setFormatter(new JavaUtilFormatter());\n        setOutputStream(System.out);\n\n        try {\n            setEncoding(null);\n        } catch (UnsupportedEncodingException ignored) {\n        }\n    }\n\n    /**\n     * Publish a {@link LogRecord}.\n     * <p>\n     * The logging request was made initially to a {@link Logger} object,\n     * which initialized the {@link LogRecord} and forwarded it here.\n     * <p>\n     * @param  record  description of the log event. A null record is\n     *                 silently ignored and is not published\n     */\n    @Override\n    public void publish(LogRecord record) {\n        super.publish(record);\n\n        flush();\n    }\n\n    /**\n     * Override {@link StreamHandler#close} to do a flush but not\n     * to close the output stream.  That is, we do <b>not</b>\n     * close {@link System#out}.\n     */\n    @Override\n    public void close() {\n        flush();\n    }\n}\n"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/logs/impl/JavaUtilDefaultLogConfigurator.java",
    "content": "package com.kumuluz.ee.logs.impl;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.logging.*;\n\npublic class JavaUtilDefaultLogConfigurator {\n\n    public static void init() {\n\n        String javaUtilConfig = System.getProperty(\"java.util.logging.config.file\");\n\n        if (javaUtilConfig == null) {\n\n            LogManager.getLogManager().reset();\n\n            Logger rootLogger = LogManager.getLogManager().getLogger(\"\");\n\n            JavaUtilConsoleHandler handler = new JavaUtilConsoleHandler();\n\n            rootLogger.addHandler(handler);\n        } else {\n\n            InputStream javaUtilConfigStream = JavaUtilDefaultLogConfigurator.class.getClassLoader()\n                    .getResourceAsStream(javaUtilConfig);\n\n            if (javaUtilConfigStream != null) {\n\n                try {\n                    LogManager.getLogManager().readConfiguration(javaUtilConfigStream);\n                } catch (IOException ignored) {\n                }\n            }\n        }\n    }\n\n    public static void initSoleHandler(Handler handler) {\n\n        LogManager.getLogManager().reset();\n\n        Logger rootLogger = LogManager.getLogManager().getLogger(\"\");\n        rootLogger.addHandler(handler);\n    }\n}"
  },
  {
    "path": "common/src/main/java/com/kumuluz/ee/logs/impl/JavaUtilFormatter.java",
    "content": "package com.kumuluz.ee.logs.impl;\n\nimport java.io.PrintWriter;\nimport java.io.StringWriter;\nimport java.time.Instant;\nimport java.time.ZoneId;\nimport java.time.ZonedDateTime;\nimport java.time.format.DateTimeFormatter;\nimport java.util.Date;\nimport java.util.logging.Formatter;\nimport java.util.logging.LogRecord;\n\npublic class JavaUtilFormatter extends Formatter {\n\n    private static final DateTimeFormatter timestampFormat = DateTimeFormatter.ofPattern(\"yyyy-MM-dd HH:mm:ss.SSS\");\n\n    @Override\n    public String format(LogRecord record) {\n\n        ZonedDateTime zonedDateTime = Instant.ofEpochMilli(record.getMillis()).atZone(ZoneId.systemDefault());\n\n        String source = record.getSourceClassName() != null ? record.getSourceClassName() : record.getLoggerName();\n        String message = formatMessage(record);\n        String throwable = \"\";\n\n        if (record.getThrown() != null) {\n\n            StringWriter sw = new StringWriter();\n            PrintWriter pw = new PrintWriter(sw);\n            pw.println();\n            record.getThrown().printStackTrace(pw);\n            pw.close();\n            throwable = sw.toString();\n        }\n\n        return zonedDateTime.format(timestampFormat) + \" \" +\n                record.getLevel().getName() + \" -- \" +\n                source + \" -- \" +\n                message + throwable + \"\\n\";\n    }\n}\n"
  },
  {
    "path": "common/src/main/resources/META-INF/kumuluzee/versions.properties",
    "content": "version=${project.version}"
  },
  {
    "path": "common/src/main/resources/META-INF/services/com.kumuluz.ee.configuration.ConfigurationSource",
    "content": "com.kumuluz.ee.configuration.sources.EnvironmentConfigurationSource\ncom.kumuluz.ee.configuration.sources.FileConfigurationSource\ncom.kumuluz.ee.configuration.sources.SystemPropertyConfigurationSource\n\n"
  },
  {
    "path": "common/src/test/java/com/kumuluz/ee/configuration/utils/ConfigurationInterpolationUtilTest.java",
    "content": "package com.kumuluz.ee.configuration.utils;\n\nimport org.junit.Test;\n\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.function.Function;\n\nimport static org.junit.Assert.*;\n\n/**\n * Tests for {@link ConfigurationInterpolationUtil}. More tests of interpolation (expressions) are in\n * kumuluzee-config-mp.\n *\n * @author Urban Malc\n * @since 4.1.0\n */\npublic class ConfigurationInterpolationUtilTest {\n\n    private static final String TEST_VALUE = \"TEST_VALUE\";\n\n\n    private Optional<String> identityResolver(String s) {\n        return Optional.ofNullable(s);\n    }\n\n    private Optional<String> testValueResolver(String s) {\n        return Optional.of(TEST_VALUE);\n    }\n\n    private Optional<String> emptyResolver(String s) {\n        return Optional.empty();\n    }\n\n    private Function<String, Optional<String>> createMapResolver(Map<String, String> entries) {\n        return s -> Optional.ofNullable(entries.get(s));\n    }\n\n    @Test\n    public void noInterpolationTest() {\n\n        assertEquals(\"test\", ConfigurationInterpolationUtil.interpolateString(\"test\", this::emptyResolver));\n        assertEquals(\"\", ConfigurationInterpolationUtil.interpolateString(\"\", this::emptyResolver));\n        assertEquals(\"${}\", ConfigurationInterpolationUtil.interpolateString(\"\\\\${}\", this::emptyResolver));\n        assertEquals(\"${test}\", ConfigurationInterpolationUtil.interpolateString(\"\\\\${test}\", this::emptyResolver));\n        assertEquals(\"${}${}\", ConfigurationInterpolationUtil.interpolateString(\"\\\\${}\\\\${}\", this::emptyResolver));\n        assertEquals(\"${${}}\", ConfigurationInterpolationUtil.interpolateString(\"\\\\${\\\\${}}\", this::emptyResolver));\n        assertEquals(\"${\", ConfigurationInterpolationUtil.interpolateString(\"\\\\${\", this::emptyResolver));\n        assertEquals(\"abc${}\", ConfigurationInterpolationUtil.interpolateString(\"abc\\\\${}\", this::emptyResolver));\n        assertEquals(\"${}def\", ConfigurationInterpolationUtil.interpolateString(\"\\\\${}def\", this::emptyResolver));\n        assertEquals(\"abc${}def\", ConfigurationInterpolationUtil.interpolateString(\"abc\\\\${}def\", this::emptyResolver));\n    }\n\n    @Test\n    public void simpleInterpolationTest() {\n\n        assertEquals(TEST_VALUE, ConfigurationInterpolationUtil.interpolateString(\"${replaceme}\", this::testValueResolver));\n        assertEquals(\"abc\" + TEST_VALUE, ConfigurationInterpolationUtil.interpolateString(\"abc${replaceme}\", this::testValueResolver));\n        assertEquals(TEST_VALUE + \"def\", ConfigurationInterpolationUtil.interpolateString(\"${replaceme}def\", this::testValueResolver));\n        assertEquals(\"abc\" + TEST_VALUE + \"def\", ConfigurationInterpolationUtil.interpolateString(\"abc${replaceme}def\", this::testValueResolver));\n        assertEquals(TEST_VALUE + TEST_VALUE, ConfigurationInterpolationUtil.interpolateString(\"${replaceme}${replaceme}\", this::testValueResolver));\n        assertEquals(TEST_VALUE + \" \" + TEST_VALUE, ConfigurationInterpolationUtil.interpolateString(\"${replaceme} ${replaceme}\", this::testValueResolver));\n    }\n\n    @Test\n    public void nestedInterpolationTest() {\n\n        assertEquals(\"i1\", ConfigurationInterpolationUtil.interpolateString(\"${${i1}}\", this::identityResolver));\n        assertEquals(\"i1i2\", ConfigurationInterpolationUtil.interpolateString(\"${i1${i2}}\", this::identityResolver));\n        assertEquals(\"i1i2i1\", ConfigurationInterpolationUtil.interpolateString(\"${i1${i2}i1}\", this::identityResolver));\n\n        assertEquals(\"finalValue\", ConfigurationInterpolationUtil.interpolateString(\"${prefix.${inner}.postfix}\",\n                this.createMapResolver(Map.of(\n                        \"inner\", \"innerval\",\n                        \"prefix.innerval.postfix\", \"finalValue\"\n                ))));\n    }\n\n    @Test\n    public void defaultValueInterpolationTest() {\n\n        assertEquals(\"defaultValue\", ConfigurationInterpolationUtil.interpolateString(\"${test:defaultValue}\", this::emptyResolver));\n        assertEquals(\"defaultValue\", ConfigurationInterpolationUtil.interpolateString(\"${:defaultValue}\", this::emptyResolver));\n        assertEquals(\"\", ConfigurationInterpolationUtil.interpolateString(\"${test:}\", this::emptyResolver));\n        assertEquals(\"\", ConfigurationInterpolationUtil.interpolateString(\"${:}\", this::emptyResolver));\n\n        assertEquals(\"abc.defaultValue\", ConfigurationInterpolationUtil.interpolateString(\"abc.${test:defaultValue}\", this::emptyResolver));\n        assertEquals(\"defaultValue.def\", ConfigurationInterpolationUtil.interpolateString(\"${test:defaultValue}.def\", this::emptyResolver));\n        assertEquals(\"abc.defaultValue.def\", ConfigurationInterpolationUtil.interpolateString(\"abc.${test:defaultValue}.def\", this::emptyResolver));\n    }\n\n    @Test\n    public void defaultValueAndNestedInterpolationTest() {\n\n        assertEquals(\"defaultValue\", ConfigurationInterpolationUtil.interpolateString(\"${first:${second:defaultValue}}\", this::emptyResolver));\n        assertEquals(\"secondValue\", ConfigurationInterpolationUtil.interpolateString(\"${first:${second:defaultValue}}\",\n                this.createMapResolver(Map.of(\n                        \"second\", \"secondValue\"\n                ))));\n        assertEquals(\"firstValue\", ConfigurationInterpolationUtil.interpolateString(\"${first:${second:defaultValue}}\",\n                this.createMapResolver(Map.of(\n                        \"first\", \"firstValue\"\n                ))));\n\n        assertEquals(\"secondDefault\", ConfigurationInterpolationUtil.interpolateString(\"${${inner:firstDefault}:secondDefault}\", this::emptyResolver));\n        assertEquals(\"firstValue\", ConfigurationInterpolationUtil.interpolateString(\"${${inner:firstDefault}:secondDefault}\",\n                this.createMapResolver(Map.of(\n                        \"firstDefault\", \"firstValue\"\n                ))));\n        assertEquals(\"secondValue\", ConfigurationInterpolationUtil.interpolateString(\"${${inner:firstDefault}:secondDefault}\",\n                this.createMapResolver(Map.of(\n                        \"inner\", \"second\",\n                        \"second\", \"secondValue\"\n                ))));\n    }\n}"
  },
  {
    "path": "components/bean-validation/hibernate-validator/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-bean-validation</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <artifactId>kumuluzee-bean-validation-hibernate-validator</artifactId>\n\n    <name>KumuluzEE Bean Validation Hibernate Validator</name>\n    <description>KumuluzEE Bean Validation component implemented by Hibernate Validator</description>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-common</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.hibernate.validator</groupId>\n            <artifactId>hibernate-validator</artifactId>\n            <version>${hibernate.validator.version}</version>\n            <exclusions>\n                <exclusion>\n                    <groupId>org.jboss.logging</groupId>\n                    <artifactId>jboss-logging</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>com.fasterxml</groupId>\n                    <artifactId>classmate</artifactId>\n                </exclusion>\n            </exclusions>\n        </dependency>\n        <dependency>\n            <groupId>org.hibernate.validator</groupId>\n            <artifactId>hibernate-validator-cdi</artifactId>\n            <version>${hibernate.validator.version}</version>\n            <exclusions>\n                <exclusion>\n                    <groupId>org.hibernate.validator</groupId>\n                    <artifactId>hibernate-validator</artifactId>\n                </exclusion>\n            </exclusions>\n        </dependency>\n        <dependency>\n            <groupId>org.jboss.logging</groupId>\n            <artifactId>jboss-logging</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.fasterxml</groupId>\n            <artifactId>classmate</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.glassfish.jersey.ext</groupId>\n            <artifactId>jersey-bean-validation</artifactId>\n            <version>${jersey.version}</version>\n            <exclusions>\n                <exclusion>\n                    <groupId>org.glassfish.hk2.external</groupId>\n                    <artifactId>javax.inject</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>org.glassfish.jersey.core</groupId>\n                    <artifactId>jersey-common</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>org.glassfish.jersey.core</groupId>\n                    <artifactId>jersey-server</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>jakarta.validation</groupId>\n                    <artifactId>jakarta.validation-api</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>org.hibernate</groupId>\n                    <artifactId>hibernate-validator</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>javax.el</groupId>\n                    <artifactId>javax.el-api</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>org.glassfish.web</groupId>\n                    <artifactId>javax.el</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>javax.ws.rs</groupId>\n                    <artifactId>javax.ws.rs-api</artifactId>\n                </exclusion>\n            </exclusions>\n        </dependency>\n\n        <dependency>\n            <groupId>junit</groupId>\n            <artifactId>junit</artifactId>\n            <scope>test</scope>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-el-uel</artifactId>\n            <scope>test</scope>\n        </dependency>\n    </dependencies>\n\n</project>"
  },
  {
    "path": "components/bean-validation/hibernate-validator/src/main/java/com/kumuluz/ee/beanvalidation/BeanValidationComponent.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.beanvalidation;\n\nimport com.kumuluz.ee.common.Component;\nimport com.kumuluz.ee.common.config.EeConfig;\nimport com.kumuluz.ee.common.dependencies.EeComponentDef;\nimport com.kumuluz.ee.common.dependencies.EeComponentDependency;\nimport com.kumuluz.ee.common.dependencies.EeComponentType;\nimport com.kumuluz.ee.common.wrapper.KumuluzServerWrapper;\n\nimport java.util.logging.Logger;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\n@EeComponentDef(name = \"Hibernate Validator\", type = EeComponentType.BEAN_VALIDATION)\n@EeComponentDependency(value = EeComponentType.EL)\npublic class BeanValidationComponent implements Component {\n\n    private Logger log = Logger.getLogger(BeanValidationComponent.class.getSimpleName());\n\n    @Override\n    public void init(KumuluzServerWrapper server, EeConfig eeConfig) {\n    }\n\n    @Override\n    public void load() {\n\n        log.info(\"Initiating Hibernate Validator\");\n    }\n}\n"
  },
  {
    "path": "components/bean-validation/hibernate-validator/src/main/resources/META-INF/services/com.kumuluz.ee.common.Component",
    "content": "com.kumuluz.ee.beanvalidation.BeanValidationComponent"
  },
  {
    "path": "components/bean-validation/hibernate-validator/src/test/java/com/kumuluz/ee/beanvalidation/test/HibernateValidatorTest.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.beanvalidation.test;\n\nimport com.kumuluz.ee.beanvalidation.test.beans.Project;\nimport com.kumuluz.ee.beanvalidation.test.beans.User;\nimport org.junit.Assert;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\n\nimport javax.validation.ConstraintViolation;\nimport javax.validation.Validation;\nimport javax.validation.Validator;\nimport javax.validation.ValidatorFactory;\nimport java.util.ArrayList;\nimport java.util.Date;\nimport java.util.Set;\n\n/**\n * @author Tilen\n */\npublic class HibernateValidatorTest {\n\n    private static Validator validator;\n\n    @BeforeClass\n    public static void setUp() {\n        ValidatorFactory factory = Validation.buildDefaultValidatorFactory();\n        validator = factory.getValidator();\n    }\n\n    @Test\n    public void testCorrectEntities() {\n\n        Project p1 = new Project();\n        p1.setName(\"Test project\");\n        p1.setDescription(\"Sample description of a project\");\n\n        User u1 = new User();\n        u1.setUsername(\"ahughes\");\n        u1.setEmail(\"amy.hughes@mac.com\");\n        u1.setFirstname(\"Amy\");\n        u1.setLastname(\"Hughes\");\n        u1.setAge(20);\n        u1.setSalary(100000d);\n        u1.setCreatedAt(new Date());\n        u1.setProjects(new ArrayList<>());\n\n        u1.getProjects().add(p1);\n        p1.setUser(u1);\n\n        Set<ConstraintViolation<User>> constraintViolations =\n                validator.validate(u1);\n\n        Assert.assertNotNull(constraintViolations);\n        Assert.assertEquals(0, constraintViolations.size());\n    }\n\n    @Test\n    public void testWrongEntities() {\n\n        Project p1 = new Project();\n        p1.setName(\"T\");\n\n        User u1 = new User();\n        u1.setUsername(\"ahughes\");\n        u1.setEmail(\"amy.hughesmac.com\");\n        u1.setFirstname(\"\");\n        u1.setLastname(\"Hughes\");\n        u1.setAge(-10);\n        u1.setSalary(100000d);\n        u1.setCreatedAt(new Date());\n        u1.setProjects(new ArrayList<>());\n\n        u1.getProjects().add(p1);\n        p1.setUser(u1);\n\n        Set<ConstraintViolation<User>> constraintViolations =\n                validator.validate(u1);\n\n        Assert.assertNotNull(constraintViolations);\n        Assert.assertEquals(4, constraintViolations.size());\n    }\n}\n"
  },
  {
    "path": "components/bean-validation/hibernate-validator/src/test/java/com/kumuluz/ee/beanvalidation/test/beans/Project.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.beanvalidation.test.beans;\n\nimport javax.validation.constraints.NotNull;\nimport javax.validation.constraints.Size;\n\n/**\n * @author Tilen\n */\npublic class Project {\n\n    @NotNull\n    @Size(min = 2, max = 30)\n    private String name;\n\n    @Size(min = 1, max = 3000)\n    private String description;\n\n    @NotNull\n    private User user;\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public String getDescription() {\n        return description;\n    }\n\n    public void setDescription(String description) {\n        this.description = description;\n    }\n\n    public User getUser() {\n        return user;\n    }\n\n    public void setUser(User user) {\n        this.user = user;\n    }\n}\n"
  },
  {
    "path": "components/bean-validation/hibernate-validator/src/test/java/com/kumuluz/ee/beanvalidation/test/beans/User.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.beanvalidation.test.beans;\n\nimport javax.validation.Valid;\nimport javax.validation.constraints.Email;\nimport javax.validation.constraints.Min;\nimport javax.validation.constraints.NotNull;\nimport javax.validation.constraints.Size;\nimport java.util.Date;\nimport java.util.List;\n\n/**\n * @author Tilen\n */\npublic class User {\n\n    @NotNull\n    @Size(min = 2, max = 30)\n    private String username;\n\n    @NotNull\n    @Email\n    private String email;\n\n    @Size(min = 2, max = 20)\n    private String firstname;\n\n    @Size(min = 2, max = 20)\n    private String lastname;\n\n    @NotNull\n    @Min(0)\n    private Integer age;\n\n    @NotNull\n    @Min(0)\n    private Double salary;\n\n    @NotNull\n    private Date createdAt;\n\n    @Valid\n    private List<Project> projects;\n\n    public String getUsername() {\n        return username;\n    }\n\n    public void setUsername(String username) {\n        this.username = username;\n    }\n\n    public String getEmail() {\n        return email;\n    }\n\n    public void setEmail(String email) {\n        this.email = email;\n    }\n\n    public String getFirstname() {\n        return firstname;\n    }\n\n    public void setFirstname(String firstname) {\n        this.firstname = firstname;\n    }\n\n    public String getLastname() {\n        return lastname;\n    }\n\n    public void setLastname(String lastname) {\n        this.lastname = lastname;\n    }\n\n    public Integer getAge() {\n        return age;\n    }\n\n    public void setAge(Integer age) {\n        this.age = age;\n    }\n\n    public Double getSalary() {\n        return salary;\n    }\n\n    public void setSalary(Double salary) {\n        this.salary = salary;\n    }\n\n    public Date getCreatedAt() {\n        return createdAt;\n    }\n\n    public void setCreatedAt(Date createdAt) {\n        this.createdAt = createdAt;\n    }\n\n    public List<Project> getProjects() {\n        return projects;\n    }\n\n    public void setProjects(List<Project> projects) {\n        this.projects = projects;\n    }\n}\n"
  },
  {
    "path": "components/bean-validation/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-components</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n    <packaging>pom</packaging>\n\n    <name>KumuluzEE Bean Validation</name>\n    <description>KumuluzEE Bean Validation component</description>\n\n    <modules>\n        <module>hibernate-validator</module>\n    </modules>\n\n    <artifactId>kumuluzee-bean-validation</artifactId>\n\n</project>"
  },
  {
    "path": "components/cdi/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-components</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n    <packaging>pom</packaging>\n\n    <name>KumuluzEE CDI</name>\n    <description>KumuluzEE CDI component</description>\n\n    <modules>\n        <module>weld</module>\n    </modules>\n\n    <artifactId>kumuluzee-cdi</artifactId>\n\n</project>"
  },
  {
    "path": "components/cdi/weld/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-cdi</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE CDI Weld</name>\n    <description>KumuluzEE CDI component implemented by Weld</description>\n\n    <artifactId>kumuluzee-cdi-weld</artifactId>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-common</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>jakarta.interceptor</groupId>\n            <artifactId>jakarta.interceptor-api</artifactId>\n            <exclusions>\n                <exclusion>\n                    <groupId>jakarta.ejb</groupId>\n                    <artifactId>jakarta.ejb-api</artifactId>\n                </exclusion>\n            </exclusions>\n        </dependency>\n        <dependency>\n            <groupId>jakarta.el</groupId>\n            <artifactId>jakarta.el-api</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.jboss.weld.servlet</groupId>\n            <artifactId>weld-servlet-core</artifactId>\n            <version>${weld.version}</version>\n            <exclusions>\n                <exclusion>\n                    <groupId>org.jboss.spec.javax.annotation</groupId>\n                    <artifactId>jboss-annotations-api_1.3_spec</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>org.jboss.spec.javax.el</groupId>\n                    <artifactId>jboss-el-api_3.0_spec</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>org.jboss.spec.javax.interceptor</groupId>\n                    <artifactId>jboss-interceptors-api_1.2_spec</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>org.jboss.logging</groupId>\n                    <artifactId>jboss-logging</artifactId>\n                </exclusion>\n            </exclusions>\n        </dependency>\n        <dependency>\n            <groupId>org.jboss</groupId>\n            <artifactId>jandex</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>org.jboss.logging</groupId>\n            <artifactId>jboss-logging</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.glassfish.jersey.ext.cdi</groupId>\n            <artifactId>jersey-cdi1x-ban-custom-hk2-binding</artifactId>\n            <version>${jersey.version}</version>\n            <exclusions>\n                <exclusion>\n                    <groupId>javax.ws.rs</groupId>\n                    <artifactId>javax.ws.rs-api</artifactId>\n                </exclusion>\n            </exclusions>\n        </dependency>\n\n    </dependencies>\n\n</project>"
  },
  {
    "path": "components/cdi/weld/src/main/java/com/kumuluz/ee/cdi/CdiComponent.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.cdi;\n\nimport com.kumuluz.ee.common.Component;\nimport com.kumuluz.ee.common.config.EeConfig;\nimport com.kumuluz.ee.common.dependencies.EeComponentDef;\nimport com.kumuluz.ee.common.dependencies.EeComponentType;\nimport com.kumuluz.ee.common.wrapper.KumuluzServerWrapper;\n\nimport java.util.logging.Logger;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\n@EeComponentDef(name = \"Weld\", type = EeComponentType.CDI)\npublic class CdiComponent implements Component {\n\n    private Logger log = Logger.getLogger(CdiComponent.class.getSimpleName());\n\n    @Override\n    public void init(KumuluzServerWrapper server, EeConfig eeConfig) {\n    }\n\n    @Override\n    public void load() {\n\n        log.info(\"Initiating Weld\");\n    }\n}\n"
  },
  {
    "path": "components/cdi/weld/src/main/java/com/kumuluz/ee/configuration/cdi/ConfigBundle.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.configuration.cdi;\n\nimport javax.enterprise.util.Nonbinding;\nimport javax.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 * @author Tilen Faganel\n * @since 2.1.0\n */\n@InterceptorBinding\n@Target({ElementType.TYPE})\n@Retention(RetentionPolicy.RUNTIME)\npublic @interface ConfigBundle {\n    @Nonbinding String value() default \"\";\n\n    @Nonbinding boolean watch() default false;\n}\n"
  },
  {
    "path": "components/cdi/weld/src/main/java/com/kumuluz/ee/configuration/cdi/ConfigValue.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.configuration.cdi;\n\nimport javax.enterprise.util.Nonbinding;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Annotation specifies key name for automatic initialisation of a field from configuration. If attribute watch is\n * set to true, key is subscribed to dynamic configuration events.\n *\n * @author Tilen Faganel\n * @since 2.1.0\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.FIELD})\npublic @interface ConfigValue {\n    @Nonbinding String value() default \"\";\n\n    @Nonbinding boolean watch() default false;\n}\n"
  },
  {
    "path": "components/cdi/weld/src/main/java/com/kumuluz/ee/configuration/cdi/interceptors/ConfigBundleInterceptor.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.configuration.cdi.interceptors;\n\nimport com.kumuluz.ee.common.utils.StringUtils;\nimport com.kumuluz.ee.configuration.cdi.ConfigBundle;\nimport com.kumuluz.ee.configuration.cdi.ConfigValue;\nimport com.kumuluz.ee.configuration.utils.ConfigurationUtil;\n\nimport javax.annotation.PostConstruct;\nimport javax.annotation.Priority;\nimport javax.interceptor.Interceptor;\nimport javax.interceptor.InvocationContext;\nimport java.lang.reflect.Array;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Method;\nimport java.util.*;\nimport java.util.logging.Logger;\n\n/**\n * Interceptor class for ConfigBundle annotation.\n *\n * @author Tilen Faganel\n * @author Jan Meznaric\n * @since 2.1.0\n */\n@Interceptor\n@ConfigBundle\n@Priority(Interceptor.Priority.LIBRARY_BEFORE)\npublic class ConfigBundleInterceptor {\n\n    private static final Logger log = Logger.getLogger(ConfigBundleInterceptor.class.getName());\n    private static final ConfigurationUtil configurationUtil = ConfigurationUtil.getInstance();\n    private final Class[] primitives = {String.class, Boolean.class, Float.class, Double.class, Integer.class, Long\n            .class, boolean.class, float.class, double.class, int.class, long.class};\n\n    /**\n     * Method initialises class fields from configuration.\n     */\n    @PostConstruct\n    public Object loadConfiguration(InvocationContext ic) throws Exception {\n\n        Object target = ic.getTarget();\n        Class targetClass = target.getClass();\n\n        if (targetClassIsProxied(targetClass)) {\n            targetClass = targetClass.getSuperclass();\n        }\n\n        ConfigBundle configBundleAnnotation = (ConfigBundle) targetClass.getDeclaredAnnotation(ConfigBundle.class);\n\n        processConfigBundleBeanSetters(target, targetClass, getKeyPrefix(targetClass), new HashMap<>(),\n                configBundleAnnotation.watch());\n\n        return ic.proceed();\n    }\n\n    /**\n     * Processes and invokes all setters in Bean annotated with @ConfigBundle\n     *\n     * @param target                  target object\n     * @param targetClass             target class\n     * @param keyPrefix               a prefix for generating key names\n     * @param processedClassRelations class pairs that have already been processed (for cycle detection)\n     * @param watchAllFields          if true, enable watch on all fields\n     * @return returns true, if at least one field was successfully populated from configuration sources\n     * @throws Exception\n     */\n    private boolean processConfigBundleBeanSetters(Object target, Class targetClass, String keyPrefix, Map<Class, Class>\n            processedClassRelations, boolean watchAllFields) throws Exception {\n\n        boolean isConfigBundleEmpty = true;\n\n        // invoke setters\n        for (Method method : targetClass.getMethods()) {\n\n            if (method.getName().substring(0, 3).equals(\"set\") && method.getParameters().length == 1) {\n\n                Class parameterType = method.getParameters()[0].getType();\n\n                // get field annotation - @ConfigValue\n                Field field = targetClass.getDeclaredField(setterToField(method.getName()));\n                ConfigValue fieldAnnotation = null;\n                if (field != null) {\n                    fieldAnnotation = field.getAnnotation(ConfigValue.class);\n                }\n\n                // watch nested class or list if all fields in the bean are annotated with watch or if a field is\n                // annotated with watch\n                boolean watchNestedClass = watchAllFields;\n                if (watchNestedClass == false) {\n                    if (fieldAnnotation != null) {\n                        watchNestedClass = fieldAnnotation.watch();\n                    }\n                }\n\n                // process primitives\n                if (Arrays.asList(primitives).contains(parameterType)) {\n\n                    Optional<String> value = getValueOfPrimitive(parameterType, getKeyName(targetClass, method\n                            .getName(), keyPrefix));\n\n                    if (value.isPresent()) {\n                        isConfigBundleEmpty = false;\n                        method.invoke(target, value.get());\n                    }\n\n                    if (watchAllFields || (fieldAnnotation != null && fieldAnnotation.watch())) {\n                        deployWatcher(target, method, getKeyName(targetClass, method.getName(), keyPrefix));\n                    }\n\n                    // process nested objeccts\n                } else if (!parameterType.isArray()) {\n\n                    processedClassRelations.put(targetClass, parameterType);\n\n                    Object nestedTarget = processNestedObject(targetClass, method, parameterType, keyPrefix,\n                            processedClassRelations, -1, watchNestedClass);\n\n                    // invoke setter method with initialised instance\n                    if (nestedTarget != null) {\n                        method.invoke(target, nestedTarget);\n                    }\n\n                    // process arrays\n                } else {\n\n                    Class componentType = parameterType.getComponentType();\n\n                    Object array = Array.newInstance(componentType, configurationUtil.getListSize(getKeyName\n                            (targetClass, method.getName(), keyPrefix)).orElse(0));\n\n                    // process list of primitives\n                    if (Arrays.asList(primitives).contains(componentType)) {\n                        for (int i = 0; i < Array.getLength(array); i++) {\n                            Optional valueOfPrimitive = getValueOfPrimitive(componentType,\n                                    getKeyName(targetClass, method.getName(), keyPrefix) + \"[\" + i + \"]\");\n                            if (valueOfPrimitive.isPresent()) {\n                                Array.set(array, i, valueOfPrimitive.get());\n                            }\n                        }\n\n                        // process list of nested classes\n                    } else {\n                        for (int i = 0; i < Array.getLength(array); i++) {\n                            Object nestedTarget = processNestedObject(targetClass, method, componentType, keyPrefix,\n                                    processedClassRelations, i, watchNestedClass);\n                            if (nestedTarget != null) {\n                                Array.set(array, i, nestedTarget);\n                            }\n\n                        }\n                    }\n\n                    method.invoke(target, array);\n\n                }\n            }\n        }\n        return isConfigBundleEmpty;\n    }\n\n    /**\n     * Returns a value of a primitive configuration type\n     *\n     * @param type configuration value type\n     * @param key  configuration value key\n     * @return\n     */\n    private Optional getValueOfPrimitive(Class type, String key) {\n\n        if (type.equals(String.class)) {\n            return configurationUtil.get(key);\n        } else if (type.equals(Boolean.class) || type.equals(boolean.class)) {\n            return configurationUtil.getBoolean(key);\n        } else if (type.equals(Float.class) || type.equals(float.class)) {\n            return configurationUtil.getFloat(key);\n        } else if (type.equals(Double.class) || type.equals(double.class)) {\n            return configurationUtil.getDouble(key);\n        } else if (type.equals(Integer.class) || type.equals(int.class)) {\n            return configurationUtil.getInteger(key);\n        } else if (type.equals(Long.class) || type.equals(long.class)) {\n            return configurationUtil.getLong(key);\n        } else {\n            return Optional.empty();\n        }\n\n    }\n\n    /**\n     * Create a new instance for nested class, check for cycles and populate nested instance.\n     *\n     * @param targetClass             target class\n     * @param method                  processed method\n     * @param parameterType           parameter type\n     * @param keyPrefix               prefix used for generation of a configuration key\n     * @param processedClassRelations class pairs that have already been processed (for cycle detection)\n     * @param arrayIndex              array index for arrays of nested objects\n     * @param watchAllFields          if true, enable watch on all fields\n     * @return\n     * @throws Exception\n     */\n    private Object processNestedObject(Class targetClass, Method method, Class parameterType, String keyPrefix,\n                                       Map<Class, Class> processedClassRelations, int arrayIndex, boolean\n                                               watchAllFields) throws Exception {\n\n        Object nestedTarget = parameterType.getConstructor().newInstance();\n        Class nestedTargetClass = nestedTarget.getClass();\n\n        // check for cycles\n        if (processedClassRelations.containsKey(nestedTargetClass) && processedClassRelations.get(nestedTargetClass)\n                .equals(targetClass)) {\n            log.warning(\"There is a cycle in the configuration class tree. ConfigBundle class may not \" +\n                    \"be populated as expected.\");\n        } else {\n\n            String key = getKeyName(targetClass, method.getName(), keyPrefix);\n\n            if (arrayIndex >= 0) {\n                key += \"[\" + arrayIndex + \"]\";\n            }\n\n            boolean isEmpty = processConfigBundleBeanSetters(nestedTarget, nestedTargetClass, key,\n                    processedClassRelations, watchAllFields);\n\n            if (isEmpty) {\n                return null;\n            }\n        }\n\n        return nestedTarget;\n    }\n\n    /**\n     * Construct key name from prefix and field name or ConfigValue value (if present)\n     *\n     * @param targetClass target class\n     * @param setter      name of the setter method\n     * @param keyPrefix   prefix used for generation of a configuration key\n     * @return key in format prefix.key-name\n     */\n    private String getKeyName(Class targetClass, String setter, String keyPrefix) throws Exception {\n\n        StringBuilder key = new StringBuilder();\n        key.append(keyPrefix);\n        if (!key.toString().isEmpty()) {\n            key.append(\".\");\n        }\n\n        // get ConfigValue\n        Field field = targetClass.getDeclaredField(setterToField(setter));\n        ConfigValue fieldAnnotation = null;\n        if (field != null) {\n            fieldAnnotation = field.getAnnotation(ConfigValue.class);\n        }\n\n        if (fieldAnnotation != null && !fieldAnnotation.value().isEmpty()) {\n            key.append(StringUtils.camelCaseToHyphenCase(fieldAnnotation.value()));\n\n        } else {\n            key.append(StringUtils.camelCaseToHyphenCase(setter.substring(3)));\n        }\n\n        return key.toString();\n\n    }\n\n    /**\n     * Generate a key prefix from annotation, class name, or parent prefix in case of nested classes.\n     *\n     * @param targetClass target class\n     * @return key prefix\n     */\n    private String getKeyPrefix(Class targetClass) {\n\n        String prefix = ((ConfigBundle) targetClass.getAnnotation(ConfigBundle.class)).value();\n\n        if (prefix.isEmpty()) {\n            prefix = StringUtils.camelCaseToHyphenCase(targetClass.getSimpleName());\n        }\n\n        if (\".\".equals(prefix)) {\n            prefix = \"\";\n        }\n\n        return prefix;\n    }\n\n    /**\n     * Parse setter name to field name.\n     *\n     * @param setter name of the setter method\n     * @return field name\n     */\n    private String setterToField(String setter) {\n        return Character.toLowerCase(setter.charAt(3)) + setter.substring(4);\n    }\n\n    /**\n     * Check if target class is proxied.\n     *\n     * @param targetClass target class\n     * @return true if target class is proxied\n     */\n    private boolean targetClassIsProxied(Class targetClass) {\n        return targetClass.getCanonicalName().contains(\"$Proxy\");\n    }\n\n    /**\n     * Subscribes to an event dispatcher and starts a watch for a given key.\n     *\n     * @param target     target instance\n     * @param method     method to invoke\n     * @param watchedKey watched key\n     * @throws Exception\n     */\n    private void deployWatcher(Object target, Method method, String watchedKey) throws Exception {\n\n        configurationUtil.subscribe(watchedKey, (key, value) -> {\n\n            if (Objects.equals(watchedKey, key)) {\n\n                try {\n                    if (String.class.equals(method.getParameters()[0].getType())) {\n                        method.invoke(target, value);\n                    } else if (Boolean.class.equals(method.getParameters()[0].getType()) || boolean.class.equals(method\n                            .getParameters()[0].getType())) {\n                        method.invoke(target, Boolean.parseBoolean(value));\n                    } else if (Float.class.equals(method.getParameters()[0].getType()) || float.class.equals(method\n                            .getParameters()[0].getType())) {\n                        try {\n                            method.invoke(target, Float.parseFloat(value));\n                        } catch (NumberFormatException e) {\n                            log.severe(\"Exception while storing new value: Number format exception. \" +\n                                    \"Expected: Float. Value: \" + value);\n                        }\n                    } else if (Double.class.equals(method.getParameters()[0].getType()) || double.class.equals(method\n                            .getParameters()[0].getType())) {\n                        try {\n                            method.invoke(target, Double.parseDouble(value));\n                        } catch (NumberFormatException e) {\n                            log.severe(\"Exception while storing new value: Number format exception. Expected:\" +\n                                    \" Double. Value: \" + value);\n                        }\n                    } else if (Integer.class.equals(method.getParameters()[0].getType()) || int.class.equals(method\n                            .getParameters()[0].getType())) {\n                        try {\n                            method.invoke(target, Integer.parseInt(value));\n                        } catch (NumberFormatException e) {\n                            log.severe(\"Exception while storing new value: Number format exception. Expected:\" +\n                                    \" Integer. Value: \" + value);\n                        }\n                    } else if (Long.class.equals(method.getParameters()[0].getType()) || long.class.equals(method\n                            .getParameters()[0].getType())) {\n                        try {\n                            method.invoke(target, Long.parseLong(value));\n                        } catch (NumberFormatException e) {\n                            log.severe(\"Exception while storing new value: Number format exception. Expected:\" +\n                                    \" Long. Value: \" + value);\n                        }\n                    }\n                } catch (IllegalAccessException e) {\n                    log.severe(\"Illegal access exception: \" + e.toString());\n                } catch (InvocationTargetException e) {\n                    log.severe(\"Invocation target exception: \" + e.toString());\n                }\n\n            }\n        });\n    }\n}\n\n\n"
  },
  {
    "path": "components/cdi/weld/src/main/java/com/kumuluz/ee/configuration/cdi/producers/ConfigurationUtilProducer.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.configuration.cdi.producers;\n\nimport com.kumuluz.ee.configuration.utils.ConfigurationUtil;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Produces;\n\n/**\n * @author Tilen Faganel\n * @since 2.1.0\n */\npublic class ConfigurationUtilProducer {\n\n    @Produces\n    @ApplicationScoped\n    public ConfigurationUtil getConfigurationUtil() {\n        return ConfigurationUtil.getInstance();\n    }\n}\n"
  },
  {
    "path": "components/cdi/weld/src/main/java/com/kumuluz/ee/configuration/cdi/producers/EeConfigProducer.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.configuration.cdi.producers;\n\nimport com.kumuluz.ee.common.config.EeConfig;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Produces;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic class EeConfigProducer {\n\n    @Produces\n    @ApplicationScoped\n    public EeConfig getConfigurationUtil() {\n        return EeConfig.getInstance();\n    }\n}\n"
  },
  {
    "path": "components/cdi/weld/src/main/java/com/kumuluz/ee/runtime/cdi/producers/EeRuntimeProducer.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.runtime.cdi.producers;\n\nimport com.kumuluz.ee.common.runtime.EeRuntime;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Produces;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic class EeRuntimeProducer {\n\n    @Produces\n    @ApplicationScoped\n    public EeRuntime getConfigurationUtil() {\n        return EeRuntime.getInstance();\n    }\n}\n"
  },
  {
    "path": "components/cdi/weld/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd\"\n       bean-discovery-mode=\"annotated\">\n</beans>"
  },
  {
    "path": "components/cdi/weld/src/main/resources/META-INF/services/com.kumuluz.ee.common.Component",
    "content": "com.kumuluz.ee.cdi.CdiComponent"
  },
  {
    "path": "components/el/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-components</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n    <packaging>pom</packaging>\n\n    <name>KumuluzEE EL</name>\n    <description>KumuluzEE EL component</description>\n\n    <modules>\n        <module>uel</module>\n    </modules>\n\n    <artifactId>kumuluzee-el</artifactId>\n\n</project>"
  },
  {
    "path": "components/el/uel/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-el</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE EL UEL</name>\n    <description>KumuluzEE EL component implemented by UEL</description>\n\n    <artifactId>kumuluzee-el-uel</artifactId>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-common</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.glassfish</groupId>\n            <artifactId>jakarta.el</artifactId>\n            <version>${uel.version}</version>\n        </dependency>\n    </dependencies>\n\n</project>"
  },
  {
    "path": "components/el/uel/src/main/java/com/kumuluz/ee/el/ElComponent.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.el;\n\nimport com.kumuluz.ee.common.Component;\nimport com.kumuluz.ee.common.config.EeConfig;\nimport com.kumuluz.ee.common.dependencies.EeComponentDef;\nimport com.kumuluz.ee.common.dependencies.EeComponentType;\nimport com.kumuluz.ee.common.wrapper.KumuluzServerWrapper;\n\nimport java.util.logging.Logger;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\n@EeComponentDef(name = \"UEL\", type = EeComponentType.EL)\npublic class ElComponent implements Component {\n\n    private Logger log = Logger.getLogger(ElComponent.class.getSimpleName());\n\n    @Override\n    public void init(KumuluzServerWrapper server, EeConfig eeConfig) {\n    }\n\n    @Override\n    public void load() {\n\n        log.info(\"Initiating UEL\");\n    }\n}\n"
  },
  {
    "path": "components/el/uel/src/main/resources/META-INF/services/com.kumuluz.ee.common.Component",
    "content": "com.kumuluz.ee.el.ElComponent"
  },
  {
    "path": "components/javamail/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-components</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n    <packaging>pom</packaging>\n\n    <name>KumuluzEE JavaMail</name>\n    <description>KumuluzEE JavaMail component</description>\n\n    <modules>\n        <module>ri</module>\n    </modules>\n\n    <artifactId>kumuluzee-javamail</artifactId>\n\n</project>"
  },
  {
    "path": "components/javamail/ri/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-javamail</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE JavaMail</name>\n    <description>KumuluzEE JavaMail component implemented by JavaMail RI</description>\n\n    <artifactId>kumuluzee-javamail-ri</artifactId>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-common</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>com.sun.mail</groupId>\n            <artifactId>javax.mail</artifactId>\n            <version>${javamail-ri.version}</version>\n        </dependency>\n    </dependencies>\n\n</project>"
  },
  {
    "path": "components/javamail/ri/src/main/java/com/kumuluz/ee/javamail/ri/JavaMailComponent.java",
    "content": "package com.kumuluz.ee.javamail.ri;\n\nimport com.kumuluz.ee.common.Component;\nimport com.kumuluz.ee.common.ServletServer;\nimport com.kumuluz.ee.common.config.EeConfig;\nimport com.kumuluz.ee.common.config.MailSessionConfig;\nimport com.kumuluz.ee.common.dependencies.EeComponentDef;\nimport com.kumuluz.ee.common.dependencies.EeComponentType;\nimport com.kumuluz.ee.common.wrapper.KumuluzServerWrapper;\n\nimport javax.mail.Session;\nimport java.util.logging.Logger;\n\n/**\n * @author Tilen Faganel\n * @since 2.6.0\n */\n@EeComponentDef(name = \"JavaMailRI\", type = EeComponentType.MAIL)\npublic class JavaMailComponent implements Component {\n\n    private Logger log = Logger.getLogger(JavaMailComponent.class.getSimpleName());\n\n    @Override\n    public void init(KumuluzServerWrapper server, EeConfig eeConfig) {\n\n        if (eeConfig.getMailSessions() != null && eeConfig.getMailSessions().size() > 0\n                && server.getServer() instanceof ServletServer) {\n\n            ServletServer servletServer = (ServletServer) server.getServer();\n\n            for (MailSessionConfig cfg : eeConfig.getMailSessions()) {\n\n                Session session = MailSessionFactory.create(cfg);\n\n                servletServer.registerResource(session, cfg.getJndiName());\n            }\n        }\n    }\n\n    @Override\n    public void load() {\n\n        log.info(\"Initiating JavaMailRi\");\n    }\n}\n"
  },
  {
    "path": "components/javamail/ri/src/main/java/com/kumuluz/ee/javamail/ri/MailSessionFactory.java",
    "content": "package com.kumuluz.ee.javamail.ri;\n\nimport com.kumuluz.ee.common.config.MailServiceConfig;\nimport com.kumuluz.ee.common.config.MailSessionConfig;\n\nimport javax.mail.Session;\nimport java.util.Map;\nimport java.util.Properties;\nimport java.util.logging.Logger;\n\npublic class MailSessionFactory {\n\n    private final static Logger LOG = Logger.getLogger(MailSessionFactory.class.getSimpleName());\n\n    private final static String TRANSPORT_PROTOCOL_KEY = \"mail.transport.protocol\";\n    private final static String STORE_PROTOCOL_KEY = \"mail.store.protocol\";\n\n    static Session create(MailSessionConfig cfg) {\n\n        Properties properties = new Properties();\n\n        if (cfg.getDebug() != null) {\n            properties.setProperty(\"mail.debug\", cfg.getDebug().toString());\n        }\n\n        if (cfg.getTransport() != null) {\n\n            if (cfg.getTransport().getProtocol() != null) {\n\n                String protocol = cfg.getTransport().getProtocol();\n\n                properties.setProperty(TRANSPORT_PROTOCOL_KEY, protocol);\n\n                configureService(properties, cfg.getTransport(), protocol);\n            } else {\n\n                LOG.warning(\"The transport protocol for the Java Mail session is not defined. Please check your configuration.\");\n            }\n        }\n\n        if (cfg.getStore() != null) {\n\n            if (cfg.getStore().getProtocol() != null) {\n\n                String protocol = cfg.getStore().getProtocol();\n\n                properties.setProperty(STORE_PROTOCOL_KEY, protocol);\n\n                configureService(properties, cfg.getStore(), protocol);\n            } else {\n\n                LOG.warning(\"The store protocol for the Java Mail session is not defined. Please check your configuration.\");\n            }\n        }\n\n        if (cfg.getProps() != null && cfg.getProps().size() > 0) {\n\n            for (Map.Entry<String, String> prop : cfg.getProps().entrySet()) {\n\n                properties.setProperty(prop.getKey(), prop.getValue());\n            }\n        }\n\n        return Session.getInstance(properties, new ManagedPasswordAuthenticator(cfg));\n    }\n\n    private static void configureService(Properties properties, MailServiceConfig serviceConfig, String protocol) {\n\n        String prefix = \"mail.\" + protocol;\n\n        if (serviceConfig.getHost() != null) {\n            properties.setProperty(prefix + \".host\", serviceConfig.getHost());\n        }\n\n        if (serviceConfig.getPort() != null) {\n            properties.setProperty(prefix + \".port\", serviceConfig.getPort().toString());\n        }\n\n        if (serviceConfig.getStarttls() != null) {\n            properties.setProperty(prefix + \".starttls.enable\", serviceConfig.getStarttls().toString());\n        }\n\n        if (serviceConfig.getConnectionTimeout() != null) {\n            properties.setProperty(prefix + \".connectiontimeout\", serviceConfig.getConnectionTimeout().toString());\n        }\n\n        if (serviceConfig.getTimeout() != null) {\n            properties.setProperty(prefix + \".timeout\", serviceConfig.getTimeout().toString());\n        }\n\n        if (serviceConfig.getPassword() != null) {\n\n            properties.setProperty(prefix + \".auth\", Boolean.TRUE.toString());\n        }\n    }\n}\n"
  },
  {
    "path": "components/javamail/ri/src/main/java/com/kumuluz/ee/javamail/ri/ManagedPasswordAuthenticator.java",
    "content": "package com.kumuluz.ee.javamail.ri;\n\nimport com.kumuluz.ee.common.config.MailServiceConfig;\nimport com.kumuluz.ee.common.config.MailSessionConfig;\n\nimport javax.mail.Authenticator;\nimport javax.mail.PasswordAuthentication;\n\npublic class ManagedPasswordAuthenticator extends Authenticator {\n\n    private MailSessionConfig mailSessionConfig;\n\n    ManagedPasswordAuthenticator(MailSessionConfig mailSessionConfig) {\n        this.mailSessionConfig = mailSessionConfig;\n    }\n\n    @Override\n    protected PasswordAuthentication getPasswordAuthentication() {\n\n        String protocol = getRequestingProtocol();\n\n        MailServiceConfig requestingConfig = null;\n\n        if (mailSessionConfig.getTransport() != null && protocol.equals(mailSessionConfig.getTransport().getProtocol())) {\n            requestingConfig = mailSessionConfig.getTransport();\n        } else if (mailSessionConfig.getStore() != null && protocol.equals(mailSessionConfig.getStore().getProtocol())) {\n            requestingConfig = mailSessionConfig.getStore();\n        }\n\n        if (requestingConfig != null && requestingConfig.getPassword() != null) {\n\n            return new PasswordAuthentication(requestingConfig.getUsername(), requestingConfig.getPassword());\n        }\n\n        return null;\n    }\n}\n"
  },
  {
    "path": "components/javamail/ri/src/main/resources/META-INF/services/com.kumuluz.ee.common.Component",
    "content": "com.kumuluz.ee.javamail.ri.JavaMailComponent"
  },
  {
    "path": "components/jax-rs/jersey/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-jax-rs</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE JAX-RS Jersey</name>\n    <description>KumuluzEE JAX-RS component implemented by Jersey</description>\n\n    <artifactId>kumuluzee-jax-rs-jersey</artifactId>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-common</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.glassfish.jersey.containers</groupId>\n            <artifactId>jersey-container-servlet</artifactId>\n            <version>${jersey.version}</version>\n            <exclusions>\n                <exclusion>\n                    <groupId>org.glassfish.hk2.external</groupId>\n                    <artifactId>javax.inject</artifactId>\n                </exclusion>\n            </exclusions>\n        </dependency>\n        <dependency>\n            <groupId>org.glassfish.jersey.media</groupId>\n            <artifactId>jersey-media-sse</artifactId>\n            <version>${jersey.version}</version>\n            <exclusions>\n                <exclusion>\n                    <groupId>org.glassfish.hk2.external</groupId>\n                    <artifactId>javax.inject</artifactId>\n                </exclusion>\n            </exclusions>\n        </dependency>\n        <dependency>\n            <groupId>org.glassfish.jersey.media</groupId>\n            <artifactId>jersey-media-json-jackson</artifactId>\n            <version>${jersey.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.glassfish.jersey.inject</groupId>\n            <artifactId>jersey-hk2</artifactId>\n            <version>${jersey.version}</version>\n            <exclusions>\n                <exclusion>\n                    <groupId>org.glassfish.hk2.external</groupId>\n                    <artifactId>javax.inject</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>org.javassist</groupId>\n                    <artifactId>javassist</artifactId>\n                </exclusion>\n            </exclusions>\n        </dependency>\n        <dependency>\n            <groupId>org.glassfish.jersey.ext.cdi</groupId>\n            <artifactId>jersey-cdi1x-servlet</artifactId>\n            <version>${jersey.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>jakarta.enterprise</groupId>\n            <artifactId>jakarta.enterprise.cdi-api</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>org.javassist</groupId>\n            <artifactId>javassist</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>com.fasterxml.jackson.jaxrs</groupId>\n            <artifactId>jackson-jaxrs-json-provider</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.glassfish.jersey.connectors</groupId>\n            <artifactId>jersey-jetty-connector</artifactId>\n            <version>${jersey.version}</version>\n            <exclusions>\n                <exclusion>\n                    <groupId>org.eclipse.jetty</groupId>\n                    <artifactId>jetty-client</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>org.glassfish.jersey.core</groupId>\n                    <artifactId>jersey-common</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>org.glassfish.jersey.core</groupId>\n                    <artifactId>jersey-client</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>javax.ws.rs</groupId>\n                    <artifactId>javax.ws.rs-api</artifactId>\n                </exclusion>\n            </exclusions>\n        </dependency>\n        <dependency>\n            <groupId>org.eclipse.jetty</groupId>\n            <artifactId>jetty-client</artifactId>\n            <version>${jetty.version}</version>\n            <scope>provided</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>javax.activation</groupId>\n            <artifactId>activation</artifactId>\n            <version>${activation.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>javax.xml.bind</groupId>\n            <artifactId>jaxb-api</artifactId>\n            <version>${jaxb-api.version}</version>\n        </dependency>\n    </dependencies>\n\n</project>"
  },
  {
    "path": "components/jax-rs/jersey/src/main/java/com/kumuluz/ee/jaxrs/JaxRsComponent.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jaxrs;\n\nimport com.kumuluz.ee.common.Component;\nimport com.kumuluz.ee.common.config.EeConfig;\nimport com.kumuluz.ee.common.dependencies.EeComponentDef;\nimport com.kumuluz.ee.common.dependencies.EeComponentDependency;\nimport com.kumuluz.ee.common.dependencies.EeComponentType;\nimport com.kumuluz.ee.common.wrapper.KumuluzServerWrapper;\n\nimport java.util.logging.Logger;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\n@EeComponentDef(name = \"Jersey\", type = EeComponentType.JAX_RS)\n@EeComponentDependency(value = EeComponentType.SERVLET)\npublic class JaxRsComponent implements Component {\n\n    private Logger log = Logger.getLogger(JaxRsComponent.class.getSimpleName());\n\n    @Override\n    public void init(KumuluzServerWrapper server, EeConfig eeConfig) {\n    }\n\n    @Override\n    public void load() {\n\n        log.info(\"Initiating Jersey\");\n    }\n}\n"
  },
  {
    "path": "components/jax-rs/jersey/src/main/java/com/kumuluz/ee/jaxrs/Jetty10ConnectorProvider.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.jaxrs;\n\nimport org.glassfish.jersey.client.spi.Connector;\nimport org.glassfish.jersey.client.spi.ConnectorProvider;\nimport org.glassfish.jersey.jetty.connector.Jetty10Connector;\n\nimport javax.ws.rs.client.Client;\nimport javax.ws.rs.core.Configuration;\n\n/**\n * Jersey connection provider for Jetty 10.\n *\n * @author Urban Malc\n * @since 4.0.0\n */\npublic class Jetty10ConnectorProvider implements ConnectorProvider {\n\n    @Override\n    public Connector getConnector(Client client, Configuration runtimeConfig) {\n        return new Jetty10Connector(client, runtimeConfig);\n    }\n}\n"
  },
  {
    "path": "components/jax-rs/jersey/src/main/java/org/glassfish/jersey/jetty/connector/Jetty10Connector.java",
    "content": "/*\n * Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved.\n *\n * This program and the accompanying materials are made available under the\n * terms of the Eclipse Public License v. 2.0, which is available at\n * http://www.eclipse.org/legal/epl-2.0.\n *\n * This Source Code may also be made available under the following Secondary\n * Licenses when the conditions for such availability set forth in the\n * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,\n * version 2 with the GNU Classpath Exception, which is available at\n * https://www.gnu.org/software/classpath/license.html.\n *\n * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0\n */\n\npackage org.glassfish.jersey.jetty.connector;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.ByteArrayOutputStream;\nimport java.io.FilterInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.net.CookieStore;\nimport java.net.URI;\nimport java.nio.ByteBuffer;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.concurrent.CancellationException;\nimport java.util.concurrent.CompletableFuture;\nimport java.util.concurrent.Future;\nimport java.util.concurrent.TimeUnit;\nimport java.util.concurrent.atomic.AtomicBoolean;\nimport java.util.concurrent.atomic.AtomicReference;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\nimport javax.ws.rs.ProcessingException;\nimport javax.ws.rs.client.Client;\nimport javax.ws.rs.core.Configuration;\nimport javax.ws.rs.core.MultivaluedMap;\n\nimport javax.net.ssl.SSLContext;\n\nimport org.eclipse.jetty.client.dynamic.HttpClientTransportDynamic;\nimport org.eclipse.jetty.client.util.BasicAuthentication;\nimport org.eclipse.jetty.client.util.BytesContentProvider;\nimport org.eclipse.jetty.client.util.FutureResponseListener;\nimport org.eclipse.jetty.client.util.OutputStreamContentProvider;\nimport org.eclipse.jetty.io.ClientConnector;\nimport org.glassfish.jersey.client.ClientProperties;\nimport org.glassfish.jersey.client.ClientRequest;\nimport org.glassfish.jersey.client.ClientResponse;\nimport org.glassfish.jersey.client.spi.AsyncConnectorCallback;\nimport org.glassfish.jersey.client.spi.Connector;\nimport org.glassfish.jersey.internal.util.collection.ByteBufferInputStream;\nimport org.glassfish.jersey.internal.util.collection.NonBlockingInputStream;\nimport org.glassfish.jersey.message.internal.HeaderUtils;\nimport org.glassfish.jersey.message.internal.OutboundMessageContext;\nimport org.glassfish.jersey.message.internal.Statuses;\n\nimport org.eclipse.jetty.client.HttpClient;\nimport org.eclipse.jetty.client.HttpProxy;\nimport org.eclipse.jetty.client.ProxyConfiguration;\nimport org.eclipse.jetty.client.api.AuthenticationStore;\nimport org.eclipse.jetty.client.api.ContentProvider;\nimport org.eclipse.jetty.client.api.ContentResponse;\nimport org.eclipse.jetty.client.api.Request;\nimport org.eclipse.jetty.client.api.Response;\nimport org.eclipse.jetty.client.api.Result;\nimport org.eclipse.jetty.http.HttpField;\nimport org.eclipse.jetty.http.HttpFields;\nimport org.eclipse.jetty.http.HttpHeader;\nimport org.eclipse.jetty.util.HttpCookieStore;\nimport org.eclipse.jetty.util.Jetty;\nimport org.eclipse.jetty.util.ssl.SslContextFactory;\nimport org.eclipse.jetty.util.thread.QueuedThreadPool;\n\n/**\n * A {@link Connector} that utilizes the Jetty HTTP Client to send and receive\n * HTTP request and responses.\n * <p/>\n * The following properties are only supported at construction of this class:\n * <ul>\n * <li>{@link ClientProperties#ASYNC_THREADPOOL_SIZE}</li>\n * <li>{@link ClientProperties#CONNECT_TIMEOUT}</li>\n * <li>{@link ClientProperties#FOLLOW_REDIRECTS}</li>\n * <li>{@link ClientProperties#PROXY_URI}</li>\n * <li>{@link ClientProperties#PROXY_USERNAME}</li>\n * <li>{@link ClientProperties#PROXY_PASSWORD}</li>\n * <li>{@link ClientProperties#PROXY_PASSWORD}</li>\n * <li>{@link JettyClientProperties#PREEMPTIVE_BASIC_AUTHENTICATION}</li>\n * <li>{@link JettyClientProperties#DISABLE_COOKIES}</li>\n * </ul>\n * <p/>\n * This transport supports both synchronous and asynchronous processing of client requests.\n * The following methods are supported: GET, POST, PUT, DELETE, HEAD, OPTIONS, TRACE, CONNECT and MOVE.\n * <p/>\n * Typical usage:\n * <p/>\n * <pre>\n * {@code\n * ClientConfig config = new ClientConfig();\n * Connector connector = new JettyConnector(config);\n * config.connector(connector);\n * Client client = ClientBuilder.newClient(config);\n *\n * // async request\n * WebTarget target = client.target(\"http://localhost:8080\");\n * Future<Response> future = target.path(\"resource\").request().async().get();\n *\n * // wait for 3 seconds\n * Response response = future.get(3, TimeUnit.SECONDS);\n * String entity = response.readEntity(String.class);\n * client.close();\n * }\n * </pre>\n * <p>\n * This connector supports only {@link org.glassfish.jersey.client.RequestEntityProcessing#BUFFERED entity buffering}.\n * Defining the property {@link ClientProperties#REQUEST_ENTITY_PROCESSING} has no effect on this connector.\n * </p>\n *\n * Adapted from org.glassfish.jersey.jetty.connector.JettyConnector for Jetty 10:\n *  - updated SSL context initialization\n *  - updated header handling\n *\n * @author Arul Dhesiaseelan (aruld at acm.org)\n * @author Marek Potociar\n */\npublic class Jetty10Connector implements Connector {\n\n    private static final Logger LOGGER = Logger.getLogger(Jetty10Connector.class.getName());\n\n    private final HttpClient client;\n    private final CookieStore cookieStore;\n    private final Configuration configuration;\n    private final Optional<Integer> syncListenerResponseMaxSize;\n\n    /**\n     * Create the new Jetty client connector.\n     *\n     * @param jaxrsClient JAX-RS client instance, for which the connector is created.\n     * @param config client configuration.\n     */\n    public Jetty10Connector(final Client jaxrsClient, final Configuration config) {\n        this.configuration = config;\n        HttpClient httpClient = null;\n        if (config.isRegistered(JettyHttpClientSupplier.class)) {\n            Optional<Object> contract = config.getInstances().stream()\n                    .filter(a-> JettyHttpClientSupplier.class.isInstance(a)).findFirst();\n            if (contract.isPresent()) {\n                httpClient = ((JettyHttpClientSupplier) contract.get()).getHttpClient();\n            }\n        }\n        if (httpClient == null) {\n            final SSLContext sslContext = jaxrsClient.getSslContext();\n            final SslContextFactory.Client sslContextFactory = new SslContextFactory.Client();\n            sslContextFactory.setSslContext(sslContext);\n\n            ClientConnector clientConnector = new ClientConnector();\n            clientConnector.setSslContextFactory(sslContextFactory);\n\n            httpClient = new HttpClient(new HttpClientTransportDynamic(clientConnector));\n        }\n        this.client = httpClient;\n\n        Boolean enableHostnameVerification = (Boolean) config.getProperties()\n                .get(JettyClientProperties.ENABLE_SSL_HOSTNAME_VERIFICATION);\n        if (enableHostnameVerification != null && enableHostnameVerification) {\n            client.getSslContextFactory().setEndpointIdentificationAlgorithm(\"https\");\n        }\n\n        final Object connectTimeout = config.getProperties().get(ClientProperties.CONNECT_TIMEOUT);\n        if (connectTimeout != null && connectTimeout instanceof Integer && (Integer) connectTimeout > 0) {\n            client.setConnectTimeout((Integer) connectTimeout);\n        }\n        final Object threadPoolSize = config.getProperties().get(ClientProperties.ASYNC_THREADPOOL_SIZE);\n        if (threadPoolSize != null && threadPoolSize instanceof Integer && (Integer) threadPoolSize > 0) {\n            final String name = HttpClient.class.getSimpleName() + \"@\" + hashCode();\n            final QueuedThreadPool threadPool = new QueuedThreadPool((Integer) threadPoolSize);\n            threadPool.setName(name);\n            client.setExecutor(threadPool);\n        }\n        Boolean disableCookies = (Boolean) config.getProperties().get(JettyClientProperties.DISABLE_COOKIES);\n        disableCookies = (disableCookies != null) ? disableCookies : false;\n\n        final AuthenticationStore auth = client.getAuthenticationStore();\n        final Object basicAuthProvider = config.getProperty(JettyClientProperties.PREEMPTIVE_BASIC_AUTHENTICATION);\n        if (basicAuthProvider != null && (basicAuthProvider instanceof BasicAuthentication)) {\n            auth.addAuthentication((BasicAuthentication) basicAuthProvider);\n        }\n\n        final Object proxyUri = config.getProperties().get(ClientProperties.PROXY_URI);\n        if (proxyUri != null) {\n            final URI u = getProxyUri(proxyUri);\n            final ProxyConfiguration proxyConfig = client.getProxyConfiguration();\n            proxyConfig.getProxies().add(new HttpProxy(u.getHost(), u.getPort()));\n\n            final Object proxyUsername = config.getProperties().get(ClientProperties.PROXY_USERNAME);\n            if (proxyUsername != null) {\n                final Object proxyPassword = config.getProperties().get(ClientProperties.PROXY_PASSWORD);\n                auth.addAuthentication(new BasicAuthentication(u, \"<<ANY_REALM>>\",\n                        String.valueOf(proxyUsername), String.valueOf(proxyPassword)));\n            }\n        }\n\n        if (disableCookies) {\n            client.setCookieStore(new HttpCookieStore.Empty());\n        }\n\n        final Object slResponseMaxSize = configuration.getProperties()\n                .get(JettyClientProperties.SYNC_LISTENER_RESPONSE_MAX_SIZE);\n        if (slResponseMaxSize != null && slResponseMaxSize instanceof Integer\n                && (Integer) slResponseMaxSize > 0) {\n            this.syncListenerResponseMaxSize = Optional.of((Integer) slResponseMaxSize);\n        }\n        else {\n            this.syncListenerResponseMaxSize = Optional.empty();\n        }\n\n        try {\n            client.start();\n        } catch (final Exception e) {\n            throw new ProcessingException(\"Failed to start the client.\", e);\n        }\n        this.cookieStore = client.getCookieStore();\n    }\n\n    @SuppressWarnings(\"ChainOfInstanceofChecks\")\n    private static URI getProxyUri(final Object proxy) {\n        if (proxy instanceof URI) {\n            return (URI) proxy;\n        } else if (proxy instanceof String) {\n            return URI.create((String) proxy);\n        } else {\n            throw new ProcessingException(LocalizationMessages.WRONG_PROXY_URI_TYPE(ClientProperties.PROXY_URI));\n        }\n    }\n\n    /**\n     * Get the {@link HttpClient}.\n     *\n     * @return the {@link HttpClient}.\n     */\n    @SuppressWarnings(\"UnusedDeclaration\")\n    public HttpClient getHttpClient() {\n        return client;\n    }\n\n    /**\n     * Get the {@link CookieStore}.\n     *\n     * @return the {@link CookieStore} instance or null when\n     * JettyClientProperties.DISABLE_COOKIES set to true.\n     */\n    public CookieStore getCookieStore() {\n        return cookieStore;\n    }\n\n    @Override\n    public ClientResponse apply(final ClientRequest jerseyRequest) throws ProcessingException {\n        final Request jettyRequest = translateRequest(jerseyRequest);\n        final Map<String, String> clientHeadersSnapshot = writeOutBoundHeaders(jerseyRequest.getHeaders(), jettyRequest);\n        final ContentProvider entity = getBytesProvider(jerseyRequest);\n        if (entity != null) {\n            jettyRequest.content(entity);\n        }\n\n        try {\n            final ContentResponse jettyResponse;\n            if (!syncListenerResponseMaxSize.isPresent()) {\n                jettyResponse = jettyRequest.send();\n            }\n            else {\n                final FutureResponseListener listener\n                        = new FutureResponseListener(jettyRequest, syncListenerResponseMaxSize.get());\n                jettyRequest.send(listener);\n                jettyResponse = listener.get();\n            }\n            HeaderUtils.checkHeaderChanges(clientHeadersSnapshot, jerseyRequest.getHeaders(),\n                    Jetty10Connector.this.getClass().getName(), jerseyRequest.getConfiguration());\n\n            final javax.ws.rs.core.Response.StatusType status = jettyResponse.getReason() == null\n                    ? Statuses.from(jettyResponse.getStatus())\n                    : Statuses.from(jettyResponse.getStatus(), jettyResponse.getReason());\n\n            final ClientResponse jerseyResponse = new ClientResponse(status, jerseyRequest);\n            processResponseHeaders(jettyResponse.getHeaders(), jerseyResponse);\n            try {\n                jerseyResponse.setEntityStream(new Jetty10Connector.HttpClientResponseInputStream(jettyResponse));\n            } catch (final IOException e) {\n                LOGGER.log(Level.SEVERE, null, e);\n            }\n\n            return jerseyResponse;\n        } catch (final Exception e) {\n            throw new ProcessingException(e);\n        }\n    }\n\n    private static void processResponseHeaders(final HttpFields respHeaders, final ClientResponse jerseyResponse) {\n        for (final HttpField header : respHeaders) {\n            final String headerName = header.getName();\n            final MultivaluedMap<String, String> headers = jerseyResponse.getHeaders();\n            List<String> list = headers.get(headerName);\n            if (list == null) {\n                list = new ArrayList<>();\n            }\n            list.add(header.getValue());\n            headers.put(headerName, list);\n        }\n    }\n\n    private static final class HttpClientResponseInputStream extends FilterInputStream {\n\n        HttpClientResponseInputStream(final ContentResponse jettyResponse) throws IOException {\n            super(getInputStream(jettyResponse));\n        }\n\n        private static InputStream getInputStream(final ContentResponse response) {\n            return new ByteArrayInputStream(response.getContent());\n        }\n    }\n\n    private Request translateRequest(final ClientRequest clientRequest) {\n\n        final URI uri = clientRequest.getUri();\n        final Request request = client.newRequest(uri);\n        request.method(clientRequest.getMethod());\n\n        request.followRedirects(clientRequest.resolveProperty(ClientProperties.FOLLOW_REDIRECTS, true));\n        final Object readTimeout = clientRequest.resolveProperty(ClientProperties.READ_TIMEOUT, -1);\n        if (readTimeout != null && readTimeout instanceof Integer && (Integer) readTimeout > 0) {\n            request.timeout((Integer) readTimeout, TimeUnit.MILLISECONDS);\n        }\n        return request;\n    }\n\n    private Map<String, String> writeOutBoundHeaders(final MultivaluedMap<String, Object> headers, final Request request) {\n        final Map<String, String> stringHeaders = HeaderUtils.asStringHeadersSingleValue(headers, configuration);\n\n        // remove User-agent header set by Jetty; Jersey already sets this in its request (incl. Jetty version)\n\n        request.headers(httpFields -> {\n            httpFields.remove(HttpHeader.USER_AGENT);\n            for (final Map.Entry<String, String> e : stringHeaders.entrySet()) {\n                httpFields.add(e.getKey(), e.getValue());\n            }\n        });\n\n        return stringHeaders;\n    }\n\n    private ContentProvider getBytesProvider(final ClientRequest clientRequest) {\n        final Object entity = clientRequest.getEntity();\n\n        if (entity == null) {\n            return null;\n        }\n\n        final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();\n        clientRequest.setStreamProvider(new OutboundMessageContext.StreamProvider() {\n            @Override\n            public OutputStream getOutputStream(final int contentLength) throws IOException {\n                return outputStream;\n            }\n        });\n\n        try {\n            clientRequest.writeEntity();\n        } catch (final IOException e) {\n            throw new ProcessingException(\"Failed to write request entity.\", e);\n        }\n        return new BytesContentProvider(outputStream.toByteArray());\n    }\n\n    private ContentProvider getStreamProvider(final ClientRequest clientRequest) {\n        final Object entity = clientRequest.getEntity();\n\n        if (entity == null) {\n            return null;\n        }\n\n        final OutputStreamContentProvider streamContentProvider = new OutputStreamContentProvider();\n        clientRequest.setStreamProvider(new OutboundMessageContext.StreamProvider() {\n            @Override\n            public OutputStream getOutputStream(final int contentLength) throws IOException {\n                return streamContentProvider.getOutputStream();\n            }\n        });\n        return streamContentProvider;\n    }\n\n    private void processContent(final ClientRequest clientRequest, final ContentProvider entity) throws IOException {\n        if (entity == null) {\n            return;\n        }\n\n        final OutputStreamContentProvider streamContentProvider = (OutputStreamContentProvider) entity;\n        try (final OutputStream output = streamContentProvider.getOutputStream()) {\n            clientRequest.writeEntity();\n        }\n    }\n\n    @Override\n    public Future<?> apply(final ClientRequest jerseyRequest, final AsyncConnectorCallback callback) {\n        final Request jettyRequest = translateRequest(jerseyRequest);\n        final Map<String, String> clientHeadersSnapshot = writeOutBoundHeaders(jerseyRequest.getHeaders(), jettyRequest);\n        final ContentProvider entity = getStreamProvider(jerseyRequest);\n        if (entity != null) {\n            jettyRequest.content(entity);\n        }\n        final AtomicBoolean callbackInvoked = new AtomicBoolean(false);\n        final Throwable failure;\n        try {\n            final CompletableFuture<ClientResponse> responseFuture =\n                    new CompletableFuture<ClientResponse>().whenComplete(\n                            (clientResponse, throwable) -> {\n                                if (throwable != null && throwable instanceof CancellationException) {\n                                    // take care of future cancellation\n                                    jettyRequest.abort(throwable);\n\n                                }\n                            });\n\n            final AtomicReference<ClientResponse> jerseyResponse = new AtomicReference<>();\n            final ByteBufferInputStream entityStream = new ByteBufferInputStream();\n            jettyRequest.send(new Response.Listener.Adapter() {\n\n                @Override\n                public void onHeaders(final Response jettyResponse) {\n                    HeaderUtils.checkHeaderChanges(clientHeadersSnapshot, jerseyRequest.getHeaders(),\n                            Jetty10Connector.this.getClass().getName(), jerseyRequest.getConfiguration());\n\n                    if (responseFuture.isDone()) {\n                        if (!callbackInvoked.compareAndSet(false, true)) {\n                            return;\n                        }\n                    }\n                    final ClientResponse response = translateResponse(jerseyRequest, jettyResponse, entityStream);\n                    jerseyResponse.set(response);\n                }\n\n                @Override\n                public void onContent(final Response jettyResponse, final ByteBuffer content) {\n                    try {\n                        // content must be consumed before returning from this method.\n\n                        if (content.hasArray()) {\n                            byte[] array = content.array();\n                            byte[] buff = new byte[content.remaining()];\n                            System.arraycopy(array, content.arrayOffset(), buff, 0, content.remaining());\n                            entityStream.put(ByteBuffer.wrap(buff));\n                        } else {\n                            byte[] buff = new byte[content.remaining()];\n                            content.get(buff);\n                            entityStream.put(ByteBuffer.wrap(buff));\n                        }\n                    } catch (final InterruptedException ex) {\n                        final ProcessingException pe = new ProcessingException(ex);\n                        entityStream.closeQueue(pe);\n                        // try to complete the future with an exception\n                        responseFuture.completeExceptionally(pe);\n                        Thread.currentThread().interrupt();\n                    }\n                }\n\n                @Override\n                public void onComplete(final Result result) {\n                    entityStream.closeQueue();\n                    if (!callbackInvoked.get()) {\n                        callback.response(jerseyResponse.get());\n                    }\n                    responseFuture.complete(jerseyResponse.get());\n                }\n\n                @Override\n                public void onFailure(final Response response, final Throwable t) {\n                    entityStream.closeQueue(t);\n                    // try to complete the future with an exception\n                    responseFuture.completeExceptionally(t);\n                    if (callbackInvoked.compareAndSet(false, true)) {\n                        callback.failure(t);\n                    }\n                }\n            });\n            processContent(jerseyRequest, entity);\n            return responseFuture;\n        } catch (final Throwable t) {\n            failure = t;\n        }\n\n        if (callbackInvoked.compareAndSet(false, true)) {\n            callback.failure(failure);\n        }\n        CompletableFuture<Object> future = new CompletableFuture<>();\n        future.completeExceptionally(failure);\n        return future;\n    }\n\n    private static ClientResponse translateResponse(final ClientRequest jerseyRequest,\n                                                    final org.eclipse.jetty.client.api.Response jettyResponse,\n                                                    final NonBlockingInputStream entityStream) {\n        final ClientResponse jerseyResponse = new ClientResponse(Statuses.from(jettyResponse.getStatus()), jerseyRequest);\n        processResponseHeaders(jettyResponse.getHeaders(), jerseyResponse);\n        jerseyResponse.setEntityStream(entityStream);\n        return jerseyResponse;\n    }\n\n    @Override\n    public String getName() {\n        return \"Jetty HttpClient \" + Jetty.VERSION;\n    }\n\n    @Override\n    public void close() {\n        try {\n            client.stop();\n        } catch (final Exception e) {\n            throw new ProcessingException(\"Failed to stop the client.\", e);\n        }\n    }\n}\n\n"
  },
  {
    "path": "components/jax-rs/jersey/src/main/resources/META-INF/services/com.kumuluz.ee.common.Component",
    "content": "com.kumuluz.ee.jaxrs.JaxRsComponent"
  },
  {
    "path": "components/jax-rs/jersey/src/main/resources/META-INF/services/org.glassfish.jersey.client.spi.ConnectorProvider",
    "content": "com.kumuluz.ee.jaxrs.Jetty10ConnectorProvider\n"
  },
  {
    "path": "components/jax-rs/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-components</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n    <packaging>pom</packaging>\n\n    <name>KumuluzEE JAX-RS</name>\n    <description>KumuluzEE JAX-RS component</description>\n\n    <modules>\n        <module>jersey</module>\n    </modules>\n\n    <artifactId>kumuluzee-jax-rs</artifactId>\n\n</project>"
  },
  {
    "path": "components/jax-ws/cxf/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-jax-ws</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE JAX-WS CXF</name>\n    <description>KumuluzEE JAX-WS component implemented by CXF</description>\n\n    <artifactId>kumuluzee-jax-ws-cxf</artifactId>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-common</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-cdi-weld</artifactId>\n            <scope>provided</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.apache.cxf</groupId>\n            <artifactId>cxf</artifactId>\n            <version>${cxf.version}</version>\n            <type>pom</type>\n        </dependency>\n        <dependency>\n            <groupId>org.apache.cxf</groupId>\n            <artifactId>cxf-rt-frontend-jaxws</artifactId>\n            <version>${cxf.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.apache.cxf</groupId>\n            <artifactId>cxf-rt-transports-http</artifactId>\n            <version>${cxf.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.sun.xml.ws</groupId>\n            <artifactId>jaxws-tools</artifactId>\n            <version>${jaxws-tools.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>javax.activation</groupId>\n            <artifactId>activation</artifactId>\n            <version>${activation.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>junit</groupId>\n            <artifactId>junit</artifactId>\n            <scope>test</scope>\n        </dependency>\n    </dependencies>\n\n    <build>\n        <plugins>\n            <plugin>\n                <artifactId>maven-compiler-plugin</artifactId>\n                <version>${maven-compiler-plugin.version}</version>\n                <executions>\n                    <execution>\n                        <id>default-compile</id>\n                        <goals>\n                            <goal>compile</goal>\n                        </goals>\n                        <configuration>\n                            <proc>none</proc>\n                        </configuration>\n                    </execution>\n                    <execution>\n                        <id>compile-important-processor</id>\n                        <phase>process-test-sources</phase>\n                        <goals>\n                            <goal>testCompile</goal>\n                        </goals>\n                        <configuration>\n                            <proc>none</proc>\n                            <testIncludes>\n                                <include>com/kumuluz/ee/jaxws/cxf/processor/*</include>\n                            </testIncludes>\n                        </configuration>\n                    </execution>\n                </executions>\n            </plugin>\n        </plugins>\n    </build>\n\n</project>"
  },
  {
    "path": "components/jax-ws/cxf/src/main/java/com/kumuluz/ee/jaxws/cxf/JaxWsComponent.java",
    "content": "/*\n *  Copyright (c) 2014-2018 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.jaxws.cxf;\n\nimport com.kumuluz.ee.common.Component;\nimport com.kumuluz.ee.common.ServletServer;\nimport com.kumuluz.ee.common.config.EeConfig;\nimport com.kumuluz.ee.common.dependencies.EeComponentDef;\nimport com.kumuluz.ee.common.dependencies.EeComponentDependency;\nimport com.kumuluz.ee.common.dependencies.EeComponentType;\nimport com.kumuluz.ee.common.runtime.EeRuntime;\nimport com.kumuluz.ee.common.wrapper.KumuluzServerWrapper;\nimport com.kumuluz.ee.jaxws.cxf.processor.JaxWsAnnotationProcessorUtil;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.logging.Logger;\n\n\n/**\n * @author gpor89\n * @since 3.0.0\n */\n@EeComponentDef(name = \"CXF\", type = EeComponentType.JAX_WS)\n@EeComponentDependency(value = EeComponentType.SERVLET)\npublic class JaxWsComponent implements Component {\n\n    private static final Logger LOG = Logger.getLogger(JaxWsComponent.class.getSimpleName());\n\n    @Override\n    public void init(KumuluzServerWrapper server, EeConfig eeConfig) {\n\n        LOG.info(\"Initiating CXF\");\n\n        // Check if CDI is present in the runtime\n        Boolean cdiPresent = EeRuntime.getInstance().getEeComponents().stream().anyMatch(c -> c.getType().equals(EeComponentType.CDI));\n        LOG.fine(\"CXF component will run with\" + (cdiPresent ? \"\" : \"out\") + \" CDI\");\n\n        final ServletServer kumuluzServer = (ServletServer) server.getServer();\n\n        final String baseUrl = server.getServer().getServerConfig().getBaseUrl();\n\n        final JaxWsAnnotationProcessorUtil wsInstance = JaxWsAnnotationProcessorUtil.getInstance();\n        wsInstance.setContextRoot(baseUrl);\n\n        final Map<String, String> servletParams = new HashMap<>();\n        servletParams.put(KumuluzCXFServlet.CDI_INIT_PARAM, cdiPresent.toString());\n\n        String contextRoot = wsInstance.getContextRoot();\n        LOG.fine(KumuluzCXFServlet.class.getName() + \" mapping set to \" + contextRoot);\n\n        kumuluzServer.registerServlet(KumuluzCXFServlet.class, contextRoot, servletParams);\n    }\n\n    @Override\n    public void load() {\n\n        LOG.info(\"CXF component initialized\");\n    }\n}\n"
  },
  {
    "path": "components/jax-ws/cxf/src/main/java/com/kumuluz/ee/jaxws/cxf/KumuluzCXFServlet.java",
    "content": "/*\n *  Copyright (c) 2014-2018 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.jaxws.cxf;\n\nimport com.kumuluz.ee.jaxws.cxf.processor.JaxWsAnnotationProcessorUtil;\nimport com.kumuluz.ee.jaxws.cxf.ws.CXFWebservicePublisher;\nimport com.kumuluz.ee.jaxws.cxf.ws.Endpoint;\nimport org.apache.cxf.transport.servlet.CXFNonSpringServlet;\n\nimport javax.servlet.ServletConfig;\nimport javax.servlet.ServletException;\nimport java.util.List;\n\n/**\n * @author gpor89\n * @since 3.0.0\n */\npublic class KumuluzCXFServlet extends CXFNonSpringServlet {\n\n    protected static final String CDI_INIT_PARAM = \"useCdi\";\n\n    private List<Endpoint> endpoints;\n\n    public void init() throws ServletException {\n        super.init();\n\n        final JaxWsAnnotationProcessorUtil wsInstance = JaxWsAnnotationProcessorUtil.getInstance();\n\n        this.endpoints = wsInstance.getEndpointList();\n    }\n\n    @Override\n    protected void loadBus(ServletConfig sc) {\n        super.loadBus(sc);\n\n        boolean cdiPresent = \"true\".equalsIgnoreCase(getInitParameter(CDI_INIT_PARAM));\n\n        final CXFWebservicePublisher publisher = new CXFWebservicePublisher();\n\n        endpoints.stream().forEach(e -> publisher.publish(e, bus, cdiPresent));\n\n        publisher.close();\n    }\n\n}\n"
  },
  {
    "path": "components/jax-ws/cxf/src/main/java/com/kumuluz/ee/jaxws/cxf/annotations/WsContext.java",
    "content": "/*\n *  Copyright (c) 2014-2018 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.jaxws.cxf.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * @author gpor89\n * @since 3.0.0\n */\n@Retention(value = RetentionPolicy.RUNTIME)\n@Target(value = {ElementType.TYPE})\npublic @interface WsContext {\n    /**\n     * Root path where webservice is about to be published\n     */\n    String contextRoot() default \"/*\";\n\n    /**\n     * Relative path, appended to contextRoot provided\n     */\n    String urlPattern() default \"\";\n\n}"
  },
  {
    "path": "components/jax-ws/cxf/src/main/java/com/kumuluz/ee/jaxws/cxf/processor/AnnotationProcessorUtil.java",
    "content": "/*\n *  Copyright (c) 2014-2018 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.jaxws.cxf.processor;\n\n\nimport javax.annotation.processing.Filer;\nimport javax.tools.FileObject;\nimport javax.tools.StandardLocation;\nimport java.io.*;\nimport java.nio.file.NoSuchFileException;\nimport java.util.Set;\n\n/**\n * @author gpor89\n * @since 3.0.0\n */\npublic class AnnotationProcessorUtil {\n\n    public static void writeFile(Set<String> content, String resourceName, Filer filer) throws IOException {\n        FileObject file = readOldFile(content, resourceName, filer);\n        if (file != null) {\n            try {\n                writeFile(content, resourceName, file, filer);\n                return;\n            } catch (IllegalStateException ignored) {\n            }\n        }\n        writeFile(content, resourceName, null, filer);\n    }\n\n    private static void writeFile(Set<String> content, String resourceName, FileObject overrideFile, Filer filer) throws IOException {\n        FileObject file = overrideFile;\n        if (file == null) {\n            file = filer.createResource(StandardLocation.CLASS_OUTPUT, \"\", resourceName);\n        }\n        try (Writer writer = file.openWriter()) {\n            for (String serviceClassName : content) {\n                writer.write(serviceClassName);\n                writer.write(System.lineSeparator());\n            }\n        }\n    }\n\n    private static FileObject readOldFile(Set<String> content, String resourceName, Filer filer) throws IOException {\n        Reader reader = null;\n        try {\n            final FileObject resource = filer.getResource(StandardLocation.CLASS_OUTPUT, \"\", resourceName);\n            reader = resource.openReader(true);\n            readOldFile(content, reader);\n            return resource;\n        } catch (NoSuchFileException | FileNotFoundException e) {\n            // close reader, return null\n        } finally {\n            if (reader != null) {\n                reader.close();\n            }\n        }\n        return null;\n    }\n\n    private static void readOldFile(Set<String> content, Reader reader) throws IOException {\n        try (BufferedReader bufferedReader = new BufferedReader(reader)) {\n            String line = bufferedReader.readLine();\n            while (line != null) {\n                content.add(line);\n                line = bufferedReader.readLine();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "components/jax-ws/cxf/src/main/java/com/kumuluz/ee/jaxws/cxf/processor/JaxWsAnnotationProcessor.java",
    "content": "/*\n *  Copyright (c) 2014-2018 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.jaxws.cxf.processor;\n\nimport javax.annotation.processing.AbstractProcessor;\nimport javax.annotation.processing.Filer;\nimport javax.annotation.processing.ProcessingEnvironment;\nimport javax.annotation.processing.RoundEnvironment;\nimport javax.jws.WebService;\nimport javax.lang.model.SourceVersion;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.ElementKind;\nimport javax.lang.model.element.TypeElement;\nimport java.io.IOException;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Set;\nimport java.util.logging.Logger;\n\n/**\n * @author gpor89\n * @since 3.0.0\n */\npublic class JaxWsAnnotationProcessor extends AbstractProcessor {\n\n    private static final Logger LOG = Logger.getLogger(JaxWsAnnotationProcessor.class.getName());\n\n    private Filer filer;\n\n    @Override\n    public SourceVersion getSupportedSourceVersion() {\n        return SourceVersion.latest();\n    }\n\n    @Override\n    public Set<String> getSupportedAnnotationTypes() {\n        return Collections.singleton(\"*\");\n    }\n\n    @Override\n    public synchronized void init(ProcessingEnvironment processingEnv) {\n        super.init(processingEnv);\n        filer = processingEnv.getFiler();\n    }\n\n    @Override\n    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {\n        Set<? extends Element> elements = roundEnv.getElementsAnnotatedWith(WebService.class);\n        Set<String> wsElementNames = new HashSet<>();\n        for (Element e : elements) {\n            getElementName(wsElementNames, e);\n        }\n\n        try {\n            if (!wsElementNames.isEmpty()) {\n                AnnotationProcessorUtil.writeFile(wsElementNames, \"META-INF/ws/java.lang.Object\", filer);\n            }\n        } catch (IOException e) {\n            LOG.warning(e.getMessage());\n        }\n\n        return false;\n    }\n\n    private void getElementName(Set<String> corsElementNames, Element e) {\n\n        ElementKind elementKind = e.getKind();\n\n        if (elementKind.equals(ElementKind.CLASS)) {\n            corsElementNames.add(e.toString());\n        }\n    }\n}\n\n"
  },
  {
    "path": "components/jax-ws/cxf/src/main/java/com/kumuluz/ee/jaxws/cxf/processor/JaxWsAnnotationProcessorUtil.java",
    "content": "/*\n *  Copyright (c) 2014-2018 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.jaxws.cxf.processor;\n\nimport com.kumuluz.ee.jaxws.cxf.annotations.WsContext;\nimport com.kumuluz.ee.jaxws.cxf.ws.Endpoint;\n\nimport javax.jws.WebService;\nimport java.io.InputStream;\nimport java.util.ArrayList;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Scanner;\nimport java.util.logging.Logger;\n\n/**\n * @author gpor89\n * @since 3.0.0\n */\npublic class JaxWsAnnotationProcessorUtil {\n\n    private static final Logger LOG = Logger.getLogger(JaxWsAnnotationProcessorUtil.class.getName());\n\n    private static final JaxWsAnnotationProcessorUtil INSTANCE = new JaxWsAnnotationProcessorUtil();\n\n    private static final String DEFAULT_CTX_ROOT = \"/*\";\n\n    private boolean initialized;\n    private List<Endpoint> endpointList;\n    private String contextRoot;\n\n    private JaxWsAnnotationProcessorUtil() {\n    }\n\n    public static synchronized JaxWsAnnotationProcessorUtil getInstance() {\n\n        if (!INSTANCE.isInitialized()) {\n            INSTANCE.init();\n        }\n\n        return INSTANCE;\n    }\n\n    private void init() {\n        contextRoot = DEFAULT_CTX_ROOT;\n        endpointList = new LinkedList<>();\n\n        List<Class<?>> wsClasses = getWsClasses();\n        for (Class<?> wsClass : wsClasses) {\n            if (targetClassIsProxied(wsClass)) {\n                wsClass = wsClass.getSuperclass();\n            }\n\n            final WebService wsAnnotation = wsClass.getAnnotation(WebService.class);\n\n            if (wsAnnotation == null) {\n                continue;\n            }\n\n            WsContext wsContext = wsClass.getAnnotation(WsContext.class);\n\n            String url = null;\n            if (wsContext != null) {\n                String annCtx = wsContext.contextRoot();\n                url = wsContext.urlPattern();\n\n                setContextRoot(annCtx);\n            }\n\n            endpointList.add(new Endpoint(wsClass, url, wsAnnotation));\n        }\n\n        initialized = true;\n    }\n\n    private List<Class<?>> getWsClasses() {\n        List<Class<?>> wsClasses = new ArrayList<>();\n\n        ClassLoader classLoader = getClass().getClassLoader();\n        InputStream is = classLoader.getResourceAsStream(\"META-INF/ws/java.lang.Object\");\n\n        if (is != null) {\n            Scanner scanner = new Scanner(is);\n\n            while (scanner.hasNextLine()) {\n                String className = scanner.nextLine();\n                try {\n                    Class resourceClass = Class.forName(className);\n                    wsClasses.add(resourceClass);\n                } catch (ClassNotFoundException e) {\n                    e.printStackTrace();\n                }\n            }\n            scanner.close();\n\n        }\n\n        return wsClasses;\n    }\n\n    private boolean targetClassIsProxied(Class targetClass) {\n        return targetClass.getCanonicalName().contains(\"$Proxy\");\n    }\n\n    private boolean isInitialized() {\n        return initialized;\n    }\n\n    public String getContextRoot() {\n        return contextRoot;\n    }\n\n    public void setContextRoot(String contextRoot) {\n        if (contextRoot != null) {\n            if (!contextRoot.startsWith(\"/\")) {\n                contextRoot = \"/\" + contextRoot;\n            }\n\n            if (!contextRoot.endsWith(\"/*\")) {\n                contextRoot = contextRoot.endsWith(\"/\") ? contextRoot + \"*\" : contextRoot + \"/*\";\n            }\n\n            this.contextRoot = contextRoot;\n        }\n    }\n\n    public List<Endpoint> getEndpointList() {\n        return endpointList;\n    }\n\n    protected void reinitialize() {\n        init();\n    }\n}\n\n"
  },
  {
    "path": "components/jax-ws/cxf/src/main/java/com/kumuluz/ee/jaxws/cxf/ws/CXFWebservicePublisher.java",
    "content": "/*\n *  Copyright (c) 2014-2018 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.jaxws.cxf.ws;\n\nimport org.apache.cxf.Bus;\nimport org.apache.cxf.endpoint.Server;\nimport org.apache.cxf.jaxws.JaxWsServerFactoryBean;\nimport org.apache.cxf.jaxws.handler.AnnotationHandlerChainBuilder;\nimport org.apache.cxf.service.invoker.Invoker;\n\nimport javax.annotation.Resource;\nimport javax.enterprise.inject.spi.CDI;\nimport javax.naming.Context;\nimport javax.naming.InitialContext;\nimport javax.naming.NameAlreadyBoundException;\nimport javax.naming.NamingException;\nimport javax.xml.ws.WebServiceContext;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.InvocationTargetException;\nimport java.util.logging.Logger;\nimport java.util.stream.Stream;\n\n/**\n * @author gpor89\n * @since 3.0.0\n */\npublic class CXFWebservicePublisher {\n\n    protected static final String JNDI_NAME_PREFIX = \"java:comp/env/\";\n    private static Logger LOG = Logger.getLogger(CXFWebservicePublisher.class.getSimpleName());\n\n    private Context context;\n\n    public Server publish(final Endpoint endpoint, final Bus bus, final boolean cdiPresent) {\n\n        final Class<?> clazz = endpoint.getImplementationClass();\n        final String url = endpoint.getUrl();\n\n        //inject resources into WS instance\n        Stream.of(clazz.getDeclaredFields())\n                .filter(f -> f.getType() == WebServiceContext.class)\n                .forEach(f -> injectWebServiceResource(f, clazz));\n\n        final Object targetBean = getBean(clazz, cdiPresent);\n\n        AnnotationHandlerChainBuilder builder = new AnnotationHandlerChainBuilder(bus);\n        InjectionHelper.injectWebServiceContext(targetBean, KumuluzWebServiceContext.getInstance());\n\n        final Invoker invoker = new KumuluzWSInvoker(clazz, targetBean);\n\n        final JaxWsServerFactoryBean fb = new JaxWsServerFactoryBean();\n\n        fb.setBlockPostConstruct(true);\n        fb.setAddress(url);\n        fb.setBus(bus);\n        fb.setServiceClass(clazz);\n        fb.setInvoker(invoker);\n        fb.setHandlers(builder.buildHandlerChainFromClass(clazz, fb.getEndpointName(), fb.getServiceName(), fb.getBindingId()));\n\n        if (endpoint.wsdlLocation() != null) {\n            //top-down approach\n            fb.setWsdlLocation(endpoint.wsdlLocation());\n        }\n\n        Server server = fb.create();\n\n        LOG.info(\"Webservice endpoint published with address=\" + fb.getAddress() +\n                \", wsdlLocation=\" + fb.getWsdlURL() +\n                \", implementor=\" + clazz.getName() +\n                \", serviceName=\" + endpoint.serviceName() +\n                \", portName=\" + endpoint.portName());\n\n        return server;\n    }\n\n    protected void injectWebServiceResource(final Field f, final Class<?> clazz) {\n        Resource annotation = f.getAnnotation(Resource.class);\n\n        if (annotation != null) {\n            String name = annotation.name();\n            String fieldName = f.getName();\n\n            if (context == null) {\n                open();\n            }\n\n            String bindName = null;\n            try {\n\n                if (name != null && !name.isEmpty()) {\n                    bindName = JNDI_NAME_PREFIX + name;\n                } else {\n                    context.createSubcontext(JNDI_NAME_PREFIX + clazz.getName());\n                    bindName = JNDI_NAME_PREFIX + clazz.getName() + \"/\" + fieldName;\n                }\n\n                context.bind(bindName, KumuluzWebServiceContext.getInstance());\n            } catch (NameAlreadyBoundException e) {\n\n            } catch (NamingException e) {\n                throw new RuntimeException(\"Unable to register jndi context for \" + bindName, e);\n            }\n        }\n    }\n\n\n    private Object getBean(Class<?> clazz, boolean cdiPresent) {\n        //cdi\n        if (cdiPresent) {\n            return CDI.current().select(clazz).get();\n        }\n\n        //pojo instance\n        try {\n            return clazz.getConstructor().newInstance();\n        } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {\n            throw new RuntimeException(\"Unable to instantiate bean from \" + clazz, e);\n        }\n\n    }\n\n    private void open() {\n        if (context == null) {\n            try {\n                context = new InitialContext();\n            } catch (NamingException e) {\n                throw new RuntimeException(\"Unable to register jndi context\", e);\n            }\n        }\n    }\n\n    public void close() {\n        if (context != null) {\n            try {\n                context.close();\n            } catch (NamingException e) {\n                LOG.severe(\"Cannot close context\");\n            }\n        }\n    }\n\n}\n"
  },
  {
    "path": "components/jax-ws/cxf/src/main/java/com/kumuluz/ee/jaxws/cxf/ws/Endpoint.java",
    "content": "/*\n *  Copyright (c) 2014-2018 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.jaxws.cxf.ws;\n\nimport javax.jws.WebService;\n\n/**\n * @author gpor89\n * @since 3.0.0\n */\npublic class Endpoint {\n\n    private String url;\n    private Class<?> implementationClass;\n    private WebService ws;\n\n    public Endpoint(Class<?> implementationClass, String url, WebService webService) {\n        this.url = url;\n        this.implementationClass = implementationClass;\n        this.ws = webService;\n    }\n\n    public String getUrl() {\n        return url != null ? url : defaultEndpointUrl();\n    }\n\n    public Class<?> getImplementationClass() {\n        return implementationClass;\n    }\n\n    public String wsdlLocation() {\n\n        if (ws == null) {\n            return null;\n        }\n\n        return ws.wsdlLocation() != null && ws.wsdlLocation().isEmpty() ? null : ws.wsdlLocation();\n    }\n\n    private String defaultEndpointUrl() {\n\n        if (ws == null || implementationClass == null) {\n            return null;\n        }\n\n        return \"/\" + implementationClass.getName();\n    }\n\n    public String serviceName() {\n\n        if (ws == null) {\n            return null;\n        }\n\n        return ws.serviceName() != null && ws.serviceName().isEmpty() ? null : ws.serviceName();\n    }\n\n    public String portName() {\n\n        if (ws == null) {\n            return null;\n        }\n\n        return ws.portName() != null && ws.portName().isEmpty() ? null : ws.portName();\n    }\n}\n"
  },
  {
    "path": "components/jax-ws/cxf/src/main/java/com/kumuluz/ee/jaxws/cxf/ws/InjectionHelper.java",
    "content": "/*\n *  Copyright (c) 2014-2018 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.jaxws.cxf.ws;\n\nimport javax.annotation.Resource;\nimport javax.xml.ws.WebServiceContext;\nimport java.lang.reflect.Field;\n\n/**\n * @author gpor89\n * @since 3.0.0\n */\npublic final class InjectionHelper {\n\n    private InjectionHelper() {\n    }\n\n    public static void injectWebServiceContext(final Object instance, final WebServiceContext ctx) {\n        final Class<?> instanceClass = instance.getClass();\n\n        //method injection not supported!\n\n        // inject @Resource\n        final Field[] resourceAnnotatedFields = instanceClass.getDeclaredFields();\n        for (Field field : resourceAnnotatedFields) {\n            try {\n                if (field.getDeclaredAnnotation(Resource.class) != null && field.getType() == WebServiceContext.class) {\n                    setField(instance, field, ctx);\n                }\n            } catch (Exception e) {\n                throw new RuntimeException(\"Cannot inject @Resource annotated field: \" + field, e);\n            }\n        }\n    }\n\n    private static void setField(final Object instance, final Field field, final Object value) {\n        try {\n            field.setAccessible(true);\n            field.set(instance, value);\n        } catch (Exception e) {\n            throw new RuntimeException(e);\n        } finally {\n            field.setAccessible(field.isAccessible());\n        }\n    }\n\n}"
  },
  {
    "path": "components/jax-ws/cxf/src/main/java/com/kumuluz/ee/jaxws/cxf/ws/KumuluzWSInvoker.java",
    "content": "/*\n *  Copyright (c) 2014-2018 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.jaxws.cxf.ws;\n\nimport org.apache.cxf.helpers.CastUtils;\nimport org.apache.cxf.jaxws.JAXWSMethodInvoker;\nimport org.apache.cxf.jaxws.context.WebServiceContextImpl;\nimport org.apache.cxf.message.Exchange;\nimport org.apache.cxf.message.MessageContentsList;\nimport org.apache.cxf.service.Service;\nimport org.apache.cxf.service.invoker.Factory;\nimport org.apache.cxf.service.invoker.Invoker;\nimport org.apache.cxf.service.invoker.MethodDispatcher;\nimport org.apache.cxf.service.model.BindingOperationInfo;\n\nimport javax.xml.ws.WebServiceContext;\nimport java.lang.reflect.Method;\nimport java.util.List;\n\n/**\n * @author gpor89\n * @since 3.0.0\n */\npublic class KumuluzWSInvoker extends JAXWSMethodInvoker implements Invoker {\n\n    private Class<?> targetClass;\n    private Object targetBean;\n\n    public KumuluzWSInvoker(final Class<?> targetClass, final Object targetBean) {\n        super((Factory) null);\n        this.targetClass = targetClass;\n        this.targetBean = targetBean;\n    }\n\n    @Override\n    public Object invoke(Exchange exchange, Object o) {\n        BindingOperationInfo bop = exchange.get(BindingOperationInfo.class);\n        MethodDispatcher md = (MethodDispatcher) exchange.get(Service.class).get(MethodDispatcher.class.getName());\n        List<Object> params = null;\n        if (o instanceof List) {\n            params = CastUtils.cast((List<?>) o);\n        } else if (o != null) {\n            params = new MessageContentsList(o);\n        }\n\n        final Method method = adjustMethodAndParams(md.getMethod(bop), exchange, params, targetClass);\n\n        return invoke(exchange, targetBean, method, params);\n    }\n\n\n    @Override\n    protected Object performInvocation(Exchange exchange, final Object serviceObject, Method m, Object[] paramArray) throws Exception {\n        WebServiceContext wsContext = new WebServiceContextImpl(null);\n\n        try {\n            KumuluzWebServiceContext.getInstance().setMessageContext(wsContext);\n\n            return super.performInvocation(exchange, serviceObject, m, paramArray);\n        } finally {\n            KumuluzWebServiceContext.getInstance().setMessageContext(null);\n        }\n    }\n\n}\n"
  },
  {
    "path": "components/jax-ws/cxf/src/main/java/com/kumuluz/ee/jaxws/cxf/ws/KumuluzWebServiceContext.java",
    "content": "/*\n *  Copyright (c) 2014-2018 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.jaxws.cxf.ws;\n\nimport org.w3c.dom.Element;\n\nimport javax.xml.ws.EndpointReference;\nimport javax.xml.ws.WebServiceContext;\nimport javax.xml.ws.handler.MessageContext;\nimport java.io.Serializable;\nimport java.security.Principal;\n\n/**\n * @author gpor89\n * @since 3.0.0\n */\npublic final class KumuluzWebServiceContext implements WebServiceContext, Serializable {\n\n    private static final long serialVersionUID = 6874657983243689841L;\n\n    private static final KumuluzWebServiceContext WS_CONTEXT_SINGLETON = new KumuluzWebServiceContext();\n\n    private final transient ThreadLocal<WebServiceContext> contexts = new InheritableThreadLocal<>();\n\n    public static KumuluzWebServiceContext getInstance() {\n        return WS_CONTEXT_SINGLETON;\n    }\n\n    public EndpointReference getEndpointReference(final Element... referenceParameters) {\n        return getWebServiceContext().getEndpointReference(referenceParameters);\n    }\n\n    public <T extends EndpointReference> T getEndpointReference(final Class<T> clazz, final Element... referenceParameters) {\n        return getWebServiceContext().getEndpointReference(clazz, referenceParameters);\n    }\n\n    public MessageContext getMessageContext() {\n        return getWebServiceContext().getMessageContext();\n    }\n\n    public void setMessageContext(final WebServiceContext ctx) {\n        this.contexts.set(ctx);\n    }\n\n    public Principal getUserPrincipal() {\n        return getWebServiceContext().getUserPrincipal();\n    }\n\n    public boolean isUserInRole(String role) {\n        return getWebServiceContext().isUserInRole(role);\n    }\n\n    private WebServiceContext getWebServiceContext() {\n        final WebServiceContext delegate = contexts.get();\n\n        if (delegate == null) {\n            throw new IllegalStateException();\n        }\n\n        return delegate;\n    }\n\n}\n"
  },
  {
    "path": "components/jax-ws/cxf/src/main/resources/META-INF/services/com.kumuluz.ee.common.Component",
    "content": "com.kumuluz.ee.jaxws.cxf.JaxWsComponent"
  },
  {
    "path": "components/jax-ws/cxf/src/main/resources/META-INF/services/javax.annotation.processing.Processor",
    "content": "com.kumuluz.ee.jaxws.cxf.processor.JaxWsAnnotationProcessor"
  },
  {
    "path": "components/jax-ws/cxf/src/test/java/com/kumuluz/ee/jaxws/cxf/impl/NoWsContextAnnotatedEndpointBean.java",
    "content": "package com.kumuluz.ee.jaxws.cxf.impl;\n\nimport javax.jws.WebService;\n\n@WebService\npublic class NoWsContextAnnotatedEndpointBean {\n}\n"
  },
  {
    "path": "components/jax-ws/cxf/src/test/java/com/kumuluz/ee/jaxws/cxf/impl/WebServiceContextBean.java",
    "content": "package com.kumuluz.ee.jaxws.cxf.impl;\n\nimport org.apache.cxf.jaxws.handler.logical.LogicalMessageContextImpl;\nimport org.apache.cxf.message.MessageImpl;\nimport org.w3c.dom.Element;\n\nimport javax.xml.ws.EndpointReference;\nimport javax.xml.ws.WebServiceContext;\nimport javax.xml.ws.handler.MessageContext;\nimport java.security.Principal;\n\n\npublic class WebServiceContextBean implements WebServiceContext {\n\n    MessageContext messageContext;\n\n    public WebServiceContextBean(String id) {\n        MessageImpl message = new MessageImpl();\n        message.put(\"id\", id);\n        messageContext = new LogicalMessageContextImpl(message);\n    }\n\n    @Override\n    public MessageContext getMessageContext() {\n        return messageContext;\n    }\n\n    @Override\n    public Principal getUserPrincipal() {\n        return null;\n    }\n\n    @Override\n    public boolean isUserInRole(String role) {\n        return false;\n    }\n\n    @Override\n    public EndpointReference getEndpointReference(Element... referenceParameters) {\n        return null;\n    }\n\n    @Override\n    public <T extends EndpointReference> T getEndpointReference(Class<T> clazz, Element... referenceParameters) {\n        return null;\n    }\n}\n"
  },
  {
    "path": "components/jax-ws/cxf/src/test/java/com/kumuluz/ee/jaxws/cxf/impl/WsContextAnnotatedEndpoint.java",
    "content": "package com.kumuluz.ee.jaxws.cxf.impl;\n\npublic interface WsContextAnnotatedEndpoint {\n}\n"
  },
  {
    "path": "components/jax-ws/cxf/src/test/java/com/kumuluz/ee/jaxws/cxf/impl/WsContextAnnotatedEndpointBean.java",
    "content": "package com.kumuluz.ee.jaxws.cxf.impl;\n\nimport com.kumuluz.ee.jaxws.cxf.annotations.WsContext;\n\nimport javax.jws.WebService;\n\n@WsContext(contextRoot = WsContextAnnotatedEndpointBean.CTX_ROOT, urlPattern = WsContextAnnotatedEndpointBean.URL_PATTERN)\n@WebService(wsdlLocation = WsContextAnnotatedEndpointBean.WSDL_URL, portName = WsContextAnnotatedEndpointBean.PORT, serviceName =\n        WsContextAnnotatedEndpointBean.SERVICE, endpointInterface = WsContextAnnotatedEndpointBean.INTERFACE)\npublic class WsContextAnnotatedEndpointBean implements WsContextAnnotatedEndpoint {\n\n    public static final String WSDL_URL = \"http://cloud.si/example.wsdl\";\n    public static final String CTX_ROOT = \"/ws/*\";\n    public static final String URL_PATTERN = \"/endpoint\";\n    public static final String PORT = \"EndpointPort\";\n    public static final String SERVICE = \"ServiceName\";\n    public static final String INTERFACE = \"com.kumuluz.ee.jaxws.cxf.impl.WsContextAnnotatedEndpoint\";\n\n}\n"
  },
  {
    "path": "components/jax-ws/cxf/src/test/java/com/kumuluz/ee/jaxws/cxf/processor/JaxWsAnnotationProcessorUtilTest.java",
    "content": "package com.kumuluz.ee.jaxws.cxf.processor;\n\nimport com.kumuluz.ee.jaxws.cxf.impl.NoWsContextAnnotatedEndpointBean;\nimport com.kumuluz.ee.jaxws.cxf.impl.WsContextAnnotatedEndpointBean;\nimport org.junit.Test;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.PrintWriter;\nimport java.net.URL;\nimport java.net.URLDecoder;\nimport java.util.stream.Stream;\n\nimport static org.junit.Assert.*;\n\npublic class JaxWsAnnotationProcessorUtilTest {\n\n    private JaxWsAnnotationProcessorUtil instance = JaxWsAnnotationProcessorUtil.getInstance();\n\n    @Test\n    public void shouldReturnDefaultWsInfo() {\n\n        String className = NoWsContextAnnotatedEndpointBean.class.getName();\n        Class<?> clazz = NoWsContextAnnotatedEndpointBean.class;\n\n        prepareEndpointList(className);\n        instance.reinitialize();\n\n        String expectedContextRoot = \"/*\";\n        String expectedUrl = \"/\" + className;\n\n        //check implementation class\n        assertEquals(\"Ws endpoint returned wrong implementation value\", clazz, instance.getEndpointList().get(0).getImplementationClass());\n\n        //assert @WsContext\n        assertEquals(\"Ws endpoint without defined contextRoot returned wrong value\", expectedContextRoot, instance.getContextRoot());\n        assertFalse(instance.getEndpointList().isEmpty());\n        assertEquals(\"Ws endpoint without defined url returned wrong value\", expectedUrl, instance.getEndpointList().get(0).getUrl());\n\n        //assert @Webservice\n        assertNull(\"Ws endpoint without defined wsdlLocation returned wrong value\", instance.getEndpointList().get(0).wsdlLocation());\n        assertNull(\"Ws endpoint without defined wsdlLocation returned wrong value\", instance.getEndpointList().get(0).portName());\n        assertNull(\"Ws endpoint without defined wsdlLocation returned wrong value\", instance.getEndpointList().get(0).serviceName());\n\n    }\n\n    @Test\n    public void shouldReturnConfiguredWsInfo() {\n\n        String className = WsContextAnnotatedEndpointBean.class.getName();\n        Class<?> clazz = WsContextAnnotatedEndpointBean.class;\n\n        prepareEndpointList(className);\n        instance.reinitialize();\n\n\n        //check implementation class\n        assertEquals(\"Ws endpoint returned wrong implementation value\", clazz, instance.getEndpointList().get(0).getImplementationClass());\n\n        //assert @WsContext\n        assertEquals(\"Ws endpoint without defined contextRoot returned wrong value\", WsContextAnnotatedEndpointBean.CTX_ROOT, instance.getContextRoot());\n        assertFalse(instance.getEndpointList().isEmpty());\n        assertEquals(\"Ws endpoint without defined url returned wrong value\", WsContextAnnotatedEndpointBean.URL_PATTERN, instance.getEndpointList().get(0)\n                .getUrl());\n\n        //assert @Webservice\n        assertEquals(\"Ws endpoint without defined wsdlLocation returned wrong value\", WsContextAnnotatedEndpointBean.WSDL_URL, instance.getEndpointList()\n                .get(0).wsdlLocation());\n        assertEquals(\"Ws endpoint without defined wsdlLocation returned wrong value\", WsContextAnnotatedEndpointBean.PORT, instance.getEndpointList()\n                .get(0).portName());\n        assertEquals(\"Ws endpoint without defined wsdlLocation returned wrong value\", WsContextAnnotatedEndpointBean.SERVICE, instance.getEndpointList()\n                .get(0).serviceName());\n    }\n\n    //helper method\n    private void prepareEndpointList(String... endpoints) {\n\n        URL url = this.getClass().getClassLoader().getResource(\"META-INF/ws/java.lang.Object\");\n        if (url == null) {\n            throw new RuntimeException(\"Service file not found.\");\n        }\n\n        try (PrintWriter out = new PrintWriter(new File(URLDecoder.decode(url.getFile(), \"UTF-8\")))) {\n            Stream.of(endpoints).forEach(out::print);\n            out.flush();\n        } catch (IOException fe) {\n            fe.printStackTrace();\n        }\n    }\n\n}\n"
  },
  {
    "path": "components/jax-ws/cxf/src/test/java/com/kumuluz/ee/jaxws/cxf/ws/KumuluzWebServiceContextTest.java",
    "content": "package com.kumuluz.ee.jaxws.cxf.ws;\n\nimport com.kumuluz.ee.jaxws.cxf.impl.WebServiceContextBean;\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertTrue;\n\npublic class KumuluzWebServiceContextTest {\n\n    @Test\n    public void shouldUseRightContext() throws InterruptedException {\n\n        WsThread one = new WsThread();\n        WsThread two = new WsThread();\n\n        one.start();\n        two.start();\n        one.join();\n        two.join();\n\n        assertTrue(\"Thread 1 context not properly propagated\", one.isSuccessful());\n        assertTrue(\"Thread 2 context not properly propagated\", two.isSuccessful());\n    }\n\n    public static class WsThread extends Thread {\n        private boolean successful = true;\n\n        public void run() {\n            String threadName = Thread.currentThread().getName();\n\n            KumuluzWebServiceContext.getInstance().setMessageContext(new WebServiceContextBean(threadName));\n\n            for (int i = 0; i < 1000; i++) {\n                //hoping for race condition to occur in 1k iterations\n                successful &= threadName.equals(KumuluzWebServiceContext.getInstance().getMessageContext().get(\"id\"));\n            }\n\n        }\n\n        public boolean isSuccessful() {\n            return successful;\n        }\n    }\n\n\n}\n"
  },
  {
    "path": "components/jax-ws/cxf/src/test/resources/META-INF/ws/java.lang.Object",
    "content": ""
  },
  {
    "path": "components/jax-ws/metro/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-jax-ws</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE JAX-WS Metro</name>\n    <description>KumuluzEE JAX-WS component implemented by Metro</description>\n\n    <artifactId>kumuluzee-jax-ws-metro</artifactId>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-common</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.glassfish.metro</groupId>\n            <artifactId>webservices-rt</artifactId>\n            <version>${metro.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.glassfish.metro</groupId>\n            <artifactId>webservices-extra</artifactId>\n            <version>${metro.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>javax.activation</groupId>\n            <artifactId>activation</artifactId>\n            <version>${activation.version}</version>\n        </dependency>\n    </dependencies>\n\n</project>"
  },
  {
    "path": "components/jax-ws/metro/src/main/java/com/kumuluz/ee/jaxws/metro/JaxWsComponent.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jaxws.metro;\n\nimport com.kumuluz.ee.common.Component;\nimport com.kumuluz.ee.common.config.EeConfig;\nimport com.kumuluz.ee.common.dependencies.EeComponentDef;\nimport com.kumuluz.ee.common.dependencies.EeComponentType;\nimport com.kumuluz.ee.common.wrapper.KumuluzServerWrapper;\n\nimport java.util.logging.Logger;\n\n/**\n * @author Tilen Faganel\n * @since 2.0.0\n */\n@EeComponentDef(name = \"Metro\", type = EeComponentType.JAX_WS)\npublic class JaxWsComponent implements Component {\n\n    private Logger log = Logger.getLogger(JaxWsComponent.class.getSimpleName());\n\n    @Override\n    public void init(KumuluzServerWrapper server, EeConfig eeConfig) {\n    }\n\n    @Override\n    public void load() {\n\n        log.info(\"Initiating Metro\");\n    }\n}\n"
  },
  {
    "path": "components/jax-ws/metro/src/main/resources/META-INF/services/com.kumuluz.ee.common.Component",
    "content": "com.kumuluz.ee.jaxws.metro.JaxWsComponent"
  },
  {
    "path": "components/jax-ws/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-components</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n    <packaging>pom</packaging>\n\n    <artifactId>kumuluzee-jax-ws</artifactId>\n\n    <modules>\n        <module>metro</module>\n        <module>cxf</module>\n    </modules>\n\n    <name>KumuluzEE JAX-WS</name>\n    <description>KumuluzEE JAX-WS component</description>\n\n</project>"
  },
  {
    "path": "components/jpa/common/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-jpa</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE JPA Common</name>\n    <description>KumuluzEE JPA component common utilities, configs and exceptions</description>\n\n    <artifactId>kumuluzee-jpa-common</artifactId>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-common</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>jakarta.persistence</groupId>\n            <artifactId>jakarta.persistence-api</artifactId>\n            <scope>provided</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-cdi-weld</artifactId>\n            <scope>provided</scope>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-jta-common</artifactId>\n            <scope>provided</scope>\n        </dependency>\n    </dependencies>\n\n</project>"
  },
  {
    "path": "components/jpa/common/src/main/java/com/kumuluz/ee/jpa/common/PersistenceSettings.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.common;\n\nimport java.util.Map;\n\n/**\n * @author Tilen Faganel\n * @since 2.3.0\n */\npublic interface PersistenceSettings {\n\n    Map<String, String> getPersistenceUnitProperties();\n}\n"
  },
  {
    "path": "components/jpa/common/src/main/java/com/kumuluz/ee/jpa/common/PersistenceUnitHolder.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.common;\n\nimport com.kumuluz.ee.jpa.common.utils.PersistenceUtils;\n\nimport javax.persistence.EntityManagerFactory;\nimport javax.persistence.Persistence;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Properties;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\npublic class PersistenceUnitHolder {\n\n    private PersistenceSettings providerProperties;\n\n    private String defaultUnitName;\n\n    private Map<String, PersistenceWrapper> factories = new HashMap<>();\n\n    private static final PersistenceUnitHolder instance = new PersistenceUnitHolder();\n\n    private PersistenceUnitHolder() {\n\n        defaultUnitName = PersistenceUtils.getDefaultUnitName().orElse(\"\");\n    }\n\n    public static PersistenceUnitHolder getInstance() {\n        return instance;\n    }\n\n    public synchronized PersistenceWrapper getEntityManagerFactory(String unitName) {\n\n        PersistenceWrapper wrapper = factories.get(unitName);\n\n        if (wrapper == null) {\n\n            Properties properties = new Properties();\n\n            if (providerProperties != null && providerProperties.getPersistenceUnitProperties() != null) {\n                properties.putAll(providerProperties.getPersistenceUnitProperties());\n            }\n\n            EntityManagerFactory factory = Persistence.createEntityManagerFactory(unitName, properties);\n            TransactionType transactionType = PersistenceUtils.getEntityManagerFactoryTransactionType(factory);\n\n            wrapper = new PersistenceWrapper(factory, transactionType);\n\n            factories.put(unitName, wrapper);\n        }\n\n        return wrapper;\n    }\n\n    public String getDefaultUnitName() {\n        return defaultUnitName;\n    }\n\n    public void setProviderProperties(PersistenceSettings providerProperties) {\n        this.providerProperties = providerProperties;\n    }\n}\n"
  },
  {
    "path": "components/jpa/common/src/main/java/com/kumuluz/ee/jpa/common/PersistenceWrapper.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.common;\n\nimport javax.persistence.EntityManagerFactory;\n\n/**\n * @author Tilen Faganel\n * @since 2.3.0\n */\npublic class PersistenceWrapper {\n\n    private EntityManagerFactory entityManagerFactory;\n    private TransactionType transactionType;\n\n    public PersistenceWrapper(EntityManagerFactory entityManagerFactory, TransactionType transactionType) {\n        this.entityManagerFactory = entityManagerFactory;\n        this.transactionType = transactionType;\n    }\n\n    public EntityManagerFactory getEntityManagerFactory() {\n        return entityManagerFactory;\n    }\n\n    public TransactionType getTransactionType() {\n        return transactionType;\n    }\n}\n"
  },
  {
    "path": "components/jpa/common/src/main/java/com/kumuluz/ee/jpa/common/TransactionType.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.common;\n\n/**\n * @author Tilen Faganel\n * @since 2.3.0\n */\npublic enum TransactionType {\n\n    RESOURCE_LOCAL,\n    JTA\n}\n"
  },
  {
    "path": "components/jpa/common/src/main/java/com/kumuluz/ee/jpa/common/exceptions/NoDefaultPersistenceUnit.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.common.exceptions;\n\n/**\n * @author Tilen Faganel\n * @since 2.3.0\n */\npublic class NoDefaultPersistenceUnit extends RuntimeException {\n\n    public NoDefaultPersistenceUnit() {\n        super(\"Cannot determine a default persistence unit. Either the configuration does not exist or \" +\n                \"there are more then one configurations or units defined\");\n    }\n}\n"
  },
  {
    "path": "components/jpa/common/src/main/java/com/kumuluz/ee/jpa/common/injection/EntityManagerWrapper.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.common.injection;\n\nimport javax.persistence.EntityManager;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic interface EntityManagerWrapper {\n\n    EntityManager getEntityManager();\n\n    void close();\n}\n"
  },
  {
    "path": "components/jpa/common/src/main/java/com/kumuluz/ee/jpa/common/injection/JpaService.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.common.injection;\n\nimport com.kumuluz.ee.configuration.utils.ConfigurationUtil;\nimport com.kumuluz.ee.jpa.common.PersistenceUnitHolder;\nimport com.kumuluz.ee.jpa.common.PersistenceWrapper;\nimport com.kumuluz.ee.jpa.common.exceptions.NoDefaultPersistenceUnit;\nimport org.jboss.weld.injection.spi.JpaInjectionServices;\nimport org.jboss.weld.injection.spi.ResourceReferenceFactory;\n\nimport javax.annotation.Priority;\nimport javax.enterprise.inject.spi.InjectionPoint;\nimport javax.persistence.EntityManager;\nimport javax.persistence.EntityManagerFactory;\nimport javax.persistence.PersistenceContext;\nimport javax.persistence.PersistenceUnit;\nimport java.util.Optional;\nimport java.util.logging.Logger;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\n@Priority(1)\npublic class JpaService implements JpaInjectionServices {\n\n    private static final Logger LOG = Logger.getLogger(JpaService.class.getSimpleName());\n\n    @Override\n    public ResourceReferenceFactory<EntityManager> registerPersistenceContextInjectionPoint\n            (InjectionPoint injectionPoint) {\n\n        PersistenceUnitHolder holder = PersistenceUnitHolder.getInstance();\n\n        PersistenceContext pc = injectionPoint.getAnnotated().getAnnotation(PersistenceContext\n                .class);\n        String unitName = pc.unitName();\n\n        if (unitName.isEmpty()) {\n\n            unitName = holder.getDefaultUnitName();\n\n            if (unitName.isEmpty()) {\n                throw new NoDefaultPersistenceUnit();\n            }\n        }\n\n        //If database is unreachable, by default, framework will fail-early and not initialize due to unhandled exception.\n        //Error can be ignored with config override per PU, however EntityManager for that connection will be null.\n        boolean continueOnError = false;\n        ConfigurationUtil cfg = ConfigurationUtil.getInstance();\n        Optional<Integer> puSizeOpt = cfg.getListSize(\"kumuluzee.persistence-units\");\n\n        if (puSizeOpt.isPresent()) {\n            for (int i = 0; i < puSizeOpt.get(); i++) {\n                Optional<String> puName = cfg.get(\"kumuluzee.persistence-units[\" + i + \"].name\");\n                if (puName.isPresent() && puName.get().equals(unitName)) {\n                    Optional<Boolean> continueOnErrorCfg = cfg.getBoolean(\"kumuluzee.persistence-units[\" + i + \"].continue-on-error\");\n                    if (continueOnErrorCfg.isPresent() && continueOnErrorCfg.get()!=null) {\n                        continueOnError = continueOnErrorCfg.get();\n                    }\n                    break;\n                }\n            }\n        }\n\n        try {\n            PersistenceWrapper wrapper = holder.getEntityManagerFactory(unitName);\n\n            return new PersistenceContextResourceFactory(unitName, wrapper.getEntityManagerFactory(),\n                wrapper.getTransactionType(), pc.synchronization());\n        }\n        catch (Exception e) {\n            if (!continueOnError) {\n                LOG.severe(\"EntityManager for pu \"+unitName+\" failed to initialize. KumuluzEE initialization failed.\");\n                throw e;\n            }\n        }\n\n        LOG.warning(\"EntityManager for pu \"+unitName+\" failed to initialize. KumuluzEE will continue the startup regardless due to config override.\");\n        return null;\n    }\n\n    @Override\n    public ResourceReferenceFactory<EntityManagerFactory> registerPersistenceUnitInjectionPoint\n            (InjectionPoint injectionPoint) {\n\n        PersistenceUnitHolder holder = PersistenceUnitHolder.getInstance();\n\n        PersistenceUnit pu = injectionPoint.getAnnotated().getAnnotation(PersistenceUnit.class);\n        String unitName = pu.unitName();\n\n        if (unitName.isEmpty()) {\n\n            unitName = holder.getDefaultUnitName();\n\n            if (unitName.isEmpty()) {\n                throw new NoDefaultPersistenceUnit();\n            }\n        }\n\n        PersistenceWrapper wrapper = holder.getEntityManagerFactory(unitName);\n\n        return new PersistenceUnitResourceFactory(wrapper.getEntityManagerFactory());\n    }\n\n    @Override\n    public void cleanup() {\n    }\n}\n"
  },
  {
    "path": "components/jpa/common/src/main/java/com/kumuluz/ee/jpa/common/injection/NonTxEntityManagerWrapper.java",
    "content": "package com.kumuluz.ee.jpa.common.injection;\n\nimport javax.persistence.EntityManager;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic class NonTxEntityManagerWrapper implements EntityManagerWrapper {\n\n    private EntityManager em;\n\n    public NonTxEntityManagerWrapper(EntityManager em) {\n        this.em = em;\n    }\n\n    @Override\n    public EntityManager getEntityManager() {\n        return em;\n    }\n\n    @Override\n    public void close() {\n\n        if (em.isOpen()) {\n            em.close();\n        }\n    }\n}\n"
  },
  {
    "path": "components/jpa/common/src/main/java/com/kumuluz/ee/jpa/common/injection/PersistenceContextResource.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.common.injection;\n\nimport org.jboss.weld.injection.spi.ResourceReference;\n\nimport javax.persistence.EntityManager;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\npublic class PersistenceContextResource implements ResourceReference<EntityManager> {\n\n    private EntityManagerWrapper entityManagerWrapper;\n\n    public PersistenceContextResource(EntityManagerWrapper entityManagerWrapper) {\n\n        this.entityManagerWrapper = entityManagerWrapper;\n    }\n\n    @Override\n    public EntityManager getInstance() {\n\n        return entityManagerWrapper.getEntityManager();\n    }\n\n    @Override\n    public void release() {\n\n        entityManagerWrapper.close();\n    }\n}\n"
  },
  {
    "path": "components/jpa/common/src/main/java/com/kumuluz/ee/jpa/common/injection/PersistenceContextResourceFactory.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.common.injection;\n\nimport com.kumuluz.ee.jpa.common.TransactionType;\nimport com.kumuluz.ee.jpa.common.jta.TxScopedEntityManagerFactory;\nimport org.jboss.weld.injection.spi.ResourceReference;\nimport org.jboss.weld.injection.spi.ResourceReferenceFactory;\n\nimport javax.persistence.EntityManager;\nimport javax.persistence.EntityManagerFactory;\nimport javax.persistence.SynchronizationType;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\npublic class PersistenceContextResourceFactory implements ResourceReferenceFactory<EntityManager> {\n\n    private String unitName;\n    private EntityManagerFactory emf;\n    private SynchronizationType sync;\n    private TransactionType transactionType;\n\n    public PersistenceContextResourceFactory(String unitName, EntityManagerFactory emf, TransactionType transactionType, SynchronizationType sync) {\n        this.unitName = unitName;\n        this.emf = emf;\n        this.sync = sync;\n        this.transactionType = transactionType;\n    }\n\n    @Override\n    public ResourceReference<EntityManager> createResource() {\n\n        EntityManagerWrapper emWrapper;\n\n        if (transactionType == TransactionType.JTA) {\n\n            emWrapper = TxScopedEntityManagerFactory.buildEntityManagerWrapper(unitName, emf, sync);\n        } else {\n            emWrapper = new NonTxEntityManagerWrapper(emf.createEntityManager());\n        }\n\n        return new PersistenceContextResource(emWrapper);\n    }\n}"
  },
  {
    "path": "components/jpa/common/src/main/java/com/kumuluz/ee/jpa/common/injection/PersistenceUnitResource.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.common.injection;\n\nimport org.jboss.weld.injection.spi.ResourceReference;\n\nimport javax.persistence.EntityManagerFactory;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\npublic class PersistenceUnitResource implements ResourceReference<EntityManagerFactory> {\n\n    private EntityManagerFactory emf;\n\n    public PersistenceUnitResource(EntityManagerFactory emf) {\n\n        this.emf = emf;\n    }\n\n    @Override\n    public EntityManagerFactory getInstance() {\n\n        return emf;\n    }\n\n    @Override\n    public void release() {\n\n    }\n}\n"
  },
  {
    "path": "components/jpa/common/src/main/java/com/kumuluz/ee/jpa/common/injection/PersistenceUnitResourceFactory.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.common.injection;\n\nimport org.jboss.weld.injection.spi.ResourceReference;\nimport org.jboss.weld.injection.spi.ResourceReferenceFactory;\n\nimport javax.persistence.EntityManagerFactory;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\npublic class PersistenceUnitResourceFactory implements\n        ResourceReferenceFactory<EntityManagerFactory> {\n\n    private EntityManagerFactory emf;\n\n    public PersistenceUnitResourceFactory(EntityManagerFactory emf) {\n\n        this.emf = emf;\n    }\n\n    @Override\n    public ResourceReference<EntityManagerFactory> createResource() {\n\n        return new PersistenceUnitResource(emf);\n    }\n}\n"
  },
  {
    "path": "components/jpa/common/src/main/java/com/kumuluz/ee/jpa/common/jta/NonTxEntityManagerHolder.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.common.jta;\n\nimport javax.persistence.EntityManager;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic class NonTxEntityManagerHolder {\n\n    private EntityManager em;\n\n    public EntityManager getEntityManager() {\n        return em;\n    }\n\n    public void setEntityManager(EntityManager em) {\n        this.em = em;\n    }\n}\n"
  },
  {
    "path": "components/jpa/common/src/main/java/com/kumuluz/ee/jpa/common/jta/NonTxQueryWrapper.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.common.jta;\n\nimport javax.persistence.*;\nimport java.util.*;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic class NonTxQueryWrapper implements Query {\n\n    private Query query;\n    private EntityManager em;\n\n    public NonTxQueryWrapper(Query query, EntityManager em) {\n        this.query = query;\n        this.em = em;\n    }\n\n    @Override\n    public List getResultList() {\n\n        List resultList = query.getResultList();\n\n        em.clear();\n\n        return resultList;\n    }\n\n    @Override\n    public Object getSingleResult() {\n\n        Object singleResult = query.getSingleResult();\n\n        em.clear();\n\n        return singleResult;\n    }\n\n    @Override\n    public int executeUpdate() {\n        return query.executeUpdate();\n    }\n\n    @Override\n    public Query setMaxResults(int maxResult) {\n        query.setMaxResults(maxResult);\n        return this;\n    }\n\n    @Override\n    public int getMaxResults() {\n        return query.getMaxResults();\n    }\n\n    @Override\n    public Query setFirstResult(int startPosition) {\n        query.setFirstResult(startPosition);\n        return this;\n    }\n\n    @Override\n    public int getFirstResult() {\n        return query.getFirstResult();\n    }\n\n    @Override\n    public Query setHint(String hintName, Object value) {\n        query.setHint(hintName, value);\n        return this;\n    }\n\n    @Override\n    public Map<String, Object> getHints() {\n        return query.getHints();\n    }\n\n    @Override\n    public <T> Query setParameter(Parameter<T> param, T value) {\n        query.setParameter(param, value);\n        return this;\n    }\n\n    @Override\n    public Query setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType) {\n        query.setParameter(param, value, temporalType);\n        return this;\n    }\n\n    @Override\n    public Query setParameter(Parameter<Date> param, Date value, TemporalType temporalType) {\n        query.setParameter(param, value, temporalType);\n        return this;\n    }\n\n    @Override\n    public Query setParameter(String name, Object value) {\n        query.setParameter(name, value);\n        return this;\n    }\n\n    @Override\n    public Query setParameter(String name, Calendar value, TemporalType temporalType) {\n        query.setParameter(name, value, temporalType);\n        return this;\n    }\n\n    @Override\n    public Query setParameter(String name, Date value, TemporalType temporalType) {\n        query.setParameter(name, value, temporalType);\n        return this;\n    }\n\n    @Override\n    public Query setParameter(int position, Object value) {\n        query.setParameter(position, value);\n        return this;\n    }\n\n    @Override\n    public Query setParameter(int position, Calendar value, TemporalType temporalType) {\n        query.setParameter(position, value, temporalType);\n        return this;\n    }\n\n    @Override\n    public Query setParameter(int position, Date value, TemporalType temporalType) {\n        query.setParameter(position, value, temporalType);\n        return this;\n    }\n\n    @Override\n    public Set<Parameter<?>> getParameters() {\n        return query.getParameters();\n    }\n\n    @Override\n    public Parameter<?> getParameter(String name) {\n        return query.getParameter(name);\n    }\n\n    @Override\n    public <T> Parameter<T> getParameter(String name, Class<T> type) {\n        return query.getParameter(name, type);\n    }\n\n    @Override\n    public Parameter<?> getParameter(int position) {\n        return query.getParameter(position);\n    }\n\n    @Override\n    public <T> Parameter<T> getParameter(int position, Class<T> type) {\n        return query.getParameter(position, type);\n    }\n\n    @Override\n    public boolean isBound(Parameter<?> param) {\n        return query.isBound(param);\n    }\n\n    @Override\n    public <T> T getParameterValue(Parameter<T> param) {\n        return query.getParameterValue(param);\n    }\n\n    @Override\n    public Object getParameterValue(String name) {\n        return query.getParameterValue(name);\n    }\n\n    @Override\n    public Object getParameterValue(int position) {\n        return query.getParameterValue(position);\n    }\n\n    @Override\n    public Query setFlushMode(FlushModeType flushMode) {\n        query.setFlushMode(flushMode);\n        return this;\n    }\n\n    @Override\n    public FlushModeType getFlushMode() {\n        return query.getFlushMode();\n    }\n\n    @Override\n    public Query setLockMode(LockModeType lockMode) {\n        query.setLockMode(lockMode);\n        return this;\n    }\n\n    @Override\n    public LockModeType getLockMode() {\n        return query.getLockMode();\n    }\n\n    @Override\n    public <T> T unwrap(Class<T> cls) {\n        return query.unwrap(cls);\n    }\n}\n"
  },
  {
    "path": "components/jpa/common/src/main/java/com/kumuluz/ee/jpa/common/jta/NonTxStoredProcedureQueryWrapper.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.common.jta;\n\nimport javax.persistence.*;\nimport java.util.*;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic class NonTxStoredProcedureQueryWrapper implements StoredProcedureQuery {\n\n    private StoredProcedureQuery storedProcedureQuery;\n    private EntityManager em;\n\n    public NonTxStoredProcedureQueryWrapper(StoredProcedureQuery storedProcedureQuery, EntityManager em) {\n        this.storedProcedureQuery = storedProcedureQuery;\n        this.em = em;\n    }\n\n    @Override\n    public StoredProcedureQuery setHint(String hintName, Object value) {\n        storedProcedureQuery.setHint(hintName, value);\n        return this;\n    }\n\n    @Override\n    public Map<String, Object> getHints() {\n        return storedProcedureQuery.getHints();\n    }\n\n    @Override\n    public <T> StoredProcedureQuery setParameter(Parameter<T> param, T value) {\n        storedProcedureQuery.setParameter(param, value);\n        return this;\n    }\n\n    @Override\n    public StoredProcedureQuery setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType) {\n        storedProcedureQuery.setParameter(param, value, temporalType);\n        return this;\n    }\n\n    @Override\n    public StoredProcedureQuery setParameter(Parameter<Date> param, Date value, TemporalType temporalType) {\n        storedProcedureQuery.setParameter(param, value, temporalType);\n        return this;\n    }\n\n    @Override\n    public StoredProcedureQuery setParameter(String name, Object value) {\n        storedProcedureQuery.setParameter(name, value);\n        return this;\n    }\n\n    @Override\n    public StoredProcedureQuery setParameter(String name, Calendar value, TemporalType temporalType) {\n        storedProcedureQuery.setParameter(name, value, temporalType);\n        return this;\n    }\n\n    @Override\n    public StoredProcedureQuery setParameter(String name, Date value, TemporalType temporalType) {\n        storedProcedureQuery.setParameter(name, value, temporalType);\n        return this;\n    }\n\n    @Override\n    public StoredProcedureQuery setParameter(int position, Object value) {\n        storedProcedureQuery.setParameter(position, value);\n        return this;\n    }\n\n    @Override\n    public StoredProcedureQuery setParameter(int position, Calendar value, TemporalType temporalType) {\n        storedProcedureQuery.setParameter(position, value, temporalType);\n        return this;\n    }\n\n    @Override\n    public StoredProcedureQuery setParameter(int position, Date value, TemporalType temporalType) {\n        storedProcedureQuery.setParameter(position, value, temporalType);\n        return this;\n    }\n\n    @Override\n    public Set<Parameter<?>> getParameters() {\n        return storedProcedureQuery.getParameters();\n    }\n\n    @Override\n    public Parameter<?> getParameter(String name) {\n        return storedProcedureQuery.getParameter(name);\n    }\n\n    @Override\n    public <T> Parameter<T> getParameter(String name, Class<T> type) {\n        return storedProcedureQuery.getParameter(name, type);\n    }\n\n    @Override\n    public Parameter<?> getParameter(int position) {\n        return storedProcedureQuery.getParameter(position);\n    }\n\n    @Override\n    public <T> Parameter<T> getParameter(int position, Class<T> type) {\n        return storedProcedureQuery.getParameter(position, type);\n    }\n\n    @Override\n    public boolean isBound(Parameter<?> param) {\n        return storedProcedureQuery.isBound(param);\n    }\n\n    @Override\n    public <T> T getParameterValue(Parameter<T> param) {\n        return storedProcedureQuery.getParameterValue(param);\n    }\n\n    @Override\n    public Object getParameterValue(String name) {\n        return storedProcedureQuery.getParameterValue(name);\n    }\n\n    @Override\n    public Object getParameterValue(int position) {\n        return storedProcedureQuery.getParameterValue(position);\n    }\n\n    @Override\n    public StoredProcedureQuery setFlushMode(FlushModeType flushMode) {\n        storedProcedureQuery.setFlushMode(flushMode);\n        return this;\n    }\n\n    @Override\n    public FlushModeType getFlushMode() {\n        return storedProcedureQuery.getFlushMode();\n    }\n\n    @Override\n    public Query setLockMode(LockModeType lockMode) {\n        storedProcedureQuery.setLockMode(lockMode);\n        return this;\n    }\n\n    @Override\n    public LockModeType getLockMode() {\n        return storedProcedureQuery.getLockMode();\n    }\n\n    @Override\n    public <T> T unwrap(Class<T> cls) {\n        return storedProcedureQuery.unwrap(cls);\n    }\n\n    @Override\n    public StoredProcedureQuery registerStoredProcedureParameter(int position, Class type, ParameterMode mode) {\n        storedProcedureQuery.registerStoredProcedureParameter(position, type, mode);\n        return this;\n    }\n\n    @Override\n    public StoredProcedureQuery registerStoredProcedureParameter(String parameterName, Class type, ParameterMode mode) {\n        storedProcedureQuery.registerStoredProcedureParameter(parameterName, type, mode);\n        return this;\n    }\n\n    @Override\n    public Object getOutputParameterValue(int position) {\n        return storedProcedureQuery.getOutputParameterValue(position);\n    }\n\n    @Override\n    public Object getOutputParameterValue(String parameterName) {\n        return storedProcedureQuery.getOutputParameterValue(parameterName);\n    }\n\n    @Override\n    public boolean execute() {\n        return storedProcedureQuery.execute();\n    }\n\n    @Override\n    public int executeUpdate() {\n        return storedProcedureQuery.executeUpdate();\n    }\n\n    @Override\n    public Query setMaxResults(int maxResult) {\n        storedProcedureQuery.setMaxResults(maxResult);\n        return this;\n    }\n\n    @Override\n    public int getMaxResults() {\n        return storedProcedureQuery.getMaxResults();\n    }\n\n    @Override\n    public Query setFirstResult(int startPosition) {\n        storedProcedureQuery.setFirstResult(startPosition);\n        return this;\n    }\n\n    @Override\n    public int getFirstResult() {\n        return storedProcedureQuery.getFirstResult();\n    }\n\n    @Override\n    public List getResultList() {\n\n        List resultList = storedProcedureQuery.getResultList();\n\n        em.clear();\n\n        return resultList;\n    }\n\n    @Override\n    public Object getSingleResult() {\n\n        Object singleResult = storedProcedureQuery.getSingleResult();\n\n        em.clear();\n\n        return singleResult;\n    }\n\n    @Override\n    public boolean hasMoreResults() {\n        return storedProcedureQuery.hasMoreResults();\n    }\n\n    @Override\n    public int getUpdateCount() {\n        return storedProcedureQuery.getUpdateCount();\n    }\n}\n"
  },
  {
    "path": "components/jpa/common/src/main/java/com/kumuluz/ee/jpa/common/jta/NonTxTypedQueryWrapper.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.common.jta;\n\nimport javax.persistence.*;\nimport java.util.*;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic class NonTxTypedQueryWrapper<X> implements TypedQuery<X> {\n\n    private TypedQuery<X> typedQuery;\n    private EntityManager em;\n\n    public NonTxTypedQueryWrapper(TypedQuery<X> typedQuery, EntityManager em) {\n        this.typedQuery = typedQuery;\n        this.em = em;\n    }\n\n    @Override\n    public List<X> getResultList() {\n\n        List<X> resultList = typedQuery.getResultList();\n\n        em.clear();\n\n        return resultList;\n    }\n\n    @Override\n    public X getSingleResult() {\n\n        X singleResult = typedQuery.getSingleResult();\n\n        em.clear();\n\n        return singleResult;\n    }\n\n    @Override\n    public int executeUpdate() {\n        return typedQuery.executeUpdate();\n    }\n\n    @Override\n    public TypedQuery<X> setMaxResults(int maxResult) {\n        typedQuery.setMaxResults(maxResult);\n        return this;\n    }\n\n    @Override\n    public int getMaxResults() {\n        return typedQuery.getMaxResults();\n    }\n\n    @Override\n    public TypedQuery<X> setFirstResult(int startPosition) {\n        typedQuery.setFirstResult(startPosition);\n        return this;\n    }\n\n    @Override\n    public int getFirstResult() {\n        return typedQuery.getFirstResult();\n    }\n\n    @Override\n    public TypedQuery<X> setHint(String hintName, Object value) {\n        typedQuery.setHint(hintName, value);\n        return this;\n    }\n\n    @Override\n    public Map<String, Object> getHints() {\n        return typedQuery.getHints();\n    }\n\n    @Override\n    public <T> TypedQuery<X> setParameter(Parameter<T> param, T value) {\n        typedQuery.setParameter(param, value);\n        return this;\n    }\n\n    @Override\n    public TypedQuery<X> setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType) {\n        typedQuery.setParameter(param, value, temporalType);\n        return this;\n    }\n\n    @Override\n    public TypedQuery<X> setParameter(Parameter<Date> param, Date value, TemporalType temporalType) {\n        typedQuery.setParameter(param, value, temporalType);\n        return this;\n    }\n\n    @Override\n    public TypedQuery<X> setParameter(String name, Object value) {\n        typedQuery.setParameter(name, value);\n        return this;\n    }\n\n    @Override\n    public TypedQuery<X> setParameter(String name, Calendar value, TemporalType temporalType) {\n        typedQuery.setParameter(name, value, temporalType);\n        return this;\n    }\n\n    @Override\n    public TypedQuery<X> setParameter(String name, Date value, TemporalType temporalType) {\n        typedQuery.setParameter(name, value, temporalType);\n        return this;\n    }\n\n    @Override\n    public TypedQuery<X> setParameter(int position, Object value) {\n        typedQuery.setParameter(position, value);\n        return this;\n    }\n\n    @Override\n    public TypedQuery<X> setParameter(int position, Calendar value, TemporalType temporalType) {\n        typedQuery.setParameter(position, value, temporalType);\n        return this;\n    }\n\n    @Override\n    public TypedQuery<X> setParameter(int position, Date value, TemporalType temporalType) {\n        typedQuery.setParameter(position, value, temporalType);\n        return this;\n    }\n\n    @Override\n    public Set<Parameter<?>> getParameters() {\n        return typedQuery.getParameters();\n    }\n\n    @Override\n    public Parameter<?> getParameter(String name) {\n        return typedQuery.getParameter(name);\n    }\n\n    @Override\n    public <T> Parameter<T> getParameter(String name, Class<T> type) {\n        return typedQuery.getParameter(name, type);\n    }\n\n    @Override\n    public Parameter<?> getParameter(int position) {\n        return typedQuery.getParameter(position);\n    }\n\n    @Override\n    public <T> Parameter<T> getParameter(int position, Class<T> type) {\n        return typedQuery.getParameter(position, type);\n    }\n\n    @Override\n    public boolean isBound(Parameter<?> param) {\n        return typedQuery.isBound(param);\n    }\n\n    @Override\n    public <T> T getParameterValue(Parameter<T> param) {\n        return typedQuery.getParameterValue(param);\n    }\n\n    @Override\n    public Object getParameterValue(String name) {\n        return typedQuery.getParameterValue(name);\n    }\n\n    @Override\n    public Object getParameterValue(int position) {\n        return typedQuery.getParameterValue(position);\n    }\n\n    @Override\n    public TypedQuery<X> setFlushMode(FlushModeType flushMode) {\n        typedQuery.setFlushMode(flushMode);\n        return this;\n    }\n\n    @Override\n    public FlushModeType getFlushMode() {\n        return typedQuery.getFlushMode();\n    }\n\n    @Override\n    public TypedQuery<X> setLockMode(LockModeType lockMode) {\n        typedQuery.setLockMode(lockMode);\n        return this;\n    }\n\n    @Override\n    public LockModeType getLockMode() {\n        return typedQuery.getLockMode();\n    }\n\n    @Override\n    public <T> T unwrap(Class<T> cls) {\n        return typedQuery.unwrap(cls);\n    }\n}\n"
  },
  {
    "path": "components/jpa/common/src/main/java/com/kumuluz/ee/jpa/common/jta/SyncEntityManagerWrapper.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.common.jta;\n\nimport javax.persistence.*;\nimport javax.persistence.criteria.CriteriaBuilder;\nimport javax.persistence.criteria.CriteriaDelete;\nimport javax.persistence.criteria.CriteriaQuery;\nimport javax.persistence.criteria.CriteriaUpdate;\nimport javax.persistence.metamodel.Metamodel;\nimport java.util.List;\nimport java.util.Map;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic class SyncEntityManagerWrapper implements EntityManager {\n\n    private EntityManager em;\n    private SynchronizationType sync;\n\n    public SyncEntityManagerWrapper(EntityManager em, SynchronizationType sync) {\n        this.em = em;\n        this.sync = sync;\n    }\n\n    public SynchronizationType getSynchronizationType() {\n        return sync;\n    }\n\n    @Override\n    public void persist(Object entity) {\n        em.persist(entity);\n    }\n\n    @Override\n    public <T> T merge(T entity) {\n        return em.merge(entity);\n    }\n\n    @Override\n    public void remove(Object entity) {\n        em.remove(entity);\n    }\n\n    @Override\n    public <T> T find(Class<T> entityClass, Object primaryKey) {\n        return em.find(entityClass, primaryKey);\n    }\n\n    @Override\n    public <T> T find(Class<T> entityClass, Object primaryKey, Map<String, Object> properties) {\n        return em.find(entityClass, primaryKey, properties);\n    }\n\n    @Override\n    public <T> T find(Class<T> entityClass, Object primaryKey, LockModeType lockMode) {\n        return em.find(entityClass, primaryKey, lockMode);\n    }\n\n    @Override\n    public <T> T find(Class<T> entityClass, Object primaryKey, LockModeType lockMode, Map<String, Object> properties) {\n        return em.find(entityClass, primaryKey, lockMode, properties);\n    }\n\n    @Override\n    public <T> T getReference(Class<T> entityClass, Object primaryKey) {\n        return em.getReference(entityClass, primaryKey);\n    }\n\n    @Override\n    public void flush() {\n        em.flush();\n    }\n\n    @Override\n    public void setFlushMode(FlushModeType flushMode) {\n        em.setFlushMode(flushMode);\n    }\n\n    @Override\n    public FlushModeType getFlushMode() {\n        return em.getFlushMode();\n    }\n\n    @Override\n    public void lock(Object entity, LockModeType lockMode) {\n        em.lock(entity, lockMode);\n    }\n\n    @Override\n    public void lock(Object entity, LockModeType lockMode, Map<String, Object> properties) {\n        em.lock(entity, lockMode, properties);\n    }\n\n    @Override\n    public void refresh(Object entity) {\n        em.refresh(entity);\n    }\n\n    @Override\n    public void refresh(Object entity, Map<String, Object> properties) {\n        em.refresh(entity, properties);\n    }\n\n    @Override\n    public void refresh(Object entity, LockModeType lockMode) {\n        em.refresh(entity, lockMode);\n    }\n\n    @Override\n    public void refresh(Object entity, LockModeType lockMode, Map<String, Object> properties) {\n        em.refresh(entity, lockMode, properties);\n    }\n\n    @Override\n    public void clear() {\n        em.clear();\n    }\n\n    @Override\n    public void detach(Object entity) {\n        em.detach(entity);\n    }\n\n    @Override\n    public boolean contains(Object entity) {\n        return em.contains(entity);\n    }\n\n    @Override\n    public LockModeType getLockMode(Object entity) {\n        return em.getLockMode(entity);\n    }\n\n    @Override\n    public void setProperty(String propertyName, Object value) {\n        em.setProperty(propertyName, value);\n    }\n\n    @Override\n    public Map<String, Object> getProperties() {\n        return em.getProperties();\n    }\n\n    @Override\n    public Query createQuery(String qlString) {\n        return em.createQuery(qlString);\n    }\n\n    @Override\n    public <T> TypedQuery<T> createQuery(CriteriaQuery<T> criteriaQuery) {\n        return em.createQuery(criteriaQuery);\n    }\n\n    @Override\n    public Query createQuery(CriteriaUpdate updateQuery) {\n        return em.createQuery(updateQuery);\n    }\n\n    @Override\n    public Query createQuery(CriteriaDelete deleteQuery) {\n        return em.createQuery(deleteQuery);\n    }\n\n    @Override\n    public <T> TypedQuery<T> createQuery(String qlString, Class<T> resultClass) {\n        return em.createQuery(qlString, resultClass);\n    }\n\n    @Override\n    public Query createNamedQuery(String name) {\n        return em.createNamedQuery(name);\n    }\n\n    @Override\n    public <T> TypedQuery<T> createNamedQuery(String name, Class<T> resultClass) {\n        return em.createNamedQuery(name, resultClass);\n    }\n\n    @Override\n    public Query createNativeQuery(String sqlString) {\n        return em.createNativeQuery(sqlString);\n    }\n\n    @Override\n    public Query createNativeQuery(String sqlString, Class resultClass) {\n        return em.createNativeQuery(sqlString, resultClass);\n    }\n\n    @Override\n    public Query createNativeQuery(String sqlString, String resultSetMapping) {\n        return em.createNativeQuery(sqlString, resultSetMapping);\n    }\n\n    @Override\n    public StoredProcedureQuery createNamedStoredProcedureQuery(String name) {\n        return em.createNamedStoredProcedureQuery(name);\n    }\n\n    @Override\n    public StoredProcedureQuery createStoredProcedureQuery(String procedureName) {\n        return em.createNamedStoredProcedureQuery(procedureName);\n    }\n\n    @Override\n    public StoredProcedureQuery createStoredProcedureQuery(String procedureName, Class... resultClasses) {\n        return em.createStoredProcedureQuery(procedureName, resultClasses);\n    }\n\n    @Override\n    public StoredProcedureQuery createStoredProcedureQuery(String procedureName, String... resultSetMappings) {\n        return em.createStoredProcedureQuery(procedureName, resultSetMappings);\n    }\n\n    @Override\n    public void joinTransaction() {\n        em.joinTransaction();\n    }\n\n    @Override\n    public boolean isJoinedToTransaction() {\n        return em.isJoinedToTransaction();\n    }\n\n    @Override\n    public <T> T unwrap(Class<T> cls) {\n        return em.unwrap(cls);\n    }\n\n    @Override\n    public Object getDelegate() {\n        return em.getDelegate();\n    }\n\n    @Override\n    public void close() {\n        em.close();\n    }\n\n    @Override\n    public boolean isOpen() {\n        return em.isOpen();\n    }\n\n    @Override\n    public EntityTransaction getTransaction() {\n        return em.getTransaction();\n    }\n\n    @Override\n    public EntityManagerFactory getEntityManagerFactory() {\n        return em.getEntityManagerFactory();\n    }\n\n    @Override\n    public CriteriaBuilder getCriteriaBuilder() {\n        return em.getCriteriaBuilder();\n    }\n\n    @Override\n    public Metamodel getMetamodel() {\n        return em.getMetamodel();\n    }\n\n    @Override\n    public <T> EntityGraph<T> createEntityGraph(Class<T> rootType) {\n        return em.createEntityGraph(rootType);\n    }\n\n    @Override\n    public EntityGraph<?> createEntityGraph(String graphName) {\n        return em.createEntityGraph(graphName);\n    }\n\n    @Override\n    public EntityGraph<?> getEntityGraph(String graphName) {\n        return em.getEntityGraph(graphName);\n    }\n\n    @Override\n    public <T> List<EntityGraph<? super T>> getEntityGraphs(Class<T> entityClass) {\n        return em.getEntityGraphs(entityClass);\n    }\n}\n"
  },
  {
    "path": "components/jpa/common/src/main/java/com/kumuluz/ee/jpa/common/jta/TxScopedEntityManager.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.common.jta;\n\nimport com.kumuluz.ee.jta.common.utils.TxUtils;\n\nimport javax.persistence.*;\nimport javax.persistence.criteria.CriteriaBuilder;\nimport javax.persistence.criteria.CriteriaDelete;\nimport javax.persistence.criteria.CriteriaQuery;\nimport javax.persistence.criteria.CriteriaUpdate;\nimport javax.persistence.metamodel.Metamodel;\nimport javax.transaction.TransactionManager;\nimport javax.transaction.TransactionSynchronizationRegistry;\nimport java.util.List;\nimport java.util.Map;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic class TxScopedEntityManager implements EntityManager {\n\n    private String unitName;\n    private EntityManagerFactory emf;\n    private SynchronizationType sync;\n    private TransactionManager transactionManager;\n    private TransactionSynchronizationRegistry transactionSynchronizationRegistry;\n    private NonTxEntityManagerHolder nonTxEmHolder;\n\n    public TxScopedEntityManager(String unitName, EntityManagerFactory emf, SynchronizationType sync, TransactionManager transactionManager, TransactionSynchronizationRegistry transactionSynchronizationRegistry, NonTxEntityManagerHolder nonTxEmHolder) {\n        this.unitName = unitName;\n        this.emf = emf;\n        this.sync = sync;\n        this.transactionManager = transactionManager;\n        this.transactionSynchronizationRegistry = transactionSynchronizationRegistry;\n        this.nonTxEmHolder = nonTxEmHolder;\n    }\n\n    @Override\n    public void persist(Object entity) {\n\n        validateActiveTransaction();\n\n        getEntityManager().persist(entity);\n    }\n\n    @Override\n    public <T> T merge(T entity) {\n\n        validateActiveTransaction();\n\n        return getEntityManager().merge(entity);\n    }\n\n    @Override\n    public void remove(Object entity) {\n\n        validateActiveTransaction();\n\n        getEntityManager().remove(entity);\n    }\n\n    @Override\n    public <T> T find(Class<T> entityClass, Object primaryKey) {\n\n        EntityManager em = getEntityManager();\n\n        T result = em.find(entityClass, primaryKey);\n\n        detachLoadedNonTxEntities(em);\n\n        return result;\n    }\n\n    @Override\n    public <T> T find(Class<T> entityClass, Object primaryKey, Map<String, Object> properties) {\n\n        EntityManager em = getEntityManager();\n\n        T result = em.find(entityClass, primaryKey, properties);\n\n        detachLoadedNonTxEntities(em);\n\n        return result;\n    }\n\n    @Override\n    public <T> T find(Class<T> entityClass, Object primaryKey, LockModeType lockMode) {\n\n        EntityManager em = getEntityManager();\n\n        T result = em.find(entityClass, primaryKey, lockMode);\n\n        detachLoadedNonTxEntities(em);\n\n        return result;\n    }\n\n    @Override\n    public <T> T find(Class<T> entityClass, Object primaryKey, LockModeType lockMode, Map<String, Object> properties) {\n\n        EntityManager em = getEntityManager();\n\n        T result = em.find(entityClass, primaryKey, lockMode, properties);\n\n        detachLoadedNonTxEntities(em);\n\n        return result;\n    }\n\n    @Override\n    public <T> T getReference(Class<T> entityClass, Object primaryKey) {\n\n        EntityManager em = getEntityManager();\n\n        T result = em.getReference(entityClass, primaryKey);\n\n        detachLoadedNonTxEntities(em);\n\n        return result;\n    }\n\n    @Override\n    public void flush() {\n\n        getEntityManager().flush();\n    }\n\n    @Override\n    public void setFlushMode(FlushModeType flushMode) {\n\n        getEntityManager().setFlushMode(flushMode);\n    }\n\n    @Override\n    public FlushModeType getFlushMode() {\n\n        return getEntityManager().getFlushMode();\n    }\n\n    @Override\n    public void lock(Object entity, LockModeType lockMode) {\n\n        getEntityManager().lock(entity, lockMode);\n    }\n\n    @Override\n    public void lock(Object entity, LockModeType lockMode, Map<String, Object> properties) {\n\n        getEntityManager().lock(entity, lockMode, properties);\n    }\n\n    @Override\n    public void refresh(Object entity) {\n\n        validateActiveTransaction();\n\n        getEntityManager().refresh(entity);\n    }\n\n    @Override\n    public void refresh(Object entity, Map<String, Object> properties) {\n\n        validateActiveTransaction();\n\n        getEntityManager().refresh(entity, properties);\n    }\n\n    @Override\n    public void refresh(Object entity, LockModeType lockMode) {\n\n        validateActiveTransaction();\n\n        getEntityManager().refresh(entity, lockMode);\n    }\n\n    @Override\n    public void refresh(Object entity, LockModeType lockMode, Map<String, Object> properties) {\n\n        validateActiveTransaction();\n\n        getEntityManager().refresh(entity, lockMode, properties);\n    }\n\n    @Override\n    public void clear() {\n\n        getEntityManager().clear();\n    }\n\n    @Override\n    public void detach(Object entity) {\n\n        getEntityManager().detach(entity);\n    }\n\n    @Override\n    public boolean contains(Object entity) {\n\n        return getEntityManager().contains(entity);\n    }\n\n    @Override\n    public LockModeType getLockMode(Object entity) {\n\n        return getEntityManager().getLockMode(entity);\n    }\n\n    @Override\n    public void setProperty(String propertyName, Object value) {\n\n        getEntityManager().setProperty(propertyName, value);\n    }\n\n    @Override\n    public Map<String, Object> getProperties() {\n\n        return getEntityManager().getProperties();\n    }\n\n    @Override\n    public Query createQuery(String qlString) {\n\n        EntityManager em = getEntityManager();\n\n        Query query = em.createQuery(qlString);\n\n        return detachLoadedNonTxQueryEntities(query, em);\n    }\n\n    @Override\n    public <T> TypedQuery<T> createQuery(CriteriaQuery<T> criteriaQuery) {\n\n        EntityManager em = getEntityManager();\n\n        TypedQuery<T> typedQuery = em.createQuery(criteriaQuery);\n\n        return detachLoadedNonTxTypedQueryEntities(typedQuery, em);\n    }\n\n    @Override\n    public Query createQuery(CriteriaUpdate updateQuery) {\n\n        return getEntityManager().createQuery(updateQuery);\n    }\n\n    @Override\n    public Query createQuery(CriteriaDelete deleteQuery) {\n\n        return getEntityManager().createQuery(deleteQuery);\n    }\n\n    @Override\n    public <T> TypedQuery<T> createQuery(String qlString, Class<T> resultClass) {\n\n        EntityManager em = getEntityManager();\n\n        TypedQuery<T> typedQuery = em.createQuery(qlString, resultClass);\n\n        return detachLoadedNonTxTypedQueryEntities(typedQuery, em);\n    }\n\n    @Override\n    public Query createNamedQuery(String name) {\n\n        EntityManager em = getEntityManager();\n\n        Query query = em.createNamedQuery(name);\n\n        return detachLoadedNonTxQueryEntities(query, em);\n    }\n\n    @Override\n    public <T> TypedQuery<T> createNamedQuery(String name, Class<T> resultClass) {\n\n        EntityManager em = getEntityManager();\n\n        TypedQuery<T> typedQuery = em.createNamedQuery(name, resultClass);\n\n        return detachLoadedNonTxTypedQueryEntities(typedQuery, em);\n    }\n\n    @Override\n    public Query createNativeQuery(String sqlString) {\n\n        EntityManager em = getEntityManager();\n\n        Query query = em.createNativeQuery(sqlString);\n\n        return detachLoadedNonTxQueryEntities(query, em);\n    }\n\n    @Override\n    public Query createNativeQuery(String sqlString, Class resultClass) {\n\n        EntityManager em = getEntityManager();\n\n        Query query = em.createNativeQuery(sqlString, resultClass);\n\n        return detachLoadedNonTxQueryEntities(query, em);\n    }\n\n    @Override\n    public Query createNativeQuery(String sqlString, String resultSetMapping) {\n\n        EntityManager em = getEntityManager();\n\n        Query query = em.createNativeQuery(sqlString, resultSetMapping);\n\n        return detachLoadedNonTxQueryEntities(query, em);\n    }\n\n    @Override\n    public StoredProcedureQuery createNamedStoredProcedureQuery(String name) {\n\n        EntityManager em = getEntityManager();\n\n        StoredProcedureQuery storedProcedureQuery = em.createNamedStoredProcedureQuery(name);\n\n        return detachLoadedNonTxStoredProcedureQueryEntities(storedProcedureQuery, em);\n    }\n\n    @Override\n    public StoredProcedureQuery createStoredProcedureQuery(String procedureName) {\n\n        EntityManager em = getEntityManager();\n\n        StoredProcedureQuery storedProcedureQuery = em.createStoredProcedureQuery(procedureName);\n\n        return detachLoadedNonTxStoredProcedureQueryEntities(storedProcedureQuery, em);\n    }\n\n    @Override\n    public StoredProcedureQuery createStoredProcedureQuery(String procedureName, Class... resultClasses) {\n\n        EntityManager em = getEntityManager();\n\n        StoredProcedureQuery storedProcedureQuery = em.createStoredProcedureQuery(procedureName, resultClasses);\n\n        return detachLoadedNonTxStoredProcedureQueryEntities(storedProcedureQuery, em);\n    }\n\n    @Override\n    public StoredProcedureQuery createStoredProcedureQuery(String procedureName, String... resultSetMappings) {\n\n        EntityManager em = getEntityManager();\n\n        StoredProcedureQuery storedProcedureQuery = em.createStoredProcedureQuery(procedureName, resultSetMappings);\n\n        return detachLoadedNonTxStoredProcedureQueryEntities(storedProcedureQuery, em);\n    }\n\n    @Override\n    public void joinTransaction() {\n\n        getEntityManager().joinTransaction();\n    }\n\n    @Override\n    public boolean isJoinedToTransaction() {\n\n        return getEntityManager().isJoinedToTransaction();\n    }\n\n    @Override\n    public <T> T unwrap(Class<T> cls) {\n\n        return getEntityManager().unwrap(cls);\n    }\n\n    @Override\n    public Object getDelegate() {\n\n        return getEntityManager().getDelegate();\n    }\n\n    @Override\n    public void close() {\n\n        throw new IllegalStateException(\"Cannot closed a transaction managed entity manager.\");\n    }\n\n    @Override\n    public boolean isOpen() {\n\n        return getEntityManager().isOpen();\n    }\n\n    @Override\n    public EntityTransaction getTransaction() {\n\n        return getEntityManager().getTransaction();\n    }\n\n    @Override\n    public EntityManagerFactory getEntityManagerFactory() {\n\n        return getEntityManager().getEntityManagerFactory();\n    }\n\n    @Override\n    public CriteriaBuilder getCriteriaBuilder() {\n\n        return getEntityManager().getCriteriaBuilder();\n    }\n\n    @Override\n    public Metamodel getMetamodel() {\n\n        return getEntityManager().getMetamodel();\n    }\n\n    @Override\n    public <T> EntityGraph<T> createEntityGraph(Class<T> rootType) {\n\n        return getEntityManager().createEntityGraph(rootType);\n    }\n\n    @Override\n    public EntityGraph<?> createEntityGraph(String graphName) {\n\n        return getEntityManager().createEntityGraph(graphName);\n    }\n\n    @Override\n    public EntityGraph<?> getEntityGraph(String graphName) {\n\n        return getEntityManager().getEntityGraph(graphName);\n    }\n\n    @Override\n    public <T> List<EntityGraph<? super T>> getEntityGraphs(Class<T> entityClass) {\n\n        return getEntityManager().getEntityGraphs(entityClass);\n    }\n\n    //// Private logic methods\n\n    private EntityManager getEntityManager() {\n\n        EntityManager em;\n\n        if (TxUtils.isActive(transactionManager)) {\n\n            em = (EntityManager) transactionSynchronizationRegistry.getResource(unitName);\n\n            if (em == null) {\n\n                em = createEntityManager();\n\n                transactionSynchronizationRegistry.registerInterposedSynchronization(new TxSynchronization(em));\n                transactionSynchronizationRegistry.putResource(unitName, em);\n            } else {\n\n                validateCompatibleSyncTypes(em);\n            }\n        } else {\n\n            em = nonTxEmHolder.getEntityManager();\n\n            if (em == null) {\n\n                em = createEntityManager();\n\n                nonTxEmHolder.setEntityManager(em);\n            }\n        }\n\n        return em;\n    }\n\n    private EntityManager createEntityManager() {\n\n        if (sync.equals(SynchronizationType.UNSYNCHRONIZED)) {\n\n            return new SyncEntityManagerWrapper(emf.createEntityManager(sync), sync);\n        }\n\n        return emf.createEntityManager();\n    }\n\n    private void detachLoadedNonTxEntities(EntityManager em) {\n\n        if (!TxUtils.isActive(transactionManager)) {\n\n            em.clear();\n        }\n    }\n\n    private Query detachLoadedNonTxQueryEntities(Query query, EntityManager em) {\n\n        if (!TxUtils.isActive(transactionManager)) {\n\n            return new NonTxQueryWrapper(query, em);\n        }\n\n        return query;\n    }\n\n    private <T> TypedQuery<T> detachLoadedNonTxTypedQueryEntities(TypedQuery<T> query, EntityManager em) {\n\n        if (!TxUtils.isActive(transactionManager)) {\n\n            return new NonTxTypedQueryWrapper<>(query, em);\n        }\n\n        return query;\n    }\n\n    private StoredProcedureQuery detachLoadedNonTxStoredProcedureQueryEntities(StoredProcedureQuery procedureQuery, EntityManager em) {\n\n        if (!TxUtils.isActive(transactionManager)) {\n\n            return new NonTxStoredProcedureQueryWrapper(procedureQuery, em);\n        }\n\n        return procedureQuery;\n    }\n\n    private void validateActiveTransaction() {\n\n        if (!TxUtils.isActive(transactionManager)) {\n\n            throw new TransactionRequiredException(\"An active transaction is required in order to perform this function.\");\n        }\n    }\n\n    private void validateCompatibleSyncTypes(EntityManager existingEm) {\n\n        if (existingEm instanceof SyncEntityManagerWrapper &&\n                ((SyncEntityManagerWrapper) existingEm).getSynchronizationType().equals(sync)) {\n\n            throw new IllegalStateException(\"Incompatible SynchronizationType for the same PersistenceContext across \" +\n                    \"multiple injection points. The SynchronizationType can not be SYNCHRONIZED if a \" +\n                    \"previous one that is UNSYCHRONIZED already exists.\");\n        }\n    }\n}\n"
  },
  {
    "path": "components/jpa/common/src/main/java/com/kumuluz/ee/jpa/common/jta/TxScopedEntityManagerFactory.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.common.jta;\n\nimport com.kumuluz.ee.jpa.common.injection.EntityManagerWrapper;\nimport com.kumuluz.ee.jta.common.JtaProvider;\n\nimport javax.persistence.EntityManager;\nimport javax.persistence.EntityManagerFactory;\nimport javax.persistence.SynchronizationType;\nimport javax.transaction.TransactionManager;\nimport javax.transaction.TransactionSynchronizationRegistry;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic class TxScopedEntityManagerFactory {\n\n    public static EntityManagerWrapper buildEntityManagerWrapper(String unitName, EntityManagerFactory emf, SynchronizationType sync) {\n\n        JtaProvider jtaProvider = JtaProvider.getInstance();\n\n        TransactionManager transactionManager = jtaProvider.getTransactionManager();\n        TransactionSynchronizationRegistry transactionSynchronizationRegistry = jtaProvider.getTransactionSynchronizationRegistry();\n\n        NonTxEntityManagerHolder emHolder = new NonTxEntityManagerHolder();\n\n        EntityManager em = new TxScopedEntityManager(unitName, emf, sync, transactionManager, transactionSynchronizationRegistry, emHolder);\n\n        return new TxScopedEntityManagerWrapper(em, emHolder);\n    }\n}\n"
  },
  {
    "path": "components/jpa/common/src/main/java/com/kumuluz/ee/jpa/common/jta/TxScopedEntityManagerWrapper.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.common.jta;\n\nimport com.kumuluz.ee.jpa.common.injection.EntityManagerWrapper;\nimport com.kumuluz.ee.jpa.common.jta.NonTxEntityManagerHolder;\n\nimport javax.persistence.EntityManager;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic class TxScopedEntityManagerWrapper implements EntityManagerWrapper {\n\n    private EntityManager em;\n    private NonTxEntityManagerHolder nonTxEmHolder;\n\n    public TxScopedEntityManagerWrapper(EntityManager em, NonTxEntityManagerHolder nonTxEmHolder) {\n        this.em = em;\n        this.nonTxEmHolder = nonTxEmHolder;\n    }\n\n    @Override\n    public EntityManager getEntityManager() {\n        return em;\n    }\n\n    @Override\n    public void close() {\n\n        EntityManager nonTxEm = nonTxEmHolder.getEntityManager();\n\n        if (nonTxEm != null && nonTxEm.isOpen()) {\n\n            nonTxEm.close();\n\n            nonTxEmHolder.setEntityManager(null);\n        }\n    }\n}\n"
  },
  {
    "path": "components/jpa/common/src/main/java/com/kumuluz/ee/jpa/common/jta/TxSynchronization.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.common.jta;\n\nimport javax.persistence.EntityManager;\nimport javax.transaction.Synchronization;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic class TxSynchronization implements Synchronization {\n\n    private EntityManager em;\n\n    public TxSynchronization(EntityManager em) {\n        this.em = em;\n    }\n\n    @Override\n    public void beforeCompletion() {\n    }\n\n    @Override\n    public void afterCompletion(int status) {\n\n        if (em != null && em.isOpen()) {\n\n            em.close();\n        }\n    }\n}\n"
  },
  {
    "path": "components/jpa/common/src/main/java/com/kumuluz/ee/jpa/common/utils/PersistenceUtils.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.common.utils;\n\nimport com.kumuluz.ee.jpa.common.TransactionType;\nimport org.w3c.dom.Document;\nimport org.w3c.dom.NodeList;\nimport org.xml.sax.SAXException;\n\nimport javax.persistence.EntityManager;\nimport javax.persistence.EntityManagerFactory;\nimport javax.xml.parsers.DocumentBuilder;\nimport javax.xml.parsers.DocumentBuilderFactory;\nimport javax.xml.parsers.ParserConfigurationException;\nimport java.io.IOException;\nimport java.net.URL;\nimport java.util.Enumeration;\nimport java.util.Optional;\n\n/**\n * @author Tilen Faganel\n * @since 2.3.0\n */\npublic class PersistenceUtils {\n\n    private static final String PERSISTENCE_XML = \"META-INF/persistence.xml\";\n\n    public static TransactionType getEntityManagerFactoryTransactionType(EntityManagerFactory emf) {\n\n        EntityManager manager = emf.createEntityManager();\n\n        // Hibernate does not throw exception when getTransaction() in JTA context is called, this is the workaround\n        // for JTA detection\n        if (emf.getProperties().containsKey(\"hibernate.transaction.coordinator_class\") &&\n                emf.getProperties().get(\"hibernate.transaction.coordinator_class\") instanceof Class &&\n                ((Class) emf.getProperties().get(\"hibernate.transaction.coordinator_class\")).getSimpleName()\n                        .equals(\"JtaTransactionCoordinatorBuilderImpl\")) {\n            return TransactionType.JTA;\n        }\n\n        try {\n            manager.getTransaction();\n\n            return TransactionType.RESOURCE_LOCAL;\n        } catch (IllegalStateException e) {\n\n            manager.close();\n            return TransactionType.JTA;\n        }\n    }\n\n    public static Optional<String> getDefaultUnitName() {\n\n        Document document;\n\n        try {\n            Enumeration<URL> enumeration = PersistenceUtils.class.getClassLoader().getResources(PERSISTENCE_XML);\n\n            if (!enumeration.hasMoreElements()) {\n                return Optional.empty();\n            }\n\n            enumeration.nextElement();\n\n            if (enumeration.hasMoreElements()) {\n                return Optional.empty();\n            }\n\n            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();\n            DocumentBuilder builder = factory.newDocumentBuilder();\n\n            document = builder.parse(PersistenceUtils.class.getClassLoader()\n                    .getResourceAsStream(PERSISTENCE_XML));\n\n        } catch (IOException | ParserConfigurationException | SAXException ex) {\n            return Optional.empty();\n        }\n\n        String rootElementName = document.getDocumentElement().getTagName();\n\n        if (!rootElementName.equals(\"persistence\")) {\n            return Optional.empty();\n        }\n\n        NodeList childNodes = document.getDocumentElement().getElementsByTagName(\"persistence-unit\");\n\n        if (childNodes.getLength() != 1) {\n            return Optional.empty();\n        }\n\n        String pu = childNodes.item(0).getNodeName();\n\n        if (!pu.equals(\"persistence-unit\")) {\n            return Optional.empty();\n        }\n\n        String puName = childNodes.item(0).getAttributes().getNamedItem(\"name\").getNodeValue();\n\n        if (puName != null && !puName.isEmpty()) {\n            return Optional.of(puName);\n        }\n\n        return Optional.empty();\n    }\n}\n"
  },
  {
    "path": "components/jpa/common/src/main/resources/META-INF/services/org.jboss.weld.bootstrap.api.Service",
    "content": "com.kumuluz.ee.jpa.common.injection.JpaService"
  },
  {
    "path": "components/jpa/eclipselink/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-jpa</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE JPA EclipseLink</name>\n    <description>KumuluzEE JPA component implemented by EclipseLink</description>\n\n    <artifactId>kumuluzee-jpa-eclipselink</artifactId>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-jpa-common</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>jakarta.persistence</groupId>\n            <artifactId>jakarta.persistence-api</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.eclipse.persistence</groupId>\n            <artifactId>org.eclipse.persistence.jpa</artifactId>\n            <version>${eclipselink.version}</version>\n            <exclusions>\n                <exclusion>\n                    <groupId>org.eclipse.persistence</groupId>\n                    <artifactId>javax.persistence</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>org.glassfish</groupId>\n                    <artifactId>javax.json</artifactId>\n                </exclusion>\n            </exclusions>\n        </dependency>\n\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-jta-common</artifactId>\n            <scope>provided</scope>\n        </dependency>\n    </dependencies>\n\n</project>"
  },
  {
    "path": "components/jpa/eclipselink/src/main/java/com/kumuluz/ee/jpa/eclipselink/EclipseLinkSettings.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.eclipselink;\n\nimport com.kumuluz.ee.jpa.common.PersistenceSettings;\nimport org.eclipse.persistence.config.PersistenceUnitProperties;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\n/**\n * @author Tilen Faganel\n * @since 2.3.0\n */\npublic class EclipseLinkSettings implements PersistenceSettings {\n\n    private Map<String, String> properties = new HashMap<>();\n\n    private Boolean jtaPresent;\n\n    EclipseLinkSettings(Boolean jtaPresent) {\n        this.jtaPresent = jtaPresent;\n    }\n\n    @Override\n    public Map<String, String> getPersistenceUnitProperties() {\n\n        if (jtaPresent) {\n            properties.put(PersistenceUnitProperties.TARGET_SERVER, KumuluzPlatform.class.getName());\n        }\n\n        return properties;\n    }\n}\n"
  },
  {
    "path": "components/jpa/eclipselink/src/main/java/com/kumuluz/ee/jpa/eclipselink/JpaComponent.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.eclipselink;\n\nimport com.kumuluz.ee.common.Component;\nimport com.kumuluz.ee.common.config.EeConfig;\nimport com.kumuluz.ee.common.dependencies.EeComponentDef;\nimport com.kumuluz.ee.common.dependencies.EeComponentType;\nimport com.kumuluz.ee.common.runtime.EeRuntime;\nimport com.kumuluz.ee.common.wrapper.KumuluzServerWrapper;\nimport com.kumuluz.ee.jpa.common.PersistenceUnitHolder;\n\nimport java.util.logging.Logger;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\n@EeComponentDef(name = \"EclipseLink\", type = EeComponentType.JPA)\npublic class JpaComponent implements Component {\n\n    private Logger log = Logger.getLogger(JpaComponent.class.getSimpleName());\n\n    @Override\n    public void init(KumuluzServerWrapper server, EeConfig eeConfig) {\n\n        PersistenceUnitHolder holder = PersistenceUnitHolder.getInstance();\n\n        // Check if JTA is present in the runtime\n        Boolean jtaPresent = EeRuntime.getInstance().getEeComponents().stream().anyMatch(c -> c.getType().equals(EeComponentType.JTA));\n\n        holder.setProviderProperties(new EclipseLinkSettings(jtaPresent));\n    }\n\n    @Override\n    public void load() {\n\n        log.info(\"Initiating EclipseLink\");\n    }\n}\n"
  },
  {
    "path": "components/jpa/eclipselink/src/main/java/com/kumuluz/ee/jpa/eclipselink/KumuluzPlatform.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.eclipselink;\n\nimport org.eclipse.persistence.platform.server.ServerPlatformBase;\nimport org.eclipse.persistence.sessions.DatabaseSession;\n\n/**\n * @author Marcos Koch Salvador\n * @since 2.3.0\n */\npublic class KumuluzPlatform extends ServerPlatformBase {\n\n    public KumuluzPlatform(DatabaseSession newDatabaseSession) {\n        super(newDatabaseSession);\n    }\n\n    @Override\n    public Class<?> getExternalTransactionControllerClass() {\n        return KumuluzTransactionController.class;\n    }\n\n}\n"
  },
  {
    "path": "components/jpa/eclipselink/src/main/java/com/kumuluz/ee/jpa/eclipselink/KumuluzTransactionController.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.eclipselink;\n\nimport com.kumuluz.ee.jta.common.JtaProvider;\nimport org.eclipse.persistence.transaction.JTATransactionController;\n\nimport javax.transaction.TransactionManager;\n\n/**\n * @author Marcos Koch Salvador\n * @since 2.3.0\n */\npublic class KumuluzTransactionController extends JTATransactionController {\n\n    @Override\n    protected TransactionManager acquireTransactionManager() throws Exception {\n        return JtaProvider.getInstance().getTransactionManager();\n    }\n}\n"
  },
  {
    "path": "components/jpa/eclipselink/src/main/resources/META-INF/services/com.kumuluz.ee.common.Component",
    "content": "com.kumuluz.ee.jpa.eclipselink.JpaComponent"
  },
  {
    "path": "components/jpa/hibernate/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-jpa</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE JPA Hibernate</name>\n    <description>KumuluzEE JPA component implemented by Hibernate</description>\n\n    <artifactId>kumuluzee-jpa-hibernate</artifactId>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-jpa-common</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.hibernate</groupId>\n            <artifactId>hibernate-core</artifactId>\n            <version>${hibernate.version}</version>\n            <exclusions>\n                <exclusion>\n                    <groupId>org.jboss.spec.javax.transaction</groupId>\n                    <artifactId>jboss-transaction-api_1.2_spec</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>org.jboss</groupId>\n                    <artifactId>jandex</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>org.jboss.logging</groupId>\n                    <artifactId>jboss-logging</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>com.fasterxml</groupId>\n                    <artifactId>classmate</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>org.javassist</groupId>\n                    <artifactId>javassist</artifactId>\n                </exclusion>\n            </exclusions>\n        </dependency>\n        <dependency>\n            <groupId>org.jboss</groupId>\n            <artifactId>jandex</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>org.jboss.logging</groupId>\n            <artifactId>jboss-logging</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.fasterxml</groupId>\n            <artifactId>classmate</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>org.javassist</groupId>\n            <artifactId>javassist</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>javax.xml.bind</groupId>\n            <artifactId>jaxb-api</artifactId>\n            <version>${jaxb-api.version}</version>\n        </dependency>\n    </dependencies>\n\n</project>"
  },
  {
    "path": "components/jpa/hibernate/src/main/java/com/kumuluz/ee/jpa/hibernate/JpaComponent.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jpa.hibernate;\n\nimport com.kumuluz.ee.common.Component;\nimport com.kumuluz.ee.common.config.EeConfig;\nimport com.kumuluz.ee.common.dependencies.EeComponentDef;\nimport com.kumuluz.ee.common.dependencies.EeComponentType;\nimport com.kumuluz.ee.common.wrapper.KumuluzServerWrapper;\n\nimport java.util.logging.Logger;\n\n/**\n * @author Tilen Faganel\n * @since 2.1.0\n */\n@EeComponentDef(name = \"Hibernate\", type = EeComponentType.JPA)\npublic class JpaComponent implements Component {\n\n    private final Logger log = Logger.getLogger(JpaComponent.class.getSimpleName());\n\n    @Override\n    public void init(KumuluzServerWrapper server, EeConfig eeConfig) {\n    }\n\n    @Override\n    public void load() {\n\n        log.info(\"Initiating Hibernate\");\n    }\n}\n"
  },
  {
    "path": "components/jpa/hibernate/src/main/resources/META-INF/services/com.kumuluz.ee.common.Component",
    "content": "com.kumuluz.ee.jpa.hibernate.JpaComponent"
  },
  {
    "path": "components/jpa/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-components</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n    <packaging>pom</packaging>\n\n    <modules>\n        <module>eclipselink</module>\n        <module>hibernate</module>\n        <module>common</module>\n    </modules>\n\n    <name>KumuluzEE JPA</name>\n    <description>KumuluzEE JPA component</description>\n\n    <artifactId>kumuluzee-jpa</artifactId>\n\n</project>"
  },
  {
    "path": "components/jsf/mojarra/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-jsf</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE JSF Mojarra</name>\n    <description>KumuluzEE JSF component implemented by Mojarra</description>\n\n    <artifactId>kumuluzee-jsf-mojarra</artifactId>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-common</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>jakarta.websocket</groupId>\n            <artifactId>jakarta.websocket-api</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>jakarta.websocket</groupId>\n            <artifactId>jakarta.websocket-client-api</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.glassfish</groupId>\n            <artifactId>jakarta.faces</artifactId>\n            <version>${mojarra.version}</version>\n        </dependency>\n    </dependencies>\n\n</project>"
  },
  {
    "path": "components/jsf/mojarra/src/main/java/com/kumuluz/ee/jsf/mojarra/JsfComponent.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jsf.mojarra;\n\nimport com.kumuluz.ee.common.Component;\nimport com.kumuluz.ee.common.config.EeConfig;\nimport com.kumuluz.ee.common.dependencies.EeComponentDef;\nimport com.kumuluz.ee.common.dependencies.EeComponentDependency;\nimport com.kumuluz.ee.common.dependencies.EeComponentType;\nimport com.kumuluz.ee.common.wrapper.KumuluzServerWrapper;\n\nimport java.util.logging.Logger;\n\n/**\n * @author Tilen Faganel\n * @since 2.0.0\n */\n@EeComponentDef(name = \"Mojarra\", type = EeComponentType.JSF)\n@EeComponentDependency(value = EeComponentType.SERVLET)\n@EeComponentDependency(value = EeComponentType.JSP)\n@EeComponentDependency(value = EeComponentType.EL)\npublic class JsfComponent implements Component {\n\n    private Logger log = Logger.getLogger(JsfComponent.class.getSimpleName());\n\n    @Override\n    public void init(KumuluzServerWrapper server, EeConfig eeConfig) {\n    }\n\n    @Override\n    public void load() {\n\n        log.info(\"Initiating Mojarra\");\n    }\n}\n"
  },
  {
    "path": "components/jsf/mojarra/src/main/resources/META-INF/services/com.kumuluz.ee.common.Component",
    "content": "com.kumuluz.ee.jsf.mojarra.JsfComponent"
  },
  {
    "path": "components/jsf/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-components</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n    <packaging>pom</packaging>\n\n    <modules>\n        <module>mojarra</module>\n    </modules>\n\n    <name>KumuluzEE JSF</name>\n    <description>KumuluzEE JSF component</description>\n\n    <artifactId>kumuluzee-jsf</artifactId>\n\n</project>"
  },
  {
    "path": "components/json-b/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-components</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n    <packaging>pom</packaging>\n\n    <name>KumuluzEE JSON-B</name>\n    <description>KumuluzEE JSOP-B component</description>\n    <modules>\n        <module>yasson</module>\n    </modules>\n\n    <artifactId>kumuluzee-json-b</artifactId>\n\n</project>"
  },
  {
    "path": "components/json-b/yasson/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-json-b</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <artifactId>kumuluzee-json-b-yasson</artifactId>\n\n    <name>KumuluzEE JSON-B Yasson</name>\n    <description>KumuluzEE JSOP-B component implemented by Yasson</description>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-common</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.eclipse</groupId>\n            <artifactId>yasson</artifactId>\n            <version>${yasson.version}</version>\n            <exclusions>\n                <exclusion>\n                    <groupId>javax.json</groupId>\n                    <artifactId>javax.json-api</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>javax.enterprise</groupId>\n                    <artifactId>cdi-api</artifactId>\n                </exclusion>\n            </exclusions>\n        </dependency>\n\n        <dependency>\n            <groupId>org.glassfish.jersey.media</groupId>\n            <artifactId>jersey-media-json-binding</artifactId>\n            <version>${jersey.version}</version>\n            <exclusions>\n                <exclusion>\n                    <groupId>org.glassfish.jersey.core</groupId>\n                    <artifactId>jersey-common</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>org.glassfish</groupId>\n                    <artifactId>javax.json</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>org.eclipse</groupId>\n                    <artifactId>yasson</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>javax.json.bind</groupId>\n                    <artifactId>javax.json.bind-api</artifactId>\n                </exclusion>\n            </exclusions>\n        </dependency>\n    </dependencies>\n\n</project>"
  },
  {
    "path": "components/json-b/yasson/src/main/java/com/kumuluz/ee/jsonb/yasson/JsonBComponent.java",
    "content": "package com.kumuluz.ee.jsonb.yasson;\n\nimport com.kumuluz.ee.common.Component;\nimport com.kumuluz.ee.common.config.EeConfig;\nimport com.kumuluz.ee.common.dependencies.EeComponentDef;\nimport com.kumuluz.ee.common.dependencies.EeComponentDependency;\nimport com.kumuluz.ee.common.dependencies.EeComponentType;\nimport com.kumuluz.ee.common.wrapper.KumuluzServerWrapper;\n\nimport java.util.logging.Logger;\n\n/**\n * @author Tilen Faganel\n * @since 2.6.0\n */\n@EeComponentDef(name = \"Yasson\", type = EeComponentType.JSON_B)\n@EeComponentDependency(value = EeComponentType.JSON_P)\npublic class JsonBComponent implements Component {\n\n    private Logger log = Logger.getLogger(JsonBComponent.class.getSimpleName());\n\n    @Override\n    public void init(KumuluzServerWrapper server, EeConfig eeConfig) {\n    }\n\n    @Override\n    public void load() {\n\n        log.info(\"Initiating Yasson\");\n    }\n}\n"
  },
  {
    "path": "components/json-b/yasson/src/main/resources/META-INF/services/com.kumuluz.ee.common.Component",
    "content": "com.kumuluz.ee.jsonb.yasson.JsonBComponent"
  },
  {
    "path": "components/json-p/jsonp/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-json-p</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <artifactId>kumuluzee-json-p-jsonp</artifactId>\n\n    <name>KumuluzEE JSON-P JSONP</name>\n    <description>KumuluzEE JSOP-P component implemented by JSONP</description>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-common</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.glassfish</groupId>\n            <artifactId>javax.json</artifactId>\n            <version>${jsonp-impl.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>org.glassfish.jersey.media</groupId>\n            <artifactId>jersey-media-json-processing</artifactId>\n            <version>${jersey.version}</version>\n            <exclusions>\n                <exclusion>\n                    <groupId>org.glassfish.jersey.core</groupId>\n                    <artifactId>jersey-common</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>org.glassfish</groupId>\n                    <artifactId>javax.json</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>javax.ws.rs</groupId>\n                    <artifactId>javax.ws.rs-api</artifactId>\n                </exclusion>\n            </exclusions>\n        </dependency>\n    </dependencies>\n\n</project>"
  },
  {
    "path": "components/json-p/jsonp/src/main/java/com/kumuluz/ee/jsonp/JsonPComponent.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jsonp;\n\nimport com.kumuluz.ee.common.Component;\nimport com.kumuluz.ee.common.config.EeConfig;\nimport com.kumuluz.ee.common.dependencies.EeComponentDef;\nimport com.kumuluz.ee.common.dependencies.EeComponentType;\nimport com.kumuluz.ee.common.wrapper.KumuluzServerWrapper;\n\nimport java.util.logging.Logger;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\n@EeComponentDef(name = \"JSONP\", type = EeComponentType.JSON_P)\npublic class JsonPComponent implements Component {\n\n    private Logger log = Logger.getLogger(JsonPComponent.class.getSimpleName());\n\n    @Override\n    public void init(KumuluzServerWrapper server, EeConfig eeConfig) {\n    }\n\n    @Override\n    public void load() {\n\n        log.info(\"Initiating JSONP\");\n    }\n}\n"
  },
  {
    "path": "components/json-p/jsonp/src/main/java/com/kumuluz/ee/jsonp/configuration/utils/JsonConfigurationUtil.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.jsonp.configuration.utils;\n\nimport com.kumuluz.ee.configuration.utils.ConfigurationUtil;\n\nimport javax.json.*;\nimport java.util.Optional;\n\n/**\n * Enables retrieval of a part of a configuration hierarchy as a JSON-P object/array.\n *\n * @author Urban Malc\n * @since 3.4.0\n */\npublic class JsonConfigurationUtil {\n\n    private static JsonConfigurationUtil instance = null;\n\n    private static synchronized void initialize() {\n        if (instance == null) {\n            instance = getBuilder().build();\n        }\n    }\n\n    public static JsonConfigurationUtil getInstance() {\n        if (instance == null) {\n            initialize();\n        }\n\n        return instance;\n    }\n\n    public static Builder getBuilder() {\n        return new JsonConfigurationUtil.Builder();\n    }\n\n    private JsonConfigurationUtil() {\n    }\n\n    private ConfigurationUtil config = ConfigurationUtil.getInstance();\n    private String mapToNull;\n    private String mapToEmptyObject;\n    private String mapToEmptyArray;\n\n    private JsonValue getMappingIfAvailable(String s) {\n        if (mapToNull != null && mapToNull.equals(s)) {\n            return JsonValue.NULL;\n        }\n        if (mapToEmptyObject != null && mapToEmptyObject.equals(s)) {\n            return JsonValue.EMPTY_JSON_OBJECT;\n        }\n        if (mapToEmptyArray != null && mapToEmptyArray.equals(s)) {\n            return JsonValue.EMPTY_JSON_ARRAY;\n        }\n\n        return null;\n    }\n\n    public Optional<JsonObject> getJsonObject(String key) {\n\n        JsonObjectBuilder objectBuilder = Json.createObjectBuilder();\n\n        config.getMapKeys(key).ifPresent(mapList -> mapList.forEach(prop -> {\n            String nextKey = (key.equals(\"\")) ? prop : key + \".\" + prop;\n\n            config.getType(nextKey).ifPresent(type -> {\n                switch (type) {\n                    case MAP:\n                        getJsonObject(nextKey).ifPresent(o -> objectBuilder.add(prop, o));\n                        break;\n                    case LIST:\n                        getJsonArray(nextKey).ifPresent(a -> objectBuilder.add(prop, a));\n                        break;\n                    case INTEGER:\n                        config.getInteger(nextKey).ifPresent(value -> objectBuilder.add(prop, value));\n                        break;\n                    case LONG:\n                        config.getLong(nextKey).ifPresent(value -> objectBuilder.add(prop, value));\n                        break;\n                    case DOUBLE:\n                        config.getDouble(nextKey).ifPresent(value -> objectBuilder.add(prop, value));\n                        break;\n                    case FLOAT:\n                        config.getFloat(nextKey).ifPresent(value -> objectBuilder.add(prop, value));\n                        break;\n                    case BOOLEAN:\n                        config.getBoolean(nextKey).ifPresent(value -> objectBuilder.add(prop, value));\n                        break;\n                    case STRING:\n                        config.get(nextKey).ifPresent(s -> {\n                            JsonValue mapped = getMappingIfAvailable(s);\n                            if (mapped != null) {\n                                objectBuilder.add(prop, mapped);\n                            } else {\n                                objectBuilder.add(prop, s);\n                            }\n                        });\n                        break;\n                }\n            });\n        }));\n\n        JsonObject jsonObject = objectBuilder.build();\n        if (jsonObject.isEmpty()) {\n            return Optional.empty();\n        }\n\n        return Optional.of(jsonObject);\n    }\n\n    public Optional<JsonArray> getJsonArray(String key) {\n        JsonArrayBuilder arrayBuilder = Json.createArrayBuilder();\n\n        config.getListSize(key).ifPresent(listSize -> {\n            for (int i = 0; i < listSize; i++) {\n                String nextKey = key + \"[\" + i + \"]\";\n                config.getType(nextKey).ifPresent(type -> {\n                    switch (type) {\n                        case MAP:\n                            getJsonObject(nextKey).ifPresent(arrayBuilder::add);\n                            break;\n                        case LIST:\n                            getJsonArray(nextKey).ifPresent(arrayBuilder::add);\n                            break;\n                        case INTEGER:\n                            config.getInteger(nextKey).ifPresent(arrayBuilder::add);\n                            break;\n                        case LONG:\n                            config.getLong(nextKey).ifPresent(arrayBuilder::add);\n                            break;\n                        case DOUBLE:\n                            config.getDouble(nextKey).ifPresent(arrayBuilder::add);\n                            break;\n                        case FLOAT:\n                            config.getFloat(nextKey).ifPresent(arrayBuilder::add);\n                            break;\n                        case BOOLEAN:\n                            config.getBoolean(nextKey).ifPresent(arrayBuilder::add);\n                            break;\n                        case STRING:\n                            config.get(nextKey).ifPresent(s -> {\n                                JsonValue mapped = getMappingIfAvailable(s);\n                                if (mapped != null) {\n                                    arrayBuilder.add(mapped);\n                                } else {\n                                    arrayBuilder.add(s);\n                                }\n                            });\n                            break;\n                    }\n                });\n            }\n        });\n\n        JsonArray jsonArray = arrayBuilder.build();\n        if (jsonArray.isEmpty()) {\n            return Optional.empty();\n        }\n\n        return Optional.of(jsonArray);\n    }\n\n\n    public static final class Builder {\n        private String mapToNull;\n        private String mapToEmptyObject;\n        private String mapToEmptyArray;\n\n        private Builder() {\n        }\n\n        public Builder mapToNull(String mapToNull) {\n            this.mapToNull = mapToNull;\n            return this;\n        }\n\n        public Builder mapToEmptyObject(String mapToEmptyObject) {\n            this.mapToEmptyObject = mapToEmptyObject;\n            return this;\n        }\n\n        public Builder mapToEmptyArray(String mapToEmptyArray) {\n            this.mapToEmptyArray = mapToEmptyArray;\n            return this;\n        }\n\n        public JsonConfigurationUtil build() {\n            JsonConfigurationUtil jsonConfigurationUtil = new JsonConfigurationUtil();\n            jsonConfigurationUtil.mapToEmptyObject = this.mapToEmptyObject;\n            jsonConfigurationUtil.mapToEmptyArray = this.mapToEmptyArray;\n            jsonConfigurationUtil.mapToNull = this.mapToNull;\n\n            return jsonConfigurationUtil;\n        }\n    }\n}\n"
  },
  {
    "path": "components/json-p/jsonp/src/main/resources/META-INF/services/com.kumuluz.ee.common.Component",
    "content": "com.kumuluz.ee.jsonp.JsonPComponent"
  },
  {
    "path": "components/json-p/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-components</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n    <packaging>pom</packaging>\n\n    <name>KumuluzEE JSON-P</name>\n    <description>KumuluzEE JSOP-P component</description>\n\n    <modules>\n        <module>jsonp</module>\n    </modules>\n\n    <artifactId>kumuluzee-json-p</artifactId>\n\n</project>"
  },
  {
    "path": "components/jsp/jetty/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-jsp</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <artifactId>kumuluzee-jsp-jetty</artifactId>\n\n    <name>KumuluzEE JSP Jetty</name>\n    <description>KumuluzEE JSP component implemented by Jetty (Apache Jasper)</description>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-common</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.eclipse.jetty</groupId>\n            <artifactId>apache-jsp</artifactId>\n            <version>${jetty.version}</version>\n            <exclusions>\n                <exclusion>\n                    <groupId>org.mortbay.jasper</groupId>\n                    <artifactId>apache-el</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>javax.servlet</groupId>\n                    <artifactId>javax.servlet-api</artifactId>\n                </exclusion>\n            </exclusions>\n        </dependency>\n\n        <dependency>\n            <groupId>junit</groupId>\n            <artifactId>junit</artifactId>\n            <scope>test</scope>\n        </dependency>\n    </dependencies>\n\n</project>"
  },
  {
    "path": "components/jsp/jetty/src/main/java/com/kumuluz/ee/jsp/JspComponent.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jsp;\n\nimport com.kumuluz.ee.common.Component;\nimport com.kumuluz.ee.common.config.EeConfig;\nimport com.kumuluz.ee.common.dependencies.EeComponentDef;\nimport com.kumuluz.ee.common.dependencies.EeComponentDependency;\nimport com.kumuluz.ee.common.dependencies.EeComponentType;\nimport com.kumuluz.ee.common.wrapper.KumuluzServerWrapper;\n\nimport java.util.logging.Logger;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\n@EeComponentDef(name = \"Jetty\", type = EeComponentType.JSP)\n@EeComponentDependency(value = EeComponentType.SERVLET, implementations = {\"Jetty\"})\n@EeComponentDependency(value = EeComponentType.EL)\npublic class JspComponent implements Component {\n\n    private Logger log = Logger.getLogger(JspComponent.class.getSimpleName());\n\n    @Override\n    public void init(KumuluzServerWrapper server, EeConfig eeConfig) {\n    }\n\n    @Override\n    public void load() {\n\n        log.info(\"Initiating Jetty Apache Jasper\");\n    }\n}\n"
  },
  {
    "path": "components/jsp/jetty/src/main/resources/META-INF/services/com.kumuluz.ee.common.Component",
    "content": "com.kumuluz.ee.jsp.JspComponent"
  },
  {
    "path": "components/jsp/jetty/src/test/java/com/kumuluz/ee/jetty/jsp/test/JspTest.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jetty.jsp.test;\n\nimport org.junit.Test;\n\n/**\n * @author Tilen\n */\npublic class JspTest {\n\n    @Test\n    public void testJspServlet() {\n\n    }\n}\n"
  },
  {
    "path": "components/jsp/jetty/src/test/java/com/kumuluz/ee/jetty/jsp/test/beans/TimeBean.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jetty.jsp.test.beans;\n\nimport java.util.Date;\n\n/**\n * @author Tilen\n */\npublic class TimeBean {\n\n    private Date currentTime;\n\n    public TimeBean() {\n\n        currentTime = new Date();\n    }\n\n    public Date getCurrentTime() {\n        return currentTime;\n    }\n\n    public void setCurrentTime(Date currentTime) {\n        this.currentTime = currentTime;\n    }\n}\n"
  },
  {
    "path": "components/jsp/jetty/src/test/java/com/kumuluz/ee/jetty/jsp/test/beans/UserBean.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jetty.jsp.test.beans;\n\nimport java.time.LocalDate;\nimport java.time.ZoneId;\nimport java.util.Date;\n\n/**\n * @author Tilen\n */\npublic class UserBean {\n\n    private String username;\n\n    private String email;\n\n    private String firstname;\n\n    private String lastname;\n\n    private Integer age;\n\n    private String country;\n\n    private Date created;\n\n    public UserBean() {\n\n        username = \"ahughes\";\n        email = \"amy.hughes@mac.com\";\n        firstname = \"Amy\";\n        lastname = \"Hughes\";\n        age = 1;\n        country = \"US\";\n        created = Date.from(\n                LocalDate.of(2014, 3, 3)\n                        .atStartOfDay()\n                        .atZone(ZoneId.systemDefault())\n                        .toInstant());\n    }\n\n    public String getUsername() {\n        return username;\n    }\n\n    public void setUsername(String username) {\n        this.username = username;\n    }\n\n    public String getEmail() {\n        return email;\n    }\n\n    public void setEmail(String email) {\n        this.email = email;\n    }\n\n    public String getFirstname() {\n        return firstname;\n    }\n\n    public void setFirstname(String firstname) {\n        this.firstname = firstname;\n    }\n\n    public String getLastname() {\n        return lastname;\n    }\n\n    public void setLastname(String lastname) {\n        this.lastname = lastname;\n    }\n\n    public Integer getAge() {\n        return age;\n    }\n\n    public void setAge(Integer age) {\n        this.age = age;\n    }\n\n    public String getCountry() {\n        return country;\n    }\n\n    public void setCountry(String country) {\n        country = country;\n    }\n\n    public Date getCreated() {\n        return created;\n    }\n\n    public void setCreated(Date created) {\n        this.created = created;\n    }\n}\n"
  },
  {
    "path": "components/jsp/jetty/src/test/resources/webapp/index.jsp",
    "content": "<jsp:useBean id=\"user\" class=\"com.kumuluz.ee.jetty.jsp.test.beans.UserBean\" scope=\"session\"/>\n<jsp:useBean id=\"time\" class=\"com.kumuluz.ee.jetty.jsp.test.beans.TimeBean\" scope=\"request\"/>\n\n<!DOCTYPE html>\n<html>\n<head lang=\"en\">\n    <meta charset=\"UTF-8\">\n    <title>KumuluzEE Jsp test</title>\n</head>\n<body>\n\n    <p>\n        <span>The time is: <%= time.getCurrentTime() %></span>\n        <br/>\n        <br/>\n        <span>The current user is:</span>\n        <br/>\n        <span>Username: <%= user.getUsername() %></span><br/>\n        <span>Email: <%= user.getEmail() %></span><br/>\n        <span>First name: <%= user.getFirstname() %></span><br/>\n        <span>Last name: <%= user.getLastname() %></span><br/>\n        <span>Age: <%= user.getAge() %></span><br/>\n        <span>Country: <%= user.getCountry() %></span><br/>\n        <span>Created: <%= user.getCreated() %></span><br/>\n    </p>\n\n</body>\n</html>"
  },
  {
    "path": "components/jsp/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-components</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n    <packaging>pom</packaging>\n\n    <name>KumuluzEE JSP</name>\n    <description>KumuluzEE JSP component</description>\n\n    <modules>\n        <module>jetty</module>\n    </modules>\n\n    <artifactId>kumuluzee-jsp</artifactId>\n\n</project>"
  },
  {
    "path": "components/jta/common/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-jta</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE JTA Common</name>\n    <description>KumuluzEE JTA component common utilities, configs and exceptions</description>\n\n    <artifactId>kumuluzee-jta-common</artifactId>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-common</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>jakarta.transaction</groupId>\n            <artifactId>jakarta.transaction-api</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>jakarta.resource</groupId>\n            <artifactId>jakarta.resource-api</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.jboss.weld.module</groupId>\n            <artifactId>weld-jta</artifactId>\n            <version>${weld.version}</version>\n            <exclusions>\n                <exclusion>\n                    <groupId>org.jboss.spec.javax.transaction</groupId>\n                    <artifactId>jboss-transaction-api_1.3_spec</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>org.jboss.spec.javax.annotation</groupId>\n                    <artifactId>jboss-annotations-api_1.3_spec</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>org.jboss.spec.javax.el</groupId>\n                    <artifactId>jboss-el-api_3.0_spec</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>org.jboss.spec.javax.interceptor</groupId>\n                    <artifactId>jboss-interceptors-api_1.2_spec</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>org.jboss.logging</groupId>\n                    <artifactId>jboss-logging</artifactId>\n                </exclusion>\n            </exclusions>\n        </dependency>\n        <dependency>\n            <groupId>org.jboss.logging</groupId>\n            <artifactId>jboss-logging</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-cdi-weld</artifactId>\n            <scope>provided</scope>\n        </dependency>\n    </dependencies>\n\n</project>"
  },
  {
    "path": "components/jta/common/src/main/java/com/kumuluz/ee/jta/common/JtaProvider.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jta.common;\n\nimport com.kumuluz.ee.common.exceptions.KumuluzServerException;\nimport io.agroal.api.transaction.TransactionIntegration;\n\nimport javax.transaction.Status;\nimport javax.transaction.TransactionManager;\nimport javax.transaction.TransactionSynchronizationRegistry;\nimport javax.transaction.UserTransaction;\nimport java.util.Arrays;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.ServiceLoader;\n\n/**\n * @author Marcos Koch Salvador\n * @since 2.3.0\n */\npublic abstract class JtaProvider {\n\n    public static final List<Integer> TRANSACTION_ACTIVE_STATUS = Arrays.asList(\n            Status.STATUS_ACTIVE, Status.STATUS_COMMITTING, Status.STATUS_MARKED_ROLLBACK, Status.STATUS_PREPARED,\n            Status.STATUS_PREPARING, Status.STATUS_ROLLING_BACK\n    );\n\n    private static JtaProvider instance;\n\n    public static JtaProvider getInstance() {\n        if (instance == null) {\n            Iterator<JtaProvider> it = ServiceLoader.load(JtaProvider.class).iterator();\n\n            if (!it.hasNext()) {\n                throw new KumuluzServerException(\"No JTA components were found\");\n            }\n\n            instance = it.next();\n        }\n        return instance;\n    }\n\n    public abstract UserTransaction getUserTransaction();\n\n    public abstract TransactionManager getTransactionManager();\n\n    public abstract TransactionSynchronizationRegistry getTransactionSynchronizationRegistry();\n\n    public abstract TransactionIntegration getTransactionIntegration(String jndiName);\n}\n"
  },
  {
    "path": "components/jta/common/src/main/java/com/kumuluz/ee/jta/common/JtaTransactionServices.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jta.common;\n\nimport org.jboss.weld.transaction.spi.TransactionServices;\n\nimport javax.transaction.Synchronization;\nimport javax.transaction.SystemException;\nimport javax.transaction.UserTransaction;\n\n/**\n * @author Marcos Koch Salvador\n * @since 2.3.0\n */\npublic class JtaTransactionServices implements TransactionServices {\n\n    @Override\n    public void registerSynchronization(Synchronization synchronizedObserver) {\n        try {\n            JtaProvider.getInstance().getTransactionManager().getTransaction().registerSynchronization(synchronizedObserver);\n        } catch (IllegalStateException | javax.transaction.RollbackException | SystemException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public boolean isTransactionActive() {\n        try {\n            int status = JtaProvider.getInstance().getTransactionManager().getStatus();\n            return JtaProvider.TRANSACTION_ACTIVE_STATUS.contains(status);\n        } catch (SystemException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public UserTransaction getUserTransaction() {\n        return JtaProvider.getInstance().getUserTransaction();\n    }\n\n    @Override\n    public void cleanup() {\n    }\n}\n"
  },
  {
    "path": "components/jta/common/src/main/java/com/kumuluz/ee/jta/common/datasources/JtaXAConnectionWrapper.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jta.common.datasources;\n\nimport com.kumuluz.ee.jta.common.JtaProvider;\nimport com.kumuluz.ee.jta.common.utils.TxUtils;\n\nimport javax.sql.XAConnection;\nimport javax.transaction.RollbackException;\nimport javax.transaction.Synchronization;\nimport javax.transaction.SystemException;\nimport javax.transaction.TransactionManager;\nimport javax.transaction.xa.XAResource;\nimport java.sql.*;\nimport java.util.Collections;\nimport java.util.Map;\nimport java.util.Properties;\nimport java.util.concurrent.Executor;\nimport java.util.logging.Logger;\n\n/**\n * @author Tilen Faganel\n * @since 2.3.0\n */\n@Deprecated\npublic class JtaXAConnectionWrapper implements Connection {\n\n    private Logger log = Logger.getLogger(JtaXAConnectionWrapper.class.getSimpleName());\n\n    private Boolean isClosed = false;\n    private Boolean isEnlistedInJTA = false;\n    private Boolean closeAfterTransactionEnd = false;\n\n    private XAConnection parentConnection;\n    private Connection xaConnection;\n    private XAResource xaResource;\n\n    private TransactionManager transactionManager;\n\n    public JtaXAConnectionWrapper(XAConnection xaConnection) throws SQLException {\n        this.xaResource = xaConnection.getXAResource();\n        this.parentConnection = xaConnection;\n        this.xaConnection = xaConnection.getConnection();\n    }\n\n    @Override\n    public Statement createStatement() throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        Statement statement = xaConnection.createStatement();\n\n        return (Statement) XAStatementProxy.newInstance(statement, this);\n    }\n\n    @Override\n    public PreparedStatement prepareStatement(String sql) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        PreparedStatement preparedStatement = xaConnection.prepareStatement(sql);\n\n        return (PreparedStatement) XAStatementProxy.newInstance(preparedStatement, this);\n    }\n\n    @Override\n    public CallableStatement prepareCall(String sql) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        CallableStatement callableStatement = xaConnection.prepareCall(sql);\n\n        return (CallableStatement) XAStatementProxy.newInstance(callableStatement, this);\n    }\n\n    @Override\n    public String nativeSQL(String sql) throws SQLException {\n\n        checkIfValid();\n\n        return xaConnection.nativeSQL(sql);\n    }\n\n    @Override\n    public boolean getAutoCommit() throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        return xaConnection.getAutoCommit();\n    }\n\n    @Override\n    public void setAutoCommit(boolean autoCommit) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        xaConnection.setAutoCommit(autoCommit);\n    }\n\n    @Override\n    public void commit() throws SQLException {\n\n        checkIfValid();\n\n        xaConnection.commit();\n    }\n\n    @Override\n    public void rollback() throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        xaConnection.rollback();\n    }\n\n    @Override\n    public void close() throws SQLException {\n\n        if (isClosed) return;\n\n        isClosed = true;\n\n        if (isEnlistedInJTA) {\n\n            closeAfterTransactionEnd = true;\n            return;\n        }\n\n        closeConnections(this);\n    }\n\n    @Override\n    public boolean isClosed() throws SQLException {\n\n        if (!isClosed) {\n            jtaPreInvoke();\n        }\n\n        return isClosed;\n    }\n\n    @Override\n    public DatabaseMetaData getMetaData() throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        return xaConnection.getMetaData();\n    }\n\n    @Override\n    public boolean isReadOnly() throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        return xaConnection.isReadOnly();\n    }\n\n    @Override\n    public void setReadOnly(boolean readOnly) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        xaConnection.setReadOnly(readOnly);\n    }\n\n    @Override\n    public String getCatalog() throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        return xaConnection.getCatalog();\n    }\n\n    @Override\n    public void setCatalog(String catalog) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        xaConnection.setCatalog(catalog);\n    }\n\n    @Override\n    public int getTransactionIsolation() throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        return xaConnection.getTransactionIsolation();\n    }\n\n    @Override\n    public void setTransactionIsolation(int level) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        xaConnection.setTransactionIsolation(level);\n    }\n\n    @Override\n    public SQLWarning getWarnings() throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        return xaConnection.getWarnings();\n    }\n\n    @Override\n    public void clearWarnings() throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        xaConnection.clearWarnings();\n    }\n\n    @Override\n    public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        Statement statement = xaConnection.createStatement(resultSetType, resultSetConcurrency);\n\n        return (Statement) XAStatementProxy.newInstance(statement, this);\n    }\n\n    @Override\n    public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        PreparedStatement preparedStatement = xaConnection.prepareStatement(sql, resultSetType, resultSetConcurrency);\n\n        return (PreparedStatement) XAStatementProxy.newInstance(preparedStatement, this);\n    }\n\n    @Override\n    public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        CallableStatement callableStatement = xaConnection.prepareCall(sql, resultSetType, resultSetConcurrency);\n\n        return (CallableStatement) XAStatementProxy.newInstance(callableStatement, this);\n    }\n\n    @Override\n    public Map<String, Class<?>> getTypeMap() throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        return xaConnection.getTypeMap();\n    }\n\n    @Override\n    public void setTypeMap(Map<String, Class<?>> map) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        xaConnection.setTypeMap(map);\n    }\n\n    @Override\n    public int getHoldability() throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        return xaConnection.getHoldability();\n    }\n\n    @Override\n    public void setHoldability(int holdability) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        xaConnection.setHoldability(holdability);\n    }\n\n    @Override\n    public Savepoint setSavepoint() throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        return xaConnection.setSavepoint();\n    }\n\n    @Override\n    public Savepoint setSavepoint(String name) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        return xaConnection.setSavepoint(name);\n    }\n\n    @Override\n    public void rollback(Savepoint savepoint) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        xaConnection.rollback();\n    }\n\n    @Override\n    public void releaseSavepoint(Savepoint savepoint) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        xaConnection.releaseSavepoint(savepoint);\n    }\n\n    @Override\n    public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        Statement statement = xaConnection.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);\n\n        return (Statement) XAStatementProxy.newInstance(statement, this);\n    }\n\n    @Override\n    public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        PreparedStatement preparedStatement = xaConnection.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability);\n\n        return (PreparedStatement) XAStatementProxy.newInstance(preparedStatement, this);\n    }\n\n    @Override\n    public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        CallableStatement callableStatement = xaConnection.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability);\n\n        return (CallableStatement) XAStatementProxy.newInstance(callableStatement, this);\n    }\n\n    @Override\n    public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        PreparedStatement preparedStatement = xaConnection.prepareStatement(sql, autoGeneratedKeys);\n\n        return (PreparedStatement) XAStatementProxy.newInstance(preparedStatement, this);\n    }\n\n    @Override\n    public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        PreparedStatement preparedStatement = xaConnection.prepareStatement(sql, columnIndexes);\n\n        return (PreparedStatement) XAStatementProxy.newInstance(preparedStatement, this);\n    }\n\n    @Override\n    public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        PreparedStatement preparedStatement = xaConnection.prepareStatement(sql, columnNames);\n\n        return (PreparedStatement) XAStatementProxy.newInstance(preparedStatement, this);\n    }\n\n    @Override\n    public Clob createClob() throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        return xaConnection.createClob();\n    }\n\n    @Override\n    public Blob createBlob() throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        return xaConnection.createBlob();\n    }\n\n    @Override\n    public NClob createNClob() throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        return xaConnection.createNClob();\n    }\n\n    @Override\n    public SQLXML createSQLXML() throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        return xaConnection.createSQLXML();\n    }\n\n    @Override\n    public boolean isValid(int timeout) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        return xaConnection.isValid(timeout);\n    }\n\n    @Override\n    public void setClientInfo(String name, String value) throws SQLClientInfoException {\n\n        try {\n            checkIfValid();\n            jtaPreInvoke();\n\n            xaConnection.setClientInfo(name, value);\n        } catch (SQLException e) {\n            throw new SQLClientInfoException(Collections.emptyMap(), e);\n        }\n    }\n\n    @Override\n    public String getClientInfo(String name) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        return xaConnection.getClientInfo(name);\n    }\n\n    @Override\n    public Properties getClientInfo() throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        return xaConnection.getClientInfo();\n    }\n\n    @Override\n    public void setClientInfo(Properties properties) throws SQLClientInfoException {\n\n        try {\n            checkIfValid();\n            jtaPreInvoke();\n\n            xaConnection.setClientInfo(properties);\n        } catch (SQLException e) {\n            throw new SQLClientInfoException(Collections.emptyMap(), e);\n        }\n    }\n\n    @Override\n    public Array createArrayOf(String typeName, Object[] elements) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        return xaConnection.createArrayOf(typeName, elements);\n    }\n\n    @Override\n    public Struct createStruct(String typeName, Object[] attributes) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        return xaConnection.createStruct(typeName, attributes);\n    }\n\n    @Override\n    public String getSchema() throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        return xaConnection.getSchema();\n    }\n\n    @Override\n    public void setSchema(String schema) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        xaConnection.setSchema(schema);\n    }\n\n    @Override\n    public void abort(Executor executor) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        xaConnection.abort(executor);\n    }\n\n    @Override\n    public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        xaConnection.setNetworkTimeout(executor, milliseconds);\n    }\n\n    @Override\n    public int getNetworkTimeout() throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        return xaConnection.getNetworkTimeout();\n    }\n\n    @Override\n    public <T> T unwrap(Class<T> iface) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        return xaConnection.unwrap(iface);\n    }\n\n    @Override\n    public boolean isWrapperFor(Class<?> iface) throws SQLException {\n\n        checkIfValid();\n        jtaPreInvoke();\n\n        return xaConnection.isWrapperFor(iface);\n    }\n\n    private void checkIfValid() throws SQLException {\n\n        if (isClosed) throw new SQLException(\"The connection is closed\");\n        if (xaConnection == null) throw new SQLException(\"The connection is invalid\");\n    }\n\n    private void jtaPreInvoke() throws SQLException {\n\n        if (isEnlistedInJTA) return;\n\n        try {\n\n            if (transactionManager == null) {\n                transactionManager = JtaProvider.getInstance().getTransactionManager();\n            }\n\n            if (TxUtils.isActive(transactionManager)) {\n\n                transactionManager.getTransaction().enlistResource(xaResource);\n                transactionManager.getTransaction().registerSynchronization(new Synchronization() {\n\n                    @Override\n                    public void beforeCompletion() {\n                    }\n\n                    @Override\n                    public void afterCompletion(int status) {\n\n                        JtaXAConnectionWrapper jtaXaConnectionWrapper = JtaXAConnectionWrapper.this;\n\n                        jtaXaConnectionWrapper.isEnlistedInJTA = false;\n\n                        if (jtaXaConnectionWrapper.closeAfterTransactionEnd && jtaXaConnectionWrapper.xaConnection != null) {\n\n                            try {\n                                closeConnections(jtaXaConnectionWrapper);\n                            } catch (SQLException e) {\n\n                                log.severe(\"There was an error closing the connection after transaction complete\");\n                            }\n                        }\n                    }\n                });\n\n                this.isEnlistedInJTA = true;\n            }\n        } catch (SystemException | RollbackException e) {\n            throw new SQLException(e);\n        }\n    }\n\n    private static void closeConnections(JtaXAConnectionWrapper jtaXaConnectionWrapper) throws SQLException {\n        if (jtaXaConnectionWrapper.xaConnection != null) {\n            jtaXaConnectionWrapper.xaConnection.close();\n            jtaXaConnectionWrapper.xaConnection = null;\n        }\n        if (jtaXaConnectionWrapper.parentConnection != null) {\n            jtaXaConnectionWrapper.parentConnection.close();\n            jtaXaConnectionWrapper.parentConnection = null;\n        }\n    }\n}\n"
  },
  {
    "path": "components/jta/common/src/main/java/com/kumuluz/ee/jta/common/datasources/JtaXADataSourceWrapper.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jta.common.datasources;\n\nimport com.kumuluz.ee.common.datasources.NonJtaXADataSourceWrapper;\n\nimport javax.sql.XAConnection;\nimport javax.sql.XADataSource;\nimport java.sql.Connection;\nimport java.sql.SQLException;\n\n/**\n * @author Tilen Faganel\n * @since 2.3.0\n */\n@Deprecated\npublic class JtaXADataSourceWrapper extends NonJtaXADataSourceWrapper {\n\n    public JtaXADataSourceWrapper(XADataSource xaDataSource) {\n        super(xaDataSource);\n    }\n\n    @Override\n    public Connection getConnection() throws SQLException {\n\n        checkIfValid();\n\n        XAConnection xaConnection = xaDataSource.getXAConnection();\n\n        return new JtaXAConnectionWrapper(xaConnection);\n    }\n\n    @Override\n    public Connection getConnection(String username, String password) throws SQLException {\n\n        checkIfValid();\n\n        XAConnection xaConnection = xaDataSource.getXAConnection(username, password);\n\n        return new JtaXAConnectionWrapper(xaConnection);\n    }\n}\n"
  },
  {
    "path": "components/jta/common/src/main/java/com/kumuluz/ee/jta/common/datasources/XAStatementProxy.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jta.common.datasources;\n\nimport java.lang.reflect.InvocationHandler;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Proxy;\nimport java.sql.CallableStatement;\nimport java.sql.PreparedStatement;\nimport java.sql.SQLException;\nimport java.sql.Statement;\n\n/**\n * @author Tilen Faganel\n * @since 2.3.0\n */\n@Deprecated\npublic class XAStatementProxy implements InvocationHandler {\n\n    private Statement statement;\n    private JtaXAConnectionWrapper jtaXaConnectionWrapper;\n\n\n    private XAStatementProxy(Statement statement, JtaXAConnectionWrapper jtaXaConnectionWrapper) {\n        this.statement = statement;\n        this.jtaXaConnectionWrapper = jtaXaConnectionWrapper;\n    }\n\n    public static Object newInstance(Statement statement, JtaXAConnectionWrapper jtaXaConnectionWrapper) {\n        return Proxy.newProxyInstance(statement.getClass().getClassLoader(), new Class<?>[]{Statement.class}, new XAStatementProxy(statement, jtaXaConnectionWrapper));\n    }\n\n    public static Object newInstance(PreparedStatement statement, JtaXAConnectionWrapper jtaXaConnectionWrapper) {\n        return Proxy.newProxyInstance(statement.getClass().getClassLoader(), new Class<?>[]{PreparedStatement.class}, new XAStatementProxy(statement, jtaXaConnectionWrapper));\n    }\n\n    public static Object newInstance(CallableStatement statement, JtaXAConnectionWrapper jtaXaConnectionWrapper) {\n        return Proxy.newProxyInstance(statement.getClass().getClassLoader(), new Class<?>[]{CallableStatement.class}, new XAStatementProxy(statement, jtaXaConnectionWrapper));\n    }\n\n    @Override\n    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {\n\n        if (jtaXaConnectionWrapper.isClosed()) {\n            throw new SQLException(\"The connection associated with this statement is closed\");\n        }\n\n        return method.invoke(statement, args);\n    }\n}\n"
  },
  {
    "path": "components/jta/common/src/main/java/com/kumuluz/ee/jta/common/exceptions/CannotRetrieveTxException.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jta.common.exceptions;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic class CannotRetrieveTxException extends IllegalStateException {\n\n    public CannotRetrieveTxException(Throwable cause) {\n        super(\"There was an error retrieving the current threads transaction.\", cause);\n    }\n}\n"
  },
  {
    "path": "components/jta/common/src/main/java/com/kumuluz/ee/jta/common/utils/TxUtils.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jta.common.utils;\n\nimport com.kumuluz.ee.jta.common.JtaProvider;\nimport com.kumuluz.ee.jta.common.exceptions.CannotRetrieveTxException;\n\nimport javax.transaction.SystemException;\nimport javax.transaction.Transaction;\nimport javax.transaction.TransactionManager;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic class TxUtils {\n\n    public static Boolean isActive(TransactionManager transactionManager) {\n\n        try {\n            Transaction tx = transactionManager.getTransaction();\n\n            return tx != null && JtaProvider.TRANSACTION_ACTIVE_STATUS.contains(tx.getStatus());\n        } catch (SystemException e) {\n            throw new CannotRetrieveTxException(e);\n        }\n    }\n}\n"
  },
  {
    "path": "components/jta/common/src/main/resources/META-INF/services/org.jboss.weld.bootstrap.api.Service",
    "content": "com.kumuluz.ee.jta.common.JtaTransactionServices"
  },
  {
    "path": "components/jta/narayana/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-jta</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE JTA Narayana</name>\n    <description>KumuluzEE JTA component implemented by Narayana</description>\n\n    <artifactId>kumuluzee-jta-narayana</artifactId>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-jta-common</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.jboss</groupId>\n            <artifactId>jboss-transaction-spi</artifactId>\n            <version>${jboss-transaction-spi.version}</version>\n            <exclusions>\n                <exclusion>\n                    <groupId>org.jboss.spec.javax.transaction</groupId>\n                    <artifactId>jboss-transaction-api_1.2_spec</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>org.jboss.spec.javax.resource</groupId>\n                    <artifactId>jboss-connector-api_1.7_spec</artifactId>\n                </exclusion>\n            </exclusions>\n        </dependency>\n        <dependency>\n            <groupId>org.jboss.narayana.jta</groupId>\n            <artifactId>narayana-jta</artifactId>\n            <version>${narayana.version}</version>\n            <exclusions>\n                <exclusion>\n                    <groupId>org.jboss</groupId>\n                    <artifactId>jboss-transaction-spi</artifactId>\n                </exclusion>\n                <exclusion>\n                    <groupId>org.jboss.spec.javax.resource</groupId>\n                    <artifactId>jboss-connector-api_1.7_spec</artifactId>\n                </exclusion>\n            </exclusions>\n        </dependency>\n        <dependency>\n            <groupId>io.agroal</groupId>\n            <artifactId>agroal-narayana</artifactId>\n            <version>${agroal.version}</version>\n        </dependency>\n    </dependencies>\n\n</project>"
  },
  {
    "path": "components/jta/narayana/src/main/java/com/kumuluz/ee/jta/narayana/JtaComponent.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jta.narayana;\n\nimport com.arjuna.ats.arjuna.common.arjPropertyManager;\nimport com.arjuna.ats.jta.utils.JNDIManager;\nimport com.kumuluz.ee.common.Component;\nimport com.kumuluz.ee.common.ServletServer;\nimport com.kumuluz.ee.common.config.EeConfig;\nimport com.kumuluz.ee.common.dependencies.EeComponentDef;\nimport com.kumuluz.ee.common.dependencies.EeComponentDependency;\nimport com.kumuluz.ee.common.dependencies.EeComponentType;\nimport com.kumuluz.ee.common.wrapper.KumuluzServerWrapper;\nimport com.kumuluz.ee.jta.common.JtaProvider;\n\nimport javax.naming.NamingException;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n/**\n * @author Marcos Koch Salvador\n * @since 2.3.0\n */\n@EeComponentDef(name = \"Narayana JTA\", type = EeComponentType.JTA)\n@EeComponentDependency(value = EeComponentType.CDI)\npublic class JtaComponent implements Component {\n\n    private Logger log = Logger.getLogger(JtaComponent.class.getSimpleName());\n\n    @Override\n    public void init(KumuluzServerWrapper server, EeConfig eeConfig) {\n        if (server.getServer() instanceof ServletServer) {\n            ((ServletServer) server.getServer()).registerTransactionManager(JtaProvider.getInstance().getUserTransaction());\n        }\n    }\n\n    @Override\n    public void load() {\n        log.info(\"Initiating Narayana JTA\");\n\n        arjPropertyManager.getObjectStoreEnvironmentBean().setObjectStoreDir(\"ObjectStore\");\n\n        try {\n            JNDIManager.bindJTAImplementation();\n        } catch (NamingException e) {\n            log.log(Level.WARNING, e.getMessage(), e);\n        }\n    }\n}\n"
  },
  {
    "path": "components/jta/narayana/src/main/java/com/kumuluz/ee/jta/narayana/NarayanaJtaProvider.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jta.narayana;\n\nimport com.arjuna.ats.jta.common.JTAEnvironmentBean;\nimport com.arjuna.ats.jta.common.jtaPropertyManager;\nimport com.kumuluz.ee.jta.common.JtaProvider;\nimport io.agroal.api.transaction.TransactionIntegration;\nimport io.agroal.narayana.NarayanaTransactionIntegration;\n\nimport javax.transaction.*;\nimport java.util.HashMap;\nimport java.util.Map;\n\n/**\n * @author Marcos Koch Salvador\n * @since 2.3.0\n */\npublic class NarayanaJtaProvider extends JtaProvider {\n\n    private final JTAEnvironmentBean jtaEnvironment;\n    private final Map<String, NarayanaTransactionIntegration> transactionIntegrations;\n\n    public NarayanaJtaProvider() {\n        jtaEnvironment = jtaPropertyManager.getJTAEnvironmentBean();\n        transactionIntegrations = new HashMap<>();\n    }\n\n    @Override\n    public UserTransaction getUserTransaction() {\n        return jtaEnvironment.getUserTransaction();\n    }\n\n    @Override\n    public TransactionManager getTransactionManager() {\n        return jtaEnvironment.getTransactionManager();\n    }\n\n    @Override\n    public TransactionSynchronizationRegistry getTransactionSynchronizationRegistry() {\n        return jtaEnvironment.getTransactionSynchronizationRegistry();\n    }\n\n    @Override\n    public TransactionIntegration getTransactionIntegration(String jndiName) {\n\n        if (!transactionIntegrations.containsKey(jndiName)) {\n            transactionIntegrations.put(jndiName, new NarayanaTransactionIntegration(getTransactionManager(),\n                    getTransactionSynchronizationRegistry(), jndiName));\n        }\n\n        return transactionIntegrations.get(jndiName);\n    }\n\n}\n"
  },
  {
    "path": "components/jta/narayana/src/main/resources/META-INF/services/com.kumuluz.ee.common.Component",
    "content": "com.kumuluz.ee.jta.narayana.JtaComponent"
  },
  {
    "path": "components/jta/narayana/src/main/resources/META-INF/services/com.kumuluz.ee.jta.common.JtaProvider",
    "content": "com.kumuluz.ee.jta.narayana.NarayanaJtaProvider"
  },
  {
    "path": "components/jta/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-components</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n    <packaging>pom</packaging>\n\n    <modules>\n\t\t<module>common</module>\n        <module>narayana</module>\n    </modules>\n\n    <name>KumuluzEE JTA</name>\n    <description>KumuluzEE JTA component</description>\n\n    <artifactId>kumuluzee-jta</artifactId>\n\n</project>"
  },
  {
    "path": "components/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n    <packaging>pom</packaging>\n\n    <name>KumuluzEE Components</name>\n    <description>KumuluzEE Java EE components that are independent of the underlying server.</description>\n\n    <modules>\n        <module>websocket</module>\n        <module>jsp</module>\n        <module>el</module>\n        <module>cdi</module>\n        <module>jax-rs</module>\n        <module>jsf</module>\n        <module>jpa</module>\n        <module>json-p</module>\n        <module>bean-validation</module>\n        <module>jax-ws</module>\n        <module>jta</module>\n        <module>json-b</module>\n        <module>javamail</module>\n    </modules>\n\n    <artifactId>kumuluzee-components</artifactId>\n\n</project>"
  },
  {
    "path": "components/websocket/jetty/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-websocket</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE WebSocket Jetty</name>\n    <description>KumuluzEE WebSocket server component for Jetty</description>\n\n    <artifactId>kumuluzee-websocket-jetty</artifactId>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-common</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-servlet-jetty</artifactId>\n            <scope>provided</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>jakarta.websocket</groupId>\n            <artifactId>jakarta.websocket-api</artifactId>\n            <version>${websocket.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.eclipse.jetty.websocket</groupId>\n            <artifactId>websocket-javax-server</artifactId>\n            <version>${jetty.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.eclipse.jetty.websocket</groupId>\n            <artifactId>websocket-javax-client</artifactId>\n            <version>${jetty.version}</version>\n        </dependency>\n    </dependencies>\n\n</project>"
  },
  {
    "path": "components/websocket/jetty/src/main/java/com/kumuluz/ee/websocket/jetty/WebSocketComponent.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.websocket.jetty;\n\nimport com.kumuluz.ee.common.Component;\nimport com.kumuluz.ee.common.config.EeConfig;\nimport com.kumuluz.ee.common.dependencies.*;\nimport com.kumuluz.ee.common.wrapper.KumuluzServerWrapper;\n\nimport java.util.logging.Logger;\n\n/**\n * @author Tilen Faganel\n * @since 2.0.0\n */\n@EeComponentDef(name = \"Jetty\", type = EeComponentType.WEBSOCKET)\n@EeComponentDependency(value = EeComponentType.SERVLET, implementations = {\"Jetty\"})\npublic class WebSocketComponent implements Component {\n\n    private Logger log = Logger.getLogger(WebSocketComponent.class.getSimpleName());\n\n    @Override\n    public void init(KumuluzServerWrapper server, EeConfig eeConfig) {\n    }\n\n    @Override\n    public void load() {\n\n        log.info(\"Initiating WebSocket for Jetty\");\n    }\n}\n"
  },
  {
    "path": "components/websocket/jetty/src/main/resources/META-INF/services/com.kumuluz.ee.common.Component",
    "content": "com.kumuluz.ee.websocket.jetty.WebSocketComponent"
  },
  {
    "path": "components/websocket/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-components</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n    <packaging>pom</packaging>\n\n    <name>KumuluzEE WebSocket</name>\n    <description>KumuluzEE WebSocket server component</description>\n\n    <modules>\n        <module>jetty</module>\n    </modules>\n\n    <artifactId>kumuluzee-websocket</artifactId>\n\n</project>"
  },
  {
    "path": "core/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE Core</name>\n    <description>KumuluzEE core bootstrap implementation</description>\n\n    <artifactId>kumuluzee-core</artifactId>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-common</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-jta-common</artifactId>\n            <scope>provided</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>junit</groupId>\n            <artifactId>junit</artifactId>\n            <scope>test</scope>\n        </dependency>\n    </dependencies>\n\n</project>"
  },
  {
    "path": "core/src/main/java/com/kumuluz/ee/EeApplication.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee;\n\nimport com.kumuluz.ee.common.*;\nimport com.kumuluz.ee.common.config.EeConfig;\nimport com.kumuluz.ee.common.dependencies.*;\nimport com.kumuluz.ee.common.exceptions.KumuluzServerException;\nimport com.kumuluz.ee.common.filters.PoweredByFilter;\nimport com.kumuluz.ee.common.runtime.EeRuntime;\nimport com.kumuluz.ee.common.runtime.EeRuntimeComponent;\nimport com.kumuluz.ee.common.runtime.EeRuntimeExtension;\nimport com.kumuluz.ee.common.runtime.EeRuntimeInternal;\nimport com.kumuluz.ee.common.utils.ResourceUtils;\nimport com.kumuluz.ee.common.wrapper.ComponentWrapper;\nimport com.kumuluz.ee.common.wrapper.EeComponentWrapper;\nimport com.kumuluz.ee.common.wrapper.ExtensionWrapper;\nimport com.kumuluz.ee.common.wrapper.KumuluzServerWrapper;\nimport com.kumuluz.ee.configuration.ConfigurationSource;\nimport com.kumuluz.ee.configuration.utils.ConfigurationImpl;\nimport com.kumuluz.ee.configuration.utils.ConfigurationUtil;\nimport com.kumuluz.ee.factories.AgroalDataSourceFactory;\nimport com.kumuluz.ee.factories.EeConfigFactory;\nimport com.kumuluz.ee.loaders.*;\nimport com.kumuluz.ee.logs.impl.JavaUtilDefaultLogConfigurator;\nimport io.agroal.api.AgroalDataSource;\n\nimport java.util.*;\nimport java.util.logging.Handler;\nimport java.util.logging.LogManager;\nimport java.util.logging.Logger;\nimport java.util.stream.Collectors;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\npublic class EeApplication {\n\n    private Logger log;\n\n    private EeConfig eeConfig;\n\n    private KumuluzServerWrapper server;\n\n    public EeApplication() {\n\n        initialize();\n    }\n\n    public EeApplication(EeConfig eeConfig) {\n\n        this.eeConfig = eeConfig;\n\n        initialize();\n    }\n\n    public static void main(String args[]) {\n\n        EeApplication app = new EeApplication();\n    }\n\n    public KumuluzServer getServer() {\n        return this.server.getServer();\n    }\n\n    private void initialize() {\n\n        // Loading the logs extension and set up logging bridges before any actual logging is done\n        Optional<LogsExtension> logsExtensionOptional = LogsExtensionLoader.loadExtension();\n\n        LogsExtension logsExtension = null;\n        if (logsExtensionOptional.isPresent()) {\n\n            logsExtension = logsExtensionOptional.get();\n\n            Optional<Class<? extends LogManager>> logManager = logsExtension.getJavaUtilLogManagerClass();\n            Optional<Handler> logHandler = logsExtension.getJavaUtilLogHandler();\n\n            if (logManager.isPresent()) {\n                System.setProperty(\"java.util.logging.manager\", logManager.get().getName());\n            } else {\n                logHandler.ifPresent(JavaUtilDefaultLogConfigurator::initSoleHandler);\n            }\n        } else {\n            JavaUtilDefaultLogConfigurator.init();\n        }\n\n        // Initialize the configuration\n        ConfigurationImpl configImpl = new ConfigurationImpl();\n\n        ConfigurationUtil.initialize(configImpl);\n\n        // we need to order config sources here in order to ensure correct initialisation of EeConfig\n        configImpl.getConfigurationSources().sort(Comparator.comparingInt(ConfigurationSource::getOrdinal).reversed());\n\n        // initialize config profiles\n        String[] configurationProfiles = ConfigurationUtil.getInstance().get(\"kumuluzee.config.profile\")\n                .or(() -> ConfigurationUtil.getInstance().get(\"mp.config.profile\"))\n                .map(s -> s.split(\",\"))\n                .orElse(new String[0]);\n\n        Arrays.stream(configurationProfiles)\n                .forEach(profile -> configImpl.getConfigurationSources().forEach(cs -> cs.initProfile(profile)));\n\n        if (this.eeConfig == null) {\n            this.eeConfig = EeConfigFactory.buildEeConfig();\n        } else if (!EeConfigFactory.isEeConfigValid(this.eeConfig)) {\n            throw new KumuluzServerException(\"The programmatically supplied EeConfig is malformed.\" +\n                    \"Please check the supplied values and the config reference to fix the missing or invalid values.\");\n        }\n\n        EeConfig.initialize(this.eeConfig);\n\n        // We first set java.util.logging.manager by extension detection and only load the extension\n        // after configuration sources have been initialized. This is because the property must be set\n        // before any calls are made to LogManager or Logger. Some of the external configuration libraries\n        // can and do in fact call the methods so this reorder is necessary.\n        if (logsExtension!=null) {\n            logsExtension.load();\n        }\n\n        // Create the main class logger\n        log = Logger.getLogger(EeApplication.class.getSimpleName());\n\n        // Signal the configuration impl that logging is up and running\n        configImpl.postInit();\n\n        for (ConfigurationSource configurationSource : configImpl.getConfigurationSources()) {\n            log.info(\"Initialized configuration source: \" + configurationSource.getClass().getSimpleName());\n        }\n\n        log.info(\"Initializing KumuluzEE\");\n\n        log.info(\"Checking for requirements\");\n\n        checkRequirements();\n\n        log.info(\"Checks passed\");\n\n        log.info(\"Initialized main configuration\");\n\n        log.info(\"Loading available EE components and extensions\");\n\n        // Loading the kumuluz server and extracting its metadata\n        KumuluzServer kumuluzServer = ServerLoader.loadServletServer();\n        processKumuluzServer(kumuluzServer);\n\n        // Loading all the present components, extracting their metadata and process dependencies\n        List<Component> components = ComponentLoader.loadComponents();\n        List<EeComponentWrapper> eeComponents = processEeComponents(components);\n\n        // Loading the config extensions and extracting its metadata\n        List<ConfigExtension> configExtensions = ConfigExtensionLoader.loadExtensions();\n        List<ExtensionWrapper<ConfigExtension>> eeConfigExtensions = processSingleEeExtensions(configExtensions, eeComponents);\n\n        List<LogsExtension> logsExtensions = logsExtensionOptional.map(Collections::singletonList).orElseGet(Collections::emptyList);\n        List<ExtensionWrapper<LogsExtension>> eeLogsExtensions = processGroupEeExtensions(logsExtensions, eeComponents);\n\n        // Loading the extensions and extracting its metadata\n        List<Extension> extensions = ExtensionLoader.loadExtensions();\n        List<ExtensionWrapper<Extension>> eeExtensions = processGroupEeExtensions(extensions, eeComponents);\n\n        log.info(\"EE Components and extensions loaded\");\n\n        log.info(\"Initializing the KumuluzEE runtime\");\n\n        EeRuntimeInternal eeRuntimeInternal = new EeRuntimeInternal();\n\n        List<EeRuntimeComponent> eeRuntimeComponents = eeComponents.stream()\n                .map(e -> new EeRuntimeComponent(e.getType(), e.getName()))\n                .collect(Collectors.toList());\n\n        List<EeRuntimeComponent> serverEeRuntimeComponents = Arrays.stream(server.getProvidedEeComponents())\n                .map(c -> new EeRuntimeComponent(c, server.getName()))\n                .collect(Collectors.toList());\n\n        serverEeRuntimeComponents.addAll(eeRuntimeComponents);\n\n        eeRuntimeInternal.setEeComponents(serverEeRuntimeComponents);\n\n        List<EeRuntimeExtension> eeRuntimeExtensions = eeExtensions.stream()\n                .map(e -> new EeRuntimeExtension(e.getGroup(), e.getName())).collect(Collectors.toList());\n\n        eeRuntimeExtensions.addAll(eeConfigExtensions.stream()\n                .map(e -> new EeRuntimeExtension(e.getGroup(), e.getName())).collect(Collectors.toList()));\n\n        eeRuntimeExtensions.addAll(eeLogsExtensions.stream()\n                .map(e -> new EeRuntimeExtension(e.getGroup(), e.getName())).collect(Collectors.toList()));\n\n        eeRuntimeInternal.setEeExtensions(eeRuntimeExtensions);\n\n        EeRuntime.initialize(eeRuntimeInternal);\n\n        log.info(\"Initialized the KumuluzEE runtime\");\n\n        // Initiate the config extensions\n        log.info(\"Initializing config extensions\");\n\n        for (ExtensionWrapper<ConfigExtension> extension : eeConfigExtensions) {\n\n            log.info(\"Found config extension implemented by \" + extension.getName());\n\n            if (extension.getExtension().isEnabled()) {\n\n                extension.getExtension().load();\n                extension.getExtension().init(server, eeConfig);\n\n                List<ConfigurationSource> sources = extension.getExtension().getConfigurationSources();\n\n                if (sources == null || sources.size() == 0) {\n                    //noinspection deprecation\n                    sources = Collections.singletonList(extension.getExtension().getConfigurationSource());\n                }\n\n                for (ConfigurationSource source : sources) {\n\n                    if (source != null) {\n                        source.init(configImpl.getDispatcher());\n                        configImpl.getConfigurationSources().add(source);\n                    }\n                }\n            } else {\n                log.info(\"Config extension \" + extension.getName() + \" won't be initialized because it's disabled.\");\n            }\n        }\n\n        // sort the configuration sources again since new sources could be added by extensions\n        configImpl.getConfigurationSources().sort(Comparator.comparingInt(ConfigurationSource::getOrdinal).reversed());\n\n        log.info(\"Config extensions initialized\");\n\n        for (ExtensionWrapper<LogsExtension> extension : eeLogsExtensions) {\n\n            log.info(\"Found logs extension implemented by \" + extension.getName());\n\n            extension.getExtension().init(server, eeConfig);\n        }\n\n        // Initiate the server\n        server.getServer().setServerConfig(eeConfig.getServer());\n        server.getServer().initServer();\n\n        // Depending on the server type, initiate server specific functionality\n        if (server.getServer() instanceof ServletServer) {\n\n            ServletServer servletServer = (ServletServer) server.getServer();\n\n            List<Extension> allExtensions = new ArrayList<>();\n            allExtensions.addAll(eeExtensions.stream().map(ExtensionWrapper::getExtension)\n                    .collect(Collectors.toList()));\n            allExtensions.addAll(eeConfigExtensions.stream().map(ExtensionWrapper::getExtension)\n                    .collect(Collectors.toList()));\n            allExtensions.addAll(eeLogsExtensions.stream().map(ExtensionWrapper::getExtension)\n                    .collect(Collectors.toList()));\n            servletServer.initWebContext(collectScanLibraries(allExtensions));\n\n            // Create and register datasources to the underlying server\n            boolean jtaPresent = eeRuntimeInternal.getEeComponents().stream().anyMatch(c -> c.getType().equals(EeComponentType.JTA));\n\n            eeConfig.getDatasources().forEach(dsc -> {\n                AgroalDataSource ds = AgroalDataSourceFactory.createDataSource(dsc, jtaPresent);\n                servletServer.registerDataSource(ds, dsc.getJndiName());\n            });\n\n            eeConfig.getXaDatasources().forEach(xdsc -> {\n                AgroalDataSource xds = AgroalDataSourceFactory.createXaDataSource(xdsc, jtaPresent);\n                servletServer.registerDataSource(xds, xdsc.getJndiName());\n            });\n\n            // Add the server info headers\n            if (eeConfig.getServer().getShowServerInfo()) {\n\n                Map<String, String> filterParams = new HashMap<>();\n                filterParams.put(\"name\", \"KumuluzEE/\" + eeRuntimeInternal.getVersion());\n                servletServer.registerFilter(PoweredByFilter.class, \"/*\", filterParams);\n            }\n        }\n\n        log.info(\"Initializing components\");\n\n        // Initiate every found component in the order specified by the components dependencies\n        for (EeComponentWrapper cw : eeComponents) {\n\n            log.info(\"Found EE component \" + cw.getType().getName() + \" implemented by \" + cw.getName());\n\n            cw.getComponent().init(server, eeConfig);\n            cw.getComponent().load();\n        }\n\n        log.info(\"Components initialized\");\n\n        // Initiate the other extensions\n        log.info(\"Initializing extensions\");\n\n        for (ExtensionWrapper<Extension> extension : eeExtensions) {\n\n            log.info(\"Found extension implemented by \" + extension.getName());\n\n            if (extension.getExtension().isEnabled()) {\n                extension.getExtension().load();\n                extension.getExtension().init(server, eeConfig);\n            } else {\n                log.info(\"Extension \" + extension.getName() + \" won't be initialized because it's disabled.\");\n            }\n        }\n\n        log.info(\"Extensions Initialized\");\n\n        server.getServer().startServer();\n\n        log.info(\"KumuluzEE started successfully\");\n    }\n\n    private List<String> collectScanLibraries(List<Extension> extensions) {\n        Set<String> scanLibraries = new HashSet<>();\n\n        extensions.stream().filter(Extension::isEnabled).forEach(e -> scanLibraries.addAll(e.scanLibraries()));\n\n        return new ArrayList<>(scanLibraries);\n    }\n\n    private void processKumuluzServer(KumuluzServer kumuluzServer) {\n\n        ServerDef serverDef = kumuluzServer.getClass().getDeclaredAnnotation(ServerDef.class);\n\n        server = new KumuluzServerWrapper(kumuluzServer, serverDef.value(), serverDef.provides());\n    }\n\n    private List<EeComponentWrapper> processEeComponents(List<Component> components) {\n\n        Map<EeComponentType, EeComponentWrapper> eeComp = new HashMap<>();\n\n        // Wrap components with their metadata and check for duplicates\n        for (Component c : components) {\n\n            EeComponentDef def = c.getClass().getDeclaredAnnotation(EeComponentDef.class);\n\n            if (def != null) {\n\n                if (eeComp.containsKey(def.type()) ||\n                        Arrays.asList(server.getProvidedEeComponents()).contains(def.type())) {\n\n                    String msg = \"Found multiple implementations (\" +\n                            (eeComp.get(def.type()) != null ? eeComp.get(def.type()).getName() : server.getName()) +\n                            \", \" + def.name() + \") of the same EE component (\" + def.type().getName() + \"). \" +\n                            \"Please check to make sure you only include a single implementation of a specific \" +\n                            \"EE component.\";\n\n                    log.severe(msg);\n\n                    throw new KumuluzServerException(msg);\n                }\n\n                EeComponentDependency[] dependencies = c.getClass().getDeclaredAnnotationsByType\n                        (EeComponentDependency.class);\n                EeComponentOptional[] optionals = c.getClass().getDeclaredAnnotationsByType(EeComponentOptional.class);\n\n                eeComp.put(def.type(), new EeComponentWrapper(c, def.name(), def.type(), dependencies, optionals));\n            }\n        }\n\n        log.info(\"Processing EE component dependencies\");\n\n        // Check if all dependencies are fulfilled\n        for (EeComponentWrapper cmp : eeComp.values()) {\n\n            for (EeComponentDependency dep : cmp.getDependencies()) {\n\n                String depCompName = null;\n\n                ComponentWrapper depComp = eeComp.get(dep.value());\n\n                // Check all posible locations for the dependency (Components and Server)\n                if (depComp != null) {\n\n                    depCompName = depComp.getName();\n                } else if (Arrays.asList(server.getProvidedEeComponents()).contains(dep.value())) {\n\n                    depCompName = server.getName();\n                }\n\n                if (depCompName == null) {\n\n                    String msg = \"EE component dependency unfulfilled. The EE component \" + cmp.getType().getName() +\n                            \" implemented by \" + cmp.getName() + \" requires \" + dep.value().getName() + \", which was \" +\n                            \"not \" +\n                            \"found. Please make sure to include the required component.\";\n\n                    log.severe(msg);\n\n                    throw new KumuluzServerException(msg);\n                }\n\n                if (dep.implementations().length > 0 &&\n                        !Arrays.asList(dep.implementations()).contains(depCompName)) {\n\n                    String msg = \"EE component implementation dependency unfulfilled. The EE component \" +\n                            cmp.getType().getName() + \" implemented by \" + cmp.getName() + \" requires \" + dep.value()\n                            .getName() +\n                            \" implemented by one of the following implementations: \" +\n                            Arrays.toString(dep.implementations()) + \". Please make sure you use one of the \" +\n                            \"implementations required by this component.\";\n\n                    log.severe(msg);\n\n                    throw new KumuluzServerException(msg);\n                }\n            }\n\n            // Check if all optional dependencies and their implementations are fulfilled\n            for (EeComponentOptional dep : cmp.getOptionalDependencies()) {\n\n                String depCompName = null;\n\n                ComponentWrapper depComp = eeComp.get(dep.value());\n\n                // Check all posible locations for the dependency (Components and Server)\n                if (depComp != null) {\n\n                    depCompName = depComp.getName();\n                } else if (!Arrays.asList(server.getProvidedEeComponents()).contains(dep.value())) {\n\n                    depCompName = server.getName();\n                }\n\n                if (depCompName != null && dep.implementations().length > 0 &&\n                        !Arrays.asList(dep.implementations()).contains(depCompName)) {\n\n                    String msg = \"EE component optional implementation dependency unfulfilled. The EE component \" +\n                            cmp.getType().getName() + \" implemented by \" + cmp.getName() + \" requires \" + dep.value()\n                            .getName() +\n                            \" implemented by one of the following implementations: \" +\n                            Arrays.toString(dep.implementations()) + \". Please make sure you use one of the \" +\n                            \"implementations required by this component.\";\n\n                    log.severe(msg);\n\n                    throw new KumuluzServerException(msg);\n                }\n            }\n        }\n\n        return new ArrayList<>(eeComp.values());\n    }\n\n    private <E extends Extension> List<ExtensionWrapper<E>> processGroupEeExtensions(List<E> extensions, List<EeComponentWrapper>\n            wrappedComponents) {\n\n        Map<String, ExtensionWrapper<E>> eeExt = new HashMap<>();\n\n        // Wrap extensions with their metadata and check for duplicates\n        for (E e : extensions) {\n\n            EeExtensionDef def = e.getClass().getDeclaredAnnotation(EeExtensionDef.class);\n\n            if (def != null) {\n\n                if (eeExt.containsKey(def.group())) {\n\n                    String msg = \"Found multiple implementations (\" + eeExt.get(def.group()).getName() +\n                            \", \" + def.name() + \") of the same EE extension group (\" + def.group() + \"). \" +\n                            \"Please check to make sure you only include a single implementation of a specific \" +\n                            \"EE extension group.\";\n\n                    log.severe(msg);\n\n                    throw new KumuluzServerException(msg);\n                }\n\n                EeComponentDependency[] dependencies = e.getClass().getDeclaredAnnotationsByType\n                        (EeComponentDependency.class);\n                EeComponentOptional[] optionals = e.getClass().getDeclaredAnnotationsByType(EeComponentOptional.class);\n\n                eeExt.put(def.group(), new ExtensionWrapper<>(e, def.name(), def.group(), dependencies, optionals));\n            }\n        }\n\n        List<ExtensionWrapper<E>> extensionWrappers = new ArrayList<>(eeExt.values());\n\n        log.info(\"Processing EE extension dependencies\");\n\n        processEeExtensionDependencies(extensionWrappers, wrappedComponents);\n\n        return extensionWrappers;\n    }\n\n    private <E extends Extension> List<ExtensionWrapper<E>> processSingleEeExtensions(List<E> extensions, List<EeComponentWrapper>\n            wrappedComponents) {\n\n        List<ExtensionWrapper<E>> extensionWrappers = new ArrayList<>();\n\n        for (E e : extensions) {\n\n            EeExtensionDef def = e.getClass().getDeclaredAnnotation(EeExtensionDef.class);\n\n            if (def != null) {\n\n                EeComponentDependency[] dependencies = e.getClass().getDeclaredAnnotationsByType(EeComponentDependency.class);\n                EeComponentOptional[] optionals = e.getClass().getDeclaredAnnotationsByType(EeComponentOptional.class);\n\n                extensionWrappers.add(new ExtensionWrapper<>(e, def.name(), def.group(), dependencies, optionals));\n            }\n        }\n\n        log.info(\"Processing EE single extensions dependencies\");\n\n        processEeExtensionDependencies(extensionWrappers, wrappedComponents);\n\n        return extensionWrappers;\n    }\n\n    private <E extends Extension> void processEeExtensionDependencies(List<ExtensionWrapper<E>> extensions, List<EeComponentWrapper>\n            components) {\n\n        // Check if all dependencies are fulfilled\n        for (ExtensionWrapper ext : extensions) {\n\n            for (EeComponentDependency dep : ext.getDependencies()) {\n\n                Optional<EeComponentWrapper> depComp = components.stream()\n                        .filter(c -> c.getType().equals(dep.value())).findFirst();\n\n                String depCompName = null;\n\n                if (depComp.isPresent()) {\n\n                    depCompName = depComp.get().getName();\n                } else if (Arrays.asList(server.getProvidedEeComponents()).contains(dep.value())) {\n\n                    depCompName = server.getName();\n                }\n\n                if (depCompName == null) {\n\n                    String msg = \"EE extension implementation dependency unfulfilled. The EE extension group \" +\n                            ext.getGroup() + \" implemented by \" + ext.getName() + \" requires \" + dep.value().getName() +\n                            \" implemented by one of the following implementations: \" +\n                            Arrays.toString(dep.implementations()) + \". Please make sure you use one of the \" +\n                            \"implementations required by this component.\";\n\n                    log.severe(msg);\n\n                    throw new KumuluzServerException(msg);\n\n                }\n\n                if (dep.implementations().length > 0 &&\n                        !Arrays.asList(dep.implementations()).contains(depCompName)) {\n\n                    String msg = \"EE extension implementation dependency unfulfilled. The EE extension group \" +\n                            ext.getGroup() + \" implemented by \" + ext.getName() + \" requires component \" +\n                            dep.value().getName() + \" implemented by one of the following implementations: \" +\n                            Arrays.toString(dep.implementations()) + \". Please make sure you use one of the \" +\n                            \"component implementations required by this component.\";\n\n                    log.severe(msg);\n\n                    throw new KumuluzServerException(msg);\n                }\n            }\n\n            // Check if all optional dependencies and their implementations are fulfilled\n            for (EeComponentOptional dep : ext.getOptionalDependencies()) {\n\n                Optional<EeComponentWrapper> depComp = components.stream()\n                        .filter(c -> c.getType().equals(dep.value())).findFirst();\n\n                String depCompName = null;\n\n                // Check all posible locations for the dependency (Components and Server)\n                if (depComp.isPresent()) {\n\n                    depCompName = depComp.get().getName();\n                } else if (!Arrays.asList(server.getProvidedEeComponents()).contains(dep.value())) {\n\n                    depCompName = server.getName();\n                }\n\n                if (depCompName != null && dep.implementations().length > 0 &&\n                        !Arrays.asList(dep.implementations()).contains(depCompName)) {\n\n                    String msg = \"EE extension optional implementation dependency unfulfilled. The EE extension group \" +\n                            ext.getGroup() + \" implemented by \" + ext.getName() + \" requires component \" +\n                            dep.value().getName() + \" implemented by one of the following implementations: \" +\n                            Arrays.toString(dep.implementations()) + \". Please make sure you use one of the \" +\n                            \"component implementations required by this component.\";\n\n                    log.severe(msg);\n\n                    throw new KumuluzServerException(msg);\n                }\n            }\n        }\n    }\n\n    private void checkRequirements() {\n\n        if (ResourceUtils.isRunningInJar()) {\n\n            log.info(\"KumuluzEE running inside a JAR runtime.\");\n        } else {\n\n            log.info(\"KumuluzEE running in an exploded class and dependency runtime.\");\n        }\n    }\n}\n"
  },
  {
    "path": "core/src/main/java/com/kumuluz/ee/factories/AgroalDataSourceFactory.java",
    "content": "package com.kumuluz.ee.factories;\n\nimport com.kumuluz.ee.common.config.DataSourceConfig;\nimport com.kumuluz.ee.common.config.DataSourcePoolConfig;\nimport com.kumuluz.ee.common.config.XaDataSourceConfig;\nimport com.kumuluz.ee.common.exceptions.KumuluzServerException;\nimport com.kumuluz.ee.common.utils.StringUtils;\nimport com.kumuluz.ee.jta.common.JtaProvider;\nimport io.agroal.api.AgroalDataSource;\nimport io.agroal.api.configuration.AgroalConnectionFactoryConfiguration.TransactionIsolation;\nimport io.agroal.api.configuration.AgroalConnectionPoolConfiguration;\nimport io.agroal.api.configuration.AgroalDataSourceConfiguration.DataSourceImplementation;\nimport io.agroal.api.configuration.supplier.AgroalConnectionFactoryConfigurationSupplier;\nimport io.agroal.api.configuration.supplier.AgroalConnectionPoolConfigurationSupplier;\nimport io.agroal.api.configuration.supplier.AgroalDataSourceConfigurationSupplier;\nimport io.agroal.api.security.NamePrincipal;\nimport io.agroal.api.security.SimplePassword;\n\nimport java.sql.Connection;\nimport java.sql.SQLException;\nimport java.sql.Statement;\nimport java.time.Duration;\nimport java.util.Arrays;\nimport java.util.Optional;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\nimport java.util.stream.Collectors;\n\n/**\n * @author Marcos Koch Salvador\n * @since 3.7.0\n */\npublic class AgroalDataSourceFactory {\n\n    private static final Logger log = Logger.getLogger(AgroalDataSourceFactory.class.getSimpleName());\n\n    public static AgroalDataSource createDataSource(DataSourceConfig dsc, boolean jtaPresent) {\n        AgroalDataSourceConfigurationSupplier dataSourceConfig = new AgroalDataSourceConfigurationSupplier();\n\n        AgroalConnectionPoolConfigurationSupplier poolConfig = dataSourceConfig.connectionPoolConfiguration();\n\n        AgroalConnectionFactoryConfigurationSupplier connectionFactoryConfig = poolConfig.connectionFactoryConfiguration();\n\n        if (!jtaPresent) {\n            dataSourceConfig.dataSourceImplementation(DataSourceImplementation.HIKARI);\n        } else {\n            poolConfig.transactionIntegration( JtaProvider.getInstance().getTransactionIntegration(dsc.getJndiName()) );\n        }\n\n        if (!StringUtils.isNullOrEmpty( dsc.getDriverClass() )) {\n            connectionFactoryConfig.connectionProviderClassName(dsc.getDriverClass());\n        } else if (!StringUtils.isNullOrEmpty( dsc.getDataSourceClass( ))) {\n            connectionFactoryConfig.connectionProviderClassName(dsc.getDataSourceClass());\n        }\n\n        if (!StringUtils.isNullOrEmpty( dsc.getConnectionUrl() )) {\n            connectionFactoryConfig.jdbcUrl(dsc.getConnectionUrl());\n        }\n\n        setDatabaseCredentials(connectionFactoryConfig, dsc.getUsername(), dsc.getPassword());\n\n        setConnectionPoolConfiguration(poolConfig, connectionFactoryConfig, dsc.getPool(), !jtaPresent);\n\n        dsc.getProps().forEach(connectionFactoryConfig::jdbcProperty);\n\n        try {\n            return AgroalDataSource.from( dataSourceConfig );\n        } catch (SQLException e) {\n            throw new KumuluzServerException(\"Failed to create DataSource\", e);\n        }\n    }\n\n    public static AgroalDataSource createXaDataSource(XaDataSourceConfig xdsc, boolean jtaPresent) {\n        AgroalDataSourceConfigurationSupplier xaDataSourceConfig = new AgroalDataSourceConfigurationSupplier();\n\n        AgroalConnectionPoolConfigurationSupplier poolConfig = xaDataSourceConfig.connectionPoolConfiguration();\n\n        AgroalConnectionFactoryConfigurationSupplier connectionFactoryConfig = poolConfig.connectionFactoryConfiguration();\n\n        if (jtaPresent) {\n            poolConfig.transactionIntegration( JtaProvider.getInstance().getTransactionIntegration(xdsc.getJndiName()) );\n        }\n\n        if (!StringUtils.isNullOrEmpty( xdsc.getXaDatasourceClass() )) {\n            connectionFactoryConfig.connectionProviderClassName( xdsc.getXaDatasourceClass() );\n        }\n\n        setDatabaseCredentials(connectionFactoryConfig, xdsc.getUsername(), xdsc.getPassword());\n\n        setConnectionPoolConfiguration(poolConfig, connectionFactoryConfig, xdsc.getPool(), false);\n\n        xdsc.getProps().forEach(connectionFactoryConfig::jdbcProperty);\n\n        try {\n            return AgroalDataSource.from( xaDataSourceConfig );\n        } catch (SQLException e) {\n            throw new KumuluzServerException(\"Failed to create XaDataSource\", e);\n        }\n    }\n\n    private static void setDatabaseCredentials(AgroalConnectionFactoryConfigurationSupplier connectionFactory, String username, String password) {\n        if (!StringUtils.isNullOrEmpty( username )) {\n            connectionFactory.principal(new NamePrincipal( username ));\n        }\n\n        if (!StringUtils.isNullOrEmpty( password )) {\n            connectionFactory.credential(new SimplePassword( password ));\n        }\n    }\n\n    private static void setConnectionPoolConfiguration(AgroalConnectionPoolConfigurationSupplier pool,\n                                                       AgroalConnectionFactoryConfigurationSupplier connectionFactoryConfig,\n                                                       DataSourcePoolConfig dscp, boolean isHikariSelected) {\n\n        Optional.ofNullable( dscp.getAutoCommit() ).ifPresent(connectionFactoryConfig::autoCommit);\n\n        Optional.ofNullable( dscp.getFlushOnClose() ).ifPresent(v -> {\n            warnMessageAgroalFeature(\"flushOnClose\", isHikariSelected);\n            pool.flushOnClose(v);\n        });\n\n        Optional.ofNullable( dscp.getConnectionTimeout() ).map(Duration::ofMillis).ifPresent(pool::acquisitionTimeout);\n\n        Optional.ofNullable( dscp.getIdleTimeout() ).map(Duration::ofMillis).ifPresent(pool::reapTimeout);\n\n        Optional.ofNullable( dscp.getMaxLifetime() ).map(Duration::ofMillis).ifPresent(pool::maxLifetime);\n\n        Optional.ofNullable( dscp.getInitialSize() ).ifPresent(v -> {\n            warnMessageAgroalFeature(\"initialSize\", isHikariSelected);\n            pool.initialSize(v);\n        });\n\n        Optional.ofNullable( dscp.getMinSize() ).ifPresent(v -> {\n            warnMessageAgroalFeature(\"minSize\", isHikariSelected);\n            pool.minSize(v);\n        });\n\n        Optional.ofNullable( dscp.getMaxSize() ).ifPresent(pool::maxSize);\n\n        if (!StringUtils.isNullOrEmpty( dscp.getName() )) {\n            // Unknown or non-existent configuration in Agroal\n            warnMessageDepreciatedProperty(\"name\");\n        }\n\n        // Unknown or non-existent configuration in Agroal\n        Optional.ofNullable( dscp.getInitializationFailTimeout() ).ifPresent(v -> warnMessageDepreciatedProperty(\"initializationFailTimeout\") );\n\n        // Unknown or non-existent configuration in Agroal\n        Optional.ofNullable( dscp.getIsolateInternalQueries() ).ifPresent(v -> warnMessageDepreciatedProperty(\"isolateInternalQueries\") );\n\n        // Unknown or non-existent configuration in Agroal\n        Optional.ofNullable( dscp.getAllowPoolSuspension() ).ifPresent(v -> warnMessageDepreciatedProperty(\"allowPoolSuspension\") );\n\n        // Unknown or non-existent configuration in Agroal\n        Optional.ofNullable( dscp.getReadOnly() ).ifPresent(v -> warnMessageDepreciatedProperty(\"readOnly\") );\n\n        // Unknown or non-existent configuration in Agroal\n        Optional.ofNullable( dscp.getRegisterMbeans() ).ifPresent(v -> warnMessageDepreciatedProperty(\"registerMbeans\") );\n\n        Optional.ofNullable( dscp.getValidationTimeout() ).map(Duration::ofMillis).ifPresent(pool::validationTimeout);\n\n        Optional.ofNullable( dscp.getLeakDetectionThreshold() ).map(Duration::ofMillis).ifPresent(pool::leakTimeout);\n\n        Optional.ofNullable( dscp.getIdleValidationTimeout() ).map(Duration::ofMillis).ifPresent(v -> {\n            warnMessageAgroalFeature(\"idleValidationTimeout\", isHikariSelected);\n            pool.idleValidationTimeout(v);\n        });\n\n        // Unknown or non-existent configuration in Agroal\n        Optional.ofNullable( dscp.getMinIdle() ).ifPresent(v -> warnMessageDepreciatedProperty(\"minIdle\") );\n\n        if (dscp.getConnectionValidSql() != null) {\n            String validationQuery = dscp.getConnectionValidSql();\n            pool.connectionValidator(new AgroalConnectionPoolConfiguration.ConnectionValidator() {\n\n                @Override\n                public boolean isValid(Connection connection) {\n                    try (Statement stmt = connection.createStatement()) {\n                        stmt.execute(validationQuery);\n                        return true;\n                    } catch (Exception e) {\n                        log.log(Level.WARNING, \"Connection validation failed\", e);\n                    }\n                    return false;\n                }\n            });\n        } else {\n            pool.connectionValidator(AgroalConnectionPoolConfiguration.ConnectionValidator.defaultValidator());\n        }\n\n        if (!StringUtils.isNullOrEmpty( dscp.getConnectionInitSql() )) {\n            connectionFactoryConfig.initialSql(dscp.getConnectionInitSql());\n        }\n\n        setJdbcTransactionIsolation(connectionFactoryConfig, dscp.getTransactionIsolation());\n    }\n\n    private static void setJdbcTransactionIsolation(AgroalConnectionFactoryConfigurationSupplier connectionFactory, String transactionIsolation) {\n        if (!StringUtils.isNullOrEmpty( transactionIsolation )) {\n\n            boolean found = false;\n\n            for (TransactionIsolation isolation : TransactionIsolation.values()) {\n\n                final String isolationName = \"TRANSACTION_\" + isolation.name();\n\n                if (isolationName.equalsIgnoreCase(transactionIsolation)) {\n                    connectionFactory.jdbcTransactionIsolation(isolation);\n                    found = true;\n                    break;\n                }\n            }\n\n            if (!found) {\n                log.warning(\"Could not find transaction isolation level with name: \" + transactionIsolation +\n                        \", possible values: \" + Arrays.stream(TransactionIsolation.values())\n                        .map(Enum::name)\n                        .map(n -> \"TRANSACTION_\" + n)\n                        .collect(Collectors.joining(\", \")));\n            }\n        }\n    }\n\n    private static void warnMessageAgroalFeature(String propertyName, boolean isHikariSelected) {\n        if (isHikariSelected) {\n            log.log(Level.WARNING, \"The property \\\"\" + propertyName + \"\\\" is exclusive to the Agroal Connection Pool, therefore it will not be recognized by HikariCP!\");\n        }\n    }\n\n    private static void warnMessageDepreciatedProperty(String propertyName) {\n        log.log(Level.WARNING, \"Property \\\"\" + propertyName + \"\\\" is not supported by Agroal Connection Pool and will be removed soon!\");\n    }\n\n}\n"
  },
  {
    "path": "core/src/main/java/com/kumuluz/ee/factories/EeConfigFactory.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.factories;\n\nimport com.kumuluz.ee.common.config.*;\nimport com.kumuluz.ee.common.utils.StringUtils;\nimport com.kumuluz.ee.configuration.utils.ConfigurationUtil;\n\nimport java.util.*;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic class EeConfigFactory {\n\n    // ordered by priority, first entry has the highest priority\n    private static final List<String> PORT_ENVIRONMENT_VARIABLE_NAMES = List.of(\n            \"PORT\",\n            \"FUNCTIONS_CUSTOMHANDLER_PORT\"\n    );\n\n    public static EeConfig buildEeConfig() {\n\n        ConfigurationUtil cfg = ConfigurationUtil.getInstance();\n\n        EeConfig.Builder eeConfigBuilder = new EeConfig.Builder();\n\n        Optional<String> appName = cfg.get(\"kumuluzee.name\");\n        Optional<String> appVersion = cfg.get(\"kumuluzee.version\");\n        Optional<Boolean> appDebug = cfg.getBoolean(\"kumuluzee.debug\");\n\n        appName.ifPresent(eeConfigBuilder::name);\n        appVersion.ifPresent(eeConfigBuilder::version);\n        appDebug.ifPresent(eeConfigBuilder::debug);\n\n        ServerConfig.Builder serverBuilder = new ServerConfig.Builder();\n\n        Optional<List<String>> serverCfgOpt = cfg.getMapKeys(\"kumuluzee.server\");\n\n        if (serverCfgOpt.isPresent()) {\n\n            Optional<String> baseUrl = cfg.get(\"kumuluzee.server.base-url\");\n            Optional<String> contextPath = cfg.get(\"kumuluzee.server.context-path\");\n            Optional<Boolean> dirBrowsing = cfg.getBoolean(\"kumuluzee.server.dir-browsing\");\n            Optional<Boolean> etags = cfg.getBoolean(\"kumuluzee.server.etags\");\n            Optional<Integer> minThreads = cfg.getInteger(\"kumuluzee.server.min-threads\");\n            Optional<Integer> maxThreads = cfg.getInteger(\"kumuluzee.server.max-threads\");\n            Optional<Boolean> forceHttps = cfg.getBoolean(\"kumuluzee.server.force-https\");\n            Optional<Boolean> showServerInfo = cfg.getBoolean(\"kumuluzee.server.show-server-info\");\n            Optional<Boolean> forwardStartupException = cfg.getBoolean(\"kumuluzee.server.jetty.forward-startup-exception\");\n\n            baseUrl.ifPresent(serverBuilder::baseUrl);\n            contextPath.ifPresent(serverBuilder::contextPath);\n            dirBrowsing.ifPresent(serverBuilder::dirBrowsing);\n            etags.ifPresent(serverBuilder::etags);\n            minThreads.ifPresent(serverBuilder::minThreads);\n            maxThreads.ifPresent(serverBuilder::maxThreads);\n            forceHttps.ifPresent(serverBuilder::forceHttps);\n            showServerInfo.ifPresent(serverBuilder::showServerInfo);\n            forwardStartupException.ifPresent(serverBuilder::forwardStartupException);\n        }\n\n        ServerConnectorConfig.Builder httpBuilder =\n                createServerConnectorConfigBuilder(\"kumuluzee.server.http\",\n                        ServerConnectorConfig.DEFAULT_HTTP_PORT);\n\n        PORT_ENVIRONMENT_VARIABLE_NAMES.stream()\n                .map(System::getenv)\n                .filter(Objects::nonNull)\n                .filter(s -> !s.isEmpty())\n                .map(Integer::parseInt)\n                .findFirst()\n                .ifPresent(httpBuilder::port);\n\n        ServerConnectorConfig.Builder httpsBuilder =\n                createServerConnectorConfigBuilder(\"kumuluzee.server.https\",\n                        ServerConnectorConfig.DEFAULT_HTTPS_PORT);\n\n        serverBuilder.http(httpBuilder);\n        serverBuilder.https(httpsBuilder);\n\n        GzipConfig.Builder gzipBuilder =\n                createGzipConfigBuilder(\"kumuluzee.server.gzip\");\n\n        serverBuilder.gzip(gzipBuilder);\n\n        eeConfigBuilder.server(serverBuilder);\n\n        Optional<List<String>> envCfgOpt = cfg.getMapKeys(\"kumuluzee.env\");\n\n        if (envCfgOpt.isPresent()) {\n\n            EnvConfig.Builder envBuilder = new EnvConfig.Builder();\n\n            Optional<String> envName = cfg.get(\"kumuluzee.env.name\");\n\n            envName.ifPresent(envBuilder::name);\n\n            eeConfigBuilder.env(envBuilder);\n        }\n\n        Optional<List<String>> loaderCfgOpt = cfg.getMapKeys(\"kumuluzee.dev\");\n\n        if (loaderCfgOpt.isPresent()) {\n\n            DevConfig.Builder devBuilder = new DevConfig.Builder();\n\n            Optional<String> webappDir = cfg.get(\"kumuluzee.dev.webapp-dir\");\n            Optional<Boolean> runningTests = cfg.getBoolean(\"kumuluzee.dev.running-tests\");\n\n            webappDir.ifPresent(devBuilder::webappDir);\n            runningTests.ifPresent(devBuilder::runningTests);\n\n            getConfigList(\"kumuluzee.dev.scan-libraries\").ifPresent(devBuilder::scanLibraries);\n\n            eeConfigBuilder.dev(devBuilder);\n        }\n\n        Optional<Integer> dsSizeOpt = cfg.getListSize(\"kumuluzee.datasources\");\n\n        if (dsSizeOpt.isPresent()) {\n\n            for (int i = 0; i < dsSizeOpt.get(); i++) {\n\n                DataSourceConfig.Builder dsc = new DataSourceConfig.Builder();\n\n                Optional<String> jndiName = cfg.get(\"kumuluzee.datasources[\" + i + \"].jndi-name\");\n                Optional<String> driverClass = cfg.get(\"kumuluzee.datasources[\" + i + \"].driver-class\");\n                Optional<String> dataSourceClass = cfg.get(\"kumuluzee.datasources[\" + i + \"].datasource-class\");\n                Optional<String> conUrl = cfg.get(\"kumuluzee.datasources[\" + i + \"].connection-url\");\n                Optional<String> user = cfg.get(\"kumuluzee.datasources[\" + i + \"].username\");\n                Optional<String> pass = cfg.get(\"kumuluzee.datasources[\" + i + \"].password\");\n\n                jndiName.ifPresent(dsc::jndiName);\n                driverClass.ifPresent(dsc::driverClass);\n                dataSourceClass.ifPresent(dsc::dataSourceClass);\n                conUrl.ifPresent(dsc::connectionUrl);\n                user.ifPresent(dsc::username);\n                pass.ifPresent(dsc::password);\n\n                Optional<List<String>> pool = cfg.getMapKeys(\"kumuluzee.datasources[\" + i + \"].pool\");\n\n                if (pool.isPresent()) {\n\n                    DataSourcePoolConfig.Builder dspc = new DataSourcePoolConfig.Builder();\n\n                    Optional<Boolean> autoCommit = cfg.getBoolean(\"kumuluzee.datasources[\" + i + \"].pool.auto-commit\");\n                    Optional<Boolean> flushOnClose = cfg.getBoolean(\"kumuluzee.datasources[\" + i + \"].pool.flush-on-close\");\n                    Optional<Long> connectionTimeout = cfg.getLong(\"kumuluzee.datasources[\" + i + \"].pool.connection-timeout\");\n                    Optional<Long> idleTimeout = cfg.getLong(\"kumuluzee.datasources[\" + i + \"].pool.idle-timeout\");\n                    Optional<Long> maxLifetime = cfg.getLong(\"kumuluzee.datasources[\" + i + \"].pool.max-lifetime\");\n                    Optional<Integer> minIdle = cfg.getInteger(\"kumuluzee.datasources[\" + i + \"].pool.min-idle\");\n                    Optional<Integer> initialSize = cfg.getInteger(\"kumuluzee.datasources[\" + i + \"].pool.initial-size\");\n                    Optional<Integer> minSize = cfg.getInteger(\"kumuluzee.datasources[\" + i + \"].pool.min-size\");\n                    Optional<Integer> maxSize = cfg.getInteger(\"kumuluzee.datasources[\" + i + \"].pool.max-size\");\n                    Optional<String> poolName = cfg.get(\"kumuluzee.datasources[\" + i + \"].pool.name\");\n                    Optional<Long> initializationFailTimeout = cfg.getLong(\"kumuluzee.datasources[\" + i + \"].pool\" +\n                            \".initialization-fail-timeout\");\n                    Optional<Boolean> isolateInternalQueries = cfg.getBoolean(\"kumuluzee.datasources[\" + i + \"].pool\" +\n                            \".isolate-internal-queries\");\n                    Optional<Boolean> allowPoolSuspension = cfg.getBoolean(\"kumuluzee.datasources[\" + i + \"].pool.allow-pool-suspension\");\n                    Optional<Boolean> readOnly = cfg.getBoolean(\"kumuluzee.datasources[\" + i + \"].pool.read-only\");\n                    Optional<Boolean> registerMbeans = cfg.getBoolean(\"kumuluzee.datasources[\" + i + \"].pool.register-mbeans\");\n                    Optional<String> connectionInitSql = cfg.get(\"kumuluzee.datasources[\" + i + \"].pool.connection-init-sql\");\n                    Optional<String> connectionValidSql = cfg.get(\"kumuluzee.datasources[\" + i + \"].pool.connection-valid-sql\");\n                    Optional<String> transactionIsolation = cfg.get(\"kumuluzee.datasources[\" + i + \"].pool.transaction-isolation\");\n                    Optional<Long> validationTimeout = cfg.getLong(\"kumuluzee.datasources[\" + i + \"].pool.validation-timeout\");\n                    Optional<Long> leakDetectionThreshold = cfg.getLong(\"kumuluzee.datasources[\" + i + \"].pool.leak-detection-threshold\");\n                    Optional<Long> idleValidationTimeout = cfg.getLong(\"kumuluzee.datasources[\" + i + \"].pool.idle-validation-timeout\");\n\n                    autoCommit.ifPresent(dspc::autoCommit);\n                    flushOnClose.ifPresent(dspc::flushOnClose);\n                    connectionTimeout.ifPresent(dspc::connectionTimeout);\n                    idleTimeout.ifPresent(dspc::idleTimeout);\n                    maxLifetime.ifPresent(dspc::maxLifetime);\n                    minIdle.ifPresent(dspc::minIdle);\n                    initialSize.ifPresent(dspc::initialSize);\n                    minSize.ifPresent(dspc::minSize);\n                    maxSize.ifPresent(dspc::maxSize);\n                    poolName.ifPresent(dspc::name);\n                    initializationFailTimeout.ifPresent(dspc::initializationFailTimeout);\n                    isolateInternalQueries.ifPresent(dspc::isolateInternalQueries);\n                    allowPoolSuspension.ifPresent(dspc::allowPoolSuspension);\n                    readOnly.ifPresent(dspc::readOnly);\n                    registerMbeans.ifPresent(dspc::registerMbeans);\n                    connectionInitSql.ifPresent(dspc::connectionInitSql);\n                    connectionValidSql.ifPresent(dspc::connectionValidSql);\n                    transactionIsolation.ifPresent(dspc::transactionIsolation);\n                    validationTimeout.ifPresent(dspc::validationTimeout);\n                    leakDetectionThreshold.ifPresent(dspc::leakDetectionThreshold);\n                    idleValidationTimeout.ifPresent(dspc::idleValidationTimeout);\n\n                    dsc.pool(dspc);\n                }\n\n                Optional<List<String>> props = cfg.getMapKeys(\"kumuluzee.datasources[\" + i + \"].props\");\n\n                if (props.isPresent()) {\n\n                    for (String propName : props.get()) {\n\n                        Optional<String> propValue = cfg.get(\"kumuluzee.datasources[\" + i + \"].props.\" + propName);\n\n                        propValue.ifPresent(v -> dsc.prop(StringUtils.hyphenCaseToCamelCase(propName), v));\n                    }\n                }\n\n                eeConfigBuilder.datasource(dsc);\n            }\n        }\n\n        Optional<Integer> xDsSizeOpt = cfg.getListSize(\"kumuluzee.xa-datasources\");\n\n        if (xDsSizeOpt.isPresent()) {\n\n            for (int i = 0; i < xDsSizeOpt.get(); i++) {\n\n                XaDataSourceConfig.Builder xdsc = new XaDataSourceConfig.Builder();\n\n                Optional<String> jndiName = cfg.get(\"kumuluzee.xa-datasources[\" + i + \"].jndi-name\");\n                Optional<String> xaDatasourceClass = cfg.get(\"kumuluzee.xa-datasources[\" + i + \"].xa-datasource-class\");\n                Optional<String> user = cfg.get(\"kumuluzee.xa-datasources[\" + i + \"].username\");\n                Optional<String> pass = cfg.get(\"kumuluzee.xa-datasources[\" + i + \"].password\");\n\n                jndiName.ifPresent(xdsc::jndiName);\n                xaDatasourceClass.ifPresent(xdsc::xaDatasourceClass);\n                user.ifPresent(xdsc::username);\n                pass.ifPresent(xdsc::password);\n\n                Optional<List<String>> pool = cfg.getMapKeys(\"kumuluzee.xa-datasources[\" + i + \"].pool\");\n\n                if (pool.isPresent()) {\n\n                    DataSourcePoolConfig.Builder dspc = new DataSourcePoolConfig.Builder();\n\n                    Optional<Boolean> autoCommit = cfg.getBoolean(\"kumuluzee.xa-datasources[\" + i + \"].pool.auto-commit\");\n                    Optional<Boolean> flushOnClose = cfg.getBoolean(\"kumuluzee.xa-datasources[\" + i + \"].pool.flush-on-close\");\n                    Optional<Long> connectionTimeout = cfg.getLong(\"kumuluzee.xa-datasources[\" + i + \"].pool.connection-timeout\");\n                    Optional<Long> idleTimeout = cfg.getLong(\"kumuluzee.xa-datasources[\" + i + \"].pool.idle-timeout\");\n                    Optional<Long> maxLifetime = cfg.getLong(\"kumuluzee.xa-datasources[\" + i + \"].pool.max-lifetime\");\n                    Optional<Integer> minIdle = cfg.getInteger(\"kumuluzee.xa-datasources[\" + i + \"].pool.min-idle\");\n                    Optional<Integer> initialSize = cfg.getInteger(\"kumuluzee.xa-datasources[\" + i + \"].pool.initial-size\");\n                    Optional<Integer> minSize = cfg.getInteger(\"kumuluzee.xa-datasources[\" + i + \"].pool.min-size\");\n                    Optional<Integer> maxSize = cfg.getInteger(\"kumuluzee.xa-datasources[\" + i + \"].pool.max-size\");\n                    Optional<String> poolName = cfg.get(\"kumuluzee.xa-datasources[\" + i + \"].pool.name\");\n                    Optional<Long> initializationFailTimeout = cfg.getLong(\"kumuluzee.xa-datasources[\" + i + \"].pool\" +\n                            \".initialization-fail-timeout\");\n                    Optional<Boolean> isolateInternalQueries = cfg.getBoolean(\"kumuluzee.xa-datasources[\" + i + \"].pool\" +\n                            \".isolate-internal-queries\");\n                    Optional<Boolean> allowPoolSuspension = cfg.getBoolean(\"kumuluzee.xa-datasources[\" + i + \"].pool.allow-pool-suspension\");\n                    Optional<Boolean> readOnly = cfg.getBoolean(\"kumuluzee.xa-datasources[\" + i + \"].pool.read-only\");\n                    Optional<Boolean> registerMbeans = cfg.getBoolean(\"kumuluzee.xa-datasources[\" + i + \"].pool.register-mbeans\");\n                    Optional<String> connectionInitSql = cfg.get(\"kumuluzee.xa-datasources[\" + i + \"].pool.connection-init-sql\");\n                    Optional<String> transactionIsolation = cfg.get(\"kumuluzee.xa-datasources[\" + i + \"].pool.transaction-isolation\");\n                    Optional<Long> validationTimeout = cfg.getLong(\"kumuluzee.xa-datasources[\" + i + \"].pool.validation-timeout\");\n                    Optional<Long> leakDetectionThreshold = cfg.getLong(\"kumuluzee.xa-datasources[\" + i + \"].pool.leak-detection-threshold\");\n                    Optional<Long> idleValidationTimeout = cfg.getLong(\"kumuluzee.xa-datasources[\" + i + \"].pool.idle-validation-timeout\");\n\n                    autoCommit.ifPresent(dspc::autoCommit);\n                    flushOnClose.ifPresent(dspc::flushOnClose);\n                    connectionTimeout.ifPresent(dspc::connectionTimeout);\n                    idleTimeout.ifPresent(dspc::idleTimeout);\n                    maxLifetime.ifPresent(dspc::maxLifetime);\n                    minIdle.ifPresent(dspc::minIdle);\n                    initialSize.ifPresent(dspc::initialSize);\n                    minSize.ifPresent(dspc::minSize);\n                    maxSize.ifPresent(dspc::maxSize);\n                    poolName.ifPresent(dspc::name);\n                    initializationFailTimeout.ifPresent(dspc::initializationFailTimeout);\n                    isolateInternalQueries.ifPresent(dspc::isolateInternalQueries);\n                    allowPoolSuspension.ifPresent(dspc::allowPoolSuspension);\n                    readOnly.ifPresent(dspc::readOnly);\n                    registerMbeans.ifPresent(dspc::registerMbeans);\n                    connectionInitSql.ifPresent(dspc::connectionInitSql);\n                    transactionIsolation.ifPresent(dspc::transactionIsolation);\n                    validationTimeout.ifPresent(dspc::validationTimeout);\n                    leakDetectionThreshold.ifPresent(dspc::leakDetectionThreshold);\n                    idleValidationTimeout.ifPresent(dspc::idleValidationTimeout);\n\n                    xdsc.pool(dspc);\n                }\n\n                Optional<List<String>> props = cfg.getMapKeys(\"kumuluzee.xa-datasources[\" + i + \"].props\");\n\n                if (props.isPresent()) {\n\n                    for (String propName : props.get()) {\n\n                        Optional<String> propValue = cfg.get(\"kumuluzee.xa-datasources[\" + i + \"].props.\" + propName);\n\n                        propValue.ifPresent(v -> xdsc.prop(StringUtils.hyphenCaseToCamelCase(propName), v));\n                    }\n                }\n\n                eeConfigBuilder.xaDatasource(xdsc);\n            }\n        }\n\n        Optional<Integer> mailSessionsSizeOpt = cfg.getListSize(\"kumuluzee.mail-sessions\");\n\n        if (mailSessionsSizeOpt.isPresent()) {\n\n            for (int i = 0; i < mailSessionsSizeOpt.get(); i++) {\n\n                String prefix = \"kumuluzee.mail-sessions[\" + i + \"]\";\n\n                MailSessionConfig.Builder mscc = new MailSessionConfig.Builder();\n\n                Optional<String> jndiName = cfg.get(prefix + \".jndi-name\");\n                Optional<Boolean> debug = cfg.getBoolean(prefix + \".debug\");\n\n                jndiName.ifPresent(mscc::jndiName);\n                debug.ifPresent(mscc::debug);\n\n                Optional<List<String>> transport = cfg.getMapKeys(prefix + \".transport\");\n                Optional<List<String>> store = cfg.getMapKeys(prefix + \".store\");\n\n                if (transport.isPresent()) {\n\n                    mscc.transport(createMailServiceConfigBuilder(prefix + \".transport\"));\n                }\n\n                if (store.isPresent()) {\n\n                    mscc.store(createMailServiceConfigBuilder(prefix + \".store\"));\n                }\n\n                Optional<List<String>> props = cfg.getMapKeys(prefix + \".props\");\n\n                if (props.isPresent()) {\n\n                    for (String propName : props.get()) {\n\n                        Optional<String> propValue = cfg.get(prefix + \".props.\" + propName);\n\n                        propValue.ifPresent(v -> mscc.prop(propName, v));\n                    }\n                }\n\n                eeConfigBuilder.mailSession(mscc);\n            }\n        }\n\n        return eeConfigBuilder.build();\n    }\n\n    public static Boolean isEeConfigValid(EeConfig eeConfig) {\n\n        return !(eeConfig == null ||\n                eeConfig.getVersion() == null ||\n                eeConfig.getDebug() == null ||\n                eeConfig.getEnv() == null ||\n                eeConfig.getDev() == null ||\n                eeConfig.getServer() == null ||\n                eeConfig.getServer().getContextPath() == null ||\n                eeConfig.getServer().getForceHttps() == null ||\n                eeConfig.getServer().getMinThreads() == null ||\n                eeConfig.getServer().getMaxThreads() == null ||\n                eeConfig.getServer().getShowServerInfo() == null ||\n                eeConfig.getServer().getForwardStartupException() == null ||\n                eeConfig.getServer().getHttp() == null ||\n                eeConfig.getServer().getHttp().getHttp2() == null ||\n                eeConfig.getServer().getHttp().getProxyForwarding() == null ||\n                eeConfig.getServer().getHttp().getRequestHeaderSize() == null ||\n                eeConfig.getServer().getHttp().getResponseHeaderSize() == null ||\n                eeConfig.getServer().getHttp().getIdleTimeout() == null ||\n                (eeConfig.getServer().getHttps() != null &&\n                        (eeConfig.getServer().getHttps().getHttp2() == null ||\n                                eeConfig.getServer().getHttps().getProxyForwarding() == null ||\n                                eeConfig.getServer().getHttps().getRequestHeaderSize() == null ||\n                                eeConfig.getServer().getHttps().getResponseHeaderSize() == null ||\n                                eeConfig.getServer().getHttps().getIdleTimeout() == null)) ||\n                eeConfig.getDatasources().stream().anyMatch(ds ->\n                        (ds == null || ds.getPool() == null ||\n                                ds.getPool().getAutoCommit() == null ||\n                                ds.getPool().getConnectionTimeout() == null ||\n                                ds.getPool().getIdleTimeout() == null ||\n                                ds.getPool().getMaxLifetime() == null ||\n                                ds.getPool().getMaxSize() == null ||\n                                ds.getPool().getValidationTimeout() == null ||\n                                ds.getPool().getLeakDetectionThreshold() == null)));\n    }\n\n    private static ServerConnectorConfig.Builder createServerConnectorConfigBuilder(String prefix, Integer defaultPort) {\n\n        ConfigurationUtil cfg = ConfigurationUtil.getInstance();\n\n        ServerConnectorConfig.Builder serverConnectorBuilder = new ServerConnectorConfig.Builder();\n\n        serverConnectorBuilder.port(defaultPort);\n\n        Optional<List<String>> serverConnectorCfgOpt = cfg.getMapKeys(prefix);\n\n        if (serverConnectorCfgOpt.isPresent()) {\n\n            Optional<Integer> port = cfg.getInteger(prefix + \".port\");\n            Optional<String> address = cfg.get(prefix + \".address\");\n            Optional<Boolean> enabled = cfg.getBoolean(prefix + \".enabled\");\n            Optional<Boolean> http2 = cfg.getBoolean(prefix + \".http2\");\n            Optional<Boolean> proxyForwarding = cfg.getBoolean(prefix + \".proxy-forwarding\");\n            Optional<Integer> requestHeaderSize = cfg.getInteger(prefix + \".request-header-size\");\n            Optional<Integer> responseHeaderSize = cfg.getInteger(prefix + \".response-header-size\");\n            Optional<Integer> idleTimeout = cfg.getInteger(prefix + \".idle-timeout\");\n\n            Optional<String> keystorePath = cfg.get(prefix + \".keystore-path\");\n            Optional<String> keystorePassword = cfg.get(prefix + \".keystore-password\");\n            Optional<String> keyAlias = cfg.get(prefix + \".key-alias\");\n            Optional<String> keyPassword = cfg.get(prefix + \".key-password\");\n            Optional<String> sslProtocols = cfg.get(prefix + \".ssl-protocols\");\n            Optional<String> sslCiphers = cfg.get(prefix + \".ssl-ciphers\");\n\n            port.ifPresent(serverConnectorBuilder::port);\n            address.ifPresent(serverConnectorBuilder::address);\n            enabled.ifPresent(serverConnectorBuilder::enabled);\n            http2.ifPresent(serverConnectorBuilder::http2);\n            proxyForwarding.ifPresent(serverConnectorBuilder::proxyForwarding);\n            requestHeaderSize.ifPresent(serverConnectorBuilder::requestHeaderSize);\n            responseHeaderSize.ifPresent(serverConnectorBuilder::responseHeaderSize);\n            idleTimeout.ifPresent(serverConnectorBuilder::idleTimeout);\n\n            keystorePath.ifPresent(serverConnectorBuilder::keystorePath);\n            keystorePassword.ifPresent(serverConnectorBuilder::keystorePassword);\n            keyAlias.ifPresent(serverConnectorBuilder::keyAlias);\n            keyPassword.ifPresent(serverConnectorBuilder::keyPassword);\n            sslProtocols.ifPresent(p -> serverConnectorBuilder.sslProtocols(Stream.of(p.split(\",\")).map(String::trim).collect(Collectors\n                    .toList())));\n            sslCiphers.ifPresent(c -> serverConnectorBuilder.sslCiphers(Stream.of(c.split(\",\")).map(String::trim).collect(Collectors\n                    .toList())));\n        }\n\n        return serverConnectorBuilder;\n    }\n\n    private static MailServiceConfig.Builder createMailServiceConfigBuilder(String prefix) {\n\n        ConfigurationUtil cfg = ConfigurationUtil.getInstance();\n\n        MailServiceConfig.Builder mailServiceBuilder = new MailServiceConfig.Builder();\n\n        Optional<String> protocol = cfg.get(prefix + \".protocol\");\n        Optional<String> host = cfg.get(prefix + \".host\");\n        Optional<Integer> port = cfg.getInteger(prefix + \".port\");\n        Optional<Boolean> starttls = cfg.getBoolean(prefix + \".starttls\");\n        Optional<String> username = cfg.get(prefix + \".username\");\n        Optional<String> password = cfg.get(prefix + \".password\");\n        Optional<Long> connectionTimeout = cfg.getLong(prefix + \".connection-timeout\");\n        Optional<Long> timeout = cfg.getLong(prefix + \".timeout\");\n\n        protocol.ifPresent(mailServiceBuilder::protocol);\n        host.ifPresent(mailServiceBuilder::host);\n        port.ifPresent(mailServiceBuilder::port);\n        starttls.ifPresent(mailServiceBuilder::starttls);\n        username.ifPresent(mailServiceBuilder::username);\n        password.ifPresent(mailServiceBuilder::password);\n        connectionTimeout.ifPresent(mailServiceBuilder::connectionTimeout);\n        timeout.ifPresent(mailServiceBuilder::timeout);\n\n        return mailServiceBuilder;\n    }\n\n    private static GzipConfig.Builder createGzipConfigBuilder(String prefix) {\n\n        ConfigurationUtil cfg = ConfigurationUtil.getInstance();\n\n        GzipConfig.Builder gzipBuilder = new GzipConfig.Builder();\n\n        Optional<Boolean> enabled = cfg.getBoolean(prefix + \".enabled\");\n        Optional<Integer> minGzipSize = cfg.getInteger(prefix + \".min-gzip-size\");\n        Optional<List<String>> includedMethods = getConfigList(prefix + \".included-methods\");\n        Optional<List<String>> includedMimeTypes = getConfigList(prefix + \".included-mime-types\");\n        Optional<List<String>> excludedMimeTypes = getConfigList(prefix + \".excluded-mime-types\");\n        Optional<List<String>> excludedAgentPatterns = getConfigList(prefix + \".excluded-agent-patterns\");\n        Optional<List<String>> excludedPaths = getConfigList(prefix + \".excluded-paths\");\n        Optional<List<String>> includedPaths = getConfigList(prefix + \".included-paths\");\n\n        enabled.ifPresent(gzipBuilder::enabled);\n        minGzipSize.ifPresent(gzipBuilder::minGzipSize);\n        includedMethods.ifPresent(gzipBuilder::includedMethods);\n        includedMimeTypes.ifPresent(gzipBuilder::includedMimeTypes);\n        excludedMimeTypes.ifPresent(gzipBuilder::excludedMimeTypes);\n        excludedAgentPatterns.ifPresent(gzipBuilder::excludedAgentPatterns);\n        excludedPaths.ifPresent(gzipBuilder::excludedPaths);\n        includedPaths.ifPresent(gzipBuilder::includedPaths);\n\n        return gzipBuilder;\n    }\n\n    private static Optional<List<String>> getConfigList(String key) {\n        ConfigurationUtil cfg = ConfigurationUtil.getInstance();\n\n        Optional<Integer> listSize = cfg.getListSize(key);\n\n        if (listSize.isPresent()) {\n            List<String> list = new ArrayList<>();\n\n            for (int i = 0; i < listSize.get(); i++) {\n                Optional<String> item = cfg.get(key + \"[\" + i + \"]\");\n\n                item.ifPresent(list::add);\n            }\n\n            if (list.size() > 0) {\n                return Optional.of(Collections.unmodifiableList(list));\n            }\n        }\n\n        return Optional.empty();\n    }\n}\n"
  },
  {
    "path": "core/src/main/java/com/kumuluz/ee/factories/JtaXADataSourceFactory.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.factories;\n\nimport com.kumuluz.ee.common.datasources.NonJtaXADataSourceWrapper;\nimport com.kumuluz.ee.jta.common.datasources.JtaXADataSourceWrapper;\n\nimport javax.sql.XADataSource;\n\n/**\n * @author Tilen Faganel\n * @since 2.3.0\n */\n@Deprecated\npublic class JtaXADataSourceFactory {\n\n    public static NonJtaXADataSourceWrapper buildJtaXADataSourceWrapper(XADataSource xaDataSource) {\n\n        return new JtaXADataSourceWrapper(xaDataSource);\n    }\n}\n"
  },
  {
    "path": "core/src/main/java/com/kumuluz/ee/loaders/ComponentLoader.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.loaders;\n\nimport com.kumuluz.ee.common.Component;\nimport com.kumuluz.ee.common.ServletServer;\nimport com.kumuluz.ee.common.config.EeConfig;\nimport com.kumuluz.ee.common.dependencies.EeComponentDef;\nimport com.kumuluz.ee.common.exceptions.KumuluzServerException;\nimport com.kumuluz.ee.common.wrapper.ComponentWrapper;\nimport com.kumuluz.ee.common.wrapper.KumuluzServerWrapper;\n\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Objects;\nimport java.util.ServiceLoader;\nimport java.util.logging.Logger;\nimport java.util.stream.Stream;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\npublic class ComponentLoader {\n\n    private static final Logger log = Logger.getLogger(ComponentLoader.class.getSimpleName());\n\n    private static final Class COMPONENT_ANNOTATIONS[] = { EeComponentDef.class };\n\n    public static List<Component> loadComponents() {\n\n        log.info(\"Loading available components\");\n\n        List<Component> components = scanForAvailableComponents();\n\n        for (Component c : components) {\n\n            boolean anyMatch = Stream.of(COMPONENT_ANNOTATIONS)\n                    .map(a -> c.getClass().getDeclaredAnnotation(a))\n                    .anyMatch(Objects::nonNull);\n\n            if (!anyMatch) {\n\n                String msg = \"The found class \\\"\" + c.getClass().getSimpleName()  + \"\\\" is missing a component\" +\n                        \"definition annotation. The annotation is required in order to correctly process the component\" +\n                        \"type and its dependencies.\";\n\n                log.severe(msg);\n\n                throw new KumuluzServerException(msg);\n            }\n        }\n\n        log.info(\"Loading for components complete\");\n\n        return components;\n    }\n\n    private static List<Component> scanForAvailableComponents() {\n\n        log.finest(\"Scanning for available components in the runtime\");\n\n        List<Component> components = new ArrayList<>();\n\n        ServiceLoader.load(Component.class).forEach(components::add);\n\n        return components;\n    }\n}\n"
  },
  {
    "path": "core/src/main/java/com/kumuluz/ee/loaders/ConfigExtensionLoader.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.loaders;\n\nimport com.kumuluz.ee.common.ConfigExtension;\nimport com.kumuluz.ee.common.dependencies.EeExtensionDef;\nimport com.kumuluz.ee.common.dependencies.EeExtensionGroup;\nimport com.kumuluz.ee.common.exceptions.KumuluzServerException;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.ServiceLoader;\nimport java.util.logging.Logger;\n\n/**\n * @author Tilen Faganel\n * @since 2.3.0\n */\npublic class ConfigExtensionLoader {\n\n    private static final Logger log = Logger.getLogger(ConfigExtensionLoader.class.getSimpleName());\n\n    public static List<ConfigExtension> loadExtensions() {\n\n        log.info(\"Loading available config extensions\");\n\n        List<ConfigExtension> extensions = scanForAvailableExtensions();\n\n        for (ConfigExtension e : extensions) {\n\n            EeExtensionDef eeExtensionDef = e.getClass().getDeclaredAnnotation(EeExtensionDef.class);\n\n            if (eeExtensionDef == null) {\n\n                String msg = \"The found class \\\"\" + e.getClass().getSimpleName() + \"\\\" is missing an extension\" +\n                        \"definition annotation. The annotation is required in order to correctly process the \" +\n                        \"extension type and its dependencies.\";\n\n                log.severe(msg);\n\n                throw new KumuluzServerException(msg);\n            }\n\n            if (!eeExtensionDef.group().equalsIgnoreCase(EeExtensionGroup.CONFIG)) {\n\n                String msg = \"The found class \\\"\" + e.getClass().getSimpleName() + \"\\\" does not have the correct \" +\n                        \"extension group defined. The interface \\\"ConfigExtension\\\" requires that the supporting \" +\n                        \" definition annotations specifies the extension group of \\\"config\\\". \";\n\n                log.severe(msg);\n\n                throw new KumuluzServerException(msg);\n            }\n        }\n\n        log.info(\"Config extension loading complete\");\n\n        return extensions;\n    }\n\n    private static List<ConfigExtension> scanForAvailableExtensions() {\n\n        List<ConfigExtension> extensions = new ArrayList<>();\n\n        ServiceLoader.load(ConfigExtension.class).forEach(extensions::add);\n\n        return extensions;\n    }\n}\n"
  },
  {
    "path": "core/src/main/java/com/kumuluz/ee/loaders/ExtensionLoader.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.loaders;\n\nimport com.kumuluz.ee.common.Extension;\nimport com.kumuluz.ee.common.dependencies.EeExtensionDef;\nimport com.kumuluz.ee.common.dependencies.EeExtensionGroup;\nimport com.kumuluz.ee.common.exceptions.KumuluzServerException;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.ServiceLoader;\nimport java.util.logging.Logger;\n\n/**\n * @author Jan Meznarič\n * @since 2.3.0\n */\npublic class ExtensionLoader {\n\n    private static final Logger log = Logger.getLogger(ExtensionLoader.class.getSimpleName());\n\n    public static List<Extension> loadExtensions() {\n\n        log.info(\"Loading available extensions\");\n\n        List<Extension> extensions = scanForAvailableExtensions();\n\n        for (Extension e : extensions) {\n\n            EeExtensionDef eeExtensionDef = e.getClass().getDeclaredAnnotation(EeExtensionDef.class);\n\n            if (eeExtensionDef == null) {\n\n                String msg = \"The found class \\\"\" + e.getClass().getSimpleName() + \"\\\" is missing an extension\" +\n                        \"definition annotation. The annotation is required in order to correctly process the \" +\n                        \"extension type and its dependencies.\";\n\n                log.severe(msg);\n\n                throw new KumuluzServerException(msg);\n            }\n\n            if (eeExtensionDef.group().equalsIgnoreCase(EeExtensionGroup.CONFIG)) {\n\n                String msg = \"The found class \\\"\" + e.getClass().getSimpleName() + \"\\\" does not have the correct \" +\n                        \"extension group defined. The extension group \\\"config\\\" requires that the class implements \" +\n                        \"the \\\"ConfigExtension\\\" interface.\";\n\n                log.severe(msg);\n\n                throw new KumuluzServerException(msg);\n            } else if (eeExtensionDef.group().equalsIgnoreCase(EeExtensionGroup.LOGS)) {\n\n                String msg = \"The found class \\\"\" + e.getClass().getSimpleName() + \"\\\" does not have the correct \" +\n                        \"extension group defined. The extension group \\\"logs\\\" requires that the class implements \" +\n                        \"the \\\"LogsExtension\\\" interface.\";\n\n                log.severe(msg);\n\n                throw new KumuluzServerException(msg);\n            }\n        }\n\n        log.info(\"Extension loading complete\");\n\n        return extensions;\n    }\n\n    private static List<Extension> scanForAvailableExtensions() {\n\n        List<Extension> extensions = new ArrayList<>();\n\n        ServiceLoader.load(Extension.class).forEach(extensions::add);\n\n        return extensions;\n    }\n}\n"
  },
  {
    "path": "core/src/main/java/com/kumuluz/ee/loaders/LogsExtensionLoader.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.loaders;\n\nimport com.kumuluz.ee.common.LogsExtension;\nimport com.kumuluz.ee.common.dependencies.EeExtensionDef;\nimport com.kumuluz.ee.common.dependencies.EeExtensionGroup;\nimport com.kumuluz.ee.common.exceptions.KumuluzServerException;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.ServiceLoader;\nimport java.util.logging.Logger;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic class LogsExtensionLoader {\n\n    public static Optional<LogsExtension> loadExtension() {\n\n        List<LogsExtension> extensions = scanForAvailableExtensions();\n\n        if (extensions.size() > 1) {\n\n            String implementations = extensions.stream().skip(1)\n                    .map(e -> e.getClass().getSimpleName())\n                    .reduce(extensions.get(0).getClass().getSimpleName(), (s, e) -> \", \" + e.getClass().getSimpleName());\n\n            Logger log = Logger.getLogger(LogsExtensionLoader.class.getSimpleName());\n\n            String msg = \"Found multiple implementations (\" + implementations + \") of the same EE extension group (logs). \" +\n                    \"Please check to make sure you only include a single implementation of a specific \" +\n                    \"EE extension group.\";\n\n            log.severe(msg);\n\n            throw new KumuluzServerException(msg);\n        }\n\n        if (extensions.size() == 1) {\n\n            LogsExtension logsExtension = extensions.get(0);\n\n            EeExtensionDef eeExtensionDef = logsExtension.getClass().getDeclaredAnnotation(EeExtensionDef.class);\n\n            if (eeExtensionDef == null) {\n\n                String msg = \"The found class \\\"\" + logsExtension.getClass().getSimpleName() + \"\\\" is missing an extension\" +\n                        \"definition annotation. The annotation is required in order to correctly process the \" +\n                        \"extension type and its dependencies.\";\n\n                Logger log = Logger.getLogger(LogsExtensionLoader.class.getSimpleName());\n\n                log.severe(msg);\n\n                throw new KumuluzServerException(msg);\n            }\n\n            if (!eeExtensionDef.group().equalsIgnoreCase(EeExtensionGroup.LOGS)) {\n\n                String msg = \"The found class \\\"\" + logsExtension.getClass().getSimpleName() + \"\\\" does not have the correct \" +\n                        \"extension group defined. The interface \\\"LogsExtension\\\" requires that the supporting \" +\n                        \" definition annotations specifies the extension group of \\\"logs\\\". \";\n\n                Logger log = Logger.getLogger(LogsExtensionLoader.class.getSimpleName());\n\n                log.severe(msg);\n\n                throw new KumuluzServerException(msg);\n            }\n\n            return Optional.of(logsExtension);\n        }\n\n        return Optional.empty();\n    }\n\n    private static List<LogsExtension> scanForAvailableExtensions() {\n\n        List<LogsExtension> extensions = new ArrayList<>();\n\n        ServiceLoader.load(LogsExtension.class).forEach(extensions::add);\n\n        return extensions;\n    }\n}\n"
  },
  {
    "path": "core/src/main/java/com/kumuluz/ee/loaders/ServerLoader.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.loaders;\n\nimport com.kumuluz.ee.common.KumuluzServer;\nimport com.kumuluz.ee.common.dependencies.ServerDef;\nimport com.kumuluz.ee.common.exceptions.KumuluzServerException;\nimport com.kumuluz.ee.common.wrapper.KumuluzServerWrapper;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.ServiceLoader;\nimport java.util.logging.Logger;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\npublic class ServerLoader {\n\n    private static Logger log = Logger.getLogger(ServerLoader.class.getSimpleName());\n\n    public static KumuluzServer loadServletServer() {\n\n        log.info(\"Loading the KumuluzEE server...\");\n\n        List<KumuluzServer> serversClasses = scanForAvailableServers();\n\n        if (serversClasses.isEmpty()) {\n\n            String msg = \"No supported servers were found. Please add one of them to the class \" +\n                    \"path. For example to add Jetty add the 'kumuluzee-servlet-jetty' module as a\" +\n                    \" dependency. For additional servers refer to the documentation.\";\n\n            log.severe(msg);\n\n            throw new KumuluzServerException(msg);\n        }\n\n        if (serversClasses.size() > 1) {\n\n            String msg = \"Multiple servers were found. Only one can be used at a time, please \" +\n                    \"remove all but one servers. For additional information refer to the \" +\n                    \"documentation.\";\n\n            log.severe(msg);\n\n            throw new KumuluzServerException(msg);\n        }\n\n        KumuluzServer server = serversClasses.get(0);\n\n        ServerDef serverDef = server.getClass().getDeclaredAnnotation(ServerDef.class);\n\n        if (serverDef == null) {\n\n            String msg = \"The found class \\\"\" + server.getClass().getSimpleName()  + \"\\\" is missing the @ServerDef\" +\n                    \"annotation. The annotation is required in order to correctly process the specific \" +\n                    \"implementation and its components.\";\n\n            log.severe(msg);\n\n            throw new KumuluzServerException(msg);\n        }\n\n        log.info(\"Found \" + serverDef.value());\n\n        return server;\n    }\n\n    private static List<KumuluzServer> scanForAvailableServers() {\n\n        log.finest(\"Scanning for available supported KumuluzEE servers\");\n\n        List<KumuluzServer> servers = new ArrayList<>();\n\n        ServiceLoader.load(KumuluzServer.class).forEach(servers::add);\n\n        return servers;\n    }\n}\n"
  },
  {
    "path": "core/src/test/java/com/kumuluz/ee/test/ExampleTest.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.test;\n\nimport org.junit.Assert;\nimport org.junit.Test;\n\n/**\n * @author Tilen Faganel\n */\npublic class ExampleTest {\n\n    @Test\n    public void testAddition() {\n\n        Assert.assertEquals(1 + 2, 3);\n    }\n}\n"
  },
  {
    "path": "pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         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    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee</artifactId>\n    <packaging>pom</packaging>\n    <version>4.2.0-SNAPSHOT</version>\n    <modules>\n        <module>common</module>\n        <module>core</module>\n        <module>servlet</module>\n        <module>components</module>\n        <module>bom</module>\n        <module>profiles</module>\n        <module>tools</module>\n    </modules>\n\n    <name>KumuluzEE</name>\n\n    <inceptionYear>2015</inceptionYear>\n    <description>\n        Lightweight framework for creating small standalone Java EE applications in a micro service\n        way.\n    </description>\n\n    <url>https://ee.kumuluz.com</url>\n\n    <properties>\n        <maven.compiler.source>11</maven.compiler.source>\n        <maven.compiler.target>11</maven.compiler.target>\n        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\n\n        <jaxb-api.version>2.3.1</jaxb-api.version>\n        <activation.version>1.1.1</activation.version>\n        <jaxws-tools.version>2.3.5</jaxws-tools.version>\n\n        <annotations.version>1.3.5</annotations.version>\n        <inject.version>1.0.3</inject.version>\n        <interceptor.version>1.2.5</interceptor.version>\n        <servlet.version>4.0.4</servlet.version>\n        <jsp.version>2.3.6</jsp.version>\n        <el.version>3.0.3</el.version>\n        <cdi.version>2.0.2</cdi.version>\n        <jpa.version>2.2.3</jpa.version>\n        <jaxrs.version>2.1.6</jaxrs.version>\n        <jaxws.version>2.3.3</jaxws.version>\n        <jsf.version>2.3.2</jsf.version>\n        <websocket.version>1.1.2</websocket.version>\n        <beanvalidation.version>2.0.2</beanvalidation.version>\n        <jsonp.version>1.1.6</jsonp.version>\n        <jsonb.version>1.0.2</jsonb.version>\n        <jta.version>1.3.3</jta.version>\n        <resource.version>1.7.4</resource.version>\n        <javamail.version>1.6.7</javamail.version>\n\n        <jandex.version>2.4.2.Final</jandex.version>\n        <jboss-logging.version>3.3.2.Final</jboss-logging.version>\n        <classmate.version>1.5.1</classmate.version>\n        <javassist.version>3.27.0-GA</javassist.version>\n        <agroal.version>1.9</agroal.version>\n        <yaml.version>1.27</yaml.version>\n        <junit.version>4.13.1</junit.version>\n        <maven.plugin.api.version>3.8.2</maven.plugin.api.version>\n        <maven-plugin-annotations.version>3.6.1</maven-plugin-annotations.version>\n        <mojo-executor.version>2.3.2</mojo-executor.version>\n\n        <maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>\n        <maven-resources-plugin.version>3.2.0</maven-resources-plugin.version>\n        <maven-plugin-plugin.version>3.6.0</maven-plugin-plugin.version>\n        <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>\n        <maven-dependency-plugin.version>3.1.2</maven-dependency-plugin.version>\n\n        <jetty.version>10.0.9</jetty.version>\n        <slf4j.version>2.0.0-alpha6</slf4j.version> <!-- the same as used by Jetty -->\n        <uel.version>3.0.3</uel.version>\n        <weld.version>3.1.8.Final</weld.version>\n        <hibernate.validator.version>6.2.0.Final</hibernate.validator.version>\n        <jersey.version>2.34</jersey.version>\n        <jackson.version>2.12.0</jackson.version>\n        <metro.version>2.4.6</metro.version>\n        <cxf.version>3.4.4</cxf.version>\n        <hibernate.version>5.5.7.Final</hibernate.version>\n        <eclipselink.version>2.7.10</eclipselink.version>\n        <mojarra.version>2.3.16</mojarra.version>\n        <jsonp-impl.version>1.1.4</jsonp-impl.version>\n        <yasson.version>1.0.8</yasson.version>\n        <narayana.version>5.10.6.Final</narayana.version>\n        <jboss-transaction-spi.version>7.6.0.Final</jboss-transaction-spi.version>\n        <javamail-ri.version>1.6.2</javamail-ri.version>\n    </properties>\n\n    <scm>\n        <connection>scm:git:git@github.com:kumuluz/kumuluze.git</connection>\n        <developerConnection>scm:git:git@github.com:kumuluz/kumuluzee.git</developerConnection>\n        <url>git@github.com:kumuluz/kumuluzee.git</url>\n    </scm>\n\n    <issueManagement>\n        <system>GitHub Issues</system>\n        <url>https://github.com/kumuluz/kumuluzee/issues</url>\n    </issueManagement>\n\n    <developers>\n        <developer>\n            <name>KumuluzEE Development Team</name>\n            <id>kumuluz</id>\n            <email>info@kumuluz.com</email>\n            <url>https://github.com/kumuluz</url>\n        </developer>\n    </developers>\n\n    <licenses>\n        <license>\n            <name>MIT License</name>\n            <url>http://www.opensource.org/licenses/mit-license.php</url>\n        </license>\n    </licenses>\n\n    <distributionManagement>\n        <snapshotRepository>\n            <id>ossrh</id>\n            <url>https://oss.sonatype.org/content/repositories/snapshots</url>\n        </snapshotRepository>\n    </distributionManagement>\n\n    <repositories>\n        <repository>\n            <id>sonatype-snapshots</id>\n            <name>OSS Sonatype repo (snapshots)</name>\n            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>\n            <releases>\n                <enabled>false</enabled>\n            </releases>\n            <snapshots>\n                <enabled>true</enabled>\n            </snapshots>\n        </repository>\n    </repositories>\n\n    <dependencyManagement>\n        <dependencies>\n            <!-- Kumuluz module dependencies-->\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-common</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-core</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-components</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-servlet</artifactId>\n                <version>${project.version}</version>\n                <type>pom</type>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-servlet-jetty</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-jsp</artifactId>\n                <version>${project.version}</version>\n                <type>pom</type>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-jsp-jetty</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-el</artifactId>\n                <version>${project.version}</version>\n                <type>pom</type>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-el-uel</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-cdi</artifactId>\n                <version>${project.version}</version>\n                <type>pom</type>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-cdi-weld</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-jpa</artifactId>\n                <version>${project.version}</version>\n                <type>pom</type>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-jpa-common</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-jpa-eclipselink</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-jpa-hibernate</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-jax-rs</artifactId>\n                <version>${project.version}</version>\n                <type>pom</type>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-jax-rs-jersey</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-jax-ws</artifactId>\n                <version>${project.version}</version>\n                <type>pom</type>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-jax-ws-metro</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-jax-ws-cxf</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-jsf</artifactId>\n                <version>${project.version}</version>\n                <type>pom</type>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-jsf-mojarra</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-websocket</artifactId>\n                <version>${project.version}</version>\n                <type>pom</type>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-websocket-jetty</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-bean-validation</artifactId>\n                <version>${project.version}</version>\n                <type>pom</type>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-bean-validation-hibernate-validator</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-json-p</artifactId>\n                <version>${project.version}</version>\n                <type>pom</type>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-json-p-jsonp</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-json-b</artifactId>\n                <version>${project.version}</version>\n                <type>pom</type>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-json-b-yasson</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-jta</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-jta-common</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-jta-narayana</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-bom</artifactId>\n                <version>${project.version}</version>\n                <type>pom</type>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-profiles</artifactId>\n                <version>${project.version}</version>\n                <type>pom</type>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-micro-profile</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-microProfile-3.3</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-tools</artifactId>\n                <version>${project.version}</version>\n                <type>pom</type>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-loader</artifactId>\n                <version>${project.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.kumuluz.ee</groupId>\n                <artifactId>kumuluzee-maven-plugin</artifactId>\n                <version>${project.version}</version>\n                <type>maven-plugin</type>\n            </dependency>\n\n            <!-- Java EE specification dependencies-->\n            <dependency>\n                <groupId>jakarta.annotation</groupId>\n                <artifactId>jakarta.annotation-api</artifactId>\n                <version>${annotations.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>jakarta.inject</groupId>\n                <artifactId>jakarta.inject-api</artifactId>\n                <version>${inject.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>jakarta.interceptor</groupId>\n                <artifactId>jakarta.interceptor-api</artifactId>\n                <version>${interceptor.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>jakarta.servlet</groupId>\n                <artifactId>jakarta.servlet-api</artifactId>\n                <version>${servlet.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>jakarta.servlet.jsp</groupId>\n                <artifactId>jakarta.servlet.jsp-api</artifactId>\n                <version>${jsp.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>jakarta.el</groupId>\n                <artifactId>jakarta.el-api</artifactId>\n                <version>${el.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>jakarta.enterprise</groupId>\n                <artifactId>jakarta.enterprise.cdi-api</artifactId>\n                <version>${cdi.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>jakarta.persistence</groupId>\n                <artifactId>jakarta.persistence-api</artifactId>\n                <version>${jpa.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>jakarta.ws.rs</groupId>\n                <artifactId>jakarta.ws.rs-api</artifactId>\n                <version>${jaxrs.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>jakarta.xml.ws</groupId>\n                <artifactId>jakarta.xml.ws-api</artifactId>\n                <version>${jaxws.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>jakarta.faces</groupId>\n                <artifactId>jakarta.faces-api</artifactId>\n                <version>${jsf.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>jakarta.websocket</groupId>\n                <artifactId>jakarta.websocket-api</artifactId>\n                <version>${websocket.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>jakarta.websocket</groupId>\n                <artifactId>jakarta.websocket-client-api</artifactId>\n                <version>${websocket.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>jakarta.validation</groupId>\n                <artifactId>jakarta.validation-api</artifactId>\n                <version>${beanvalidation.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>jakarta.json</groupId>\n                <artifactId>jakarta.json-api</artifactId>\n                <version>${jsonp.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>jakarta.json.bind</groupId>\n                <artifactId>jakarta.json.bind-api</artifactId>\n                <version>${jsonb.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>jakarta.transaction</groupId>\n                <artifactId>jakarta.transaction-api</artifactId>\n                <version>${jta.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>jakarta.resource</groupId>\n                <artifactId>jakarta.resource-api</artifactId>\n                <version>${resource.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>jakarta.mail</groupId>\n                <artifactId>jakarta.mail-api</artifactId>\n                <version>${javamail.version}</version>\n            </dependency>\n\n            <!-- Various libraries used throughout the framework-->\n            <dependency>\n                <groupId>com.fasterxml.jackson</groupId>\n                <artifactId>jackson-bom</artifactId>\n                <version>${jackson.version}</version>\n                <scope>import</scope>\n                <type>pom</type>\n            </dependency>\n            <dependency>\n                <groupId>org.jboss</groupId>\n                <artifactId>jandex</artifactId>\n                <version>${jandex.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>org.jboss.logging</groupId>\n                <artifactId>jboss-logging</artifactId>\n                <version>${jboss-logging.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>com.fasterxml</groupId>\n                <artifactId>classmate</artifactId>\n                <version>${classmate.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>org.javassist</groupId>\n                <artifactId>javassist</artifactId>\n                <version>${javassist.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>io.agroal</groupId>\n                <artifactId>agroal-api</artifactId>\n                <version>${agroal.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>org.yaml</groupId>\n                <artifactId>snakeyaml</artifactId>\n                <version>${yaml.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>junit</groupId>\n                <artifactId>junit</artifactId>\n                <version>${junit.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>org.apache.maven</groupId>\n                <artifactId>maven-plugin-api</artifactId>\n                <version>${maven.plugin.api.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>org.apache.maven.plugin-tools</groupId>\n                <artifactId>maven-plugin-annotations</artifactId>\n                <version>${maven-plugin-annotations.version}</version>\n            </dependency>\n            <dependency>\n                <groupId>org.twdata.maven</groupId>\n                <artifactId>mojo-executor</artifactId>\n                <version>${mojo-executor.version}</version>\n            </dependency>\n        </dependencies>\n    </dependencyManagement>\n\n    <build>\n        <plugins>\n            <plugin>\n                <groupId>org.sonatype.plugins</groupId>\n                <artifactId>nexus-staging-maven-plugin</artifactId>\n                <version>1.6.5</version>\n                <extensions>true</extensions>\n                <configuration>\n                    <serverId>ossrh</serverId>\n                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>\n                    <autoReleaseAfterClose>true</autoReleaseAfterClose>\n                </configuration>\n            </plugin>\n        </plugins>\n    </build>\n\n    <profiles>\n        <profile>\n            <id>deploy</id>\n            <build>\n                <plugins>\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-gpg-plugin</artifactId>\n                        <version>1.6</version>\n                        <executions>\n                            <execution>\n                                <id>sign-artifacts</id>\n                                <phase>verify</phase>\n                                <goals>\n                                    <goal>sign</goal>\n                                </goals>\n                                <configuration>\n                                    <gpgArguments>\n                                        <arg>--pinentry-mode</arg>\n                                        <arg>loopback</arg>\n                                    </gpgArguments>\n                                </configuration>\n                            </execution>\n                        </executions>\n                    </plugin>\n                    <plugin>\n                        <groupId>org.apache.maven.plugins</groupId>\n                        <artifactId>maven-javadoc-plugin</artifactId>\n                        <configuration>\n                            <doclint>none</doclint>\n                        </configuration>\n                    </plugin>\n                </plugins>\n            </build>\n        </profile>\n    </profiles>\n\n</project>\n"
  },
  {
    "path": "profiles/micro-profile/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-profiles</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE MicroProfile</name>\n    <description>\n        KumuluzEE MicroProfile which includes and tracks the latest community based specification found at\n        https://microprofile.io, which focuses on technologies best-suited to build modern Java based cloud\n        applications that follow the microservice architecture. The main KumuluzEE profile includes the reference\n        implementations of the profile/specification.\n    </description>\n\n    <artifactId>kumuluzee-micro-profile</artifactId>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-microProfile-3.3</artifactId>\n        </dependency>\n    </dependencies>\n\n</project>"
  },
  {
    "path": "profiles/micro-profile-1.0/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-profiles</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE MicroProfile 1.0</name>\n    <description>\n        KumuluzEE MicroProfile 1.0 which includes and tracks the version 1.0 community based specification found at\n        https://microprofile.io, which focuses on technologies best-suited to build modern Java based cloud\n        applications that follow the microservice architecture. The main KumuluzEE profile includes the reference\n        implementations of the profile/specification.\n    </description>\n\n    <artifactId>kumuluzee-microProfile-1.0</artifactId>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-core</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-servlet-jetty</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-cdi-weld</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-jax-rs-jersey</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-json-p-jsonp</artifactId>\n        </dependency>\n    </dependencies>\n\n</project>"
  },
  {
    "path": "profiles/micro-profile-1.1/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-profiles</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE MicroProfile 1.1</name>\n    <description>\n        KumuluzEE MicroProfile 1.1 which includes and tracks the version 1.1 community based specification found at\n        https://microprofile.io, which focuses on technologies best-suited to build modern Java based cloud\n        applications that follow the microservice architecture. The main KumuluzEE profile includes the reference\n        implementations of the profile/specification.\n    </description>\n\n    <artifactId>kumuluzee-microProfile-1.1</artifactId>\n\n    <properties>\n        <version.kumuluzee-config-mp>1.1.1</version.kumuluzee-config-mp>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-core</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-servlet-jetty</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-cdi-weld</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-jax-rs-jersey</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-json-p-jsonp</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>com.kumuluz.ee.config</groupId>\n            <artifactId>kumuluzee-config-mp</artifactId>\n            <version>${version.kumuluzee-config-mp}</version>\n        </dependency>\n    </dependencies>\n\n</project>"
  },
  {
    "path": "profiles/micro-profile-1.2/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-profiles</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE MicroProfile 1.2</name>\n    <description>\n        KumuluzEE MicroProfile 1.2 which includes and tracks the version 1.2 community based specification found at\n        https://microprofile.io, which focuses on technologies best-suited to build modern Java based cloud\n        applications that follow the microservice architecture. The main KumuluzEE profile includes the reference\n        implementations of the profile/specification.\n    </description>\n\n    <artifactId>kumuluzee-microProfile-1.2</artifactId>\n\n    <properties>\n        <version.kumuluzee-config-mp>1.1.1</version.kumuluzee-config-mp>\n        <version.kumuluzee-fault-tolerance>1.0.0</version.kumuluzee-fault-tolerance>\n        <version.kumuluzee-health>1.0.0</version.kumuluzee-health>\n        <version.kumuluzee-metrics>1.0.0</version.kumuluzee-metrics>\n        <version.kumuluzee-jwt-auth>1.0.0</version.kumuluzee-jwt-auth>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-core</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-servlet-jetty</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-cdi-weld</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-jax-rs-jersey</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-json-p-jsonp</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>com.kumuluz.ee.config</groupId>\n            <artifactId>kumuluzee-config-mp</artifactId>\n            <version>${version.kumuluzee-config-mp}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.fault.tolerance</groupId>\n            <artifactId>kumuluzee-fault-tolerance-hystrix</artifactId>\n            <version>${version.kumuluzee-fault-tolerance}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.health</groupId>\n            <artifactId>kumuluzee-health</artifactId>\n            <version>${version.kumuluzee-health}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.metrics</groupId>\n            <artifactId>kumuluzee-metrics-core</artifactId>\n            <version>${version.kumuluzee-metrics}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.jwt</groupId>\n            <artifactId>kumuluzee-jwt-auth</artifactId>\n            <version>${version.kumuluzee-jwt-auth}</version>\n        </dependency>\n    </dependencies>\n\n</project>"
  },
  {
    "path": "profiles/micro-profile-1.3/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-profiles</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE MicroProfile 1.3</name>\n    <description>\n        KumuluzEE MicroProfile 1.3 which includes and tracks the version 1.3 community based specification found at\n        https://microprofile.io, which focuses on technologies best-suited to build modern Java based cloud\n        applications that follow the microservice architecture. The main KumuluzEE profile includes the reference\n        implementations of the profile/specification.\n    </description>\n\n    <artifactId>kumuluzee-microProfile-1.3</artifactId>\n\n    <properties>\n        <version.kumuluzee-config-mp>1.2.1</version.kumuluzee-config-mp>\n        <version.kumuluzee-fault-tolerance>1.0.1</version.kumuluzee-fault-tolerance>\n        <version.kumuluzee-health>1.0.1</version.kumuluzee-health>\n        <version.kumuluzee-metrics>1.1.2</version.kumuluzee-metrics>\n        <version.kumuluzee-jwt-auth>1.0.1</version.kumuluzee-jwt-auth>\n        <version.kumuluzee-opentracing>1.2.1</version.kumuluzee-opentracing>\n        <version.kumuluzee-openapi-mp>1.0.1</version.kumuluzee-openapi-mp>\n        <version.kumuluzee-rest-client>1.0.1</version.kumuluzee-rest-client>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-core</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-servlet-jetty</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-cdi-weld</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-jax-rs-jersey</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-json-p-jsonp</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>com.kumuluz.ee.config</groupId>\n            <artifactId>kumuluzee-config-mp</artifactId>\n            <version>${version.kumuluzee-config-mp}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.fault.tolerance</groupId>\n            <artifactId>kumuluzee-fault-tolerance-hystrix</artifactId>\n            <version>${version.kumuluzee-fault-tolerance}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.health</groupId>\n            <artifactId>kumuluzee-health</artifactId>\n            <version>${version.kumuluzee-health}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.metrics</groupId>\n            <artifactId>kumuluzee-metrics-core</artifactId>\n            <version>${version.kumuluzee-metrics}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.jwt</groupId>\n            <artifactId>kumuluzee-jwt-auth</artifactId>\n            <version>${version.kumuluzee-jwt-auth}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.opentracing</groupId>\n            <artifactId>kumuluzee-opentracing-jaeger</artifactId>\n            <version>${version.kumuluzee-opentracing}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.openapi</groupId>\n            <artifactId>kumuluzee-openapi-mp</artifactId>\n            <version>${version.kumuluzee-openapi-mp}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.rest-client</groupId>\n            <artifactId>kumuluzee-rest-client</artifactId>\n            <version>${version.kumuluzee-rest-client}</version>\n        </dependency>\n    </dependencies>\n\n</project>"
  },
  {
    "path": "profiles/micro-profile-1.4/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-profiles</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE MicroProfile 1.4</name>\n    <description>\n        KumuluzEE MicroProfile 1.4 which includes and tracks the version 1.4 community based specification found at\n        https://microprofile.io, which focuses on technologies best-suited to build modern Java based cloud\n        applications that follow the microservice architecture. The main KumuluzEE profile includes the reference\n        implementations of the profile/specification.\n    </description>\n\n    <artifactId>kumuluzee-microProfile-1.4</artifactId>\n\n    <properties>\n        <version.kumuluzee-config-mp>1.3.0</version.kumuluzee-config-mp>\n        <version.kumuluzee-fault-tolerance>1.1.3</version.kumuluzee-fault-tolerance>\n        <version.kumuluzee-health>1.0.1</version.kumuluzee-health>\n        <version.kumuluzee-metrics>1.1.2</version.kumuluzee-metrics>\n        <version.kumuluzee-jwt-auth>1.1.1</version.kumuluzee-jwt-auth>\n        <version.kumuluzee-opentracing>1.2.1</version.kumuluzee-opentracing>\n        <version.kumuluzee-openapi-mp>1.0.1</version.kumuluzee-openapi-mp>\n        <version.kumuluzee-rest-client>1.1.0</version.kumuluzee-rest-client>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-core</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-servlet-jetty</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-cdi-weld</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-jax-rs-jersey</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-json-p-jsonp</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>com.kumuluz.ee.config</groupId>\n            <artifactId>kumuluzee-config-mp</artifactId>\n            <version>${version.kumuluzee-config-mp}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.fault.tolerance</groupId>\n            <artifactId>kumuluzee-fault-tolerance-hystrix</artifactId>\n            <version>${version.kumuluzee-fault-tolerance}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.health</groupId>\n            <artifactId>kumuluzee-health</artifactId>\n            <version>${version.kumuluzee-health}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.metrics</groupId>\n            <artifactId>kumuluzee-metrics-core</artifactId>\n            <version>${version.kumuluzee-metrics}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.jwt</groupId>\n            <artifactId>kumuluzee-jwt-auth</artifactId>\n            <version>${version.kumuluzee-jwt-auth}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.opentracing</groupId>\n            <artifactId>kumuluzee-opentracing-jaeger</artifactId>\n            <version>${version.kumuluzee-opentracing}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.openapi</groupId>\n            <artifactId>kumuluzee-openapi-mp</artifactId>\n            <version>${version.kumuluzee-openapi-mp}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.rest-client</groupId>\n            <artifactId>kumuluzee-rest-client</artifactId>\n            <version>${version.kumuluzee-rest-client}</version>\n        </dependency>\n    </dependencies>\n\n</project>"
  },
  {
    "path": "profiles/micro-profile-2.0/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-profiles</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE MicroProfile 2.0</name>\n    <description>\n        KumuluzEE MicroProfile 2.0 which includes and tracks the version 2.0 community based specification found at\n        https://microprofile.io, which focuses on technologies best-suited to build modern Java based cloud\n        applications that follow the microservice architecture. The main KumuluzEE profile includes the reference\n        implementations of the profile/specification.\n    </description>\n\n    <artifactId>kumuluzee-microProfile-2.0</artifactId>\n\n    <properties>\n        <version.kumuluzee-config-mp>1.3.0</version.kumuluzee-config-mp>\n        <version.kumuluzee-fault-tolerance>1.1.3</version.kumuluzee-fault-tolerance>\n        <version.kumuluzee-health>1.0.1</version.kumuluzee-health>\n        <version.kumuluzee-metrics>1.1.2</version.kumuluzee-metrics>\n        <version.kumuluzee-jwt-auth>1.1.1</version.kumuluzee-jwt-auth>\n        <version.kumuluzee-opentracing>1.2.1</version.kumuluzee-opentracing>\n        <version.kumuluzee-openapi-mp>1.0.1</version.kumuluzee-openapi-mp>\n        <version.kumuluzee-rest-client>1.1.0</version.kumuluzee-rest-client>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-core</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-servlet-jetty</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-cdi-weld</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-jax-rs-jersey</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-json-p-jsonp</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-json-b-yasson</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>com.kumuluz.ee.config</groupId>\n            <artifactId>kumuluzee-config-mp</artifactId>\n            <version>${version.kumuluzee-config-mp}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.fault.tolerance</groupId>\n            <artifactId>kumuluzee-fault-tolerance-hystrix</artifactId>\n            <version>${version.kumuluzee-fault-tolerance}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.health</groupId>\n            <artifactId>kumuluzee-health</artifactId>\n            <version>${version.kumuluzee-health}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.metrics</groupId>\n            <artifactId>kumuluzee-metrics-core</artifactId>\n            <version>${version.kumuluzee-metrics}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.jwt</groupId>\n            <artifactId>kumuluzee-jwt-auth</artifactId>\n            <version>${version.kumuluzee-jwt-auth}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.opentracing</groupId>\n            <artifactId>kumuluzee-opentracing-jaeger</artifactId>\n            <version>${version.kumuluzee-opentracing}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.openapi</groupId>\n            <artifactId>kumuluzee-openapi-mp</artifactId>\n            <version>${version.kumuluzee-openapi-mp}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.rest-client</groupId>\n            <artifactId>kumuluzee-rest-client</artifactId>\n            <version>${version.kumuluzee-rest-client}</version>\n        </dependency>\n    </dependencies>\n\n</project>\n"
  },
  {
    "path": "profiles/micro-profile-2.1/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-profiles</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE MicroProfile 2.1</name>\n    <description>\n        KumuluzEE MicroProfile 2.1 which includes and tracks the version 2.1 community based specification found at\n        https://microprofile.io, which focuses on technologies best-suited to build modern Java based cloud\n        applications that follow the microservice architecture. The main KumuluzEE profile includes the reference\n        implementations of the profile/specification.\n    </description>\n\n    <artifactId>kumuluzee-microProfile-2.1</artifactId>\n\n    <properties>\n        <version.kumuluzee-config-mp>1.3.0</version.kumuluzee-config-mp>\n        <version.kumuluzee-fault-tolerance>1.1.3</version.kumuluzee-fault-tolerance>\n        <version.kumuluzee-health>1.0.1</version.kumuluzee-health>\n        <version.kumuluzee-metrics>1.1.2</version.kumuluzee-metrics>\n        <version.kumuluzee-jwt-auth>1.1.1</version.kumuluzee-jwt-auth>\n        <version.kumuluzee-opentracing>1.2.1</version.kumuluzee-opentracing>\n        <version.kumuluzee-openapi-mp>1.0.1</version.kumuluzee-openapi-mp>\n        <version.kumuluzee-rest-client>1.1.0</version.kumuluzee-rest-client>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-core</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-servlet-jetty</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-cdi-weld</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-jax-rs-jersey</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-json-p-jsonp</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-json-b-yasson</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>com.kumuluz.ee.config</groupId>\n            <artifactId>kumuluzee-config-mp</artifactId>\n            <version>${version.kumuluzee-config-mp}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.fault.tolerance</groupId>\n            <artifactId>kumuluzee-fault-tolerance-hystrix</artifactId>\n            <version>${version.kumuluzee-fault-tolerance}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.health</groupId>\n            <artifactId>kumuluzee-health</artifactId>\n            <version>${version.kumuluzee-health}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.metrics</groupId>\n            <artifactId>kumuluzee-metrics-core</artifactId>\n            <version>${version.kumuluzee-metrics}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.jwt</groupId>\n            <artifactId>kumuluzee-jwt-auth</artifactId>\n            <version>${version.kumuluzee-jwt-auth}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.opentracing</groupId>\n            <artifactId>kumuluzee-opentracing-jaeger</artifactId>\n            <version>${version.kumuluzee-opentracing}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.openapi</groupId>\n            <artifactId>kumuluzee-openapi-mp</artifactId>\n            <version>${version.kumuluzee-openapi-mp}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.rest-client</groupId>\n            <artifactId>kumuluzee-rest-client</artifactId>\n            <version>${version.kumuluzee-rest-client}</version>\n        </dependency>\n    </dependencies>\n\n</project>"
  },
  {
    "path": "profiles/micro-profile-2.2/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-profiles</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE MicroProfile 2.2</name>\n    <description>\n        KumuluzEE MicroProfile 2.2 which includes and tracks the version 2.2 community based specification found at\n        https://microprofile.io, which focuses on technologies best-suited to build modern Java based cloud\n        applications that follow the microservice architecture. The main KumuluzEE profile includes the reference\n        implementations of the profile/specification.\n    </description>\n\n    <artifactId>kumuluzee-microProfile-2.2</artifactId>\n\n    <properties>\n        <version.kumuluzee-config-mp>1.3.0</version.kumuluzee-config-mp>\n        <version.kumuluzee-fault-tolerance>2.0.0</version.kumuluzee-fault-tolerance>\n        <version.kumuluzee-health>1.0.1</version.kumuluzee-health>\n        <version.kumuluzee-metrics>1.1.3</version.kumuluzee-metrics>\n        <version.kumuluzee-jwt-auth>1.1.1</version.kumuluzee-jwt-auth>\n        <version.kumuluzee-opentracing>1.3.1</version.kumuluzee-opentracing>\n        <version.kumuluzee-openapi-mp>1.1.2</version.kumuluzee-openapi-mp>\n        <version.kumuluzee-rest-client>1.2.2</version.kumuluzee-rest-client>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-core</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-servlet-jetty</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-cdi-weld</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-jax-rs-jersey</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-json-p-jsonp</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-json-b-yasson</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>com.kumuluz.ee.config</groupId>\n            <artifactId>kumuluzee-config-mp</artifactId>\n            <version>${version.kumuluzee-config-mp}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.fault.tolerance</groupId>\n            <artifactId>kumuluzee-fault-tolerance-smallrye</artifactId>\n            <version>${version.kumuluzee-fault-tolerance}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.health</groupId>\n            <artifactId>kumuluzee-health</artifactId>\n            <version>${version.kumuluzee-health}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.metrics</groupId>\n            <artifactId>kumuluzee-metrics-core</artifactId>\n            <version>${version.kumuluzee-metrics}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.jwt</groupId>\n            <artifactId>kumuluzee-jwt-auth</artifactId>\n            <version>${version.kumuluzee-jwt-auth}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.opentracing</groupId>\n            <artifactId>kumuluzee-opentracing-jaeger</artifactId>\n            <version>${version.kumuluzee-opentracing}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.openapi</groupId>\n            <artifactId>kumuluzee-openapi-mp</artifactId>\n            <version>${version.kumuluzee-openapi-mp}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.rest-client</groupId>\n            <artifactId>kumuluzee-rest-client</artifactId>\n            <version>${version.kumuluzee-rest-client}</version>\n        </dependency>\n    </dependencies>\n\n</project>\n"
  },
  {
    "path": "profiles/micro-profile-3.0/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-profiles</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE MicroProfile 3.0</name>\n    <description>\n        KumuluzEE MicroProfile 3.0 which includes and tracks the version 3.0 community based specification found at\n        https://microprofile.io, which focuses on technologies best-suited to build modern Java based cloud\n        applications that follow the microservice architecture. The main KumuluzEE profile includes the reference\n        implementations of the profile/specification.\n    </description>\n\n    <artifactId>kumuluzee-microProfile-3.0</artifactId>\n\n    <properties>\n        <version.kumuluzee-config-mp>1.3.0</version.kumuluzee-config-mp>\n        <version.kumuluzee-fault-tolerance>2.0.1</version.kumuluzee-fault-tolerance>\n        <version.kumuluzee-health>2.0.1</version.kumuluzee-health>\n        <version.kumuluzee-metrics>2.0.1</version.kumuluzee-metrics>\n        <version.kumuluzee-jwt-auth>1.1.3</version.kumuluzee-jwt-auth>\n        <version.kumuluzee-opentracing>1.3.1</version.kumuluzee-opentracing>\n        <version.kumuluzee-openapi-mp>1.1.2</version.kumuluzee-openapi-mp>\n        <version.kumuluzee-rest-client>1.3.3</version.kumuluzee-rest-client>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-core</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-servlet-jetty</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-cdi-weld</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-jax-rs-jersey</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-json-p-jsonp</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-json-b-yasson</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>com.kumuluz.ee.config</groupId>\n            <artifactId>kumuluzee-config-mp</artifactId>\n            <version>${version.kumuluzee-config-mp}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.fault.tolerance</groupId>\n            <artifactId>kumuluzee-fault-tolerance-smallrye</artifactId>\n            <version>${version.kumuluzee-fault-tolerance}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.health</groupId>\n            <artifactId>kumuluzee-health</artifactId>\n            <version>${version.kumuluzee-health}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.metrics</groupId>\n            <artifactId>kumuluzee-metrics-core</artifactId>\n            <version>${version.kumuluzee-metrics}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.jwt</groupId>\n            <artifactId>kumuluzee-jwt-auth</artifactId>\n            <version>${version.kumuluzee-jwt-auth}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.opentracing</groupId>\n            <artifactId>kumuluzee-opentracing-jaeger</artifactId>\n            <version>${version.kumuluzee-opentracing}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.openapi</groupId>\n            <artifactId>kumuluzee-openapi-mp</artifactId>\n            <version>${version.kumuluzee-openapi-mp}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.rest-client</groupId>\n            <artifactId>kumuluzee-rest-client</artifactId>\n            <version>${version.kumuluzee-rest-client}</version>\n        </dependency>\n    </dependencies>\n\n</project>\n"
  },
  {
    "path": "profiles/micro-profile-3.1/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-profiles</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE MicroProfile 3.1</name>\n    <description>\n        KumuluzEE MicroProfile 3.1 which includes and tracks the version 3.1 community based specification found at\n        https://microprofile.io, which focuses on technologies best-suited to build modern Java based cloud\n        applications that follow the microservice architecture. The main KumuluzEE profile includes the reference\n        implementations of the profile/specification.\n    </description>\n\n    <artifactId>kumuluzee-microProfile-3.1</artifactId>\n\n    <properties>\n        <version.kumuluzee-config-mp>1.3.0</version.kumuluzee-config-mp>\n        <version.kumuluzee-fault-tolerance>2.0.1</version.kumuluzee-fault-tolerance>\n        <version.kumuluzee-health>2.1.1</version.kumuluzee-health>\n        <version.kumuluzee-metrics>2.1.0</version.kumuluzee-metrics>\n        <version.kumuluzee-jwt-auth>1.1.3</version.kumuluzee-jwt-auth>\n        <version.kumuluzee-opentracing>1.3.1</version.kumuluzee-opentracing>\n        <version.kumuluzee-openapi-mp>1.1.2</version.kumuluzee-openapi-mp>\n        <version.kumuluzee-rest-client>1.3.3</version.kumuluzee-rest-client>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-core</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-servlet-jetty</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-cdi-weld</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-jax-rs-jersey</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-json-p-jsonp</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-json-b-yasson</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>com.kumuluz.ee.config</groupId>\n            <artifactId>kumuluzee-config-mp</artifactId>\n            <version>${version.kumuluzee-config-mp}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.fault.tolerance</groupId>\n            <artifactId>kumuluzee-fault-tolerance-smallrye</artifactId>\n            <version>${version.kumuluzee-fault-tolerance}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.health</groupId>\n            <artifactId>kumuluzee-health</artifactId>\n            <version>${version.kumuluzee-health}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.metrics</groupId>\n            <artifactId>kumuluzee-metrics-core</artifactId>\n            <version>${version.kumuluzee-metrics}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.jwt</groupId>\n            <artifactId>kumuluzee-jwt-auth</artifactId>\n            <version>${version.kumuluzee-jwt-auth}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.opentracing</groupId>\n            <artifactId>kumuluzee-opentracing-jaeger</artifactId>\n            <version>${version.kumuluzee-opentracing}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.openapi</groupId>\n            <artifactId>kumuluzee-openapi-mp</artifactId>\n            <version>${version.kumuluzee-openapi-mp}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.rest-client</groupId>\n            <artifactId>kumuluzee-rest-client</artifactId>\n            <version>${version.kumuluzee-rest-client}</version>\n        </dependency>\n    </dependencies>\n\n</project>\n"
  },
  {
    "path": "profiles/micro-profile-3.2/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-profiles</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE MicroProfile 3.2</name>\n    <description>\n        KumuluzEE MicroProfile 3.2 which includes and tracks the version 3.2 community based specification found at\n        https://microprofile.io, which focuses on technologies best-suited to build modern Java based cloud\n        applications that follow the microservice architecture. The main KumuluzEE profile includes the reference\n        implementations of the profile/specification.\n    </description>\n\n    <artifactId>kumuluzee-microProfile-3.2</artifactId>\n\n    <properties>\n        <version.kumuluzee-config-mp>1.3.0</version.kumuluzee-config-mp>\n        <version.kumuluzee-fault-tolerance>2.0.1</version.kumuluzee-fault-tolerance>\n        <version.kumuluzee-health>2.1.1</version.kumuluzee-health>\n        <version.kumuluzee-metrics>2.2.1</version.kumuluzee-metrics>\n        <version.kumuluzee-jwt-auth>1.1.3</version.kumuluzee-jwt-auth>\n        <version.kumuluzee-opentracing>1.3.1</version.kumuluzee-opentracing>\n        <version.kumuluzee-openapi-mp>1.1.2</version.kumuluzee-openapi-mp>\n        <version.kumuluzee-rest-client>1.3.3</version.kumuluzee-rest-client>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-core</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-servlet-jetty</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-cdi-weld</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-jax-rs-jersey</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-json-p-jsonp</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-json-b-yasson</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>com.kumuluz.ee.config</groupId>\n            <artifactId>kumuluzee-config-mp</artifactId>\n            <version>${version.kumuluzee-config-mp}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.fault.tolerance</groupId>\n            <artifactId>kumuluzee-fault-tolerance-smallrye</artifactId>\n            <version>${version.kumuluzee-fault-tolerance}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.health</groupId>\n            <artifactId>kumuluzee-health</artifactId>\n            <version>${version.kumuluzee-health}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.metrics</groupId>\n            <artifactId>kumuluzee-metrics-core</artifactId>\n            <version>${version.kumuluzee-metrics}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.jwt</groupId>\n            <artifactId>kumuluzee-jwt-auth</artifactId>\n            <version>${version.kumuluzee-jwt-auth}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.opentracing</groupId>\n            <artifactId>kumuluzee-opentracing-jaeger</artifactId>\n            <version>${version.kumuluzee-opentracing}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.openapi</groupId>\n            <artifactId>kumuluzee-openapi-mp</artifactId>\n            <version>${version.kumuluzee-openapi-mp}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.rest-client</groupId>\n            <artifactId>kumuluzee-rest-client</artifactId>\n            <version>${version.kumuluzee-rest-client}</version>\n        </dependency>\n    </dependencies>\n\n</project>\n"
  },
  {
    "path": "profiles/micro-profile-3.3/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-profiles</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE MicroProfile 3.3</name>\n    <description>\n        KumuluzEE MicroProfile 3.3 which includes and tracks the version 3.3 community based specification found at\n        https://microprofile.io, which focuses on technologies best-suited to build modern Java based cloud\n        applications that follow the microservice architecture. The main KumuluzEE profile includes the reference\n        implementations of the profile/specification.\n    </description>\n\n    <artifactId>kumuluzee-microProfile-3.3</artifactId>\n\n    <properties>\n        <version.kumuluzee-config-mp>1.4.0</version.kumuluzee-config-mp>\n        <version.kumuluzee-fault-tolerance>2.1.1</version.kumuluzee-fault-tolerance>\n        <version.kumuluzee-health>2.2.0</version.kumuluzee-health>\n        <version.kumuluzee-metrics>2.3.0</version.kumuluzee-metrics>\n        <version.kumuluzee-jwt-auth>1.1.3</version.kumuluzee-jwt-auth>\n        <version.kumuluzee-opentracing>1.3.1</version.kumuluzee-opentracing>\n        <version.kumuluzee-openapi-mp>1.2.2</version.kumuluzee-openapi-mp>\n        <version.kumuluzee-rest-client>1.4.1.2</version.kumuluzee-rest-client>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-core</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-servlet-jetty</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-cdi-weld</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-jax-rs-jersey</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-json-p-jsonp</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-json-b-yasson</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>com.kumuluz.ee.config</groupId>\n            <artifactId>kumuluzee-config-mp</artifactId>\n            <version>${version.kumuluzee-config-mp}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.fault.tolerance</groupId>\n            <artifactId>kumuluzee-fault-tolerance-smallrye</artifactId>\n            <version>${version.kumuluzee-fault-tolerance}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.health</groupId>\n            <artifactId>kumuluzee-health</artifactId>\n            <version>${version.kumuluzee-health}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.metrics</groupId>\n            <artifactId>kumuluzee-metrics-core</artifactId>\n            <version>${version.kumuluzee-metrics}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.jwt</groupId>\n            <artifactId>kumuluzee-jwt-auth</artifactId>\n            <version>${version.kumuluzee-jwt-auth}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.opentracing</groupId>\n            <artifactId>kumuluzee-opentracing-jaeger</artifactId>\n            <version>${version.kumuluzee-opentracing}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.openapi</groupId>\n            <artifactId>kumuluzee-openapi-mp</artifactId>\n            <version>${version.kumuluzee-openapi-mp}</version>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee.rest-client</groupId>\n            <artifactId>kumuluzee-rest-client</artifactId>\n            <version>${version.kumuluzee-rest-client}</version>\n            <exclusions>\n                <exclusion>\n                    <groupId>org.eclipse.microprofile.fault-tolerance</groupId>\n                    <artifactId>microprofile-fault-tolerance-api</artifactId>\n                </exclusion>\n            </exclusions>\n        </dependency>\n    </dependencies>\n\n</project>\n"
  },
  {
    "path": "profiles/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n    <packaging>pom</packaging>\n\n    <name>KumuluzEE Profiles</name>\n    <description>\n        KumuluzEE component profiles with the most common selections of components for easier standardization\n        and bootstrapping of the runtime environment.\n    </description>\n    <modules>\n        <module>micro-profile</module>\n        <module>micro-profile-1.0</module>\n        <module>micro-profile-1.1</module>\n        <module>micro-profile-1.2</module>\n        <module>micro-profile-1.3</module>\n        <module>micro-profile-1.4</module>\n        <module>micro-profile-2.0</module>\n        <module>micro-profile-2.1</module>\n        <module>micro-profile-2.2</module>\n        <module>micro-profile-3.0</module>\n        <module>micro-profile-3.1</module>\n        <module>micro-profile-3.2</module>\n        <module>micro-profile-3.3</module>\n    </modules>\n\n    <artifactId>kumuluzee-profiles</artifactId>\n\n</project>\n"
  },
  {
    "path": "servlet/jetty/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-servlet</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE Servlet Jetty</name>\n    <description>KumuluzEE servlet component implemented by Jetty</description>\n\n    <artifactId>kumuluzee-servlet-jetty</artifactId>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-common</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-loader</artifactId>\n            <optional>true</optional>\n        </dependency>\n\n        <dependency>\n            <groupId>org.eclipse.jetty</groupId>\n            <artifactId>jetty-alpn-java-server</artifactId>\n            <version>${jetty.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.eclipse.jetty</groupId>\n            <artifactId>jetty-alpn-java-client</artifactId>\n            <version>${jetty.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.eclipse.jetty</groupId>\n            <artifactId>jetty-webapp</artifactId>\n            <version>${jetty.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.eclipse.jetty</groupId>\n            <artifactId>jetty-annotations</artifactId>\n            <version>${jetty.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.eclipse.jetty</groupId>\n            <artifactId>jetty-jndi</artifactId>\n            <version>${jetty.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.eclipse.jetty.http2</groupId>\n            <artifactId>http2-server</artifactId>\n            <version>${jetty.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.eclipse.jetty</groupId>\n            <artifactId>jetty-alpn-server</artifactId>\n            <version>${jetty.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.eclipse.jetty.http2</groupId>\n            <artifactId>http2-http-client-transport</artifactId>\n            <version>${jetty.version}</version>\n        </dependency>\n        <dependency>\n            <groupId>org.slf4j</groupId>\n            <artifactId>slf4j-jdk14</artifactId>\n            <version>${slf4j.version}</version>\n        </dependency>\n\n        <dependency>\n            <groupId>junit</groupId>\n            <artifactId>junit</artifactId>\n            <scope>test</scope>\n        </dependency>\n    </dependencies>\n</project>"
  },
  {
    "path": "servlet/jetty/src/main/java/com/kumuluz/ee/jetty/JettyAttributes.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.jetty;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\npublic class JettyAttributes {\n\n    public static final String jarPattern = \"org.eclipse.jetty.server.webapp\" +\n            \".ContainerIncludeJarPattern\";\n\n    public static final String dirBrowsing = \"org.eclipse.jetty.servlet.Default.dirAllowed\";\n\n    public static final String etags = \"org.eclipse.jetty.servlet.Default.etags\";\n}\n"
  },
  {
    "path": "servlet/jetty/src/main/java/com/kumuluz/ee/jetty/JettyFactory.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.jetty;\n\nimport com.kumuluz.ee.common.config.ServerConfig;\nimport com.kumuluz.ee.common.config.ServerConnectorConfig;\nimport com.kumuluz.ee.common.utils.StringUtils;\nimport org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory;\nimport org.eclipse.jetty.http.HttpVersion;\nimport org.eclipse.jetty.http2.HTTP2Cipher;\nimport org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory;\nimport org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory;\nimport org.eclipse.jetty.server.*;\nimport org.eclipse.jetty.util.ssl.SslContextFactory;\nimport org.eclipse.jetty.util.thread.QueuedThreadPool;\nimport org.eclipse.jetty.util.thread.ThreadPool;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.logging.Logger;\nimport java.util.stream.Collectors;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\npublic class JettyFactory {\n\n    private static final Logger LOG = Logger.getLogger(JettyFactory.class.getSimpleName());\n\n    private final ServerConfig serverConfig;\n\n    public JettyFactory(ServerConfig serverConfig) {\n\n        this.serverConfig = serverConfig;\n    }\n\n    public Server create() {\n\n        Server server = new Server(createThreadPool());\n\n        server.setStopAtShutdown(true);\n        server.setConnectors(createConnectors(server));\n\n        return server;\n    }\n\n    private ThreadPool createThreadPool() {\n\n        QueuedThreadPool threadPool = new QueuedThreadPool();\n\n        threadPool.setMinThreads(serverConfig.getMinThreads());\n        threadPool.setMaxThreads(serverConfig.getMaxThreads());\n\n        LOG.info(\"Starting KumuluzEE on Jetty with \" + serverConfig.getMinThreads() + \" minimum \" +\n                \"and \" + serverConfig.getMaxThreads() + \" maximum threads\");\n\n        return threadPool;\n    }\n\n    private Connector[] createConnectors(final Server server) {\n\n        ServerConnectorConfig httpConfig = serverConfig.getHttp();\n        ServerConnectorConfig httpsConfig = serverConfig.getHttps();\n\n        List<ServerConnector> connectors = new ArrayList<>();\n\n        if (Boolean.FALSE.equals(httpConfig.getEnabled()) && (httpsConfig == null || Boolean.FALSE.equals(httpsConfig.getEnabled()))) {\n            throw new IllegalStateException(\"Both the HTTP and HTTPS connectors can not be disabled. Please enable at least one.\");\n        }\n\n        if (serverConfig.getForceHttps() && (httpsConfig == null || !Boolean.TRUE.equals(httpsConfig.getEnabled()))) {\n            throw new IllegalStateException(\"You must enable the HTTPS connector in order to force redirects to it (`kumuluzee.server\" +\n                    \".https.enabled` must be true).\");\n        }\n\n        if (httpConfig.getEnabled() == null || httpConfig.getEnabled()) {\n\n            HttpConfiguration httpConfiguration = new HttpConfiguration();\n            httpConfiguration.setRequestHeaderSize(httpConfig.getRequestHeaderSize());\n            httpConfiguration.setResponseHeaderSize(httpConfig.getResponseHeaderSize());\n            httpConfiguration.setSendServerVersion(serverConfig.getShowServerInfo());\n\n            if (Boolean.TRUE.equals(httpConfig.getProxyForwarding())) {\n                httpConfiguration.addCustomizer(new ForwardedRequestCustomizer());\n            }\n\n            if (httpsConfig != null && Boolean.TRUE.equals(httpsConfig.getEnabled())) {\n                httpConfiguration.setSecurePort(\n                        httpsConfig.getPort() == null ? ServerConnectorConfig.DEFAULT_HTTPS_PORT : httpsConfig.getPort());\n            }\n\n            ServerConnector httpConnector;\n\n            HttpConnectionFactory http = new HttpConnectionFactory(httpConfiguration);\n\n            if (httpConfig.getHttp2()) {\n\n                HTTP2CServerConnectionFactory http2c = new HTTP2CServerConnectionFactory(httpConfiguration);\n\n                httpConnector = new ServerConnector(server, http, http2c);\n            } else {\n\n                httpConnector = new ServerConnector(server, http);\n            }\n\n            httpConnector.setPort(httpConfig.getPort() == null ? ServerConnectorConfig.DEFAULT_HTTP_PORT : httpConfig.getPort());\n            httpConnector.setHost(httpConfig.getAddress());\n\n            httpConnector.setIdleTimeout(httpConfig.getIdleTimeout());\n\n            connectors.add(httpConnector);\n        }\n\n        if (httpsConfig != null && httpsConfig.getEnabled() != null && httpsConfig.getEnabled()) {\n\n            if (StringUtils.isNullOrEmpty(httpsConfig.getKeystorePath())) {\n                throw new IllegalStateException(\"Cannot create SSL connector; keystore path not specified.\");\n            }\n\n            if (StringUtils.isNullOrEmpty(httpsConfig.getKeystorePassword())) {\n                throw new IllegalStateException(\"Cannot create SSL connector; keystore password not specified.\");\n            }\n\n            if (StringUtils.isNullOrEmpty(httpsConfig.getKeyPassword())) {\n                throw new IllegalStateException(\"Cannot create SSL connector; key password not specified.\");\n            }\n\n            ServerConnector httpsConnector;\n\n            HttpConfiguration httpsConfiguration = new HttpConfiguration();\n            httpsConfiguration.setRequestHeaderSize(httpsConfig.getRequestHeaderSize());\n            httpsConfiguration.setResponseHeaderSize(httpsConfig.getResponseHeaderSize());\n            httpsConfiguration.addCustomizer(new SecureRequestCustomizer());\n            httpsConfiguration.setSendServerVersion(serverConfig.getShowServerInfo());\n\n            if (Boolean.TRUE.equals(httpsConfig.getProxyForwarding())) {\n                httpsConfiguration.addCustomizer(new ForwardedRequestCustomizer());\n            }\n\n            HttpConnectionFactory http = new HttpConnectionFactory(httpsConfiguration);\n\n            SslContextFactory.Server sslContextFactory = new SslContextFactory.Server();\n            sslContextFactory.setKeyStorePath(httpsConfig.getKeystorePath());\n            sslContextFactory.setKeyStorePassword(httpsConfig.getKeystorePassword());\n\n            if (httpsConfig.getKeyPassword() != null) {\n                sslContextFactory.setKeyManagerPassword(httpsConfig.getKeyPassword());\n            }\n\n            if (StringUtils.isNullOrEmpty(httpsConfig.getKeyAlias())) {\n                sslContextFactory.setCertAlias(httpsConfig.getKeyAlias());\n            }\n\n            if (httpsConfig.getSslProtocols() != null) {\n\n                sslContextFactory.setIncludeProtocols(httpsConfig.getSslProtocols().toArray(new String[0]));\n            }\n\n            if (httpsConfig.getSslCiphers() != null) {\n\n                sslContextFactory.setExcludeCipherSuites();\n                sslContextFactory.setIncludeCipherSuites(httpsConfig.getSslCiphers().toArray(new String[0]));\n            }\n\n            if (httpsConfig.getHttp2()) {\n\n                sslContextFactory.setCipherComparator(HTTP2Cipher.COMPARATOR);\n                sslContextFactory.setUseCipherSuitesOrder(true);\n\n                HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(httpsConfiguration);\n\n                ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory();\n                alpn.setDefaultProtocol(HttpVersion.HTTP_1_1.toString());\n\n                SslConnectionFactory ssl = new SslConnectionFactory(sslContextFactory, alpn.getProtocol());\n\n                httpsConnector = new ServerConnector(server, ssl, alpn, h2, http);\n            } else {\n\n                SslConnectionFactory ssl = new SslConnectionFactory(sslContextFactory, http.getProtocol());\n\n                httpsConnector = new ServerConnector(server, ssl, http);\n            }\n\n            httpsConnector.setPort(httpsConfig.getPort() == null ? ServerConnectorConfig.DEFAULT_HTTPS_PORT : httpsConfig.getPort());\n            httpsConnector.setHost(httpsConfig.getAddress());\n\n            httpsConnector.setIdleTimeout(httpsConfig.getIdleTimeout());\n\n            connectors.add(httpsConnector);\n        }\n\n        String ports = connectors.stream()\n                .map(connector ->\n                        String.format(\"%d [%s]\", connector.getPort(), String.join(\", \", connector.getProtocols())))\n                .collect(Collectors.joining(\", \"));\n\n        LOG.info(String.format(\"Starting KumuluzEE on port(s): %s\", ports));\n\n        return connectors.toArray(new ServerConnector[0]);\n    }\n}\n"
  },
  {
    "path": "servlet/jetty/src/main/java/com/kumuluz/ee/jetty/JettyJarClasspathUtil.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.jetty;\n\nimport com.kumuluz.ee.loader.EeClassLoader;\n\nimport java.util.List;\n\n/**\n * Obtains extra classpath jars from {@link EeClassLoader}. Must be in separate file because {@link EeClassLoader} is\n * not present on the classpath when running in exploded.\n *\n * @author Urban Malc\n * @since 3.1.0\n */\npublic class JettyJarClasspathUtil {\n\n    public static String getExtraClasspath(List<String> scanLibraries) {\n\n        if (!(JettyJarClasspathUtil.class.getClassLoader() instanceof EeClassLoader)) {\n            throw new IllegalStateException(\"Classloader not instance of EeClassLoader\");\n        }\n\n        EeClassLoader eeClassLoader = (EeClassLoader) JettyJarClasspathUtil.class.getClassLoader();\n\n        return String.join(\",\", eeClassLoader\n                .getJarFilesLocations(scanLibraries));\n    }\n}\n"
  },
  {
    "path": "servlet/jetty/src/main/java/com/kumuluz/ee/jetty/JettyServletServer.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.jetty;\n\nimport com.kumuluz.ee.common.ServletServer;\nimport com.kumuluz.ee.common.attributes.ClasspathAttributes;\nimport com.kumuluz.ee.common.config.EeConfig;\nimport com.kumuluz.ee.common.config.GzipConfig;\nimport com.kumuluz.ee.common.config.ServerConfig;\nimport com.kumuluz.ee.common.dependencies.EeComponentType;\nimport com.kumuluz.ee.common.dependencies.ServerDef;\nimport com.kumuluz.ee.common.exceptions.KumuluzServerException;\nimport com.kumuluz.ee.common.servlet.ServletWrapper;\nimport com.kumuluz.ee.common.utils.ResourceUtils;\nimport org.eclipse.jetty.annotations.AnnotationConfiguration;\nimport org.eclipse.jetty.plus.jndi.Resource;\nimport org.eclipse.jetty.plus.jndi.Transaction;\nimport org.eclipse.jetty.plus.webapp.EnvConfiguration;\nimport org.eclipse.jetty.plus.webapp.PlusConfiguration;\nimport org.eclipse.jetty.server.Handler;\nimport org.eclipse.jetty.server.Server;\nimport org.eclipse.jetty.server.handler.HandlerList;\nimport org.eclipse.jetty.server.handler.SecuredRedirectHandler;\nimport org.eclipse.jetty.server.handler.gzip.GzipHandler;\nimport org.eclipse.jetty.servlet.FilterHolder;\nimport org.eclipse.jetty.servlet.ServletHolder;\nimport org.eclipse.jetty.servlet.listener.ELContextCleaner;\nimport org.eclipse.jetty.webapp.*;\n\nimport javax.naming.NamingException;\nimport javax.servlet.DispatcherType;\nimport javax.servlet.Filter;\nimport javax.servlet.Servlet;\nimport javax.sql.DataSource;\nimport javax.transaction.UserTransaction;\nimport java.io.IOException;\nimport java.util.*;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\nimport java.util.regex.Pattern;\n\n/**\n * @author Tilen Faganel\n * @since 1.0.0\n */\n@ServerDef(value = \"Jetty\", provides = {EeComponentType.SERVLET})\npublic class JettyServletServer implements ServletServer {\n\n    private final Logger log = Logger.getLogger(JettyServletServer.class.getSimpleName());\n\n    private Server server;\n\n    private WebAppContext appContext;\n\n    private ServerConfig serverConfig;\n\n    @Override\n    public void initServer() {\n\n        server = createJettyFactory().create();\n    }\n\n    @Override\n    public void startServer() {\n\n        if (server == null)\n            throw new IllegalStateException(\"Jetty has to be initialized before starting it\");\n\n        if (server.isStarted() || server.isStarting())\n            throw new IllegalStateException(\"Jetty is already started\");\n\n        try {\n            server.start();\n        } catch (Exception e) {\n\n            log.severe(e.getMessage());\n\n            throw new KumuluzServerException(e.getMessage(), e);\n        }\n    }\n\n    @Override\n    public void stopServer() {\n\n        if (server == null)\n            throw new IllegalStateException(\"Jetty has to be initialized before stopping it\");\n\n        if (server.isStopped() || server.isStopping())\n            throw new IllegalStateException(\"Jetty is already stopped\");\n\n        try {\n            server.stop();\n        } catch (Exception e) {\n\n            log.severe(e.getMessage());\n\n            throw new KumuluzServerException(e.getMessage(), e.getCause());\n        }\n    }\n\n    @Override\n    public void initWebContext(List<String> scanLibraries) {\n\n        if (server == null)\n            throw new IllegalStateException(\"Jetty has to be initialized before adding a web context\");\n\n        if (server.isStarted() || server.isStarting())\n            throw new IllegalStateException(\"Jetty cannot be started before adding a web context\");\n\n        if (EeConfig.getInstance().getDev().getScanLibraries() != null) {\n            scanLibraries.addAll(EeConfig.getInstance().getDev().getScanLibraries());\n        }\n\n        appContext = new WebAppContext();\n\n        appContext.setConfigurationClasses(createConfigurations());\n\n        try {\n            appContext.setClassLoader(getClass().getClassLoader());\n        } catch (Exception e) {\n            throw new IllegalStateException(\"Unable to set custom classloader for Jetty\", e);\n        }\n\n        if (ResourceUtils.isRunningInJar()) {\n            appContext.setAttribute(JettyAttributes.jarPattern, ClasspathAttributes.jar);\n\n            try {\n                appContext.setExtraClasspath(JettyJarClasspathUtil.getExtraClasspath(scanLibraries));\n            } catch (IOException e) {\n                throw new IllegalStateException(\"Unable to set extra classpath for Jetty\", e);\n            }\n        } else {\n            StringBuilder explodedClasspath = new StringBuilder(ClasspathAttributes.exploded);\n\n            if (ResourceUtils.isRunningTests()) {\n                explodedClasspath.append(\"|\").append(ClasspathAttributes.exploded_test);\n            }\n\n            for (String lib : scanLibraries) {\n                if (lib.endsWith(\".jar\")) {\n                    explodedClasspath.append(\"|^.*/\").append(Pattern.quote(lib)).append(\"$\");\n                } else {\n                    explodedClasspath.append(\"|^.*/\").append(Pattern.quote(lib)).append(\"-[^/]+\\\\.jar$\");\n                }\n            }\n\n            log.fine(\"Using classpath scanning regex: \" + explodedClasspath);\n            appContext.setAttribute(JettyAttributes.jarPattern, explodedClasspath.toString());\n        }\n\n        appContext.setParentLoaderPriority(true);\n\n        appContext.setResourceBase(ResourceUtils.getProjectWebResources());\n\n        appContext.setContextPath(serverConfig.getContextPath());\n\n        if (serverConfig.getForwardStartupException() != null) {\n            appContext.setThrowUnavailableOnStartupException(serverConfig.getForwardStartupException());\n        }\n\n        if (!Boolean.TRUE.equals(serverConfig.getDirBrowsing())) {\n\n            appContext.setInitParameter(JettyAttributes.dirBrowsing, \"false\");\n        }\n\n        if (Boolean.TRUE.equals(serverConfig.getEtags())) {\n            appContext.setInitParameter(JettyAttributes.etags, \"true\");\n        }\n\n        // Since ELContextCleaner cannot perform reflective access to BeanELResolver it logs a warning before container\n        // shutdown. Because Jetty is running in embedded mode, this purge is not necessary and the warning is irrelevant.\n        Logger.getLogger(ELContextCleaner.class.getName()).setLevel(Level.SEVERE);\n\n        log.info(\"Starting KumuluzEE with context root '\" + serverConfig.getContextPath() + \"'\");\n\n        GzipConfig gzipConfig = serverConfig.getGzip();\n\n        if (serverConfig.getForceHttps() || (gzipConfig != null && gzipConfig.getEnabled())) {\n\n            final ArrayList<Handler> handlers = new ArrayList<>();\n\n            // Set the secured redirect handler in case the force https option is selected\n            if( serverConfig.getForceHttps()) {\n                handlers.add(new SecuredRedirectHandler());\n            }\n\n            // Set the gzip handler in case the use gzip option is selected\n            if(gzipConfig != null && gzipConfig.getEnabled()) {\n                GzipHandler gzipHandler = new GzipHandler();\n\n                if(gzipConfig.getMinGzipSize() != null)\n                    gzipHandler.setMinGzipSize(gzipConfig.getMinGzipSize());\n                if(gzipConfig.getIncludedMethods() != null)\n                    gzipHandler.setIncludedMethods(gzipConfig.getIncludedMethods().toArray(new String[0]));\n                if(gzipConfig.getIncludedMimeTypes() != null)\n                    gzipHandler.setIncludedMimeTypes(gzipConfig.getIncludedMimeTypes().toArray(new String[0]));\n                if(gzipConfig.getExcludedMimeTypes() != null)\n                    gzipHandler.setExcludedMimeTypes(gzipConfig.getExcludedMimeTypes().toArray(new String[0]));\n                if(gzipConfig.getExcludedPaths() != null)\n                    gzipHandler.setExcludedPaths(gzipConfig.getExcludedPaths().toArray(new String[0]));\n                if(gzipConfig.getIncludedPaths() != null)\n                    gzipHandler.setIncludedPaths(gzipConfig.getIncludedPaths().toArray(new String[0]));\n\n                gzipHandler.setHandler(appContext);\n                handlers.add(gzipHandler);\n            } else {\n                handlers.add(appContext);\n            }\n\n            HandlerList handlerList = new HandlerList();\n            handlerList.setHandlers(handlers.toArray(new Handler[0]));\n\n            server.setHandler(handlerList);\n        } else {\n\n            server.setHandler(appContext);\n        }\n    }\n\n    @Override\n    public ServerConfig getServerConfig() {\n\n        return serverConfig;\n    }\n\n    @Override\n    public void setServerConfig(ServerConfig serverConfig) {\n\n        this.serverConfig = serverConfig;\n    }\n\n    @Override\n    public void registerServlet(Class<? extends Servlet> servletClass, String mapping) {\n\n        registerServlet(servletClass, mapping, null, 0);\n    }\n\n    @Override\n    public void registerServlet(Class<? extends Servlet> servletClass, String mapping, Map<String, String>\n            parameters) {\n\n        registerServlet(servletClass, mapping, parameters, 0);\n    }\n\n    @Override\n    public void registerServlet(Class<? extends Servlet> servletClass, String mapping, Map<String, String>\n            parameters, int initOrder) {\n\n        if (server == null)\n            throw new IllegalStateException(\"Jetty has to be initialized before adding a servlet \");\n\n        if (server.isStarted() || server.isStarting())\n            throw new IllegalStateException(\"Jetty cannot be started before adding a servlet\");\n\n        @SuppressWarnings(\"unchecked\")\n        Class<Servlet> servlet = (Class<Servlet>) servletClass;\n\n        ServletHolder holder = new ServletHolder(servlet);\n        holder.setInitOrder(initOrder);\n\n        if (parameters != null) {\n            parameters.forEach(holder::setInitParameter);\n        }\n\n        appContext.addServlet(holder, mapping);\n    }\n\n    @Override\n    public void registerListener(EventListener listener) {\n\n        if (server == null)\n            throw new IllegalStateException(\"Jetty has to be initialized before adding a listener\");\n\n        if (server.isStarted() || server.isStarting())\n            throw new IllegalStateException(\"Jetty cannot be started before adding a listener\");\n\n        appContext.addEventListener(listener);\n    }\n\n    @Override\n    public void registerFilter(Class<? extends Filter> filterClass, String pathSpec) {\n\n        registerFilter(filterClass, pathSpec, EnumSet.of(DispatcherType.REQUEST));\n    }\n\n    @Override\n    public void registerFilter(Class<? extends Filter> filterClass, String pathSpec, Map<String, String> parameters) {\n\n        registerFilter(filterClass, pathSpec, EnumSet.of(DispatcherType.REQUEST), parameters);\n    }\n\n    @Override\n    public void registerFilter(Class<? extends Filter> filterClass, String pathSpec, EnumSet<DispatcherType> dispatches) {\n\n        registerFilter(filterClass, pathSpec, dispatches, null);\n    }\n\n    @Override\n    public void registerFilter(Class<? extends Filter> filterClass, String pathSpec, EnumSet<DispatcherType> dispatches, Map<String,\n            String> parameters) {\n\n        if (server == null)\n            throw new IllegalStateException(\"Jetty has to be initialized before adding a servlet \");\n\n        if (server.isStarted() || server.isStarting())\n            throw new IllegalStateException(\"Jetty cannot be started before adding a servlet\");\n\n        FilterHolder holder = new FilterHolder(filterClass);\n\n        if (parameters != null) {\n\n            parameters.forEach(holder::setInitParameter);\n        }\n\n        appContext.addFilter(holder, pathSpec, dispatches);\n    }\n\n    @Override\n    public void registerDataSource(DataSource ds, String jndiName) {\n\n        try {\n            Resource resource = new Resource(jndiName, ds);\n\n            appContext.setAttribute(jndiName, resource);\n        } catch (NamingException e) {\n            throw new IllegalArgumentException(\"Unable to create naming data source entry with jndi name \" + jndiName + \"\", e);\n        }\n    }\n\n    @Override\n    public List<ServletWrapper> getRegisteredServlets() {\n\n        List<ServletWrapper> servlets = new ArrayList<>();\n\n        Arrays.stream(this.appContext.getServletHandler().getServlets())\n                .forEach(s -> servlets.add(new ServletWrapper(s.getName(), s.getContextPath())));\n\n        return servlets;\n    }\n\n    @Override\n    public void registerResource(Object o, String jndiName) {\n\n        try {\n            Resource resource = new Resource(jndiName, o);\n\n            appContext.setAttribute(jndiName, resource);\n        } catch (NamingException e) {\n            throw new IllegalArgumentException(\"Unable to create naming resource entry with jndi name \" + jndiName + \"\", e);\n        }\n    }\n\n    @Override\n    public void registerTransactionManager(UserTransaction userTransaction) {\n        try {\n            new Transaction(userTransaction);\n        } catch (NamingException e) {\n            throw new IllegalArgumentException(\"Unable to create transaction manager\", e);\n        }\n    }\n\n    private JettyFactory createJettyFactory() {\n\n        return new JettyFactory(serverConfig);\n    }\n\n    private List<String> createConfigurations() {\n\n        List<String> configurations = new ArrayList<>();\n\n        configurations.add(WebAppConfiguration.class.getName());\n        configurations.add(AnnotationConfiguration.class.getName());\n        configurations.add(WebInfConfiguration.class.getName());\n        configurations.add(WebXmlConfiguration.class.getName());\n        configurations.add(MetaInfConfiguration.class.getName());\n        configurations.add(FragmentConfiguration.class.getName());\n        configurations.add(JettyWebXmlConfiguration.class.getName());\n        configurations.add(EnvConfiguration.class.getName());\n        configurations.add(PlusConfiguration.class.getName());\n\n        return configurations;\n    }\n}\n"
  },
  {
    "path": "servlet/jetty/src/main/resources/META-INF/services/com.kumuluz.ee.common.KumuluzServer",
    "content": "com.kumuluz.ee.jetty.JettyServletServer"
  },
  {
    "path": "servlet/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n    <packaging>pom</packaging>\n\n    <modules>\n        <module>jetty</module>\n    </modules>\n\n    <name>KumuluzEE Servlet</name>\n    <description>KumuluzEE servlet server component</description>\n\n    <artifactId>kumuluzee-servlet</artifactId>\n\n</project>"
  },
  {
    "path": "settings.xml",
    "content": "<settings xmlns=\"http://maven.apache.org/SETTINGS/1.0.0\"\n          xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n          xsi:schemaLocation=\"http://maven.apache.org/SETTINGS/1.0.0\n                      http://maven.apache.org/xsd/settings-1.0.0.xsd\">\n    <localRepository/>\n    <interactiveMode/>\n    <usePluginRegistry/>\n    <offline/>\n    <pluginGroups/>\n    <servers>\n        <server>\n            <id>ossrh</id>\n            <username>${env.OSSRH_USERNAME}</username>\n            <password>${env.OSSRH_PASSWORD}</password>\n        </server>\n    </servers>\n    <mirrors/>\n    <proxies/>\n    <profiles>\n        <profile>\n            <id>ossrh</id>\n            <activation>\n                <activeByDefault>true</activeByDefault>\n            </activation>\n            <properties>\n                <gpg.keyname>8DCC0AFC</gpg.keyname>\n                <gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>\n            </properties>\n\n            <repositories>\n                <repository>\n                    <id>sonatype-snapshots</id>\n                    <name>Sonatype Snapshots</name>\n                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>\n                    <releases>\n                        <enabled>false</enabled>\n                    </releases>\n                    <snapshots>\n                        <enabled>true</enabled>\n                    </snapshots>\n                </repository>\n            </repositories>\n        </profile>\n    </profiles>\n    <activeProfiles/>\n</settings>"
  },
  {
    "path": "tools/loader/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-tools</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n\n    <name>KumuluzEE Loader</name>\n    <description>KumuluzEE custom class loader implementation</description>\n\n    <artifactId>kumuluzee-loader</artifactId>\n</project>"
  },
  {
    "path": "tools/loader/src/main/java/com/kumuluz/ee/loader/EeBootLoader.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.loader;\n\nimport com.kumuluz.ee.loader.exception.EeClassLoaderException;\n\nimport java.util.MissingResourceException;\nimport java.util.ResourceBundle;\n\n/**\n * @author Benjamin Kastelic\n *\n */\npublic class EeBootLoader {\n\n    public static void main(String[] args) throws Throwable {\n\n        try {\n            ResourceBundle bootLoaderProperties = ResourceBundle.getBundle(\"META-INF/kumuluzee/boot-loader\");\n\n            String mainClass = bootLoaderProperties.getString(\"main-class\");\n\n            launch(args, mainClass);\n        } catch (MissingResourceException e) {\n\n            throw new EeClassLoaderException(\"KumuluzEE Boot Loader config properties are malformed or missing.\", e);\n        }\n    }\n\n    /**\n     * Start the boot procedure.\n     * Use the {@link EeClassLoader} EeClassLoader to find, load and start the main class.\n     */\n    private static void launch(String[] args, String mainClass) throws Throwable {\n        EeClassLoader classLoader = new EeClassLoader();\n        classLoader.invokeMain(mainClass, args);\n    }\n}\n"
  },
  {
    "path": "tools/loader/src/main/java/com/kumuluz/ee/loader/EeClassLoader.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.loader;\n\nimport com.kumuluz.ee.loader.exception.EeClassLoaderException;\nimport com.kumuluz.ee.loader.jar.FileInfo;\nimport com.kumuluz.ee.loader.jar.JarEntryInfo;\nimport com.kumuluz.ee.loader.jar.JarFileInfo;\n\nimport java.io.*;\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Method;\nimport java.net.URI;\nimport java.net.URISyntaxException;\nimport java.net.URL;\nimport java.net.URLDecoder;\nimport java.security.CodeSource;\nimport java.security.ProtectionDomain;\nimport java.security.cert.Certificate;\nimport java.util.*;\nimport java.util.jar.JarEntry;\nimport java.util.jar.JarFile;\nimport java.util.logging.Logger;\nimport java.util.regex.Pattern;\nimport java.util.stream.Collectors;\nimport java.util.zip.ZipFile;\n\n/**\n * @author Benjamin Kastelic\n * @since 2.4.0\n */\npublic class EeClassLoader extends ClassLoader {\n\n    /**\n     * Directory name for temporary files.\n     */\n    private static final String TMP_DIRECTORY = \"tmp/EeClassLoader\";\n    private Boolean DEBUG = false;\n    private File tempDir;\n    private List<JarFileInfo> jarFiles;\n    private List<FileInfo> files;\n    private Set<File> deleteOnExit;\n    private Map<String, Class<?>> classes;\n\n    private JarFileInfo jarFileInfo;\n\n    /**\n     * Default constructor.\n     * Defines system class loader as a parent class loader.\n     */\n    public EeClassLoader() {\n        this(ClassLoader.getSystemClassLoader());\n    }\n\n    /**\n     * Constructor.\n     */\n    public EeClassLoader(ClassLoader parent) {\n        super(parent);\n\n        String debugString = System.getProperty(\"com.kumuluz.ee.loader.debug\");\n\n        if (debugString != null) {\n\n            DEBUG = Boolean.valueOf(debugString);\n        }\n\n        long startTime = System.currentTimeMillis();\n\n        debug(\"Initialising KumuluzEE classloader\");\n\n        classes = new HashMap<>();\n        jarFiles = Collections.synchronizedList(new ArrayList<>());\n        files = Collections.synchronizedList(new ArrayList<>());\n        deleteOnExit = new HashSet<>();\n\n        String mainJarURLString;\n        ProtectionDomain protectionDomain = getClass().getProtectionDomain();\n        CodeSource codeSource = protectionDomain.getCodeSource();\n        URL mainJarURL = codeSource.getLocation();\n        String protocol = mainJarURL.getProtocol();\n\n        // Decoding required for 'space char' in URL:\n        //    URL.getFile() returns \"/C:/my%20dir/MyApp.jar\" for \"/C:/my dir/MyApp.jar\"\n        try {\n            mainJarURLString = URLDecoder.decode(mainJarURL.getFile(), \"UTF-8\");\n        } catch (UnsupportedEncodingException e) {\n\n            String msg = String.format(\"Failed to decode URL: %s %s\", mainJarURL, e.toString());\n\n            throw new EeClassLoaderException(msg, e);\n        }\n\n        File mainJarFile = new File(mainJarURLString);\n\n        try {\n            jarFileInfo = new JarFileInfo(new JarFile(mainJarFile, true, ZipFile.OPEN_READ, JarFile.runtimeVersion()),\n                    mainJarFile.getName(), null, protectionDomain, null);\n\n            debug(String.format(\"Loading from main JAR: '%s' PROTOCOL: '%s'\", mainJarURLString, protocol));\n        } catch (IOException e) {\n\n            String msg = String.format(\"Not a JAR: %s %s\", mainJarURLString, e.toString());\n\n            throw new EeClassLoaderException(msg, e);\n        }\n\n        // load main JAR:\n        try {\n            // start recursive JAR loading\n            extractMainJar(jarFileInfo);\n            loadJar(jarFileInfo);\n        } catch (Exception e) {\n\n            String msg = String.format(\"Not a valid URL: %s %s\", mainJarURL, e.toString());\n\n            throw new EeClassLoaderException(msg, e);\n        }\n\n        debug(String.format(\"Initialised KumuluzEE classloader @%dms\", System.currentTimeMillis() - startTime));\n    }\n\n    private void createTempDirectory() throws URISyntaxException {\n        // Create temp directory for classpath initialization\n        if (tempDir == null) {\n\n            ProtectionDomain protectionDomain = getClass().getProtectionDomain();\n            CodeSource codeSource = protectionDomain.getCodeSource();\n            URI location = (codeSource == null ? null : codeSource.getLocation().toURI());\n            String path = (location == null ? null : location.getSchemeSpecificPart());\n            if (path == null) {\n                throw new IllegalStateException(\"Unable to determine code source archive\");\n            }\n\n            File jarDir = new File(path);\n            String jarFolder = jarDir.getParentFile().getPath();\n\n            File dir = new File(jarFolder, TMP_DIRECTORY);\n\n            if (!dir.exists()) {\n                dir.mkdirs();\n            }\n\n            dir.deleteOnExit();\n\n            chmod777(dir); // Unix - allow temp directory RW access to all users.\n            if (!dir.exists() || !dir.isDirectory()) {\n                throw new EeClassLoaderException(\"Cannot create temp directory \" + dir.getAbsolutePath());\n            }\n            tempDir = dir;\n        }\n    }\n\n    private File createFile(JarEntry jarEntry, InputStream is) throws EeClassLoaderException {\n        File tmpFile = null;\n        try {\n            if (jarEntry.isDirectory()) {\n                tmpFile = new File(tempDir + File.separator + jarEntry);\n                tmpFile.mkdirs();\n                tmpFile.deleteOnExit();\n                chmod777(tmpFile);\n                return tmpFile;\n            } else {\n                String fileName = jarEntry.getName();\n                File tempDir = this.tempDir;\n                int lastPathIndex = jarEntry.getName().lastIndexOf(\"/\");\n                if (lastPathIndex > -1) {\n                    String dirPath = jarEntry.getName().substring(0, lastPathIndex);\n                    tempDir = new File(tempDir.getPath() + File.separator + dirPath);\n                    tempDir.mkdirs();\n                    tempDir.deleteOnExit();\n                    chmod777(tempDir);\n                    fileName = fileName.substring(lastPathIndex + 1);\n                }\n                tmpFile = new File(tempDir + File.separator + fileName);\n                tmpFile.deleteOnExit();\n                chmod777(tmpFile); // Unix - allow temp file deletion by any user\n                BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(tmpFile));\n                while(is.available() > 0) {\n                    os.write(is.read());\n                }\n                os.close();\n                return tmpFile;\n            }\n        } catch (IOException e) {\n            throw new EeClassLoaderException(String.format(\"Cannot create file '%s' for %s\", tmpFile, jarEntry), e);\n        }\n    }\n\n    private File createJarFile(JarEntryInfo jarEntryInfo) throws EeClassLoaderException {\n        File tmpFile = null;\n        try {\n            tmpFile = new File(tempDir.getPath() + File.separator + jarEntryInfo.getName());\n            tmpFile.deleteOnExit();\n            chmod777(tmpFile); // Unix - allow temp file deletion by any user\n            byte[] bytes = jarEntryInfo.getJarBytes();\n            BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(tmpFile));\n            os.write(bytes);\n            os.close();\n            return tmpFile;\n        } catch (IOException e) {\n            throw new EeClassLoaderException(String.format(\"Cannot create temp file '%s' for %s\", tmpFile, jarEntryInfo.getJarEntry()), e);\n        }\n    }\n\n    private void extractMainJar(JarFileInfo jarFileInfo) throws URISyntaxException {\n        final String LIB_DIRECTORY = \"lib/\";\n\n        createTempDirectory();\n\n        jarFileInfo.getJarFile()\n                .stream()\n                .parallel()\n                .filter(je -> !je.getName().toLowerCase().startsWith(LIB_DIRECTORY))\n                .forEach(je -> {\n                    try {\n                        JarEntryInfo jarEntryInfo = new JarEntryInfo(jarFileInfo, je);\n                        File tempFile = createFile(je, jarFileInfo.getJarFile().getInputStream(je));\n\n                        debug(String.format(\"Loading inner JAR %s from temp file %s\", jarEntryInfo.getJarEntry(), getFilenameForLog(tempFile)));\n\n                        files.add(new FileInfo(tempFile, je.getName()));\n                    } catch (IOException e) {\n                        throw new RuntimeException(String.format(\"Cannot load jar entries from jar %s\", je.getName().toLowerCase()), e);\n                    } catch (EeClassLoaderException e) {\n                        throw new RuntimeException(\"ERROR on loading inner JAR: \" + e.getMessageAll());\n                    }\n                });\n    }\n\n    /**\n     * Loads specified JAR.\n     */\n    private void loadJar(final JarFileInfo jarFileInfo) {\n        final String JAR_SUFFIX = \".jar\";\n\n        jarFiles.add(jarFileInfo);\n        jarFileInfo.getJarFile()\n                .stream()\n                .parallel()\n                .filter(je -> !je.isDirectory() && je.getName().toLowerCase().endsWith(JAR_SUFFIX))\n                .forEach(je -> {\n                    try {\n                        JarEntryInfo jarEntryInfo = new JarEntryInfo(jarFileInfo, je);\n                        File tempFile = createJarFile(jarEntryInfo);\n\n                        debug(String.format(\"Loading inner JAR %s from temp file %s\", jarEntryInfo.getJarEntry(), getFilenameForLog(tempFile)));\n\n                        // Construct ProtectionDomain for this inner JAR:\n                        URL url = tempFile.toURI().toURL();\n                        ProtectionDomain pdParent = jarFileInfo.getProtectionDomain();\n                        // 'csParent' is never null: top JAR has it, classloader creates it for child JAR:\n                        CodeSource csParent = pdParent.getCodeSource();\n                        Certificate[] certParent = csParent.getCertificates();\n                        CodeSource csChild = certParent == null\n                                ? new CodeSource(url, csParent.getCodeSigners())\n                                : new CodeSource(url, certParent);\n                        ProtectionDomain pdChild = new ProtectionDomain(csChild, pdParent.getPermissions(), pdParent.getClassLoader(), pdParent.getPrincipals());\n                        loadJar(new JarFileInfo(new JarFile(tempFile, true, ZipFile.OPEN_READ, JarFile.runtimeVersion()),\n                                jarEntryInfo.getName(), jarFileInfo, pdChild, tempFile));\n                    } catch (IOException e) {\n                        throw new RuntimeException(String.format(\"Cannot load jar entries from jar %s\", je.getName().toLowerCase()), e);\n                    } catch (EeClassLoaderException e) {\n                        throw new RuntimeException(\"ERROR on loading inner JAR: \" + e.getMessageAll());\n                    }\n                });\n    }\n\n    private JarEntryInfo findJarEntry(String name) {\n        for (JarFileInfo jarFileInfo : jarFiles) {\n            JarFile jarFile = jarFileInfo.getJarFile();\n            JarEntry jarEntry = jarFile.getJarEntry(name);\n            if (jarEntry != null) {\n                return new JarEntryInfo(jarFileInfo, jarEntry);\n            }\n        }\n        return null;\n    }\n\n    private URL findFile(String name) {\n        for (FileInfo fileInfo : files) {\n            if (fileInfo.getSimpleName().equals(name)) {\n                try {\n                    return fileInfo.getFile().toURI().toURL();\n                } catch (Exception e) {\n                    // ignore\n                }\n            }\n        }\n        return null;\n    }\n\n    private List<JarEntryInfo> findJarEntries(String name) {\n\n        List<JarEntryInfo> jarEntryInfoList = new ArrayList<>();\n\n        for (JarFileInfo jarFileInfo : jarFiles) {\n\n            JarFile jarFile = jarFileInfo.getJarFile();\n            JarEntry jarEntry = jarFile.getJarEntry(name);\n            if (jarEntry != null) {\n                jarEntryInfoList.add(new JarEntryInfo(jarFileInfo, jarEntry));\n            }\n        }\n\n        return jarEntryInfoList;\n    }\n\n    private List<URL> findFiles(String name) {\n\n        List<URL> urlList = new ArrayList<>();\n\n        for (FileInfo fileInfo : files) {\n\n            if (fileInfo.getSimpleName().equals(name)) {\n                try {\n                    URL fileUrl = fileInfo.getFile().toURI().toURL();\n                    urlList.add(fileUrl);\n                } catch (Exception e) {\n                    // ignore\n                }\n            }\n        }\n\n        return urlList;\n    }\n\n    /**\n     * Finds native library entry.\n     *\n     * @param libraryName Library name. For example for the library name \"Native\"\n     *  - Windows returns entry \"Native.dll\"\n     *  - Linux returns entry \"libNative.so\"\n     *  - Mac returns entry \"libNative.jnilib\" or \"libNative.dylib\"\n     *    (depending on Apple or Oracle JDK and/or JDK version)\n     * @return Native library entry.\n     */\n    private JarEntryInfo findJarNativeEntry(String libraryName) {\n        String name = System.mapLibraryName(libraryName);\n        for (JarFileInfo jarFileInfo : jarFiles) {\n            JarFile jarFile = jarFileInfo.getJarFile();\n            Enumeration<JarEntry> entries = jarFile.entries();\n            while (entries.hasMoreElements()) {\n                JarEntry jarEntry = entries.nextElement();\n                if (jarEntry.isDirectory()) {\n                    continue;\n                }\n\n                // Example: name is \"Native.dll\"\n                String jarEntryName = jarEntry.getName(); // \"Native.dll\" or \"abc/xyz/Native.dll\"\n                // name \"Native.dll\" could be found, for example\n                //   - in the path: abc/Native.dll/xyz/my.dll <-- do not load this one!\n                //   - in the partial name: abc/aNative.dll   <-- do not load this one!\n                String[] token = jarEntryName.split(\"/\"); // the last token is library name\n                if (token.length > 0 && token[token.length - 1].equals(name)) {\n\n                    debug(String.format(\"Loading native library '%s' found as '%s' in JAR %s\", libraryName, jarEntryName, jarFileInfo.getSimpleName()));\n\n                    return new JarEntryInfo(jarFileInfo, jarEntry);\n                }\n            }\n        }\n        return null;\n    }\n\n    /**\n     * Loads class from a JAR and searches for all jar-in-jar.\n     */\n    private Class<?> findJarClass(String className) throws EeClassLoaderException {\n        Class<?> clazz = classes.get(className);\n        if (clazz != null) {\n            return clazz;\n        }\n\n        // Char '/' works for Win32 and Unix.\n        String fullClassName = className.replace('.', '/') + \".class\";\n        JarEntryInfo jarEntryInfo = findJarEntry(fullClassName);\n        String jarSimpleName = null;\n        if (jarEntryInfo != null) {\n            jarSimpleName = jarEntryInfo.getJarFileInfo().getSimpleName();\n            definePackage(className, jarEntryInfo);\n            byte[] bytes = jarEntryInfo.getJarBytes();\n            try {\n                clazz = defineClass(className, bytes, 0, bytes.length, jarEntryInfo.getJarFileInfo().getProtectionDomain());\n            } catch (ClassFormatError e) {\n                throw new EeClassLoaderException(null, e);\n            }\n        }\n        if (clazz == null) {\n            throw new EeClassLoaderException(className);\n        }\n        classes.put(className, clazz);\n\n        debug(String.format(\"Loaded %s by %s from JAR %s\", className, getClass().getName(), jarSimpleName));\n\n        return clazz;\n    }\n\n    /**\n     * Checks how the application was loaded: from JAR or file system.\n     */\n    private boolean isLaunchedFromJar() {\n        return jarFiles != null && !jarFiles.isEmpty();\n    }\n\n    /**\n     * Invokes main() method on class with provided parameters.\n     */\n    public void invokeMain(String className, String[] args) throws Throwable {\n\n        Class<?> clazz = loadClass(className);\n\n        debug(String.format(\"Launch: %s.main(); Loader: %s\", className, clazz.getClassLoader()));\n\n        Method method = clazz.getMethod(\"main\", String[].class);\n\n        if (method == null) {\n            throw new NoSuchMethodException(\"The main() method in class \\\"\" + className + \"\\\" not found.\");\n        }\n\n        try {\n            method.invoke(null, (Object)args);\n        } catch (InvocationTargetException e) {\n            throw e.getTargetException();\n        }\n    }\n\n    @Override\n    protected synchronized Class<?> loadClass(String className, boolean bResolve) throws ClassNotFoundException {\n\n        debug(String.format(\"LOADING %s (resolve=%b)\", className, bResolve));\n\n        Thread.currentThread().setContextClassLoader(this); // !!!\n\n        Class<?> clazz = null;\n\n        try {\n            // Step 1. This class is already loaded by system classloader.\n            if (getClass().getName().equals(className)) {\n                return EeClassLoader.class;\n            }\n            // Step 2. Already loaded class.\n            clazz = findLoadedClass(className);\n            if (clazz != null) {\n\n                debug(String.format(\"Class %s already loaded\", className));\n\n                return clazz;\n            }\n            // Step 3. Load from JAR.\n            if (isLaunchedFromJar()) {\n                try {\n                    clazz = findJarClass(className); // Do not simplify! See \"finally\"!\n                    return clazz;\n                } catch (EeClassLoaderException e) {\n                    if (e.getCause() == null) {\n                        debug(String.format(\"Not found %s in JAR by %s: %s\", className, getClass().getName(), e.getMessage()));\n                    } else {\n                        debug(String.format(\"Error loading %s in JAR by %s: %s\", className, getClass().getName(), e.getCause()));\n                    }\n                    // keep looking...\n                }\n            }\n            // Step 4. Load by parent (usually system) class loader.\n            try {\n                ClassLoader classLoader = getParent();\n                clazz = classLoader.loadClass(className);\n\n                debug(String.format(\"Loaded %s by %s\", className, classLoader.getClass().getName()));\n\n                return clazz;\n            } catch (ClassNotFoundException e) {\n                // Ignore\n            }\n            // Nothing else to try ...\n            throw new ClassNotFoundException(\"Failure to load: \" + className);\n        } finally {\n            if (clazz != null  &&  bResolve) {\n                resolveClass(clazz);\n            }\n        }\n    }\n\n    @Override\n    protected Class<?> findClass(String s) throws ClassNotFoundException {\n        return loadClass(s); // same as loadClass(s, false)\n    }\n\n    @Override\n    protected URL findResource(String name) {\n\n        debug(String.format(\"findResource: %s\", name));\n\n        if (isLaunchedFromJar()) {\n            URL file = findFile(normalizeResourceName(name));\n            if (file != null) {\n                debug(String.format(\"found resource: %s\", file));\n\n                return file;\n            }\n\n            JarEntryInfo inf = findJarEntry(normalizeResourceName(name));\n            if (inf != null) {\n                URL url = inf.getURL();\n\n                debug(String.format(\"found resource: %s\", url));\n\n                return url;\n            }\n\n            debug(String.format(\"not found resource: %s\", name));\n\n            return null;\n        }\n\n        return super.findResource(name);\n    }\n\n    @Override\n    public Enumeration<URL> getResources(String name) throws IOException {\n        return findResources(name);\n    }\n\n    @Override\n    public Enumeration<URL> findResources(String name) throws IOException {\n\n        debug(String.format(\"getResources: %s\", name));\n\n        if (isLaunchedFromJar()) {\n            List<URL> fileUrls = findFiles(normalizeResourceName(name));\n            List<JarEntryInfo> jarEntries = findJarEntries(normalizeResourceName(name));\n\n            List<URL> urls = new ArrayList<>(fileUrls);\n\n            for (JarEntryInfo jarEntryInfo : jarEntries) {\n                if (jarEntryInfo.getJarFileInfo().equals(this.jarFileInfo)) {\n                    continue;\n                }\n\n                URL url = jarEntryInfo.getURL();\n                if (url != null) {\n                    urls.add(url);\n                }\n            }\n\n            return Collections.enumeration(urls);\n        }\n\n        return super.findResources(name);\n    }\n\n    @Override\n    protected String findLibrary(String name) {\n\n        debug(String.format(\"findLibrary: %s\", name));\n\n        if (isLaunchedFromJar()) {\n            JarEntryInfo jarEntryInfo = findJarNativeEntry(name);\n            if (jarEntryInfo != null) {\n                try {\n                    File file = createJarFile(jarEntryInfo);\n\n                    debug(String.format(\"Loading native library %s from temp file %s\", jarEntryInfo.getJarEntry(), getFilenameForLog(file)));\n\n                    deleteOnExit.add(file);\n                    return file.getAbsolutePath();\n                } catch (EeClassLoaderException e) {\n\n                    debug(String.format(\"Failure to load native library %s: %s\", name, e.toString()));\n                }\n            }\n            return null;\n        }\n        return super.findLibrary(name);\n    }\n\n    public List<String> getJarFilesLocations(List<String> filenames) {\n        List<String> locations = new ArrayList<>();\n\n        for (String filename : filenames) {\n            // try exact match\n            JarFileInfo jarLib = jarFiles.stream()\n                    .filter(jfi -> jfi.getSimpleName().contains(\"!\"))\n                    .filter(jfi -> jfi.getSimpleName().split(\"!\")[1].equals(\"lib_\" + filename))\n                    .findFirst().orElse(null);\n\n            if (jarLib == null) {\n                // try artifact name search only\n                String regex = \"^.*!lib_\" + Pattern.quote(filename) + \"-[^/]+\\\\.jar$\";\n                List<JarFileInfo> matchedFiles = jarFiles.stream().filter(jfi -> jfi.getSimpleName().matches(regex))\n                        .collect(Collectors.toList());\n\n                if (matchedFiles.size() == 1) {\n                    jarLib = matchedFiles.get(0);\n                } else if (matchedFiles.size() > 1) {\n                    // multiple matches, select one with the shortest name\n                    jarLib = matchedFiles.stream().min(Comparator.comparingInt(jfi -> jfi.getSimpleName().length()))\n                            .orElseThrow(() -> new RuntimeException(\"Could not find library with shortest name\"));\n\n                    // logging should be initialized by now\n                    Logger log = Logger.getLogger(EeClassLoader.class.getSimpleName());\n                    log.severe(String.format(\"Multiple jar files with artifact name similar to '%s' found ([%s]). \" +\n                                    \"Using %s. Consider matching by full name.\",\n                            filename,\n                            matchedFiles.stream().map(jfi -> jfi.getSimpleName().split(\"!\")[1].substring(4))\n                                    .collect(Collectors.joining(\", \")),\n                            jarLib.getSimpleName().split(\"!\")[1].substring(4))\n                    );\n                }\n                // else exception is thrown because jarLib == null\n            }\n\n            if (jarLib == null) {\n                throw new IllegalArgumentException(\"Could not locate library \" + filename);\n            }\n\n            locations.add(jarLib.getFileDeleteOnExit().getAbsolutePath());\n        }\n\n        return Collections.unmodifiableList(locations);\n    }\n\n    /**\n     * The default <code>ClassLoader.defineClass()</code> does not create package\n     * for the loaded class and leaves it null. Each package referenced by this\n     * class loader must be created only once before the\n     * <code>ClassLoader.defineClass()</code> call.\n     * The base class <code>ClassLoader</code> keeps cache with created packages\n     * for reuse.\n     *\n     * @param className class to load.\n     * @throws  IllegalArgumentException\n     *          If package name duplicates an existing package either in this\n     *          class loader or one of its ancestors.\n     */\n    private void definePackage(String className, JarEntryInfo jarEntryInfo) throws IllegalArgumentException {\n        int index = className.lastIndexOf('.');\n        String packageName = index > 0 ? className.substring(0, index) : \"\";\n        if (getPackage(packageName) == null) {\n            JarFileInfo jarFileInfo = jarEntryInfo.getJarFileInfo();\n            definePackage(\n                    packageName, jarFileInfo.getSpecificationTitle(), jarFileInfo.getSpecificationVersion(),\n                    jarFileInfo.getSpecificationVendor(), jarFileInfo.getImplementationTitle(),\n                    jarFileInfo.getImplementationVersion(), jarFileInfo.getImplementationVendor(),\n                    jarFileInfo.getSealURL()\n            );\n        }\n    }\n\n    /**\n     * The system class loader could load resources defined as\n     * \"com/abc/Foo.txt\" or \"com\\abc\\Foo.txt\".\n     * This method converts path with '\\' to default '/' JAR delimiter.\n     *\n     * @param name resource name including path.\n     * @return normalized resource name.\n     */\n    private String normalizeResourceName(String name) {\n        return name.replace('\\\\', '/');\n    }\n\n    private void chmod777(File file) {\n        file.setReadable(true, false);\n        file.setWritable(true, false);\n        file.setExecutable(true, false); // Unix: allow content for dir, redundant for file\n    }\n\n    private String getFilenameForLog(File file) {\n        try {\n            // In form \"C:\\Documents and Settings\\...\"\n            return file.getCanonicalPath();\n        } catch (IOException e) {\n            // In form \"C:\\DOCUME~1\\...\"\n            return file.getAbsolutePath();\n        }\n    }\n\n    private void debug(String msg) {\n\n        if (DEBUG) {\n            System.out.println(msg);\n        }\n    }\n}\n"
  },
  {
    "path": "tools/loader/src/main/java/com/kumuluz/ee/loader/exception/EeClassLoaderException.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.loader.exception;\n\n/**\n * @author Benjamin Kastelic\n * @since 2.4.0\n */\npublic class EeClassLoaderException extends RuntimeException {\n\n    public EeClassLoaderException(String message) {\n        super(message);\n    }\n\n    public EeClassLoaderException(String message, Throwable cause) {\n        super(message, cause);\n    }\n\n    public String getMessageAll() {\n        StringBuilder stringBuilder = new StringBuilder();\n\n        for (Throwable e = this;  e != null;  e = e.getCause()) {\n            if (stringBuilder.length() > 0) {\n                stringBuilder.append(\" / \");\n            }\n\n            String message = e.getMessage();\n            if (message == null  ||  message.length() == 0) {\n                message = e.getClass().getSimpleName();\n            }\n\n            stringBuilder.append(message);\n        }\n\n        return stringBuilder.toString();\n    }\n}\n"
  },
  {
    "path": "tools/loader/src/main/java/com/kumuluz/ee/loader/jar/FileInfo.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.loader.jar;\n\nimport java.io.File;\n\n/**\n * @author Benjamin Kastelic, Sunesis ltd.\n * @since 1.0.0\n */\npublic class FileInfo {\n\n    private File file;\n    private String simpleName;\n\n    public FileInfo(File file, String simpleName) {\n        this.simpleName = simpleName;\n        if (this.simpleName.endsWith(\"/\") && this.simpleName.length() > 1) {\n            this.simpleName = this.simpleName.substring(0 ,this.simpleName.length() - 1);\n        }\n\n        this.file = file;\n    }\n\n    public File getFile() {\n        return file;\n    }\n\n    public void setFile(File file) {\n        this.file = file;\n    }\n\n    public String getSimpleName() {\n        return simpleName;\n    }\n\n    public void setSimpleName(String simpleName) {\n        this.simpleName = simpleName;\n    }\n}\n"
  },
  {
    "path": "tools/loader/src/main/java/com/kumuluz/ee/loader/jar/JarEntryInfo.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.loader.jar;\n\nimport com.kumuluz.ee.loader.exception.EeClassLoaderException;\n\nimport java.io.DataInputStream;\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.net.MalformedURLException;\nimport java.net.URI;\nimport java.net.URISyntaxException;\nimport java.net.URL;\nimport java.util.jar.JarEntry;\n\n/**\n * Class with JAR entry information. Keeps JAR file and entry object.\n *\n * @author Benjamin Kastelic\n * @since 2.4.0\n */\npublic class JarEntryInfo {\n\n    private JarFileInfo jarFileInfo;\n    private JarEntry jarEntry;\n\n    public JarEntryInfo(JarFileInfo jarFileInfo, JarEntry jarEntry) {\n        this.jarFileInfo = jarFileInfo;\n        this.jarEntry = jarEntry;\n    }\n\n    public JarFileInfo getJarFileInfo() {\n        return jarFileInfo;\n    }\n\n    public void setJarFileInfo(JarFileInfo jarFileInfo) {\n        this.jarFileInfo = jarFileInfo;\n    }\n\n    public JarEntry getJarEntry() {\n        return jarEntry;\n    }\n\n    public void setJarEntry(JarEntry jarEntry) {\n        this.jarEntry = jarEntry;\n    }\n\n    public URL getURL() { // used in findResource() and findResources()\n        try {\n            String jarFileName = new File(jarFileInfo.getJarFile().getName()).toURI().toString();\n            URI uri = new URI(\"jar:\" + jarFileName + \"!/\" + jarEntry);\n            return uri.toURL();\n        } catch (URISyntaxException | MalformedURLException e) {\n            return null;\n        }\n    }\n\n    public String getName() { // used in createTempFile() and loadJar()\n        return jarEntry.getName().replace('/', '_');\n    }\n\n    /**\n     * Read JAR entry and return byte array of this JAR entry.\n     */\n    public byte[] getJarBytes() throws EeClassLoaderException {\n        DataInputStream dataInputStream = null;\n        byte[] bytes;\n\n        try {\n            long jarEntrySize = jarEntry.getSize();\n            if (jarEntrySize <= 0  ||  jarEntrySize >= Integer.MAX_VALUE) {\n                throw new EeClassLoaderException(\"Invalid size \" + jarEntrySize + \" for entry \" + jarEntry);\n            }\n\n            bytes = new byte[(int) jarEntrySize];\n\n            InputStream inputStream = jarFileInfo.getJarFile().getInputStream(jarEntry);\n            dataInputStream = new DataInputStream(inputStream);\n            dataInputStream.readFully(bytes);\n        } catch (IOException e) {\n            throw new EeClassLoaderException(null, e);\n        } finally {\n            if (dataInputStream != null) {\n                try {\n                    dataInputStream.close();\n                } catch (IOException e) {\n                    // Ignore\n                }\n            }\n        }\n\n        return bytes;\n    }\n\n    @Override\n    public String toString() {\n        return \"JAR: \" + jarFileInfo.getJarFile().getName() + \" ENTRY: \" + jarEntry;\n    }\n}\n"
  },
  {
    "path": "tools/loader/src/main/java/com/kumuluz/ee/loader/jar/JarFileInfo.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.loader.jar;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.net.MalformedURLException;\nimport java.net.URL;\nimport java.security.ProtectionDomain;\nimport java.util.jar.Attributes;\nimport java.util.jar.JarFile;\nimport java.util.jar.Manifest;\n\n/**\n * Class that holds JAR file information.\n *\n * @author Benjamin Kastelic\n * @since 2.4.0\n */\npublic class JarFileInfo {\n\n    private JarFile jarFile; // this is the essence of JarFileInfo wrapper\n    private String simpleName; // accumulated for logging like: \"topJar!childJar!kidJar\"\n    private File fileDeleteOnExit;\n    private Manifest manifest; // required for package creation\n    private ProtectionDomain protectionDomain;\n\n    /**\n     * @param jarFile\n     *            Never null.\n     * @param simpleName\n     *            Used for logging. Never null.\n     * @param jarFileParent\n     *            Used to make simpleName for logging. Null for top level JAR.\n     * @param fileDeleteOnExit\n     *            Used only to delete temporary file on exit.\n     *            Could be null if not required to delete on exit (top level JAR)\n     */\n    public JarFileInfo(JarFile jarFile, String simpleName, JarFileInfo jarFileParent, ProtectionDomain protectionDomain, File fileDeleteOnExit) {\n        this.simpleName = (jarFileParent == null ? \"\" : jarFileParent.simpleName + \"!\") + simpleName;\n        this.jarFile = jarFile;\n        this.protectionDomain = protectionDomain;\n        this.fileDeleteOnExit = fileDeleteOnExit;\n        try {\n            this.manifest = jarFile.getManifest(); // 'null' if META-INF directory is missing\n        } catch (IOException e) {\n            // Ignore and create blank manifest\n        }\n        if (this.manifest == null) {\n            this.manifest = new Manifest();\n        }\n    }\n\n    public String getSpecificationTitle() {\n        return manifest.getMainAttributes().getValue(Attributes.Name.SPECIFICATION_TITLE);\n    }\n\n    public String getSpecificationVersion() {\n        return manifest.getMainAttributes().getValue(Attributes.Name.SPECIFICATION_VERSION);\n    }\n\n    public String getSpecificationVendor() {\n        return manifest.getMainAttributes().getValue(Attributes.Name.SPECIFICATION_VENDOR);\n    }\n\n    public String getImplementationTitle() {\n        return manifest.getMainAttributes().getValue(Attributes.Name.IMPLEMENTATION_TITLE);\n    }\n\n    public String getImplementationVersion() {\n        return manifest.getMainAttributes().getValue(Attributes.Name.IMPLEMENTATION_VERSION);\n    }\n\n    public String getImplementationVendor() {\n        return manifest.getMainAttributes().getValue(Attributes.Name.IMPLEMENTATION_VENDOR);\n    }\n\n    public URL getSealURL() {\n        String seal = manifest.getMainAttributes().getValue(Attributes.Name.SEALED);\n        if (seal != null) {\n            try {\n                return new URL(seal);\n            } catch (MalformedURLException e) {\n                // Ignore\n            }\n        }\n        return null;\n    }\n\n    public JarFile getJarFile() {\n        return jarFile;\n    }\n\n    public void setJarFile(JarFile jarFile) {\n        this.jarFile = jarFile;\n    }\n\n    public String getSimpleName() {\n        return simpleName;\n    }\n\n    public void setSimpleName(String simpleName) {\n        this.simpleName = simpleName;\n    }\n\n    public File getFileDeleteOnExit() {\n        return fileDeleteOnExit;\n    }\n\n    public void setFileDeleteOnExit(File fileDeleteOnExit) {\n        this.fileDeleteOnExit = fileDeleteOnExit;\n    }\n\n    public Manifest getManifest() {\n        return manifest;\n    }\n\n    public void setManifest(Manifest manifest) {\n        this.manifest = manifest;\n    }\n\n    public ProtectionDomain getProtectionDomain() {\n        return protectionDomain;\n    }\n\n    public void setProtectionDomain(ProtectionDomain protectionDomain) {\n        this.protectionDomain = protectionDomain;\n    }\n}\n"
  },
  {
    "path": "tools/maven-plugin/README.md",
    "content": "# KumuluzEE Maven Plugin\n\n> KumuluzEE Maven Plugin for the Kumuluz EE microservice framework\n\nTODO - description\n\n## Usage\n\nInclude the plugin in your project:\n\n```xml\n<plugin>\n    <groupId>com.kumuluz.ee</groupId>\n    <artifactId>kumuluzee-maven-plugin</artifactId>\n    <version>${kumuluzee.version}</version>\n</plugin>\n```\n\n### Goals\n\n* __kumuluzee:copy-dependencies__\n    \n    Copy dependencies and prepare for execution in an exploded class and dependency runtime.\n\n\n* __kumuluzee:repackage__\n\n    Repackages existing JAR archives so that they can be executed from the command line using `java -jar`.\n    \n    ###### Parameters\n    \n    * __finalName__\n    \n        Final name of the generated \"uber\" JAR.\n        \n        __Default value is__: `${project.build.finalName}` or `${project.artifactId}-${project.version}`\n        \n    * __outputDirectory__\n    \n        Directory containing the generated JAR.\n        \n        __Default value is__: `${project.build.directory}`\n    \n* __kumuluzee:run__\n\n    Run the application in an exploded class and dependency runtime.\n    "
  },
  {
    "path": "tools/maven-plugin/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee-tools</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n    <packaging>maven-plugin</packaging>\n\n    <name>KumuluzEE Maven Plugin</name>\n    <description>KumuluzEE maven plugin for building single uber jars</description>\n\n    <artifactId>kumuluzee-maven-plugin</artifactId>\n\n    <properties>\n        <kumuluzee.plugin.test.skip>false</kumuluzee.plugin.test.skip>\n    </properties>\n\n    <dependencies>\n        <dependency>\n            <groupId>com.kumuluz.ee</groupId>\n            <artifactId>kumuluzee-loader</artifactId>\n            <scope>provided</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.maven</groupId>\n            <artifactId>maven-plugin-api</artifactId>\n            <scope>provided</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.apache.maven.plugin-tools</groupId>\n            <artifactId>maven-plugin-annotations</artifactId>\n            <scope>provided</scope>\n        </dependency>\n\n        <dependency>\n            <groupId>org.twdata.maven</groupId>\n            <artifactId>mojo-executor</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>com.fasterxml.jackson.core</groupId>\n            <artifactId>jackson-databind</artifactId>\n        </dependency>\n\n        <dependency>\n            <groupId>org.apache.commons</groupId>\n            <artifactId>commons-lang3</artifactId>\n            <version>3.6</version>\n        </dependency>\n    </dependencies>\n\n    <build>\n        <resources>\n            <resource>\n                <directory>${project.build.directory}/generated-resources/loader</directory>\n            </resource>\n            <resource>\n                <directory>src/main/resources</directory>\n                <filtering>true</filtering>\n            </resource>\n        </resources>\n        <plugins>\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-dependency-plugin</artifactId>\n                <version>${maven-dependency-plugin.version}</version>\n                <executions>\n                    <execution>\n                        <id>include-loader</id>\n                        <phase>generate-resources</phase>\n                        <goals>\n                            <goal>copy</goal>\n                        </goals>\n                        <configuration>\n                            <skip>${kumuluzee.plugin.test.skip}</skip>\n                            <artifactItems>\n                                <artifactItem>\n                                    <groupId>com.kumuluz.ee</groupId>\n                                    <artifactId>kumuluzee-loader</artifactId>\n                                    <version>${project.version}</version>\n                                    <destFileName>kumuluzee-loader.jar</destFileName>\n                                </artifactItem>\n                            </artifactItems>\n                            <outputDirectory>${project.build.directory}/generated-resources/loader/META-INF/loader\n                            </outputDirectory>\n                        </configuration>\n                    </execution>\n                </executions>\n            </plugin>\n\n            <plugin>\n                <groupId>org.apache.maven.plugins</groupId>\n                <artifactId>maven-plugin-plugin</artifactId>\n                <version>${maven-plugin-plugin.version}</version>\n                <configuration>\n                    <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>\n                </configuration>\n                <executions>\n                    <execution>\n                        <id>mojo-descriptor</id>\n                        <goals>\n                            <goal>descriptor</goal>\n                        </goals>\n                    </execution>\n                    <execution>\n                        <id>help-goal</id>\n                        <goals>\n                            <goal>helpmojo</goal>\n                        </goals>\n                    </execution>\n                </executions>\n            </plugin>\n        </plugins>\n    </build>\n</project>"
  },
  {
    "path": "tools/maven-plugin/src/main/java/com/kumuluz/ee/maven/plugin/AbstractCopyDependenciesMojo.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.maven.plugin;\n\nimport org.apache.maven.execution.MavenSession;\nimport org.apache.maven.plugin.AbstractMojo;\nimport org.apache.maven.plugin.BuildPluginManager;\nimport org.apache.maven.plugin.MojoExecutionException;\nimport org.apache.maven.plugins.annotations.Component;\nimport org.apache.maven.plugins.annotations.Parameter;\nimport org.apache.maven.project.MavenProject;\n\nimport java.io.IOException;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\n\nimport static org.twdata.maven.mojoexecutor.MojoExecutor.*;\n\n/**\n * @author Benjamin Kastelic\n * @since 2.4.0\n */\npublic abstract class AbstractCopyDependenciesMojo extends AbstractMojo {\n\n    @Parameter(defaultValue = \"${project}\", readonly = true, required = true)\n    protected MavenProject project;\n\n    @Parameter(defaultValue = \"${session}\", readonly = true, required = true)\n    protected MavenSession session;\n    @Component\n    protected BuildPluginManager buildPluginManager;\n    @Parameter\n    private String webappDir;\n\n    private String outputDirectory;\n    private String baseDirectory;\n\n    protected void copyDependencies()\n            throws MojoExecutionException {\n\n        copyDependencies(null);\n    }\n\n    /**\n     * Copies dependencies to /target/dependency or to target/{outputSubdirectory} if the outputSubdirectory parameter is\n     * provided\n     */\n    protected void copyDependencies(String outputSubdirectory)\n            throws MojoExecutionException {\n\n        outputDirectory = project.getBuild().getDirectory();\n        baseDirectory = project.getBasedir().getAbsolutePath();\n\n        String outputDirectory = outputSubdirectory == null\n                ? this.outputDirectory + \"/dependency\"\n                : this.outputDirectory + \"/\" + outputSubdirectory;\n\n        executeMojo(\n                plugin(\n                        groupId(\"org.apache.maven.plugins\"),\n                        artifactId(\"maven-dependency-plugin\"),\n                        version(MojoConstants.MAVEN_DEPENDENCY_PLUGIN_VERSION)\n                ),\n                goal(\"copy-dependencies\"),\n                configuration(\n                        element(\"includeScope\", \"runtime\"),\n                        element(\"overWriteSnapshots\", \"true\"),\n                        element(\"excludeArtifactIds\", \"kumuluzee-loader\"),\n                        element(\"outputDirectory\", outputDirectory)\n                ),\n                executionEnvironment(project, session, buildPluginManager)\n        );\n\n        copyOrCreateWebapp();\n    }\n\n    private void copyOrCreateWebapp() throws MojoExecutionException {\n\n        boolean webappExists = false;\n\n        // search for target/classes/webapp\n        Path outputWebApp = Paths.get(outputDirectory, \"classes/webapp\");\n\n        if (Files.isDirectory(outputWebApp)) {\n\n            webappExists = true;\n        }\n\n        // search for src/main/webapp\n        if (!webappExists) {\n\n            Path sourceWebApp = webappDir == null ?\n                    Paths.get(baseDirectory, \"src\", \"main\", \"webapp\") :\n                    Paths.get(baseDirectory, webappDir);\n\n            getLog().info(sourceWebApp.toAbsolutePath().toString());\n\n            if (Files.isDirectory(sourceWebApp)) {\n\n                String sourceWebAppDir = webappDir == null ? \"src/main/webapp\" : webappDir;\n\n                executeMojo(\n                        plugin(\n                                groupId(\"org.apache.maven.plugins\"),\n                                artifactId(\"maven-resources-plugin\"),\n                                version(MojoConstants.MAVEN_RESOURCE_PLUGIN_VERSION)\n                        ),\n                        goal(\"copy-resources\"),\n                        configuration(\n                                element(name(\"outputDirectory\"), \"${basedir}/target/classes/webapp\"),\n                                element(name(\"resources\"),\n                                        element(name(\"resource\"),\n                                                element(name(\"directory\"), sourceWebAppDir)\n                                        ))\n                        ),\n                        executionEnvironment(project, session, buildPluginManager)\n                );\n\n                // check if webapp resources were successfully copied\n                if (Files.isDirectory(outputWebApp)) {\n\n                    webappExists = true;\n                }\n            }\n        }\n\n        if (!webappExists) {\n\n            try {\n\n                Files.createDirectories(outputWebApp);\n\n            } catch (IOException e) {\n\n                throw new MojoExecutionException(\"Could not create the necessary `webapp` directory. Please check the target folder \" +\n                        \"permissions.\", e);\n            }\n        }\n    }\n\n}\n"
  },
  {
    "path": "tools/maven-plugin/src/main/java/com/kumuluz/ee/maven/plugin/AbstractPackageMojo.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n */\npackage com.kumuluz.ee.maven.plugin;\n\nimport org.apache.maven.execution.MavenSession;\nimport org.apache.maven.plugin.MojoExecutionException;\nimport org.apache.maven.plugins.annotations.Parameter;\nimport org.apache.maven.project.MavenProject;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.net.URI;\nimport java.net.URISyntaxException;\nimport java.nio.charset.StandardCharsets;\nimport java.nio.file.*;\nimport java.security.CodeSource;\nimport java.security.ProtectionDomain;\nimport java.util.jar.JarFile;\nimport java.util.zip.ZipFile;\n\nimport static org.twdata.maven.mojoexecutor.MojoExecutor.*;\n\n/**\n * @author Benjamin Kastelic\n * @since 2.4.0\n */\npublic abstract class AbstractPackageMojo extends AbstractCopyDependenciesMojo {\n\n    private static final String LOADER_JAR = \"META-INF/loader/kumuluzee-loader.jar\";\n    private static final String TEMP_DIR_NAME_PREFIX = \"kumuluzee-loader\";\n    private static final String CLASS_SUFFIX = \".class\";\n\n    @Parameter(defaultValue = \"com.kumuluz.ee.EeApplication\")\n    private String mainClass;\n\n    private String buildDirectory;\n    private String outputDirectory;\n    private String finalName;\n\n    protected void repackage() throws MojoExecutionException {\n        buildDirectory = project.getBuild().getDirectory();\n        outputDirectory = project.getBuild().getOutputDirectory();\n        finalName = project.getBuild().getFinalName();\n\n        checkPrecoditions();\n        copyDependencies(\"classes/lib\");\n        unpackDependencies();\n        packageJar();\n        renameJars();\n    }\n\n    private void checkPrecoditions() throws MojoExecutionException {\n        getLog().info(\"Checking if project meets the preconditions.\");\n\n        // only jar packagins if allowed\n        if (!project.getPackaging().toLowerCase().equals(\"jar\")) {\n            throw new MojoExecutionException(\"Only projects of \\\"jar\\\" packaging can be repackaged into an Uber JAR.\");\n        }\n    }\n\n    private void unpackDependencies() throws MojoExecutionException {\n        getLog().info(\"Unpacking kumuluzee-loader dependency.\");\n\n        try {\n            // get plugin JAR\n            URI pluginJarURI = getPluginJarPath();\n\n            Path pluginJarFile = Paths.get(pluginJarURI);\n\n            // explicit cast to ClassLoader null is required for Java 15 compilation\n            FileSystem pluginJarFs = FileSystems.newFileSystem(pluginJarFile, (ClassLoader) null);\n\n            Path loaderJarFile = pluginJarFs.getPath(LOADER_JAR);\n            Path tmpJar = Files.createTempFile(TEMP_DIR_NAME_PREFIX, \".tmp\");\n\n            Files.copy(loaderJarFile, tmpJar, StandardCopyOption.REPLACE_EXISTING);\n\n            JarFile loaderJar = new JarFile(tmpJar.toFile(), true, ZipFile.OPEN_READ, JarFile.runtimeVersion());\n\n            loaderJar.stream().parallel()\n                    .filter(loaderJarEntry -> loaderJarEntry.getName().toLowerCase().endsWith(CLASS_SUFFIX))\n                    .forEach(loaderJarEntry -> {\n                        try {\n\n                            Path outputPath = Paths.get(outputDirectory, loaderJarEntry.getName());\n\n                            Path outputPathParent = outputPath.getParent();\n\n                            if (outputPathParent != null) {\n\n                                Files.createDirectories(outputPathParent);\n                            }\n\n                            InputStream inputStream = loaderJar.getInputStream(loaderJarEntry);\n\n                            Files.copy(inputStream, outputPath, StandardCopyOption.REPLACE_EXISTING);\n\n                            inputStream.close();\n                        } catch (IOException ignored) {\n                        }\n                    });\n\n            loaderJar.close();\n\n            Files.delete(tmpJar);\n\n            // Create the boot loader config file\n            Path loaderConf = Paths.get(outputDirectory, \"META-INF\", \"kumuluzee\", \"boot-loader.properties\");\n\n            Path loaderConfParent = loaderConf.getParent();\n\n            if (!Files.exists(loaderConfParent)) {\n\n                Files.createDirectories(loaderConfParent);\n            }\n\n            String loaderConfContent = \"main-class=\" + mainClass;\n\n            Files.write(loaderConf, loaderConfContent.getBytes(StandardCharsets.UTF_8));\n        } catch (IOException e) {\n            throw new MojoExecutionException(\"Failed to unpack kumuluzee-loader dependency: \" + e.getMessage() + \".\");\n        }\n    }\n\n    private URI getPluginJarPath() throws MojoExecutionException {\n        try {\n            ProtectionDomain protectionDomain = RepackageMojo.class.getProtectionDomain();\n            CodeSource codeSource = protectionDomain.getCodeSource();\n\n            if (codeSource == null) {\n                throw new MojoExecutionException(\"Failed to retrieve plugin JAR file path. Unobtainable Code Source.\");\n            }\n\n            return codeSource.getLocation().toURI();\n        } catch (URISyntaxException e) {\n            throw new MojoExecutionException(\"Failed to retrieve plugin JAR file path.\", e);\n        }\n    }\n\n    private void packageJar() throws MojoExecutionException {\n\n        // Execute maven-jar-plugin in a separate execution environment, in order not to pollute the current project with\n        // attached artifact. Attached artifact will replace the current main artifact after rename, but reference in\n        // project.getAttachedArtifacts() cannot be removed after it's been added by maven-jar-plugin.\n        MavenProject projectClone = new MavenProject(project);\n        MavenSession sessionClone = session.clone();\n        sessionClone.setCurrentProject(projectClone);\n\n        executeMojo(\n                plugin(\n                        groupId(\"org.apache.maven.plugins\"),\n                        artifactId(\"maven-jar-plugin\"),\n                        version(MojoConstants.MAVEN_JAR_PLUGIN_VERSION)\n                ),\n                goal(\"jar\"),\n                configuration(\n                        element(\"finalName\", finalName),\n                        element(\"outputDirectory\", buildDirectory),\n                        element(\"classifier\", \"uber\"),\n                        element(\"forceCreation\", \"true\"),\n                        element(\"archive\",\n                                element(\"manifest\",\n                                        element(\"mainClass\", \"com.kumuluz.ee.loader.EeBootLoader\")\n                                )\n                        )\n                ),\n                executionEnvironment(projectClone, sessionClone, buildPluginManager)\n        );\n    }\n\n    private void renameJars() throws MojoExecutionException {\n        try {\n            Path sourcePath1 = Paths.get(buildDirectory, finalName + \".jar\");\n\n            getLog().info(\"Repackaging jar: \" + sourcePath1.toAbsolutePath());\n\n            if (Files.exists(sourcePath1)) {\n                Files.move(\n                        sourcePath1,\n                        sourcePath1.resolveSibling(finalName + \".jar.original\"),\n                        StandardCopyOption.REPLACE_EXISTING\n                );\n            }\n\n            Path sourcePath2 = Paths.get(buildDirectory, finalName + \"-uber.jar\");\n\n            if (Files.exists(sourcePath2)) {\n                Files.move(\n                        sourcePath2,\n                        sourcePath2.resolveSibling(finalName + \".jar\"),\n                        StandardCopyOption.REPLACE_EXISTING\n                );\n            }\n        } catch (IOException e) {\n            throw new MojoExecutionException(\"Unable to rename the final build artifact.\");\n        }\n    }\n}\n"
  },
  {
    "path": "tools/maven-plugin/src/main/java/com/kumuluz/ee/maven/plugin/CopyDependenciesMojo.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.maven.plugin;\n\nimport org.apache.maven.execution.MavenSession;\nimport org.apache.maven.plugin.BuildPluginManager;\nimport org.apache.maven.plugin.MojoExecutionException;\nimport org.apache.maven.plugins.annotations.*;\nimport org.apache.maven.project.MavenProject;\n\n/**\n * Copy dependencies and prepare for execution in an exploded class and dependency runtime.\n *\n * @author Benjamin Kastelic\n * @since 2.4.0\n */\n@Mojo(\n        name = \"copy-dependencies\",\n        defaultPhase = LifecyclePhase.PACKAGE,\n        requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME,\n        requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME\n)\npublic class CopyDependenciesMojo extends AbstractCopyDependenciesMojo {\n\n    @Override\n    public void execute() throws MojoExecutionException {\n        copyDependencies();\n    }\n}\n"
  },
  {
    "path": "tools/maven-plugin/src/main/java/com/kumuluz/ee/maven/plugin/MojoConstants.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.maven.plugin;\n\nimport java.util.ResourceBundle;\n\n/**\n * @author Tilen Faganel\n * @since 2.4.0\n */\npublic class MojoConstants {\n\n    public static final String MAVEN_JAR_PLUGIN_VERSION = ResourceBundle.getBundle(\"META-INF/kumuluzee/plugin-versions\").getString(\"maven-jar-plugin.version\");\n    public static final String MAVEN_RESOURCE_PLUGIN_VERSION = ResourceBundle.getBundle(\"META-INF/kumuluzee/plugin-versions\").getString(\"maven-resources-plugin.version\");\n    public static final String MAVEN_DEPENDENCY_PLUGIN_VERSION = ResourceBundle.getBundle(\"META-INF/kumuluzee/plugin-versions\").getString(\"maven-dependency-plugin.version\");\n}\n"
  },
  {
    "path": "tools/maven-plugin/src/main/java/com/kumuluz/ee/maven/plugin/RepackageMojo.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.maven.plugin;\n\nimport org.apache.maven.plugin.MojoExecutionException;\nimport org.apache.maven.plugin.MojoFailureException;\nimport org.apache.maven.plugins.annotations.LifecyclePhase;\nimport org.apache.maven.plugins.annotations.Mojo;\nimport org.apache.maven.plugins.annotations.ResolutionScope;\n\n/**\n * Repackages existing JAR archives so that they can be executed from the command line using {@literal java -jar}.\n *\n * @author Benjamin Kastelic\n * @since 2.4.0\n */\n@Mojo(\n        name = \"repackage\",\n        defaultPhase = LifecyclePhase.PACKAGE,\n        threadSafe = true,\n        requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME,\n        requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME\n)\npublic class RepackageMojo extends AbstractPackageMojo {\n\n    @Override\n    public void execute() throws MojoExecutionException, MojoFailureException {\n\n        repackage();\n    }\n}\n"
  },
  {
    "path": "tools/maven-plugin/src/main/java/com/kumuluz/ee/maven/plugin/RunExplodedMojo.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.maven.plugin;\n\nimport org.apache.maven.execution.MavenSession;\nimport org.apache.maven.plugin.BuildPluginManager;\nimport org.apache.maven.plugin.MojoExecutionException;\nimport org.apache.maven.plugins.annotations.*;\nimport org.apache.maven.project.MavenProject;\n\nimport java.io.File;\n\nimport static org.twdata.maven.mojoexecutor.MojoExecutor.*;\n\n/**\n * Run the application in an exploded class and dependency runtime.\n *\n * @author Benjamin Kastelic\n * @since 2.4.0\n */\n@Mojo(\n        name = \"run\",\n        defaultPhase = LifecyclePhase.PACKAGE,\n        requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME,\n        requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME\n)\npublic class RunExplodedMojo extends AbstractCopyDependenciesMojo {\n\n    @Override\n    public void execute() throws MojoExecutionException {\n\n        final String CLASSPATH_FORMAT = \"target%1$sclasses%2$starget%1$sdependency%1$s*\";\n\n        copyDependencies();\n\n        executeMojo(\n                plugin(\n                        groupId(\"org.codehaus.mojo\"),\n                        artifactId(\"exec-maven-plugin\"),\n                        version(\"1.6.0\")\n                ),\n                goal(\"java\"),\n                configuration(\n                        element(name(\"mainClass\"), \"com.kumuluz.ee.EeApplication\"),\n                        element(name(\"arguments\"),\n                                element(name(\"argument\"), \"-classpath\"),\n                                element(name(\"argument\"), String.format(CLASSPATH_FORMAT, File.separator, File.pathSeparator)))\n                ),\n                executionEnvironment(project, session, buildPluginManager)\n        );\n    }\n}\n"
  },
  {
    "path": "tools/maven-plugin/src/main/java/com/kumuluz/ee/maven/plugin/RunJarMojo.java",
    "content": "/*\n *  Copyright (c) 2014-2017 Kumuluz and/or its affiliates\n *  and other contributors as indicated by the @author tags and\n *  the contributor list.\n *\n *  Licensed under the MIT License (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 *  https://opensource.org/licenses/MIT\n *\n *  The software is provided \"AS IS\", WITHOUT WARRANTY OF ANY KIND, express or\n *  implied, including but not limited to the warranties of merchantability,\n *  fitness for a particular purpose and noninfringement. in no event shall the\n *  authors or copyright holders be liable for any claim, damages or other\n *  liability, whether in an action of contract, tort or otherwise, arising from,\n *  out of or in connection with the software or the use or other dealings in the\n *  software. See the License for the specific language governing permissions and\n *  limitations under the License.\n*/\npackage com.kumuluz.ee.maven.plugin;\n\nimport org.apache.maven.execution.MavenSession;\nimport org.apache.maven.plugin.BuildPluginManager;\nimport org.apache.maven.plugin.MojoExecutionException;\nimport org.apache.maven.plugin.MojoFailureException;\nimport org.apache.maven.plugins.annotations.Component;\nimport org.apache.maven.plugins.annotations.Parameter;\nimport org.apache.maven.project.MavenProject;\n\nimport static org.twdata.maven.mojoexecutor.MojoExecutor.*;\n\n/**\n * Run the application in an executable JAR archive runtime.\n *\n * @author Benjamin Kastelic\n * @since 2.4.0\n */\n//@Mojo(\n//        name = \"run-jar\",\n//        defaultPhase = LifecyclePhase.PACKAGE,\n//        requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME,\n//        requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME\n//)\npublic class RunJarMojo extends AbstractPackageMojo {\n\n    @Parameter(defaultValue = \"${project.build.directory}\")\n    private String outputDirectory;\n\n    @Parameter(defaultValue = \"${project.build.finalName}\")\n    private String finalName;\n\n    @Override\n    public void execute() throws MojoExecutionException, MojoFailureException {\n\n        repackage();\n\n        executeMojo(\n                plugin(\n                        groupId(\"org.codehaus.mojo\"),\n                        artifactId(\"exec-maven-plugin\"),\n                        version(\"1.6.0\")\n                ),\n                goal(\"exec\"),\n                configuration(\n                        element(\"executable\", \"java\"),\n                        element(name(\"arguments\"),\n                                element(name(\"argument\"), \"-jar\"),\n                                element(name(\"argument\"), outputDirectory + \"/\" + finalName + \".jar\")\n                        )\n                ),\n                executionEnvironment(project, session, buildPluginManager)\n        );\n    }\n}\n"
  },
  {
    "path": "tools/maven-plugin/src/main/resources/META-INF/kumuluzee/plugin-versions.properties",
    "content": "maven-jar-plugin.version=${maven-jar-plugin.version}\nmaven-resources-plugin.version=${maven-resources-plugin.version}\nmaven-dependency-plugin.version=${maven-dependency-plugin.version}"
  },
  {
    "path": "tools/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <parent>\n        <artifactId>kumuluzee</artifactId>\n        <groupId>com.kumuluz.ee</groupId>\n        <version>4.2.0-SNAPSHOT</version>\n    </parent>\n    <modelVersion>4.0.0</modelVersion>\n    <packaging>pom</packaging>\n\n    <name>KumuluzEE Tools</name>\n    <description>Various KumuluzEE tools</description>\n    <modules>\n        <module>loader</module>\n        <module>maven-plugin</module>\n    </modules>\n\n    <artifactId>kumuluzee-tools</artifactId>\n</project>"
  }
]