http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/f6d9354b/nifi-nar-maven-plugin/src/main/java/org/apache/nifi/NarMojo.java ---------------------------------------------------------------------- diff --git a/nifi-nar-maven-plugin/src/main/java/org/apache/nifi/NarMojo.java b/nifi-nar-maven-plugin/src/main/java/org/apache/nifi/NarMojo.java new file mode 100644 index 0000000..da03182 --- /dev/null +++ b/nifi-nar-maven-plugin/src/main/java/org/apache/nifi/NarMojo.java @@ -0,0 +1,613 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.nifi; + +import java.io.File; +import java.io.IOException; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import org.apache.maven.archiver.MavenArchiveConfiguration; +import org.apache.maven.archiver.MavenArchiver; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.DependencyResolutionRequiredException; +import org.apache.maven.artifact.factory.ArtifactFactory; +import org.apache.maven.artifact.installer.ArtifactInstaller; +import org.apache.maven.artifact.metadata.ArtifactMetadataSource; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; +import org.apache.maven.artifact.resolver.ArtifactCollector; +import org.apache.maven.artifact.resolver.ArtifactNotFoundException; +import org.apache.maven.artifact.resolver.ArtifactResolutionException; +import org.apache.maven.artifact.resolver.ArtifactResolver; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugin.dependency.utils.DependencyStatusSets; +import org.apache.maven.plugin.dependency.utils.DependencyUtil; +import org.apache.maven.plugin.dependency.utils.filters.DestFileFilter; +import org.apache.maven.plugin.dependency.utils.resolvers.ArtifactsResolver; +import org.apache.maven.plugin.dependency.utils.resolvers.DefaultArtifactsResolver; +import org.apache.maven.plugin.dependency.utils.translators.ArtifactTranslator; +import org.apache.maven.plugin.dependency.utils.translators.ClassifierTypeTranslator; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.annotations.ResolutionScope; +import org.apache.maven.project.MavenProject; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.project.MavenProjectHelper; +import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException; +import org.apache.maven.shared.artifact.filter.collection.ArtifactIdFilter; +import org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter; +import org.apache.maven.shared.artifact.filter.collection.ClassifierFilter; +import org.apache.maven.shared.artifact.filter.collection.FilterArtifacts; +import org.apache.maven.shared.artifact.filter.collection.GroupIdFilter; +import org.apache.maven.shared.artifact.filter.collection.ScopeFilter; +import org.apache.maven.shared.artifact.filter.collection.ProjectTransitivityFilter; +import org.apache.maven.shared.artifact.filter.collection.TypeFilter; +import org.codehaus.plexus.archiver.ArchiverException; +import org.codehaus.plexus.archiver.jar.JarArchiver; +import org.codehaus.plexus.archiver.jar.ManifestException; +import org.codehaus.plexus.archiver.manager.ArchiverManager; +import org.codehaus.plexus.util.FileUtils; +import org.codehaus.plexus.util.StringUtils; + +/** + * Packages the current project as an Apache NiFi Archive (NAR). + * + * The following code is derived from maven-dependencies-plugin and + * maven-jar-plugin. The functionality of CopyDependenciesMojo and JarMojo was + * simplified to the use case of NarMojo. + * + */ +@Mojo(name = "nar", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = false, requiresDependencyResolution = ResolutionScope.RUNTIME) +public class NarMojo extends AbstractMojo { + + private static final String[] DEFAULT_EXCLUDES = new String[]{"**/package.html"}; + private static final String[] DEFAULT_INCLUDES = new String[]{"**/**"}; + + /** + * POM + * + */ + @Parameter(defaultValue = "${project}", readonly = true, required = true) + protected MavenProject project; + + @Parameter(defaultValue = "${session}", readonly = true, required = true) + protected MavenSession session; + + /** + * List of files to include. Specified as fileset patterns. + */ + @Parameter(property = "includes") + protected String[] includes; + /** + * List of files to exclude. Specified as fileset patterns. + */ + @Parameter(property = "excludes") + protected String[] excludes; + /** + * Name of the generated NAR. + * + */ + @Parameter(alias = "narName", property = "nar.finalName", defaultValue = "${project.build.finalName}", required = true) + protected String finalName; + + /** + * The Jar archiver. + * + * \@\component role="org.codehaus.plexus.archiver.Archiver" roleHint="jar" + */ + @Component(role = org.codehaus.plexus.archiver.Archiver.class, hint = "jar") + private JarArchiver jarArchiver; + /** + * The archive configuration to use. + * + * See <a + * href="http://maven.apache.org/shared/maven-archiver/index.html">the + * documentation for Maven Archiver</a>. + * + */ + @Parameter(property = "archive") + protected final MavenArchiveConfiguration archive = new MavenArchiveConfiguration(); + /** + * Path to the default MANIFEST file to use. It will be used if + * <code>useDefaultManifestFile</code> is set to <code>true</code>. + * + */ + @Parameter(property = "defaultManifestFiles", defaultValue = "${project.build.outputDirectory}/META-INF/MANIFEST.MF", readonly = true, required = true) + protected File defaultManifestFile; + + /** + * Set this to <code>true</code> to enable the use of the + * <code>defaultManifestFile</code>. + * + * @since 2.2 + */ + @Parameter(property = "nar.useDefaultManifestFile", defaultValue = "false") + protected boolean useDefaultManifestFile; + + @Component + protected MavenProjectHelper projectHelper; + + /** + * Whether creating the archive should be forced. + * + */ + @Parameter(property = "nar.forceCreation", defaultValue = "false") + protected boolean forceCreation; + + /** + * Classifier to add to the artifact generated. If given, the artifact will + * be an attachment instead. + * + */ + @Parameter(property = "classifier") + protected String classifier; + + @Component + protected ArtifactInstaller installer; + + @Component + protected ArtifactRepositoryFactory repositoryFactory; + + /** + * This only applies if the classifier parameter is used. + * + */ + @Parameter(property = "mdep.failOnMissingClassifierArtifact", defaultValue = "true", required = false) + protected boolean failOnMissingClassifierArtifact = true; + + /** + * Comma Separated list of Types to include. Empty String indicates include + * everything (default). + * + */ + @Parameter(property = "includeTypes", required = false) + protected String includeTypes; + + /** + * Comma Separated list of Types to exclude. Empty String indicates don't + * exclude anything (default). + * + */ + @Parameter(property = "excludeTypes", required = false) + protected String excludeTypes; + + /** + * Scope to include. An Empty string indicates all scopes (default). + * + */ + @Parameter(property = "includeScope", required = false) + protected String includeScope; + + /** + * Scope to exclude. An Empty string indicates no scopes (default). + * + */ + @Parameter(property = "excludeScope", required = false) + protected String excludeScope; + + /** + * Comma Separated list of Classifiers to include. Empty String indicates + * include everything (default). + * + */ + @Parameter(property = "includeClassifiers", required = false) + protected String includeClassifiers; + + /** + * Comma Separated list of Classifiers to exclude. Empty String indicates + * don't exclude anything (default). + * + */ + @Parameter(property = "excludeClassifiers", required = false) + protected String excludeClassifiers; + + /** + * Specify classifier to look for. Example: sources + * + */ + @Parameter(property = "classifier", required = false) + protected String copyDepClassifier; + + /** + * Specify type to look for when constructing artifact based on classifier. + * Example: java-source,jar,war, nar + * + */ + @Parameter(property = "type", required = false, defaultValue = "nar") + protected String type; + + /** + * Comma separated list of Artifact names too exclude. + * + */ + @Parameter(property = "excludeArtifacts", required = false) + protected String excludeArtifactIds; + + /** + * Comma separated list of Artifact names to include. + * + */ + @Parameter(property = "includeArtifacts", required = false) + protected String includeArtifactIds; + + /** + * Comma separated list of GroupId Names to exclude. + * + */ + @Parameter(property = "excludeArtifacts", required = false) + protected String excludeGroupIds; + + /** + * Comma separated list of GroupIds to include. + * + */ + @Parameter(property = "includeGroupIds", required = false) + protected String includeGroupIds; + + /** + * Directory to store flag files + * + */ + @Parameter(property = "markersDirectory", required = false, defaultValue = "${project.build.directory}/dependency-maven-plugin-markers") + protected File markersDirectory; + + /** + * Overwrite release artifacts + * + */ + @Parameter(property = "overWriteReleases", required = false) + protected boolean overWriteReleases; + + /** + * Overwrite snapshot artifacts + * + */ + @Parameter(property = "overWriteSnapshots", required = false) + protected boolean overWriteSnapshots; + + /** + * Overwrite artifacts that don't exist or are older than the source. + * + */ + @Parameter(property = "overWriteIfNewer", required = false, defaultValue = "true") + protected boolean overWriteIfNewer; + + @Parameter( property = "projectBuildDirectory", required = false, defaultValue = "${project.build.directory}") + protected File projectBuildDirectory; + + /** + * Used to look up Artifacts in the remote repository. + */ + @Component + protected ArtifactFactory factory; + + /** + * Used to look up Artifacts in the remote repository. + * + */ + @Component + protected ArtifactResolver resolver; + + /** + * Artifact collector, needed to resolve dependencies. + * + */ + @Component(role = org.apache.maven.artifact.resolver.ArtifactCollector.class) + protected ArtifactCollector artifactCollector; + + @Component(role = org.apache.maven.artifact.metadata.ArtifactMetadataSource.class) + protected ArtifactMetadataSource artifactMetadataSource; + + /** + * Location of the local repository. + * + */ + @Parameter(property = "localRepository", required = true, readonly = true) + protected ArtifactRepository local; + + /** + * List of Remote Repositories used by the resolver + * + */ + @Parameter(property = "project.remoteArtifactRepositories", required = true, readonly = true) + protected List remoteRepos; + + /** + * To look up Archiver/UnArchiver implementations + * + */ + @Component + protected ArchiverManager archiverManager; + + /** + * Contains the full list of projects in the reactor. + * + */ + @Parameter(property = "reactorProjects", required = true, readonly = true) + protected List reactorProjects; + + /** + * If the plugin should be silent. + * + */ + @Parameter(property = "silent", required = false, defaultValue = "false") + public boolean silent; + + /** + * Output absolute filename for resolved artifacts + * + */ + @Parameter(property = "outputAbsoluteArtifactFilename", defaultValue = "false", required = false) + protected boolean outputAbsoluteArtifactFilename; + + @Override + public void execute() throws MojoExecutionException, MojoFailureException { + copyDependencies(); + makeNar(); + } + + private void copyDependencies() throws MojoExecutionException { + DependencyStatusSets dss = getDependencySets(this.failOnMissingClassifierArtifact); + Set artifacts = dss.getResolvedDependencies(); + + for (Object artifactObj : artifacts) { + copyArtifact((Artifact) artifactObj); + } + + artifacts = dss.getSkippedDependencies(); + for (Object artifactOjb : artifacts) { + Artifact artifact = (Artifact) artifactOjb; + getLog().info(artifact.getFile().getName() + " already exists in destination."); + } + } + + protected void copyArtifact(Artifact artifact) throws MojoExecutionException { + String destFileName = DependencyUtil.getFormattedFileName(artifact, false); + final File destDir = DependencyUtil.getFormattedOutputDirectory(false, false, false, false, false, getDependenciesDirectory(), artifact); + final File destFile = new File(destDir, destFileName); + copyFile(artifact.getFile(), destFile); + } + + protected Artifact getResolvedPomArtifact(Artifact artifact) { + Artifact pomArtifact = this.factory.createArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), "", "pom"); + // Resolve the pom artifact using repos + try { + this.resolver.resolve(pomArtifact, this.remoteRepos, this.local); + } catch (ArtifactResolutionException | ArtifactNotFoundException e) { + getLog().info(e.getMessage()); + } + return pomArtifact; + } + + protected ArtifactsFilter getMarkedArtifactFilter() { + return new DestFileFilter(this.overWriteReleases, this.overWriteSnapshots, this.overWriteIfNewer, false, false, false, false, false, getDependenciesDirectory()); + } + + protected DependencyStatusSets getDependencySets(boolean stopOnFailure) throws MojoExecutionException { + // add filters in well known order, least specific to most specific + FilterArtifacts filter = new FilterArtifacts(); + + filter.addFilter(new ProjectTransitivityFilter(project.getDependencyArtifacts(), false)); + filter.addFilter(new ScopeFilter(this.includeScope, this.excludeScope)); + filter.addFilter(new TypeFilter(this.includeTypes, this.excludeTypes)); + filter.addFilter(new ClassifierFilter(this.includeClassifiers, this.excludeClassifiers)); + filter.addFilter(new GroupIdFilter(this.includeGroupIds, this.excludeGroupIds)); + filter.addFilter(new ArtifactIdFilter(this.includeArtifactIds, this.excludeArtifactIds)); + + // explicitly filter our nar dependencies + filter.addFilter(new TypeFilter("", "nar")); + + // start with all artifacts. + Set artifacts = project.getArtifacts(); + + // perform filtering + try { + artifacts = filter.filter(artifacts); + } catch (ArtifactFilterException e) { + throw new MojoExecutionException(e.getMessage(), e); + } + + // transform artifacts if classifier is set + final DependencyStatusSets status; + if (StringUtils.isNotEmpty(copyDepClassifier)) { + status = getClassifierTranslatedDependencies(artifacts, stopOnFailure); + } else { + status = filterMarkedDependencies(artifacts); + } + + return status; + } + + protected DependencyStatusSets getClassifierTranslatedDependencies(Set artifacts, boolean stopOnFailure) throws MojoExecutionException { + Set unResolvedArtifacts = new HashSet(); + Set resolvedArtifacts = artifacts; + DependencyStatusSets status = new DependencyStatusSets(); + + // possibly translate artifacts into a new set of artifacts based on the + // classifier and type + // if this did something, we need to resolve the new artifacts + if (StringUtils.isNotEmpty(copyDepClassifier)) { + ArtifactTranslator translator = new ClassifierTypeTranslator(this.copyDepClassifier, this.type, this.factory); + artifacts = translator.translate(artifacts, getLog()); + + status = filterMarkedDependencies(artifacts); + + // the unskipped artifacts are in the resolved set. + artifacts = status.getResolvedDependencies(); + + // resolve the rest of the artifacts + ArtifactsResolver artifactsResolver = new DefaultArtifactsResolver(this.resolver, this.local, + this.remoteRepos, stopOnFailure); + resolvedArtifacts = artifactsResolver.resolve(artifacts, getLog()); + + // calculate the artifacts not resolved. + unResolvedArtifacts.addAll(artifacts); + unResolvedArtifacts.removeAll(resolvedArtifacts); + } + + // return a bean of all 3 sets. + status.setResolvedDependencies(resolvedArtifacts); + status.setUnResolvedDependencies(unResolvedArtifacts); + + return status; + } + + protected DependencyStatusSets filterMarkedDependencies(Set artifacts) throws MojoExecutionException { + // remove files that have markers already + FilterArtifacts filter = new FilterArtifacts(); + filter.clearFilters(); + filter.addFilter(getMarkedArtifactFilter()); + + Set unMarkedArtifacts; + try { + unMarkedArtifacts = filter.filter(artifacts); + } catch (ArtifactFilterException e) { + throw new MojoExecutionException(e.getMessage(), e); + } + + // calculate the skipped artifacts + Set skippedArtifacts = new HashSet(); + skippedArtifacts.addAll(artifacts); + skippedArtifacts.removeAll(unMarkedArtifacts); + + return new DependencyStatusSets(unMarkedArtifacts, null, skippedArtifacts); + } + + protected void copyFile(File artifact, File destFile) throws MojoExecutionException { + try { + getLog().info("Copying " + (this.outputAbsoluteArtifactFilename ? artifact.getAbsolutePath() : artifact.getName()) + " to " + destFile); + FileUtils.copyFile(artifact, destFile); + } catch (Exception e) { + throw new MojoExecutionException("Error copying artifact from " + artifact + " to " + destFile, e); + } + } + + private File getClassesDirectory() { + final File outputDirectory = projectBuildDirectory; + return new File(outputDirectory, "classes"); + } + + private File getDependenciesDirectory() { + return new File(getClassesDirectory(), "META-INF/bundled-dependencies"); + } + + private void makeNar() throws MojoExecutionException { + File narFile = createArchive(); + + if (classifier != null) { + projectHelper.attachArtifact(project, "nar", classifier, narFile); + } else { + project.getArtifact().setFile(narFile); + } + } + + public File createArchive() throws MojoExecutionException { + final File outputDirectory = projectBuildDirectory; + File narFile = getNarFile(outputDirectory, finalName, classifier); + MavenArchiver archiver = new MavenArchiver(); + archiver.setArchiver(jarArchiver); + archiver.setOutputFile(narFile); + archive.setForced(forceCreation); + + try { + File contentDirectory = getClassesDirectory(); + if (!contentDirectory.exists()) { + getLog().warn("NAR will be empty - no content was marked for inclusion!"); + } else { + archiver.getArchiver().addDirectory(contentDirectory, getIncludes(), getExcludes()); + } + + File existingManifest = defaultManifestFile; + if (useDefaultManifestFile && existingManifest.exists() && archive.getManifestFile() == null) { + getLog().info("Adding existing MANIFEST to archive. Found under: " + existingManifest.getPath()); + archive.setManifestFile(existingManifest); + } + + // automatically add the artifact id to the manifest + archive.addManifestEntry("Nar-Id", project.getArtifactId()); + + // look for a nar dependency + String narDependency = getNarDependency(); + if (narDependency != null) { + archive.addManifestEntry("Nar-Dependency-Id", narDependency); + } + + archiver.createArchive(session, project, archive); + return narFile; + } catch (ArchiverException | MojoExecutionException | ManifestException | IOException | DependencyResolutionRequiredException e) { + throw new MojoExecutionException("Error assembling NAR", e); + } + } + + private String[] getIncludes() { + if (includes != null && includes.length > 0) { + return includes; + } + return DEFAULT_INCLUDES; + } + + private String[] getExcludes() { + if (excludes != null && excludes.length > 0) { + return excludes; + } + return DEFAULT_EXCLUDES; + } + + protected File getNarFile(File basedir, String finalName, String classifier) { + if (classifier == null) { + classifier = ""; + } else if (classifier.trim().length() > 0 && !classifier.startsWith("-")) { + classifier = "-" + classifier; + } + + return new File(basedir, finalName + classifier + ".nar"); + } + + private String getNarDependency() throws MojoExecutionException { + String narDependency = null; + + // get nar dependencies + FilterArtifacts filter = new FilterArtifacts(); + filter.addFilter(new TypeFilter("nar", "")); + + // start with all artifacts. + Set artifacts = project.getArtifacts(); + + // perform filtering + try { + artifacts = filter.filter(artifacts); + } catch (ArtifactFilterException e) { + throw new MojoExecutionException(e.getMessage(), e); + } + + // ensure there is a single nar dependency + if (artifacts.size() > 1) { + throw new MojoExecutionException("Each NAR represents a ClassLoader. A NAR dependency allows that NAR's ClassLoader to be " + + "used as the parent of this NAR's ClassLoader. As a result, only a single NAR dependency is allowed."); + } else if (artifacts.size() == 1) { + final Artifact artifact = (Artifact) artifacts.iterator().next(); + narDependency = artifact.getArtifactId(); + } + + return narDependency; + } +}
http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/f6d9354b/nifi-nar-maven-plugin/src/main/resources/META-INF/plexus/components.xml ---------------------------------------------------------------------- diff --git a/nifi-nar-maven-plugin/src/main/resources/META-INF/plexus/components.xml b/nifi-nar-maven-plugin/src/main/resources/META-INF/plexus/components.xml new file mode 100644 index 0000000..ad2c3cb --- /dev/null +++ b/nifi-nar-maven-plugin/src/main/resources/META-INF/plexus/components.xml @@ -0,0 +1,52 @@ +<?xml version="1.0"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<component-set> + <components> + <component> + <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role> + <role-hint>nar</role-hint> + <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation> + <configuration> + <lifecycles> + <lifecycle> + <id>default</id> + <phases> + <process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources> + <compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile> + <process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources> + <test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile> + <test>org.apache.maven.plugins:maven-surefire-plugin:test</test> + <package>org.apache.nifi:nifi-nar-maven-plugin:nar</package> + <install>org.apache.maven.plugins:maven-install-plugin:install</install> + <deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy> + </phases> + </lifecycle> + </lifecycles> + </configuration> + </component> + <component> + <role>org.apache.maven.artifact.handler.ArtifactHandler</role> + <role-hint>nar</role-hint> + <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation> + <configuration> + <type>nar</type> + <language>java</language> + <addedToClasspath>false</addedToClasspath> + <includesDependencies>true</includesDependencies> + </configuration> + </component> + </components> +</component-set> http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/f6d9354b/nifi/README.md ---------------------------------------------------------------------- diff --git a/nifi/README.md b/nifi/README.md index d9f7e53..e077c0c 100644 --- a/nifi/README.md +++ b/nifi/README.md @@ -27,7 +27,7 @@ To build: - Execute 'mvn clean install' or for parallel build execute 'mvn -T 2.0C clean install' To start NiFi: -- Change directory to 'assembly'. In the target directory there should be a build of nifi. +- Change directory to 'nifi-assembly'. In the target directory there should be a build of nifi. - Unpack the build wherever you like or use the already unpacked build. '<install_location>/bin/nifi.sh start' - Direct your browser to http://localhost:8080/nifi/ http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/f6d9354b/nifi/assembly/pom.xml ---------------------------------------------------------------------- diff --git a/nifi/assembly/pom.xml b/nifi/assembly/pom.xml deleted file mode 100644 index e186a44..0000000 --- a/nifi/assembly/pom.xml +++ /dev/null @@ -1,458 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.nifi</groupId> - <artifactId>nifi-parent</artifactId> - <version>0.0.1-incubating-SNAPSHOT</version> - </parent> - <artifactId>nifi</artifactId> - <version>0.0.1-incubating-SNAPSHOT</version> - <packaging>pom</packaging> - <name>NiFi Release</name> - <description>This is the assembly Apache NiFi (incubating)</description> - <build> - <plugins> - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <attach>false</attach> - </configuration> - <executions> - <execution> - <id>make shared resource</id> - <goals> - <goal>single</goal> - </goals> - <phase>package</phase> - <configuration> - <descriptors> - <descriptor>src/main/assembly/dependencies.xml</descriptor> - </descriptors> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - <dependencies> - <dependency> - <groupId>ch.qos.logback</groupId> - <artifactId>logback-classic</artifactId> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jcl-over-slf4j</artifactId> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jul-to-slf4j</artifactId> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>log4j-over-slf4j</artifactId> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>nifi-api</artifactId> - </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>nifi-runtime</artifactId> - </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>nifi-bootstrap</artifactId> - </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>nifi-resources</artifactId> - <classifier>resources</classifier> - <scope>runtime</scope> - <type>zip</type> - </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>nifi-docs</artifactId> - <classifier>resources</classifier> - <scope>runtime</scope> - <type>zip</type> - </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>nifi-framework-nar</artifactId> - <type>nar</type> - </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>volatile-provenance-repository-nar</artifactId> - <type>nar</type> - </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>persistent-provenance-repository-nar</artifactId> - <type>nar</type> - </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>standard-services-api-nar</artifactId> - <type>nar</type> - </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>ssl-context-service-nar</artifactId> - <type>nar</type> - </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>distributed-cache-services-nar</artifactId> - <type>nar</type> - </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>nifi-standard-nar</artifactId> - <type>nar</type> - </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>nifi-jetty-bundle</artifactId> - <type>nar</type> - </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>update-attribute-nar</artifactId> - <type>nar</type> - </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>monitor-threshold-nar</artifactId> - <type>nar</type> - </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>hadoop-libraries-nar</artifactId> - <type>nar</type> - </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>hadoop-nar</artifactId> - <type>nar</type> - </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>kafka-nar</artifactId> - <type>nar</type> - </dependency> - </dependencies> - - <properties> - <!--Wrapper Properties--> - <nifi.wrapper.jvm.heap.initial.mb>256</nifi.wrapper.jvm.heap.initial.mb> - <nifi.wrapper.jvm.heap.max.mb>512</nifi.wrapper.jvm.heap.max.mb> - <nifi.initial.permgen.size.mb>128</nifi.initial.permgen.size.mb> - <nifi.max.permgen.size.mb>128</nifi.max.permgen.size.mb> - <nifi.wrapper.logfile.maxsize>10m</nifi.wrapper.logfile.maxsize> - <nifi.wrapper.logfile.maxfiles>10</nifi.wrapper.logfile.maxfiles> - - <!-- nifi.properties: core properties --> - <nifi.flowcontroller.autoResumeState>true</nifi.flowcontroller.autoResumeState> - <nifi.flowcontroller.graceful.shutdown.period>10 sec</nifi.flowcontroller.graceful.shutdown.period> - <nifi.flowservice.writedelay.interval>500 ms</nifi.flowservice.writedelay.interval> - <nifi.administrative.yield.duration>30 sec</nifi.administrative.yield.duration> - - <nifi.flow.configuration.file>./conf/flow.xml.gz</nifi.flow.configuration.file> - <nifi.flow.configuration.archive.dir>./conf/archive/</nifi.flow.configuration.archive.dir> - <nifi.reporting.task.configuration.file>./conf/reporting-tasks.xml</nifi.reporting.task.configuration.file> - <nifi.controller.service.configuration.file>./conf/controller-services.xml</nifi.controller.service.configuration.file> - <nifi.authority.provider.configuration.file>./conf/authority-providers.xml</nifi.authority.provider.configuration.file> - <nifi.templates.directory>./conf/templates</nifi.templates.directory> - <nifi.database.directory>./database_repository</nifi.database.directory> - - <nifi.flowfile.repository.implementation>org.apache.nifi.controller.repository.WriteAheadFlowFileRepository</nifi.flowfile.repository.implementation> - <nifi.flowfile.repository.directory>./flowfile_repository</nifi.flowfile.repository.directory> - <nifi.flowfile.repository.partitions>256</nifi.flowfile.repository.partitions> - <nifi.flowfile.repository.checkpoint.interval>2 mins</nifi.flowfile.repository.checkpoint.interval> - <nifi.flowfile.repository.always.sync>false</nifi.flowfile.repository.always.sync> - <nifi.swap.manager.implementation>org.apache.nifi.controller.FileSystemSwapManager</nifi.swap.manager.implementation> - <nifi.queue.swap.threshold>20000</nifi.queue.swap.threshold> - <nifi.swap.in.period>5 sec</nifi.swap.in.period> - <nifi.swap.in.threads>1</nifi.swap.in.threads> - <nifi.swap.out.period>5 sec</nifi.swap.out.period> - <nifi.swap.out.threads>4</nifi.swap.out.threads> - - <nifi.content.repository.implementation>org.apache.nifi.controller.repository.FileSystemRepository</nifi.content.repository.implementation> - <nifi.content.claim.max.appendable.size>10 MB</nifi.content.claim.max.appendable.size> - <nifi.content.claim.max.flow.files>100</nifi.content.claim.max.flow.files> - <nifi.content.repository.directory.default>./content_repository</nifi.content.repository.directory.default> - <nifi.content.repository.archive.max.retention.period /> - <nifi.content.repository.archive.max.usage.percentage /> - <nifi.content.repository.archive.enabled>false</nifi.content.repository.archive.enabled> - <nifi.content.repository.always.sync>false</nifi.content.repository.always.sync> - <nifi.content.viewer.url /> - - - <nifi.restore.directory /> - <nifi.ui.banner.text></nifi.ui.banner.text> - <nifi.ui.autorefresh.interval>30 sec</nifi.ui.autorefresh.interval> - <nifi.nar.library.directory>./lib</nifi.nar.library.directory> - <nifi.nar.working.directory>./work/nar/</nifi.nar.working.directory> - <nifi.documentation.working.directory>./work/docs/components</nifi.documentation.working.directory> - - <nifi.sensitive.props.algorithm>PBEWITHMD5AND256BITAES-CBC-OPENSSL</nifi.sensitive.props.algorithm> - <nifi.sensitive.props.provider>BC</nifi.sensitive.props.provider> - <nifi.h2.url.append>;LOCK_TIMEOUT=25000;WRITE_DELAY=0;AUTO_SERVER=FALSE</nifi.h2.url.append> - - <nifi.remote.input.socket.port>9990</nifi.remote.input.socket.port> - - <!-- persistent provenance repository properties --> - <nifi.provenance.repository.implementation>org.apache.nifi.provenance.PersistentProvenanceRepository</nifi.provenance.repository.implementation> - <nifi.provenance.repository.directory.default>./provenance_repository</nifi.provenance.repository.directory.default> - <nifi.provenance.repository.max.storage.time>24 hours</nifi.provenance.repository.max.storage.time> - <nifi.provenance.repository.max.storage.size>1 GB</nifi.provenance.repository.max.storage.size> - <nifi.provenance.repository.rollover.time>5 mins</nifi.provenance.repository.rollover.time> - <nifi.provenance.repository.rollover.size>100 MB</nifi.provenance.repository.rollover.size> - <nifi.provenance.repository.query.threads>2</nifi.provenance.repository.query.threads> - <nifi.provenance.repository.compress.on.rollover>true</nifi.provenance.repository.compress.on.rollover> - <nifi.provenance.repository.indexed.fields>EventType, FlowFileUUID, Filename, ProcessorID</nifi.provenance.repository.indexed.fields> - <nifi.provenance.repository.indexed.attributes /> - <nifi.provenance.repository.index.shard.size>500 MB</nifi.provenance.repository.index.shard.size> - <nifi.provenance.repository.always.sync>false</nifi.provenance.repository.always.sync> - <nifi.provenance.repository.journal.count>16</nifi.provenance.repository.journal.count> - - <!-- volatile provenance repository properties --> - <nifi.provenance.repository.buffer.size>100000</nifi.provenance.repository.buffer.size> - - <!-- Component status repository properties --> - <nifi.components.status.repository.implementation>org.apache.nifi.controller.status.history.VolatileComponentStatusRepository</nifi.components.status.repository.implementation> - <nifi.components.status.repository.buffer.size>288</nifi.components.status.repository.buffer.size> - <nifi.components.status.snapshot.frequency>5 mins</nifi.components.status.snapshot.frequency> - - <!-- nifi.properties: web properties --> - <nifi.web.war.directory>./lib</nifi.web.war.directory> - <nifi.web.http.host /> - <nifi.web.http.port>8080</nifi.web.http.port> - <nifi.web.https.host /> - <nifi.web.https.port /> - <nifi.jetty.work.dir>./work/jetty</nifi.jetty.work.dir> - <nifi.web.jetty.threads>200</nifi.web.jetty.threads> - - <!-- nifi.properties: security properties --> - <nifi.security.keystore /> - <nifi.security.keystoreType /> - <nifi.security.keystorePasswd /> - <nifi.security.keyPasswd /> - <nifi.security.truststore /> - <nifi.security.truststoreType /> - <nifi.security.truststorePasswd /> - <nifi.security.needClientAuth /> - <nifi.security.authorizedUsers.file>./conf/authorized-users.xml</nifi.security.authorizedUsers.file> - <nifi.security.user.credential.cache.duration>24 hours</nifi.security.user.credential.cache.duration> - <nifi.security.user.authority.provider>file-provider</nifi.security.user.authority.provider> - <nifi.security.x509.principal.extractor /> - <nifi.security.support.new.account.requests /> - <nifi.security.ocsp.responder.url /> - <nifi.security.ocsp.responder.certificate /> - - <!-- nifi.properties: cluster common properties (cluster manager and nodes must have same values) --> - <nifi.cluster.protocol.heartbeat.interval>5 sec</nifi.cluster.protocol.heartbeat.interval> - <nifi.cluster.protocol.is.secure>false</nifi.cluster.protocol.is.secure> - <nifi.cluster.protocol.socket.timeout>30 sec</nifi.cluster.protocol.socket.timeout> - <nifi.cluster.protocol.connection.handshake.timeout>45 sec</nifi.cluster.protocol.connection.handshake.timeout> - <nifi.cluster.protocol.use.multicast>false</nifi.cluster.protocol.use.multicast> - <nifi.cluster.protocol.multicast.address /> - <nifi.cluster.protocol.multicast.port /> - <nifi.cluster.protocol.multicast.service.broadcast.delay>500 ms</nifi.cluster.protocol.multicast.service.broadcast.delay> - <nifi.cluster.protocol.multicast.service.locator.attempts>3</nifi.cluster.protocol.multicast.service.locator.attempts> - <nifi.cluster.protocol.multicast.service.locator.attempts.delay>1 sec</nifi.cluster.protocol.multicast.service.locator.attempts.delay> - - <!-- nifi.properties: cluster node properties (only configure for cluster nodes) --> - <nifi.cluster.is.node>false</nifi.cluster.is.node> - <nifi.cluster.node.address /> - <nifi.cluster.node.protocol.port /> - <nifi.cluster.node.protocol.threads>2</nifi.cluster.node.protocol.threads> - <nifi.cluster.node.unicast.manager.address /> - <nifi.cluster.node.unicast.manager.protocol.port /> - - <!-- nifi.properties: cluster manager properties (only configure for cluster manager) --> - <nifi.cluster.is.manager>false</nifi.cluster.is.manager> - <nifi.cluster.manager.address /> - <nifi.cluster.manager.protocol.port /> - <nifi.cluster.manager.node.firewall.file /> - <nifi.cluster.manager.node.event.history.size>10</nifi.cluster.manager.node.event.history.size> - <nifi.cluster.manager.node.api.connection.timeout>30 sec</nifi.cluster.manager.node.api.connection.timeout> - <nifi.cluster.manager.node.api.read.timeout>30 sec</nifi.cluster.manager.node.api.read.timeout> - <nifi.cluster.manager.node.api.request.threads>10</nifi.cluster.manager.node.api.request.threads> - <nifi.cluster.manager.flow.retrieval.delay>5 sec</nifi.cluster.manager.flow.retrieval.delay> - <nifi.cluster.manager.protocol.threads>10</nifi.cluster.manager.protocol.threads> - <nifi.cluster.manager.safemode.duration>0 sec</nifi.cluster.manager.safemode.duration> - </properties> - <profiles> - <profile> - <id>rpm</id> - <activation> - <activeByDefault>false</activeByDefault> - </activation> - <build> - <plugins> - <plugin> - <artifactId>maven-dependency-plugin</artifactId> - <executions> - <execution> - <id>unpack-shared-resources</id> - <goals> - <goal>unpack-dependencies</goal> - </goals> - <phase>generate-resources</phase> - <configuration> - <outputDirectory>${project.build.directory}/generated-resources</outputDirectory> - <includeArtifactIds>nifi-resources</includeArtifactIds> - <includeGroupIds>org.apache.nifi</includeGroupIds> - <excludeTransitive>false</excludeTransitive> - </configuration> - </execution> - <execution> - <id>unpack-docs</id> - <goals> - <goal>unpack-dependencies</goal> - </goals> - <phase>generate-resources</phase> - <configuration> - <outputDirectory>${project.build.directory}/generated-docs</outputDirectory> - <includeArtifactIds>nifi-docs</includeArtifactIds> - <includeGroupIds>org.apache.nifi</includeGroupIds> - <excludeTransitive>false</excludeTransitive> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>rpm-maven-plugin</artifactId> - <configuration> - <summary>Apache NiFi (incubating)</summary> - <description>Apache Nifi (incubating) is dataflow system based on the Flow-Based Programming concepts.</description> - <license>Apache License, Version 2.0 and others (see included LICENSE file)</license> - <url>http://nifi.incubator.apache.org</url> - <group>Utilities</group> - <prefix>/opt/nifi</prefix> - <defineStatements> - <defineStatement>_use_internal_dependency_generator 0</defineStatement> - </defineStatements> - <defaultDirmode>750</defaultDirmode> - <defaultFilemode>640</defaultFilemode> - <defaultUsername>root</defaultUsername> - <defaultGroupname>root</defaultGroupname> - </configuration> - <executions> - <execution> - <id>build-bin-rpm</id> - <goals> - <goal>attached-rpm</goal> - </goals> - <configuration> - <classifier>bin</classifier> - <provides> - <provide>nifi</provide> - </provides> - <mappings> - <mapping> - <directory>/opt/nifi/nifi-${project.version}</directory> - </mapping> - <mapping> - <directory>/opt/nifi/nifi-${project.version}</directory> - <sources> - <source> - <location>../LICENSE</location> - </source> - <source> - <location>../NOTICE</location> - </source> - <source> - <location>../DISCLAIMER</location> - </source> - <source> - <location>../README.md</location> - <destination>README</destination> - </source> - </sources> - </mapping> - <mapping> - <directory>/opt/nifi/nifi-${project.version}/bin</directory> - <filemode>750</filemode> - <sources> - <source> - <location>${project.build.directory}/generated-resources/bin/nifi.sh</location> - <destination>nifi.sh</destination> - <filter>true</filter> - </source> - </sources> - </mapping> - <mapping> - <directory>/opt/nifi/nifi-${project.version}/conf</directory> - <configuration>true</configuration> - <sources> - <source> - <location>${project.build.directory}/generated-resources/conf</location> - <filter>true</filter> - </source> - </sources> - </mapping> - <mapping> - <directory>/opt/nifi/nifi-${project.version}/lib</directory> - <dependency> - <excludes> - <exclude>org.apache.nifi:nifi-bootstrap</exclude> - <exclude>org.apache.nifi:nifi-resources</exclude> - <exclude>org.apache.nifi:nifi-docs</exclude> - </excludes> - </dependency> - </mapping> - <mapping> - <directory>/opt/nifi/nifi-${project.version}/lib/bootstrap</directory> - <dependency> - <includes> - <include>org.apache.nifi:nifi-bootstrap</include> - </includes> - </dependency> - </mapping> - <mapping> - <directory>/opt/nifi/nifi-${project.version}/docs</directory> - <sources> - <source> - <location>${project.build.directory}/generated-docs</location> - </source> - </sources> - </mapping> - </mappings> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - </profiles> -</project> http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/f6d9354b/nifi/assembly/src/main/assembly/dependencies.xml ---------------------------------------------------------------------- diff --git a/nifi/assembly/src/main/assembly/dependencies.xml b/nifi/assembly/src/main/assembly/dependencies.xml deleted file mode 100644 index 3481b0a..0000000 --- a/nifi/assembly/src/main/assembly/dependencies.xml +++ /dev/null @@ -1,140 +0,0 @@ -<?xml version="1.0"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<assembly> - <id>bin</id> - <formats> - <format>dir</format> - <format>zip</format> - <format>tar.gz</format> - </formats> - <includeBaseDirectory>true</includeBaseDirectory> - <baseDirectory>${project.artifactId}-${project.version}</baseDirectory> - - <dependencySets> - <!-- Write out all dependency artifacts to lib directory --> - <dependencySet> - <scope>runtime</scope> - <useProjectArtifact>false</useProjectArtifact> - <outputDirectory>lib</outputDirectory> - <directoryMode>0750</directoryMode> - <fileMode>0640</fileMode> - <useTransitiveFiltering>true</useTransitiveFiltering> - <excludes> - <exclude>nifi-bootstrap</exclude> - <exclude>nifi-resources</exclude> - <exclude>nifi-docs</exclude> - </excludes> - </dependencySet> - - <!-- Write out the bootstrap lib component to its own dir --> - <dependencySet> - <scope>runtime</scope> - <useProjectArtifact>false</useProjectArtifact> - <outputDirectory>lib/bootstrap</outputDirectory> - <directoryMode>0750</directoryMode> - <fileMode>0640</fileMode> - <useTransitiveFiltering>true</useTransitiveFiltering> - <includes> - <include>nifi-bootstrap</include> - </includes> - </dependencySet> - - <!-- Write out the conf directory contents --> - <dependencySet> - <scope>runtime</scope> - <useProjectArtifact>false</useProjectArtifact> - <outputDirectory>./</outputDirectory> - <directoryMode>0750</directoryMode> - <fileMode>0640</fileMode> - <useTransitiveFiltering>true</useTransitiveFiltering> - <includes> - <include>nifi-resources</include> - </includes> - <unpack>true</unpack> - <unpackOptions> - <filtered>true</filtered> - <includes> - <include>conf/*</include> - </includes> - </unpackOptions> - </dependencySet> - - <!-- Write out the bin directory contents --> - <dependencySet> - <scope>runtime</scope> - <useProjectArtifact>false</useProjectArtifact> - <outputDirectory>./</outputDirectory> - <directoryMode>0750</directoryMode> - <fileMode>0750</fileMode> - <useTransitiveFiltering>true</useTransitiveFiltering> - <includes> - <include>nifi-resources</include> - </includes> - <unpack>true</unpack> - <unpackOptions> - <filtered>true</filtered> - <includes> - <include>bin/*</include> - </includes> - </unpackOptions> - </dependencySet> - - <!-- Writes out the docs directory contents --> - <dependencySet> - <scope>runtime</scope> - <useProjectArtifact>false</useProjectArtifact> - <outputDirectory>docs/</outputDirectory> - <useTransitiveFiltering>true</useTransitiveFiltering> - <includes> - <include>nifi-docs</include> - </includes> - <unpack>true</unpack> - <unpackOptions> - <filtered>false</filtered> - </unpackOptions> - </dependencySet> - </dependencySets> - <files> - <file> - <source>../README.md</source> - <outputDirectory>./</outputDirectory> - <destName>README</destName> - <fileMode>0644</fileMode> - <filtered>true</filtered> - </file> - <file> - <source>../DISCLAIMER</source> - <outputDirectory>./</outputDirectory> - <destName>DISCLAIMER</destName> - <fileMode>0644</fileMode> - <filtered>true</filtered> - </file> - <file> - <source>../LICENSE</source> - <outputDirectory>./</outputDirectory> - <destName>LICENSE</destName> - <fileMode>0644</fileMode> - <filtered>true</filtered> - </file> - <file> - <source>../NOTICE</source> - <outputDirectory>./</outputDirectory> - <destName>NOTICE</destName> - <fileMode>0644</fileMode> - <filtered>true</filtered> - </file> - </files> -</assembly> http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/f6d9354b/nifi/commons/data-provenance-utils/.gitignore ---------------------------------------------------------------------- diff --git a/nifi/commons/data-provenance-utils/.gitignore b/nifi/commons/data-provenance-utils/.gitignore deleted file mode 100755 index 19f2e00..0000000 --- a/nifi/commons/data-provenance-utils/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/target -/target http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/f6d9354b/nifi/commons/data-provenance-utils/pom.xml ---------------------------------------------------------------------- diff --git a/nifi/commons/data-provenance-utils/pom.xml b/nifi/commons/data-provenance-utils/pom.xml deleted file mode 100644 index 983c40a..0000000 --- a/nifi/commons/data-provenance-utils/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - --> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.nifi</groupId> - <artifactId>nifi-commons-parent</artifactId> - <version>0.0.1-incubating-SNAPSHOT</version> - </parent> - - <artifactId>data-provenance-utils</artifactId> - <version>0.0.1-incubating-SNAPSHOT</version> - <packaging>jar</packaging> - - <name>data-provenance-utils</name> - - <dependencies> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>nifi-api</artifactId> - </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>nifi-utils</artifactId> - </dependency> - </dependencies> -</project> http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/f6d9354b/nifi/commons/data-provenance-utils/src/main/java/org/apache/nifi/provenance/AsyncLineageSubmission.java ---------------------------------------------------------------------- diff --git a/nifi/commons/data-provenance-utils/src/main/java/org/apache/nifi/provenance/AsyncLineageSubmission.java b/nifi/commons/data-provenance-utils/src/main/java/org/apache/nifi/provenance/AsyncLineageSubmission.java deleted file mode 100644 index dc24a93..0000000 --- a/nifi/commons/data-provenance-utils/src/main/java/org/apache/nifi/provenance/AsyncLineageSubmission.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.provenance; - -import java.util.Collection; -import java.util.Date; -import java.util.UUID; - -import org.apache.nifi.provenance.lineage.ComputeLineageSubmission; -import org.apache.nifi.provenance.lineage.LineageComputationType; - -/** - * - */ -public class AsyncLineageSubmission implements ComputeLineageSubmission { - private final String lineageIdentifier = UUID.randomUUID().toString(); - private final Date submissionTime = new Date(); - - private final LineageComputationType computationType; - private final Long eventId; - private final Collection<String> lineageFlowFileUuids; - - private volatile boolean canceled = false; - - private final StandardLineageResult result; - - public AsyncLineageSubmission(final LineageComputationType computationType, final Long eventId, final Collection<String> lineageFlowFileUuids, final int numSteps) { - this.computationType = computationType; - this.eventId = eventId; - this.lineageFlowFileUuids = lineageFlowFileUuids; - this.result = new StandardLineageResult(numSteps, lineageFlowFileUuids); - } - - @Override - public StandardLineageResult getResult() { - return result; - } - - @Override - public Date getSubmissionTime() { - return submissionTime; - } - - @Override - public String getLineageIdentifier() { - return lineageIdentifier; - } - - @Override - public void cancel() { - this.canceled = true; - } - - @Override - public boolean isCanceled() { - return canceled; - } - - @Override - public LineageComputationType getLineageComputationType() { - return computationType; - } - - @Override - public Long getExpandedEventId() { - return eventId; - } - - @Override - public Collection<String> getLineageFlowFileUuids() { - return lineageFlowFileUuids; - } -} http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/f6d9354b/nifi/commons/data-provenance-utils/src/main/java/org/apache/nifi/provenance/AsyncQuerySubmission.java ---------------------------------------------------------------------- diff --git a/nifi/commons/data-provenance-utils/src/main/java/org/apache/nifi/provenance/AsyncQuerySubmission.java b/nifi/commons/data-provenance-utils/src/main/java/org/apache/nifi/provenance/AsyncQuerySubmission.java deleted file mode 100644 index 4244476..0000000 --- a/nifi/commons/data-provenance-utils/src/main/java/org/apache/nifi/provenance/AsyncQuerySubmission.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.provenance; - -import java.util.Date; -import java.util.concurrent.TimeUnit; - -import org.apache.nifi.provenance.search.Query; -import org.apache.nifi.provenance.search.QuerySubmission; - -/** - * - */ -public class AsyncQuerySubmission implements QuerySubmission { - - public static final int TTL = (int) TimeUnit.MILLISECONDS.convert(60, TimeUnit.SECONDS); - - private final Date submissionTime = new Date(); - private final Query query; - - private volatile boolean canceled = false; - private final StandardQueryResult queryResult; - - /** - * Constructs an AsyncQuerySubmission with the given query and the given - * number of steps, indicating how many results must be added to this - * AsyncQuerySubmission before it is considered finished - * - * @param query - * @param numSteps - */ - public AsyncQuerySubmission(final Query query, final int numSteps) { - this.query = query; - queryResult = new StandardQueryResult(query, numSteps); - } - - @Override - public Date getSubmissionTime() { - return submissionTime; - } - - @Override - public String getQueryIdentifier() { - return query.getIdentifier(); - } - - @Override - public void cancel() { - this.canceled = true; - queryResult.cancel(); - } - - @Override - public boolean isCanceled() { - return canceled; - } - - @Override - public Query getQuery() { - return query; - } - - @Override - public StandardQueryResult getResult() { - return queryResult; - } -} http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/f6d9354b/nifi/commons/data-provenance-utils/src/main/java/org/apache/nifi/provenance/NamedSearchableField.java ---------------------------------------------------------------------- diff --git a/nifi/commons/data-provenance-utils/src/main/java/org/apache/nifi/provenance/NamedSearchableField.java b/nifi/commons/data-provenance-utils/src/main/java/org/apache/nifi/provenance/NamedSearchableField.java deleted file mode 100644 index dc2903f..0000000 --- a/nifi/commons/data-provenance-utils/src/main/java/org/apache/nifi/provenance/NamedSearchableField.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.provenance; - -import org.apache.nifi.provenance.search.SearchableField; -import org.apache.nifi.provenance.search.SearchableFieldType; - -import static java.util.Objects.requireNonNull; - -/** - * - */ -public class NamedSearchableField implements SearchableField { - - private final String identifier; - private final String searchableName; - private final SearchableFieldType fieldType; - private final String friendlyName; - private final boolean attribute; - - NamedSearchableField(final String identifier, final String searchableName, final String friendlyName, final boolean attribute) { - this(identifier, searchableName, friendlyName, attribute, SearchableFieldType.STRING); - } - - NamedSearchableField(final String identifier, final String searchableName, final String friendlyName, final boolean attribute, final SearchableFieldType fieldType) { - this.identifier = requireNonNull(identifier); - this.searchableName = requireNonNull(searchableName); - this.friendlyName = requireNonNull(friendlyName); - this.attribute = requireNonNull(attribute); - this.fieldType = requireNonNull(fieldType); - } - - @Override - public String getIdentifier() { - return identifier; - } - - @Override - public String getSearchableFieldName() { - return searchableName; - } - - @Override - public String getFriendlyName() { - return friendlyName; - } - - @Override - public boolean isAttribute() { - return attribute; - } - - @Override - public SearchableFieldType getFieldType() { - return fieldType; - } - - @Override - public String toString() { - return friendlyName; - } - - @Override - public int hashCode() { - return 298347 + searchableName.hashCode() + (attribute ? 1 : 0); - } - - @Override - public boolean equals(final Object obj) { - if (obj == null) { - return false; - } - - if (!(obj instanceof SearchableField)) { - return false; - } - - final SearchableField other = (SearchableField) obj; - return (this.searchableName.equals(other.getSearchableFieldName()) && attribute == other.isAttribute()); - } -} http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/f6d9354b/nifi/commons/data-provenance-utils/src/main/java/org/apache/nifi/provenance/SearchableFieldParser.java ---------------------------------------------------------------------- diff --git a/nifi/commons/data-provenance-utils/src/main/java/org/apache/nifi/provenance/SearchableFieldParser.java b/nifi/commons/data-provenance-utils/src/main/java/org/apache/nifi/provenance/SearchableFieldParser.java deleted file mode 100644 index 6a934b1..0000000 --- a/nifi/commons/data-provenance-utils/src/main/java/org/apache/nifi/provenance/SearchableFieldParser.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.provenance; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.nifi.provenance.search.SearchableField; - -public class SearchableFieldParser { - - public static List<SearchableField> extractSearchableFields(final String indexedFieldString, final boolean predefinedField) { - final List<SearchableField> searchableFields = new ArrayList<>(); - if (indexedFieldString != null) { - final String[] split = indexedFieldString.split(","); - for (String fieldName : split) { - fieldName = fieldName.trim(); - if (fieldName.isEmpty()) { - continue; - } - - final SearchableField searchableField; - if (predefinedField) { - searchableField = SearchableFields.getSearchableField(fieldName); - } else { - searchableField = SearchableFields.newSearchableAttribute(fieldName); - } - - if (searchableField == null) { - throw new RuntimeException("Invalid Configuration: Provenance Repository configured to Index field '" + fieldName + "', but this is not a valid field"); - } - searchableFields.add(searchableField); - } - } - - return searchableFields; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/f6d9354b/nifi/commons/data-provenance-utils/src/main/java/org/apache/nifi/provenance/SearchableFields.java ---------------------------------------------------------------------- diff --git a/nifi/commons/data-provenance-utils/src/main/java/org/apache/nifi/provenance/SearchableFields.java b/nifi/commons/data-provenance-utils/src/main/java/org/apache/nifi/provenance/SearchableFields.java deleted file mode 100644 index 97c9880..0000000 --- a/nifi/commons/data-provenance-utils/src/main/java/org/apache/nifi/provenance/SearchableFields.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.nifi.provenance; - -import org.apache.nifi.provenance.search.SearchableField; -import org.apache.nifi.provenance.search.SearchableFieldType; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -/** - * - */ -public class SearchableFields { - - public static final SearchableField Identifier = new NamedSearchableField("Identifier", "identifier", "Identifier", false); - public static final SearchableField EventTime = new NamedSearchableField("EventTime", "time", "Event Time", false, SearchableFieldType.DATE); - public static final SearchableField FlowFileUUID = new NamedSearchableField("FlowFileUUID", "uuid", "FlowFile UUID", false); - public static final SearchableField Filename = new NamedSearchableField("Filename", "filename", "Filename", false); - public static final SearchableField EventType = new NamedSearchableField("EventType", "eventType", "Event Type", false); - public static final SearchableField TransitURI = new NamedSearchableField("TransitURI", "transitUri", "Transit URI", false); - public static final SearchableField ComponentID = new NamedSearchableField("ProcessorID", "processorId", "Component ID", false); - public static final SearchableField AlternateIdentifierURI = new NamedSearchableField("AlternateIdentifierURI", "alternateIdentifierUri", "Alternate Identifier URI", false); - public static final SearchableField FileSize = new NamedSearchableField("FileSize", "fileSize", "File Size", false, SearchableFieldType.DATA_SIZE); - public static final SearchableField Details = new NamedSearchableField("Details", "details", "Details", false, SearchableFieldType.STRING); - public static final SearchableField Relationship = new NamedSearchableField("Relationship", "relationship", "Relationship", false, SearchableFieldType.STRING); - - public static final SearchableField LineageStartDate = new NamedSearchableField("LineageStartDate", "lineageStartDate", "Lineage Start Date", false, SearchableFieldType.DATE); - public static final SearchableField LineageIdentifier = new NamedSearchableField("LineageIdentifiers", "lineageIdentifier", "Lineage Identifier", false, SearchableFieldType.STRING); - - public static final SearchableField ContentClaimSection = new NamedSearchableField("ContentClaimSection", "contentClaimSection", "Content Claim Section", false, SearchableFieldType.STRING); - public static final SearchableField ContentClaimContainer = new NamedSearchableField("ContentClaimContainer", "contentClaimContainer", "Content Claim Container", false, SearchableFieldType.STRING); - public static final SearchableField ContentClaimIdentifier = new NamedSearchableField("ContentClaimIdentifier", "contentClaimIdentifier", "Content Claim Identifier", false, SearchableFieldType.STRING); - public static final SearchableField ContentClaimOffset = new NamedSearchableField("ContentClaimOffset", "contentClaimOffset", "Content Claim Offset", false, SearchableFieldType.LONG); - public static final SearchableField SourceQueueIdentifier = new NamedSearchableField("SourceQueueIdentifier", "sourceQueueIdentifier", "Source Queue Identifier", false, SearchableFieldType.STRING); - - private static final Map<String, SearchableField> standardFields; - - static { - final SearchableField[] searchableFields = new SearchableField[]{ - EventTime, FlowFileUUID, Filename, EventType, TransitURI, - ComponentID, AlternateIdentifierURI, FileSize, Relationship, Details, - LineageStartDate, LineageIdentifier, ContentClaimSection, ContentClaimContainer, ContentClaimIdentifier, - ContentClaimOffset, SourceQueueIdentifier}; - - final Map<String, SearchableField> fields = new HashMap<>(); - for (final SearchableField field : searchableFields) { - fields.put(field.getIdentifier(), field); - } - - standardFields = Collections.unmodifiableMap(fields); - } - - private SearchableFields() { - } - - public static Collection<SearchableField> getStandardFields() { - return standardFields.values(); - } - - public static SearchableField getSearchableField(final String fieldIdentifier) { - return standardFields.get(fieldIdentifier); - } - - public static SearchableField newSearchableAttribute(final String attributeName) { - return new NamedSearchableField(attributeName, attributeName, attributeName, true); - } -}
