[GitHub] metron pull request #865: METRON-1212 The bundle System and Maven Plugin (Fe...
Github user ottobackwards closed the pull request at: https://github.com/apache/metron/pull/865 ---
[GitHub] metron pull request #865: METRON-1212 The bundle System and Maven Plugin (Fe...
GitHub user ottobackwards reopened a pull request: https://github.com/apache/metron/pull/865 METRON-1212 The bundle System and Maven Plugin (Feature Branch) This PR contains the Bundle system and Maven Plugin. The bundle system and the plugin are adapted from the Apache Nifi project. ## bundles-maven-plugin The bundles-maven-plugin is an adapted version of the jar dependency plugin whose function is to bundle a jar of jars based on the dependencies for a project. It also creates metadata attributes. A project's jar, and it's non-provided dependency jars are place in a /lib entry in the bundle, with the bundle itself being in jar format. ## bundles-lib The bundles-lib contains the functionality required to: - discover bundles - inspect bundles for exposed extension types - load the bundles - create special class loaders for bundles - deliver instances of extension types for use NAR exposed the bundles through many classes. I have created the BundleSystem interface to expose a more usable, simplified api for our use cases. ### From the original PR for METRON-777: Metron Bundle Plugin - adaptation of the nifi plugin - more configurable wrt file extension/dependency and metadata naming bundle-lib - adaptation of nifi-nar-utils to be used outside of the nifi project - rudimentary extensibility to allow configuration and injection of service types and other things that were hard coded to nifi - refactored from File based to VFS based - rebranding to Bundle from Nar ( although the lib and the plugin allow that to be configured now ) - added capability to the properties class to write to stream, adapted to uri from paths - added integration tests for hdfs - changed to be ClassIndex based instead of ServiceLoader. Service loader is slower, and Casey's ClassIndex work is great. This also removes the NAR's required manual maintenance of the service file. - refactored to use VFS to load the bundle/nar into the classloader AND to use VFS to load the dependency jars -> VFS as a composite filesystem. Thus going from NAR's 'working directory', exploded NARS to just loading the bundle/nar. ## Previous Review Please see [@mattf_apache's review](https://github.com/apache/metron/pull/530/files/c5f8c34e4de8e6d456b97edd6f8a0d33b4819d69) ## changes from that review I have changed the InitContext operations to have explicit builders, and made it so that creating a context can be done separately from initialization. Two contexts can then be 'merged'. This is to allow for the addition of new bundles after initialization. In preparing this PR I have: - made checkstyle fixes - fixed several types - added a requested set of tests loading and executing simple interface/implementation from bundle beyond what is already in the bundle-lib tests ## Testing *` cd bundles-maven-plugin && mvn -q install && cd .. ` must be run once to install the maven plugin * This review is code review and test code review and running only * [Test Project](https://github.com/ottobackwards/test-bundles-plugin) can be examined as a simple example of how to create bundles. * The README.md has getting started and quickstart sections with some overview of creating by hand ### For all changes: - [x] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel). - [x] Does your PR title start with METRON- where is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [x] Has your PR been rebased against the latest commit within the target branch (typically master)? - [x] Have you ensured that the full suite of tests and checks have been executed in the root metron \ - [x] Have you written or updated unit tests and or integration tests to verify your changes? ### For documentation related changes: - [x] Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? You can merge this pull request into a Git repository by running: $ git pull https://github.com/ottobackwards/metron fifth_bundles Alternatively you can review and apply these changes as the patch at: https://github.com/apache/metron/pull/865.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #865 commit 207d367e360074ad53d6f7ece4e1f1febc5a64e1 Author: Otto FowlerDate: 2017-09-27T10:29:42Z The bundle=lib and maven plugin for bundles. as compared to the feature branch the differences are: - Added some
[GitHub] metron pull request #865: METRON-1212 The bundle System and Maven Plugin (Fe...
Github user JonZeolla commented on a diff in the pull request: https://github.com/apache/metron/pull/865#discussion_r157303681 --- Diff: bundles-maven-plugin/README.md --- @@ -20,7 +20,9 @@ Apache Metron Bundles Maven Plugin helps to build Bundles Archives to support th - [Requirements](#requirements) - [Building](#building) -- [Getting Stared](#getting_started) +- [Getting Stared](#getting-started) --- End diff -- `s/Stared/Started/` ---
[GitHub] metron pull request #865: METRON-1212 The bundle System and Maven Plugin (Fe...
Github user JonZeolla commented on a diff in the pull request: https://github.com/apache/metron/pull/865#discussion_r157196243 --- Diff: bundles-maven-plugin/README.md --- @@ -0,0 +1,230 @@ + +# Apache Metron Bundle Maven Plugin + +Apache Metron Bundles Maven Plugin helps to build Bundles Archives to support the classloader isolation model. + +## Table of Contents + +- [Requirements](#requirements) +- [Building](#building) +- [Getting Stared](#getting_started) +- [Getting Help](#getting-help) +- [License](#license) + +## Requirements +* JDK 1.7 or higher +* Apache Maven 3.1.0 or higher + +## Building + +Building the bundles-maven-plugin module should be rare since it will be released infrequently compared to +the main 'metron' code tree. + +- Build with `mvn clean install` +- Presuming you need to make use of changes to the bundles-maven-plugin module, you should next + go to the [metron](../metron) directory and follow its instructions. + +## Getting Started + +While it is most likely +that a maven archetype is being utilized to create bundles, as part of a toolkit etc, you may want to create on manually, or may need to create a project for use in an archetype. + +The plugin is utilized by setting the packaging of a maven module to 'bundle'. + +```xml +bundle +``` + +This means that when you package this module, any of it's non-provided dependencies will be packaged into the produced bundle ( and all of their non-provided dependencies as well). +Since a library may not always be distributed as part of a bundle with all it's dependencies, the bundle module +shall be a separate module from the actual classes and dependencies to be bundled. + +A very simple example layout for a project that utilizes bundles would be: + +```bash +âââ README.md +âââ pom.xml +âââ testapp +â  âââ pom.xml +â  âââ src +â  â  âââ main +â  â  â  âââ java +â  â  â  âââ org +â  â  â  âââ apache +â  â  â  âââ test +â  â  â  âââ App.java +â  â  âââ test +â  â  âââ java +â  â  âââ org +â  â  âââ apache +â  â  âââ test +â  â  âââ AppTest.java +âââ testappbundle +âââ pom.xml +``` +Where testappbundle is the bundle module that creates a bundle of testapp, and contains the following pom.xml: +```xml + +http://maven.apache.org/POM/4.0.0; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd;> + +test.bundles.plugin +org.apache.test +1.0-SNAPSHOT + + 4.0.0 + + test.app.bundle + + + bundle + + + + + org.apache.test + test.app + 1.0-SNAPSHOT + + + + + + + + + org.apache.metron + bundles-maven-plugin + 0.4.2 + true + + + + + + + +org.apache.metron +bundles-maven-plugin +0.4.2 +true + + + + +``` +When the module is packaged, it packages all of it's non-provided dependencies into the bundles /bundled-dependencies directory. +Thus, to create a bundle of a module's jar and that jar's non-provided dependencies, you add that module to your +bundle modules dependencies. You can unzip and examine the bundle in the target directory, and verify +it's contents, which should be similar to : + +```bash +-> % tree . +. +âââ META-INF +âââ MANIFEST.MF +âââ bundled-dependencies +â  âââ log4j-1.2.17.jar +â  âââ metron-common-0.4.1.jar +â  âââ slf4j-api-1.7.7.jar +â  âââ slf4j-log4j12-1.7.7.jar +â  âââ test.app-1.0-SNAPSHOT.jar +âââ maven +âââ org.apache.test +âââ test.app.bundle +âââ pom.properties +âââ pom.xml +``` + +This reflects the testapp project, which has these dependencies : + +```xml + + + org.apache.metron + metron-common + 0.4.1 + + + junit +
[GitHub] metron pull request #865: METRON-1212 The bundle System and Maven Plugin (Fe...
Github user JonZeolla commented on a diff in the pull request: https://github.com/apache/metron/pull/865#discussion_r157196009 --- Diff: metron-bundles/bundles-lib/src/main/java/org/apache/metron/bundles/VfsBundleClassLoaderResource.java --- @@ -0,0 +1,110 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 --- End diff -- I think there's an extraneous space before http in this comment block. ---
[GitHub] metron pull request #865: METRON-1212 The bundle System and Maven Plugin (Fe...
Github user JonZeolla commented on a diff in the pull request: https://github.com/apache/metron/pull/865#discussion_r157196275 --- Diff: bundles-maven-plugin/README.md --- @@ -0,0 +1,230 @@ + +# Apache Metron Bundle Maven Plugin + +Apache Metron Bundles Maven Plugin helps to build Bundles Archives to support the classloader isolation model. + +## Table of Contents + +- [Requirements](#requirements) +- [Building](#building) +- [Getting Stared](#getting_started) +- [Getting Help](#getting-help) +- [License](#license) + +## Requirements +* JDK 1.7 or higher +* Apache Maven 3.1.0 or higher + +## Building + +Building the bundles-maven-plugin module should be rare since it will be released infrequently compared to +the main 'metron' code tree. + +- Build with `mvn clean install` +- Presuming you need to make use of changes to the bundles-maven-plugin module, you should next + go to the [metron](../metron) directory and follow its instructions. + +## Getting Started + +While it is most likely +that a maven archetype is being utilized to create bundles, as part of a toolkit etc, you may want to create on manually, or may need to create a project for use in an archetype. + +The plugin is utilized by setting the packaging of a maven module to 'bundle'. + +```xml +bundle +``` + +This means that when you package this module, any of it's non-provided dependencies will be packaged into the produced bundle ( and all of their non-provided dependencies as well). +Since a library may not always be distributed as part of a bundle with all it's dependencies, the bundle module +shall be a separate module from the actual classes and dependencies to be bundled. + +A very simple example layout for a project that utilizes bundles would be: + +```bash +âââ README.md +âââ pom.xml +âââ testapp +â  âââ pom.xml +â  âââ src +â  â  âââ main +â  â  â  âââ java +â  â  â  âââ org +â  â  â  âââ apache +â  â  â  âââ test +â  â  â  âââ App.java +â  â  âââ test +â  â  âââ java +â  â  âââ org +â  â  âââ apache +â  â  âââ test +â  â  âââ AppTest.java +âââ testappbundle +âââ pom.xml +``` +Where testappbundle is the bundle module that creates a bundle of testapp, and contains the following pom.xml: +```xml + +http://maven.apache.org/POM/4.0.0; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd;> + +test.bundles.plugin +org.apache.test +1.0-SNAPSHOT + + 4.0.0 + + test.app.bundle + + + bundle + + + + + org.apache.test + test.app + 1.0-SNAPSHOT + + + + + + + + + org.apache.metron + bundles-maven-plugin + 0.4.2 + true + + + + + + + +org.apache.metron +bundles-maven-plugin +0.4.2 +true + + + + +``` +When the module is packaged, it packages all of it's non-provided dependencies into the bundles /bundled-dependencies directory. +Thus, to create a bundle of a module's jar and that jar's non-provided dependencies, you add that module to your +bundle modules dependencies. You can unzip and examine the bundle in the target directory, and verify +it's contents, which should be similar to : + +```bash +-> % tree . +. +âââ META-INF +âââ MANIFEST.MF +âââ bundled-dependencies +â  âââ log4j-1.2.17.jar +â  âââ metron-common-0.4.1.jar +â  âââ slf4j-api-1.7.7.jar +â  âââ slf4j-log4j12-1.7.7.jar +â  âââ test.app-1.0-SNAPSHOT.jar +âââ maven +âââ org.apache.test +âââ test.app.bundle +âââ pom.properties +âââ pom.xml +``` + +This reflects the testapp project, which has these dependencies : + +```xml + + + org.apache.metron + metron-common + 0.4.1 + + + junit +
[GitHub] metron pull request #865: METRON-1212 The bundle System and Maven Plugin (Fe...
Github user JonZeolla commented on a diff in the pull request: https://github.com/apache/metron/pull/865#discussion_r157195764 --- Diff: metron-bundles/bundles-lib/README.md --- @@ -0,0 +1,213 @@ +# Apache Metron Bundles + +Apache Metron Bundles and this documentation are a derivative of the [Apache Nifi](http://www.nifi.apache.org) [NARs](http://nifi.apache.org/developer-guide.html). --- End diff -- Change this to Apache Metron Bundles and this documentation are a derivative of the \[Apache Nifi]\(https://nifi.apache.org) \[NARs\](https://nifi.apache.org/developer-guide.html). ---
[GitHub] metron pull request #865: METRON-1212 The bundle System and Maven Plugin (Fe...
Github user JonZeolla commented on a diff in the pull request: https://github.com/apache/metron/pull/865#discussion_r157196527 --- Diff: metron-bundles/bundles-lib/pom.xml --- @@ -0,0 +1,185 @@ + + + +http://maven.apache.org/POM/4.0.0; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd;> +4.0.0 + +org.apache.metron +metron-bundles +0.4.2 + + +bundles-lib +jar + + + +The Apache Software License, Version 2.0 +http://www.apache.org/licenses/LICENSE-2.0.txt --- End diff -- `s/http/https/` ---
[GitHub] metron pull request #865: METRON-1212 The bundle System and Maven Plugin (Fe...
Github user JonZeolla commented on a diff in the pull request: https://github.com/apache/metron/pull/865#discussion_r157196342 --- Diff: bundles-maven-plugin/pom.xml --- @@ -0,0 +1,328 @@ + + +http://maven.apache.org/POM/4.0.0; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd;> +4.0.0 + +org.apache +apache +17 + + +org.apache.metron +bundles-maven-plugin +0.4.2 +maven-plugin +Apache Metron Bundles Maven Plugin +http://metron.apache.org --- End diff -- `s/http/https/` ---
[GitHub] metron pull request #865: METRON-1212 The bundle System and Maven Plugin (Fe...
Github user JonZeolla commented on a diff in the pull request: https://github.com/apache/metron/pull/865#discussion_r157196122 --- Diff: bundles-maven-plugin/NOTICE --- @@ -0,0 +1,8 @@ +Apache NiFi +Copyright 2014-2017 The Apache Software Foundation + +Apache Metron +Copyright 2015-2017 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). --- End diff -- `s/http/https`? ---
[GitHub] metron pull request #865: METRON-1212 The bundle System and Maven Plugin (Fe...
Github user JonZeolla commented on a diff in the pull request: https://github.com/apache/metron/pull/865#discussion_r157196378 --- Diff: bundles-maven-plugin/pom.xml --- @@ -0,0 +1,328 @@ + + +http://maven.apache.org/POM/4.0.0; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd;> +4.0.0 + +org.apache +apache +17 + + +org.apache.metron +bundles-maven-plugin +0.4.2 +maven-plugin +Apache Metron Bundles Maven Plugin +http://metron.apache.org + +Apache Metron Project +http://metron.apache.org/ --- End diff -- `s/http/https/` ---
[GitHub] metron pull request #865: METRON-1212 The bundle System and Maven Plugin (Fe...
Github user JonZeolla commented on a diff in the pull request: https://github.com/apache/metron/pull/865#discussion_r157197191 --- Diff: bundles-maven-plugin/README.md --- @@ -0,0 +1,230 @@ + +# Apache Metron Bundle Maven Plugin + +Apache Metron Bundles Maven Plugin helps to build Bundles Archives to support the classloader isolation model. + +## Table of Contents + +- [Requirements](#requirements) +- [Building](#building) +- [Getting Stared](#getting_started) +- [Getting Help](#getting-help) +- [License](#license) + +## Requirements +* JDK 1.7 or higher +* Apache Maven 3.1.0 or higher + +## Building + +Building the bundles-maven-plugin module should be rare since it will be released infrequently compared to +the main 'metron' code tree. + +- Build with `mvn clean install` +- Presuming you need to make use of changes to the bundles-maven-plugin module, you should next + go to the [metron](../metron) directory and follow its instructions. --- End diff -- Broken link. Not positive offhand how to fix in a way that also works in the site-book, I need to take another look later. Just noting for now. ---
[GitHub] metron pull request #865: METRON-1212 The bundle System and Maven Plugin (Fe...
Github user JonZeolla commented on a diff in the pull request: https://github.com/apache/metron/pull/865#discussion_r157196478 --- Diff: bundles-maven-plugin/pom.xml --- @@ -0,0 +1,328 @@ + + +http://maven.apache.org/POM/4.0.0; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd;> +4.0.0 + +org.apache +apache +17 + + +org.apache.metron +bundles-maven-plugin +0.4.2 +maven-plugin +Apache Metron Bundles Maven Plugin +http://metron.apache.org + +Apache Metron Project +http://metron.apache.org/ + + + +Apache License, Version 2.0 +http://www.apache.org/licenses/LICENSE-2.0 --- End diff -- `s/http/https/` ---
[GitHub] metron pull request #865: METRON-1212 The bundle System and Maven Plugin (Fe...
Github user JonZeolla commented on a diff in the pull request: https://github.com/apache/metron/pull/865#discussion_r157194648 --- Diff: bundles-maven-plugin/README.md --- @@ -0,0 +1,230 @@ + +# Apache Metron Bundle Maven Plugin + +Apache Metron Bundles Maven Plugin helps to build Bundles Archives to support the classloader isolation model. + +## Table of Contents + +- [Requirements](#requirements) +- [Building](#building) +- [Getting Stared](#getting_started) --- End diff -- Change to \[Getting Started\](#getting-started) then insert below \[Quickstart\](#quickstart) \[Settings and configuration\](#settings-and-configuration) ---
[GitHub] metron pull request #865: METRON-1212 The bundle System and Maven Plugin (Fe...
GitHub user ottobackwards opened a pull request: https://github.com/apache/metron/pull/865 METRON-1212 The bundle System and Maven Plugin (Feature Branch) This PR contains the Bundle system and Maven Plugin. The bundle system and the plugin are adapted from the Apache Nifi project. ## bundles-maven-plugin The bundles-maven-plugin is an adapted version of the jar dependency plugin whose function is to bundle a jar of jars based on the dependencies for a project. It also creates metadata attributes. A project's jar, and it's non-provided dependency jars are place in a /lib entry in the bundle, with the bundle itself being in jar format. ## bundles-lib The bundles-lib contains the functionality required to: - discover bundles - inspect bundles for exposed extension types - load the bundles - create special class loaders for bundles - deliver instances of extension types for use NAR exposed the bundles through many classes. I have created the BundleSystem interface to expose a more usable, simplified api for our use cases. ### From the original PR for METRON-777: Metron Bundle Plugin - adaptation of the nifi plugin - more configurable wrt file extension/dependency and metadata naming bundle-lib - adaptation of nifi-nar-utils to be used outside of the nifi project - rudimentary extensibility to allow configuration and injection of service types and other things that were hard coded to nifi - refactored from File based to VFS based - rebranding to Bundle from Nar ( although the lib and the plugin allow that to be configured now ) - added capability to the properties class to write to stream, adapted to uri from paths - added integration tests for hdfs - changed to be ClassIndex based instead of ServiceLoader. Service loader is slower, and Casey's ClassIndex work is great. This also removes the NAR's required manual maintenance of the service file. - refactored to use VFS to load the bundle/nar into the classloader AND to use VFS to load the dependency jars -> VFS as a composite filesystem. Thus going from NAR's 'working directory', exploded NARS to just loading the bundle/nar. ## Previous Review Please see [@mattf_apache's review](https://github.com/apache/metron/pull/530/files/c5f8c34e4de8e6d456b97edd6f8a0d33b4819d69) ## changes from that review I have changed the InitContext operations to have explicit builders, and made it so that creating a context can be done separately from initialization. Two contexts can then be 'merged'. This is to allow for the addition of new bundles after initialization. In preparing this PR I have: - made checkstyle fixes - fixed several types - added a requested set of tests loading and executing simple interface/implementation from bundle beyond what is already in the bundle-lib tests ## Testing *` cd bundles-maven-plugin && mvn -q install && cd .. ` must be run once to install the maven plugin * This review is code review and test code review and running only * [Test Project](https://github.com/ottobackwards/test-bundles-plugin) can be examined as a simple example of how to create bundles. * The README.md has getting started and quickstart sections with some overview of creating by hand ### For all changes: - [x] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel). - [x] Does your PR title start with METRON- where is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [x] Has your PR been rebased against the latest commit within the target branch (typically master)? - [x] Have you ensured that the full suite of tests and checks have been executed in the root metron \ - [x] Have you written or updated unit tests and or integration tests to verify your changes? ### For documentation related changes: - [x] Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? You can merge this pull request into a Git repository by running: $ git pull https://github.com/ottobackwards/metron fifth_bundles Alternatively you can review and apply these changes as the patch at: https://github.com/apache/metron/pull/865.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #865 ---