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-XXXX where XXXX 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
----
----
---