NIFI-4734 refactored couchbase bundle, jms bundle, removed jms test-lib usage, fixed broken SeeAlso and service links causing docs warns. Corrected L&N in each bundle. This closes #2369.
Signed-off-by: Mark Payne <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/6ee6b5e5 Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/6ee6b5e5 Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/6ee6b5e5 Branch: refs/heads/master Commit: 6ee6b5e57c5ad932c43f08be1f45acb37f2ffe45 Parents: 42a1ee0 Author: joewitt <[email protected]> Authored: Wed Jan 3 22:11:01 2018 -0500 Committer: Mark Payne <[email protected]> Committed: Thu Jan 4 09:16:17 2018 -0500 ---------------------------------------------------------------------- nifi-assembly/pom.xml | 5 + .../nifi-couchbase-nar/pom.xml | 5 + .../src/main/resources/META-INF/NOTICE | 9 + .../nifi-couchbase-processors/pom.xml | 11 +- .../CouchbaseClusterControllerService.java | 38 -- .../processors/couchbase/GetCouchbaseKey.java | 3 - .../processors/couchbase/PutCouchbaseKey.java | 3 - .../nifi-couchbase-services-api-nar/pom.xml | 41 +++ .../src/main/resources/META-INF/NOTICE | 21 ++ .../nifi-couchbase-services-api/pom.xml | 39 ++ .../CouchbaseClusterControllerService.java | 36 ++ nifi-nar-bundles/nifi-couchbase-bundle/pom.xml | 2 + .../html/HtmlDocumentationWriter.java | 28 +- .../src/main/resources/META-INF/LICENSE | 233 ------------ .../src/main/resources/META-INF/NOTICE | 37 +- .../nifi-jms-bundle/nifi-jms-cf-service/pom.xml | 17 +- .../jms/cf/JMSConnectionFactoryProvider.java | 266 -------------- .../JMSConnectionFactoryProviderDefinition.java | 98 +----- .../main/java/org/apache/nifi/jms/cf/Utils.java | 107 ------ ...org.apache.nifi.controller.ControllerService | 15 - .../additionalDetails.html | 56 --- .../cf/JMSConnectionFactoryProviderTest.java | 195 ---------- .../java/org/apache/nifi/jms/cf/TestUtils.java | 65 ---- .../src/test/resources/log4j.properties | 20 -- .../nifi-jms-cf-service/test-lib/README | 4 - .../TestConnectionFactory.java | 111 ------ .../test-lib/test_user_lib.jar | Bin 3452 -> 0 bytes .../src/main/resources/META-INF/NOTICE | 55 ++- .../nifi-jms-bundle/nifi-jms-processors/pom.xml | 11 + .../jms/cf/JMSConnectionFactoryProvider.java | 352 +++++++++++++++++++ .../main/java/org/apache/nifi/jms/cf/Utils.java | 107 ++++++ ...org.apache.nifi.controller.ControllerService | 15 + .../additionalDetails.html | 56 +++ .../cf/JMSConnectionFactoryProviderTest.java | 66 ++++ .../processors/standard/HandleHttpRequest.java | 3 +- .../HBase_1_1_2_ClientMapCacheService.java | 2 +- pom.xml | 11 + 37 files changed, 860 insertions(+), 1283 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/6ee6b5e5/nifi-assembly/pom.xml ---------------------------------------------------------------------- diff --git a/nifi-assembly/pom.xml b/nifi-assembly/pom.xml index 39b06e8..225ce63 100755 --- a/nifi-assembly/pom.xml +++ b/nifi-assembly/pom.xml @@ -338,6 +338,11 @@ language governing permissions and limitations under the License. --> </dependency> <dependency> <groupId>org.apache.nifi</groupId> + <artifactId>nifi-couchbase-services-api-nar</artifactId> + <type>nar</type> + </dependency> + <dependency> + <groupId>org.apache.nifi</groupId> <artifactId>nifi-hbase-nar</artifactId> <type>nar</type> </dependency> http://git-wip-us.apache.org/repos/asf/nifi/blob/6ee6b5e5/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-nar/pom.xml ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-nar/pom.xml b/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-nar/pom.xml index ae7773f..61ba773 100644 --- a/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-nar/pom.xml +++ b/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-nar/pom.xml @@ -33,6 +33,11 @@ <dependencies> <dependency> <groupId>org.apache.nifi</groupId> + <artifactId>nifi-couchbase-services-api-nar</artifactId> + <type>nar</type> + </dependency> + <dependency> + <groupId>org.apache.nifi</groupId> <artifactId>nifi-couchbase-processors</artifactId> <version>1.5.0-SNAPSHOT</version> </dependency> http://git-wip-us.apache.org/repos/asf/nifi/blob/6ee6b5e5/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-nar/src/main/resources/META-INF/NOTICE ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-nar/src/main/resources/META-INF/NOTICE b/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-nar/src/main/resources/META-INF/NOTICE index f7343f5..ff94b66 100644 --- a/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-nar/src/main/resources/META-INF/NOTICE +++ b/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-nar/src/main/resources/META-INF/NOTICE @@ -19,3 +19,12 @@ The following binary components are provided under the Apache Software License v The following NOTICE information applies: Couchbase Java SDK Copyright 2012 Netflix, Inc. + + (ASLv2) Apache Commons Lang + The following NOTICE information applies: + Apache Commons Lang + Copyright 2001-2017 The Apache Software Foundation + + This product includes software from the Spring Framework, + under the Apache License 2.0 (see: StringUtils.containsWhitespace()) + http://git-wip-us.apache.org/repos/asf/nifi/blob/6ee6b5e5/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-processors/pom.xml ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-processors/pom.xml b/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-processors/pom.xml index f8e5b34..f21713a 100644 --- a/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-processors/pom.xml +++ b/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-processors/pom.xml @@ -35,6 +35,11 @@ <artifactId>nifi-utils</artifactId> </dependency> <dependency> + <groupId>org.apache.nifi</groupId> + <artifactId>nifi-couchbase-services-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> </dependency> @@ -49,14 +54,8 @@ <scope>test</scope> </dependency> <dependency> - <groupId>com.couchbase.client</groupId> - <artifactId>java-client</artifactId> - <version>2.2.0</version> - </dependency> - <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>4.11</version> <scope>test</scope> </dependency> </dependencies> http://git-wip-us.apache.org/repos/asf/nifi/blob/6ee6b5e5/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-processors/src/main/java/org/apache/nifi/couchbase/CouchbaseClusterControllerService.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-processors/src/main/java/org/apache/nifi/couchbase/CouchbaseClusterControllerService.java b/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-processors/src/main/java/org/apache/nifi/couchbase/CouchbaseClusterControllerService.java deleted file mode 100644 index fcf72d5..0000000 --- a/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-processors/src/main/java/org/apache/nifi/couchbase/CouchbaseClusterControllerService.java +++ /dev/null @@ -1,38 +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.couchbase; - -import org.apache.nifi.annotation.documentation.CapabilityDescription; -import org.apache.nifi.controller.ControllerService; - -import com.couchbase.client.java.Bucket; - -/** - * Provides a connection to a Couchbase Server cluster throughout a NiFi Data - * flow. - */ -@CapabilityDescription("Provides a centralized Couchbase connection.") -public interface CouchbaseClusterControllerService extends ControllerService { - - /** - * Open a bucket connection. - * @param bucketName the bucket name to access - * @return a connected bucket instance - */ - public Bucket openBucket(String bucketName); - -} http://git-wip-us.apache.org/repos/asf/nifi/blob/6ee6b5e5/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-processors/src/main/java/org/apache/nifi/processors/couchbase/GetCouchbaseKey.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-processors/src/main/java/org/apache/nifi/processors/couchbase/GetCouchbaseKey.java b/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-processors/src/main/java/org/apache/nifi/processors/couchbase/GetCouchbaseKey.java index 63b583a..76e28cb 100644 --- a/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-processors/src/main/java/org/apache/nifi/processors/couchbase/GetCouchbaseKey.java +++ b/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-processors/src/main/java/org/apache/nifi/processors/couchbase/GetCouchbaseKey.java @@ -32,11 +32,9 @@ import org.apache.nifi.annotation.behavior.InputRequirement.Requirement; import org.apache.nifi.annotation.behavior.WritesAttribute; import org.apache.nifi.annotation.behavior.WritesAttributes; import org.apache.nifi.annotation.documentation.CapabilityDescription; -import org.apache.nifi.annotation.documentation.SeeAlso; import org.apache.nifi.annotation.documentation.Tags; import org.apache.nifi.components.PropertyDescriptor; import org.apache.nifi.couchbase.CouchbaseAttributes; -import org.apache.nifi.couchbase.CouchbaseClusterControllerService; import org.apache.nifi.flowfile.FlowFile; import org.apache.nifi.logging.ComponentLog; import org.apache.nifi.processor.ProcessContext; @@ -59,7 +57,6 @@ import com.couchbase.client.java.error.DocumentDoesNotExistException; @CapabilityDescription("Get a document from Couchbase Server via Key/Value access. The ID of the document to fetch may be supplied by setting the <Document Id> property. " + "NOTE: if the Document Id property is not set, the contents of the FlowFile will be read to determine the Document Id, which means that the contents of the entire " + "FlowFile will be buffered in memory.") -@SeeAlso({CouchbaseClusterControllerService.class}) @WritesAttributes({ @WritesAttribute(attribute = "couchbase.cluster", description = "Cluster where the document was retrieved from."), @WritesAttribute(attribute = "couchbase.bucket", description = "Bucket where the document was retrieved from."), http://git-wip-us.apache.org/repos/asf/nifi/blob/6ee6b5e5/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-processors/src/main/java/org/apache/nifi/processors/couchbase/PutCouchbaseKey.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-processors/src/main/java/org/apache/nifi/processors/couchbase/PutCouchbaseKey.java b/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-processors/src/main/java/org/apache/nifi/processors/couchbase/PutCouchbaseKey.java index 2d89d8f..f8c32b8 100644 --- a/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-processors/src/main/java/org/apache/nifi/processors/couchbase/PutCouchbaseKey.java +++ b/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-processors/src/main/java/org/apache/nifi/processors/couchbase/PutCouchbaseKey.java @@ -32,11 +32,9 @@ import org.apache.nifi.annotation.behavior.ReadsAttributes; import org.apache.nifi.annotation.behavior.WritesAttribute; import org.apache.nifi.annotation.behavior.WritesAttributes; import org.apache.nifi.annotation.documentation.CapabilityDescription; -import org.apache.nifi.annotation.documentation.SeeAlso; import org.apache.nifi.annotation.documentation.Tags; import org.apache.nifi.components.PropertyDescriptor; import org.apache.nifi.couchbase.CouchbaseAttributes; -import org.apache.nifi.couchbase.CouchbaseClusterControllerService; import org.apache.nifi.flowfile.FlowFile; import org.apache.nifi.flowfile.attributes.CoreAttributes; import org.apache.nifi.logging.ComponentLog; @@ -58,7 +56,6 @@ import com.couchbase.client.java.document.RawJsonDocument; @Tags({"nosql", "couchbase", "database", "put"}) @CapabilityDescription("Put a document to Couchbase Server via Key/Value access.") -@SeeAlso({CouchbaseClusterControllerService.class}) @InputRequirement(Requirement.INPUT_REQUIRED) @ReadsAttributes({ @ReadsAttribute(attribute = "uuid", description = "Used as a document id if 'Document Id' is not specified"), http://git-wip-us.apache.org/repos/asf/nifi/blob/6ee6b5e5/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-services-api-nar/pom.xml ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-services-api-nar/pom.xml b/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-services-api-nar/pom.xml new file mode 100644 index 0000000..3e0f790 --- /dev/null +++ b/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-services-api-nar/pom.xml @@ -0,0 +1,41 @@ +<?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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.nifi</groupId> + <artifactId>nifi-couchbase-bundle</artifactId> + <version>1.5.0-SNAPSHOT</version> + </parent> + + <artifactId>nifi-couchbase-services-api-nar</artifactId> + <version>1.5.0-SNAPSHOT</version> + <packaging>nar</packaging> + <properties> + <maven.javadoc.skip>true</maven.javadoc.skip> + <source.skip>true</source.skip> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.nifi</groupId> + <artifactId>nifi-couchbase-services-api</artifactId> + <version>1.5.0-SNAPSHOT</version> + </dependency> + </dependencies> + +</project> http://git-wip-us.apache.org/repos/asf/nifi/blob/6ee6b5e5/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-services-api-nar/src/main/resources/META-INF/NOTICE ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-services-api-nar/src/main/resources/META-INF/NOTICE b/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-services-api-nar/src/main/resources/META-INF/NOTICE new file mode 100644 index 0000000..18858c3 --- /dev/null +++ b/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-services-api-nar/src/main/resources/META-INF/NOTICE @@ -0,0 +1,21 @@ +nifi-couchbase-services-api-nar +Copyright 2014-2017 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +****************** +Apache Software License v2 +****************** + +The following binary components are provided under the Apache Software License v2 + + (ASLv2) Couchbase Java SDK + The following NOTICE information applies: + Couchbase Java SDK + Copyright 2014 Couchbase, Inc. + + (ASLv2) RxJava + The following NOTICE information applies: + Couchbase Java SDK + Copyright 2012 Netflix, Inc. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/6ee6b5e5/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-services-api/pom.xml ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-services-api/pom.xml b/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-services-api/pom.xml new file mode 100644 index 0000000..079bde6 --- /dev/null +++ b/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-services-api/pom.xml @@ -0,0 +1,39 @@ +<?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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.nifi</groupId> + <artifactId>nifi-couchbase-bundle</artifactId> + <version>1.5.0-SNAPSHOT</version> + </parent> + + <artifactId>nifi-couchbase-services-api</artifactId> + <packaging>jar</packaging> + + <dependencies> + <dependency> + <groupId>org.apache.nifi</groupId> + <artifactId>nifi-api</artifactId> + </dependency> + <dependency> + <groupId>com.couchbase.client</groupId> + <artifactId>java-client</artifactId> + <version>2.2.0</version> + </dependency> + </dependencies> +</project> http://git-wip-us.apache.org/repos/asf/nifi/blob/6ee6b5e5/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-services-api/src/main/java/org/apache/nifi/couchbase/CouchbaseClusterControllerService.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-services-api/src/main/java/org/apache/nifi/couchbase/CouchbaseClusterControllerService.java b/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-services-api/src/main/java/org/apache/nifi/couchbase/CouchbaseClusterControllerService.java new file mode 100644 index 0000000..83e52be --- /dev/null +++ b/nifi-nar-bundles/nifi-couchbase-bundle/nifi-couchbase-services-api/src/main/java/org/apache/nifi/couchbase/CouchbaseClusterControllerService.java @@ -0,0 +1,36 @@ +/* + * 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.couchbase; + +import org.apache.nifi.controller.ControllerService; + +import com.couchbase.client.java.Bucket; + +/** + * Provides a connection to a Couchbase Server cluster throughout a NiFi Data + * flow. + */ +public interface CouchbaseClusterControllerService extends ControllerService { + + /** + * Open a bucket connection. + * @param bucketName the bucket name to access + * @return a connected bucket instance + */ + public Bucket openBucket(String bucketName); + +} http://git-wip-us.apache.org/repos/asf/nifi/blob/6ee6b5e5/nifi-nar-bundles/nifi-couchbase-bundle/pom.xml ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-couchbase-bundle/pom.xml b/nifi-nar-bundles/nifi-couchbase-bundle/pom.xml index 83fcc8b..94b4eb8 100644 --- a/nifi-nar-bundles/nifi-couchbase-bundle/pom.xml +++ b/nifi-nar-bundles/nifi-couchbase-bundle/pom.xml @@ -28,6 +28,8 @@ <packaging>pom</packaging> <modules> + <module>nifi-couchbase-services-api</module> + <module>nifi-couchbase-services-api-nar</module> <module>nifi-couchbase-processors</module> <module>nifi-couchbase-nar</module> </modules> http://git-wip-us.apache.org/repos/asf/nifi/blob/6ee6b5e5/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java index 15f3e5a..a61429a 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlDocumentationWriter.java @@ -287,7 +287,7 @@ public class HtmlDocumentationWriter implements DocumentationWriter { if (componentNames.length > 0 || classNames.length > 0) { // Write alternatives - iterateAndLinkComponents(xmlStreamWriter, componentNames, classNames, ","); + iterateAndLinkComponents(xmlStreamWriter, componentNames, classNames, ",", configurableComponent.getClass().getSimpleName()); } else { xmlStreamWriter.writeCharacters("No alternative components suggested."); } @@ -314,7 +314,7 @@ public class HtmlDocumentationWriter implements DocumentationWriter { String[] classNames = seeAlso.classNames(); if (componentNames.length > 0 || classNames.length > 0) { // Write alternatives - iterateAndLinkComponents(xmlStreamWriter, componentNames, classNames, ", "); + iterateAndLinkComponents(xmlStreamWriter, componentNames, classNames, ", ", configurableComponent.getClass().getSimpleName()); } else { xmlStreamWriter.writeCharacters("No tags provided."); } @@ -643,7 +643,7 @@ public class HtmlDocumentationWriter implements DocumentationWriter { if (implementations.length > 0) { final String title = implementations.length > 1 ? "Implementations: " : "Implementation: "; writeSimpleElement(xmlStreamWriter, "strong", title); - iterateAndLinkComponents(xmlStreamWriter, implementations, null, "<br>"); + iterateAndLinkComponents(xmlStreamWriter, implementations, null, "<br>", controllerServiceClass.getSimpleName()); } else { xmlStreamWriter.writeCharacters("No implementations found."); } @@ -762,21 +762,23 @@ public class HtmlDocumentationWriter implements DocumentationWriter { * @param separator a separator used to split the values (in case more than 1. If the separator is enclosed in * between "<" and ">" (.e.g "<br>" it is treated as a tag and written to the xmlStreamWriter as an * empty tag + * @param sourceContextName the source context/name of the item being linked * @throws XMLStreamException thrown if there is a problem writing the XML */ - protected void iterateAndLinkComponents(final XMLStreamWriter xmlStreamWriter, final Class<? extends ConfigurableComponent>[] linkedComponents, String[] classNames, String separator) + protected void iterateAndLinkComponents(final XMLStreamWriter xmlStreamWriter, final Class<? extends ConfigurableComponent>[] linkedComponents, + final String[] classNames, final String separator, final String sourceContextName) throws XMLStreamException { - + String effectiveSeparator = separator; // Treat the the possible separators boolean separatorIsElement; - if (separator.startsWith("<") && separator.endsWith(">")) { + if (effectiveSeparator.startsWith("<") && effectiveSeparator.endsWith(">")) { separatorIsElement = true; } else { separatorIsElement = false; } // Whatever the result, strip the possible < and > characters - separator = separator.replaceAll("\\<([^>]*)>","$1"); + effectiveSeparator = effectiveSeparator.replaceAll("\\<([^>]*)>","$1"); int index = 0; for (final Class<? extends ConfigurableComponent> linkedComponent : linkedComponents ) { @@ -794,16 +796,16 @@ public class HtmlDocumentationWriter implements DocumentationWriter { if (index != 0) { if (separatorIsElement) { - xmlStreamWriter.writeEmptyElement(separator); + xmlStreamWriter.writeEmptyElement(effectiveSeparator); } else { - xmlStreamWriter.writeCharacters(separator); + xmlStreamWriter.writeCharacters(effectiveSeparator); } } writeLink(xmlStreamWriter, linkedComponent.getSimpleName(), "../../../../../components/" + group + "/" + id + "/" + version + "/" + linkedComponent.getCanonicalName() + "/index.html"); ++index; } else { - LOGGER.warn("Could not link to {} because no bundles were found", new Object[] {linkedComponentName}); + LOGGER.warn("Could not link to {} because no bundles were found for {}", new Object[] {linkedComponentName, sourceContextName}); } } @@ -811,9 +813,9 @@ public class HtmlDocumentationWriter implements DocumentationWriter { for (final String className : classNames) { if (index != 0) { if (separatorIsElement) { - xmlStreamWriter.writeEmptyElement(separator); + xmlStreamWriter.writeEmptyElement(effectiveSeparator); } else { - xmlStreamWriter.writeCharacters(separator); + xmlStreamWriter.writeCharacters(effectiveSeparator); } } @@ -835,7 +837,7 @@ public class HtmlDocumentationWriter implements DocumentationWriter { ++index; } else { - LOGGER.warn("Could not link to {} because no bundles were found", new Object[] {className}); + LOGGER.warn("Could not link to {} because no bundles were found for {}", new Object[] {className, sourceContextName}); } } } http://git-wip-us.apache.org/repos/asf/nifi/blob/6ee6b5e5/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service-nar/src/main/resources/META-INF/LICENSE ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service-nar/src/main/resources/META-INF/LICENSE b/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service-nar/src/main/resources/META-INF/LICENSE deleted file mode 100644 index 0c6534d..0000000 --- a/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service-nar/src/main/resources/META-INF/LICENSE +++ /dev/null @@ -1,233 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - -APACHE NIFI SUBCOMPONENTS: - -The Apache NiFi project contains subcomponents with separate copyright -notices and license terms. Your use of the source code for the these -subcomponents is subject to the terms and conditions of the following -licenses. - - The binary distribution of this product bundles 'Bouncy Castle JDK 1.5' - under an MIT style license. - - Copyright (c) 2000 - 2015 The Legion of the Bouncy Castle Inc. (http://www.bouncycastle.org) - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - http://git-wip-us.apache.org/repos/asf/nifi/blob/6ee6b5e5/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service-nar/src/main/resources/META-INF/NOTICE ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service-nar/src/main/resources/META-INF/NOTICE b/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service-nar/src/main/resources/META-INF/NOTICE index 9c13792..ec45e91 100644 --- a/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service-nar/src/main/resources/META-INF/NOTICE +++ b/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service-nar/src/main/resources/META-INF/NOTICE @@ -4,36 +4,11 @@ Copyright 2014-2017 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). -****************** -Apache Software License v2 -****************** +************************ +Common Development and Distribution License 1.1 +************************ -The following binary components are provided under the Apache Software License v2 +The following binary components are provided under the Common Development and Distribution License 1.1. See project link for details. - (ASLv2) Apache Commons Lang - The following NOTICE information applies: - Apache Commons Lang - Copyright 2001-2016 The Apache Software Foundation - - (ASLv2) Jackson JSON processor - The following NOTICE information applies: - # Jackson JSON processor - - Jackson is a high-performance, Free/Open Source JSON processing library. - It was originally written by Tatu Saloranta ([email protected]), and has - been in development since 2007. - It is currently developed by a community of developers, as well as supported - commercially by FasterXML.com. - - ## Licensing - - Jackson core and extension components may licensed under different licenses. - To find the details that apply to this artifact see the accompanying LICENSE file. - For more information, including possible other licensing options, contact - FasterXML.com (http://fasterxml.com). - - ## Credits - - A list of contributors may be found from CREDITS file, which is included - in some artifacts (usually source distributions); but is always available - from the source code management (SCM) system project uses. + (CDDL 1.1) (GPL2 w/ CPE) Javax JMS Api (javax.jms:javax.jms-api:jar:2.0.1 - http://java.net/projects/jms-spec/pages/Home) + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/6ee6b5e5/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/pom.xml ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/pom.xml b/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/pom.xml index e45ae37..5279be0 100644 --- a/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/pom.xml +++ b/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/pom.xml @@ -20,26 +20,11 @@ <dependencies> <dependency> <groupId>org.apache.nifi</groupId> - <artifactId>nifi-ssl-context-service-api</artifactId> - </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>nifi-processor-utils</artifactId> + <artifactId>nifi-api</artifactId> </dependency> <dependency> <groupId>javax.jms</groupId> <artifactId>javax.jms-api</artifactId> </dependency> - <dependency> - <groupId>log4j</groupId> - <artifactId>log4j</artifactId> - <version>1.2.17</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>nifi-mock</artifactId> - <scope>test</scope> - </dependency> </dependencies> </project> http://git-wip-us.apache.org/repos/asf/nifi/blob/6ee6b5e5/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/src/main/java/org/apache/nifi/jms/cf/JMSConnectionFactoryProvider.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/src/main/java/org/apache/nifi/jms/cf/JMSConnectionFactoryProvider.java b/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/src/main/java/org/apache/nifi/jms/cf/JMSConnectionFactoryProvider.java deleted file mode 100644 index d21b0be..0000000 --- a/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/src/main/java/org/apache/nifi/jms/cf/JMSConnectionFactoryProvider.java +++ /dev/null @@ -1,266 +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.jms.cf; - -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map.Entry; - -import javax.jms.ConnectionFactory; -import javax.net.ssl.SSLContext; - -import org.apache.nifi.annotation.behavior.DynamicProperty; -import org.apache.nifi.annotation.documentation.CapabilityDescription; -import org.apache.nifi.annotation.documentation.SeeAlso; -import org.apache.nifi.annotation.documentation.Tags; -import org.apache.nifi.annotation.lifecycle.OnDisabled; -import org.apache.nifi.annotation.lifecycle.OnEnabled; -import org.apache.nifi.components.PropertyDescriptor; -import org.apache.nifi.controller.AbstractControllerService; -import org.apache.nifi.controller.ConfigurationContext; -import org.apache.nifi.processor.util.StandardValidators; -import org.apache.nifi.reporting.InitializationException; -import org.apache.nifi.ssl.SSLContextService; -import org.apache.nifi.ssl.SSLContextService.ClientAuth; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Provides a factory service that creates and initializes - * {@link ConnectionFactory} specific to the third party JMS system. - * <p> - * It accomplishes it by adjusting current classpath by adding to it the - * additional resources (i.e., JMS client libraries) provided by the user via - * {@link JMSConnectionFactoryProviderDefinition#CLIENT_LIB_DIR_PATH}, allowing - * it then to create an instance of the target {@link ConnectionFactory} based - * on the provided {@link JMSConnectionFactoryProviderDefinition#CONNECTION_FACTORY_IMPL} - * which can be than access via {@link #getConnectionFactory()} method. - * </p> - */ -@Tags({ "jms", "messaging", "integration", "queue", "topic", "publish", "subscribe" }) -@CapabilityDescription("Provides a generic service to create vendor specific javax.jms.ConnectionFactory implementations. " - + "ConnectionFactory can be served once this service is configured successfully") -@DynamicProperty(name = "The name of a Connection Factory configuration property.", value = "The value of a given Connection Factory configuration property.", - description = "The properties that are set following Java Beans convention where a property name is derived from the 'set*' method of the vendor " - + "specific ConnectionFactory's implementation. For example, 'com.ibm.mq.jms.MQConnectionFactory.setChannel(String)' would imply 'channel' " - + "property and 'com.ibm.mq.jms.MQConnectionFactory.setTransportType(int)' would imply 'transportType' property.") -@SeeAlso(classNames = { "org.apache.nifi.jms.processors.ConsumeJMS", "org.apache.nifi.jms.processors.PublishJMS" }) -public class JMSConnectionFactoryProvider extends AbstractControllerService implements JMSConnectionFactoryProviderDefinition { - - private final Logger logger = LoggerFactory.getLogger(JMSConnectionFactoryProvider.class); - - private static final List<PropertyDescriptor> propertyDescriptors; - - static { - propertyDescriptors = Collections.unmodifiableList(Arrays.asList(CONNECTION_FACTORY_IMPL, CLIENT_LIB_DIR_PATH, BROKER_URI, SSL_CONTEXT_SERVICE)); - } - - private volatile boolean configured; - - private volatile ConnectionFactory connectionFactory; - - /** - * - */ - @Override - protected List<PropertyDescriptor> getSupportedPropertyDescriptors() { - return propertyDescriptors; - } - - /** - * - */ - @Override - protected PropertyDescriptor getSupportedDynamicPropertyDescriptor(final String propertyDescriptorName) { - return new PropertyDescriptor.Builder() - .description("Specifies the value for '" + propertyDescriptorName - + "' property to be set on the provided ConnectionFactory implementation.") - .name(propertyDescriptorName).addValidator(StandardValidators.NON_EMPTY_VALIDATOR).dynamic(true) - .build(); - } - - /** - * - * @return new instance of {@link ConnectionFactory} - */ - @Override - public ConnectionFactory getConnectionFactory() { - if (this.configured) { - return this.connectionFactory; - } - throw new IllegalStateException("ConnectionFactory can not be obtained unless " - + "this ControllerService is configured. See onConfigure(ConfigurationContext) method."); - } - - /** - * - */ - @OnEnabled - public void enable(ConfigurationContext context) throws InitializationException { - try { - if (!this.configured) { - if (logger.isInfoEnabled()) { - logger.info("Configuring " + this.getClass().getSimpleName() + " for '" - + context.getProperty(CONNECTION_FACTORY_IMPL).evaluateAttributeExpressions().getValue() + "' to be connected to '" - + BROKER_URI + "'"); - } - // will load user provided libraries/resources on the classpath - Utils.addResourcesToClasspath(context.getProperty(CLIENT_LIB_DIR_PATH).evaluateAttributeExpressions().getValue()); - - this.createConnectionFactoryInstance(context); - - this.setConnectionFactoryProperties(context); - } - this.configured = true; - } catch (Exception e) { - logger.error("Failed to configure " + this.getClass().getSimpleName(), e); - this.configured = false; - throw new IllegalStateException(e); - } - } - - /** - * - */ - @OnDisabled - public void disable() { - this.connectionFactory = null; - this.configured = false; - } - - /** - * This operation follows standard bean convention by matching property name - * to its corresponding 'setter' method. Once the method was located it is - * invoked to set the corresponding property to a value provided by during - * service configuration. For example, 'channel' property will correspond to - * 'setChannel(..) method and 'queueManager' property will correspond to - * setQueueManager(..) method with a single argument. - * - * There are also few adjustments to accommodate well known brokers. For - * example ActiveMQ ConnectionFactory accepts address of the Message Broker - * in a form of URL while IBMs in the form of host/port pair (more common). - * So this method will use value retrieved from the 'BROKER_URI' static - * property 'as is' if ConnectionFactory implementation is coming from - * ActiveMQ and for all others (for now) the 'BROKER_URI' value will be - * split on ':' and the resulting pair will be used to execute - * setHostName(..) and setPort(..) methods on the provided - * ConnectionFactory. This may need to be maintained and adjusted to - * accommodate other implementation of ConnectionFactory, but only for - * URL/Host/Port issue. All other properties are set as dynamic properties - * where user essentially provides both property name and value, The bean - * convention is also explained in user manual for this component with links - * pointing to documentation of various ConnectionFactories. - * - * @see #setProperty(String, String) method - */ - private void setConnectionFactoryProperties(ConfigurationContext context) { - for (final Entry<PropertyDescriptor, String> entry : context.getProperties().entrySet()) { - PropertyDescriptor descriptor = entry.getKey(); - String propertyName = descriptor.getName(); - if (descriptor.isDynamic()) { - this.setProperty(propertyName, entry.getValue()); - } else { - if (propertyName.equals(BROKER)) { - String brokerValue = context.getProperty(descriptor).evaluateAttributeExpressions().getValue(); - if (context.getProperty(CONNECTION_FACTORY_IMPL).evaluateAttributeExpressions().getValue().startsWith("org.apache.activemq")) { - this.setProperty("brokerURL", brokerValue); - } else { - String[] hostPort = brokerValue.split(":"); - if (hostPort.length == 2) { - this.setProperty("hostName", hostPort[0]); - this.setProperty("port", hostPort[1]); - } else if (hostPort.length != 2) { - this.setProperty("serverUrl", brokerValue); // for tibco - } else { - throw new IllegalArgumentException("Failed to parse broker url: " + brokerValue); - } - } - SSLContextService sc = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class); - if (sc != null) { - SSLContext ssl = sc.createSSLContext(ClientAuth.NONE); - this.setProperty("sSLSocketFactory", ssl.getSocketFactory()); - } - } // ignore 'else', since it's the only non-dynamic property that is relevant to CF configuration - } - } - } - - /** - * Sets corresponding {@link ConnectionFactory}'s property to a - * 'propertyValue' by invoking a 'setter' method that corresponds to - * 'propertyName'. For example, 'channel' property will correspond to - * 'setChannel(..) method and 'queueManager' property will correspond to - * setQueueManager(..) method with a single argument. - * - * NOTE: There is a limited type conversion to accommodate property value - * types since all NiFi configuration properties comes as String. It is - * accomplished by checking the argument type of the method and executing - * its corresponding conversion to target primitive (e.g., value 'true' will - * go thru Boolean.parseBoolean(propertyValue) if method argument is of type - * boolean). None-primitive values are not supported at the moment and will - * result in {@link IllegalArgumentException}. It is OK though since based - * on analysis of several ConnectionFactory implementation the all seem to - * follow bean convention and all their properties using Java primitives as - * arguments. - */ - private void setProperty(String propertyName, Object propertyValue) { - String methodName = this.toMethodName(propertyName); - Method method = Utils.findMethod(methodName, this.connectionFactory.getClass()); - if (method != null) { - try { - Class<?> returnType = method.getParameterTypes()[0]; - if (String.class.isAssignableFrom(returnType)) { - method.invoke(this.connectionFactory, propertyValue); - } else if (int.class.isAssignableFrom(returnType)) { - method.invoke(this.connectionFactory, Integer.parseInt((String) propertyValue)); - } else if (long.class.isAssignableFrom(returnType)) { - method.invoke(this.connectionFactory, Long.parseLong((String) propertyValue)); - } else if (boolean.class.isAssignableFrom(returnType)) { - method.invoke(this.connectionFactory, Boolean.parseBoolean((String) propertyValue)); - } else { - method.invoke(this.connectionFactory, propertyValue); - } - } catch (Exception e) { - throw new IllegalStateException("Failed to set property " + propertyName, e); - } - } else if (propertyName.equals("hostName")) { - this.setProperty("host", propertyValue); // try 'host' as another common convention. - } - } - - /** - * Creates an instance of the {@link ConnectionFactory} from the provided - * 'CONNECTION_FACTORY_IMPL'. - */ - private void createConnectionFactoryInstance(ConfigurationContext context) { - String connectionFactoryImplName = context.getProperty(CONNECTION_FACTORY_IMPL).evaluateAttributeExpressions().getValue(); - this.connectionFactory = Utils.newDefaultInstance(connectionFactoryImplName); - } - - /** - * Will convert propertyName to a method name following bean convention. For - * example, 'channel' property will correspond to 'setChannel method and - * 'queueManager' property will correspond to setQueueManager method name - */ - private String toMethodName(String propertyName) { - char c[] = propertyName.toCharArray(); - c[0] = Character.toUpperCase(c[0]); - return "set" + new String(c); - } -} http://git-wip-us.apache.org/repos/asf/nifi/blob/6ee6b5e5/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/src/main/java/org/apache/nifi/jms/cf/JMSConnectionFactoryProviderDefinition.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/src/main/java/org/apache/nifi/jms/cf/JMSConnectionFactoryProviderDefinition.java b/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/src/main/java/org/apache/nifi/jms/cf/JMSConnectionFactoryProviderDefinition.java index c3afd32..adb94fd 100644 --- a/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/src/main/java/org/apache/nifi/jms/cf/JMSConnectionFactoryProviderDefinition.java +++ b/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/src/main/java/org/apache/nifi/jms/cf/JMSConnectionFactoryProviderDefinition.java @@ -16,119 +16,23 @@ */ package org.apache.nifi.jms.cf; -import java.io.File; - import javax.jms.ConnectionFactory; -import org.apache.nifi.components.PropertyDescriptor; -import org.apache.nifi.components.ValidationContext; -import org.apache.nifi.components.ValidationResult; -import org.apache.nifi.components.Validator; import org.apache.nifi.controller.ControllerService; -import org.apache.nifi.processor.util.StandardValidators; -import org.apache.nifi.ssl.SSLContextService; /** * Defines a strategy to create implementations to load and initialize third * party implementations of the {@link ConnectionFactory} */ public interface JMSConnectionFactoryProviderDefinition extends ControllerService { - static final String BROKER = "broker"; - static final String CF_IMPL = "cf"; - static final String CF_LIB = "cflib"; - - public static final PropertyDescriptor CONNECTION_FACTORY_IMPL = new PropertyDescriptor.Builder() - .name(CF_IMPL) - .displayName("MQ ConnectionFactory Implementation") - .description("A fully qualified name of the JMS ConnectionFactory implementation " - + "class (i.e., org.apache.activemq.ActiveMQConnectionFactory)") - .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) - .required(true) - .expressionLanguageSupported(true) - .build(); - public static final PropertyDescriptor CLIENT_LIB_DIR_PATH = new PropertyDescriptor.Builder() - .name(CF_LIB) - .displayName("MQ Client Libraries path (i.e., /usr/jms/lib)") - .description("Path to the directory with additional resources (i.e., JARs, configuration files etc.) to be added " - + "to the classpath. Such resources typically represent target MQ client libraries for the " - + "ConnectionFactory implementation.") - .addValidator(new ClientLibValidator()) - .required(true) - .expressionLanguageSupported(true) - .build(); - - // ConnectionFactory specific properties - public static final PropertyDescriptor BROKER_URI = new PropertyDescriptor.Builder() - .name(BROKER) - .displayName("Broker URI") - .description("URI pointing to the network location of the JMS Message broker. For example, " - + "'tcp://myhost:61616' for ActiveMQ or 'myhost:1414' for IBM MQ") - .addValidator(new NonEmptyBrokerURIValidator()) - .required(true) - .expressionLanguageSupported(true) - .build(); - - public static final PropertyDescriptor SSL_CONTEXT_SERVICE = new PropertyDescriptor.Builder() - .name("SSL Context Service") - .description("The SSL Context Service used to provide client certificate information for TLS/SSL connections.") - .required(false) - .identifiesControllerService(SSLContextService.class) - .build(); /** * Returns an instance of the {@link ConnectionFactory} specific to the * target messaging system (i.e., - * org.apache.activemq.ActiveMQConnectionFactory). It is created based on - * the value of the supplied 'CONNECTION_FACTORY_IMPL' property and JMS - * client libraries supplied via 'CLIENT_LIB_DIR_PATH' property. + * org.apache.activemq.ActiveMQConnectionFactory). * * @return instance of {@link ConnectionFactory} */ ConnectionFactory getConnectionFactory(); - /** - * {@link Validator} that ensures that brokerURI's length > 0 after EL evaluation - */ - static class NonEmptyBrokerURIValidator implements Validator { - - @Override - public ValidationResult validate(String subject, String input, ValidationContext context) { - String value = input; - if (context.isExpressionLanguageSupported(subject) && context.isExpressionLanguagePresent(input)) { - value = context.getProperty(BROKER_URI).evaluateAttributeExpressions().getValue(); - } - return StandardValidators.NON_EMPTY_VALIDATOR.validate(subject, value, context); - } - } - - /** - * - */ - static class ClientLibValidator implements Validator { - @Override - public ValidationResult validate(String subject, String input, ValidationContext context) { - String libDirPath = context.getProperty(CLIENT_LIB_DIR_PATH).evaluateAttributeExpressions().getValue(); - StringBuilder invalidationMessageBuilder = new StringBuilder(); - if (libDirPath != null) { - File file = new File(libDirPath); - if (!file.isDirectory()) { - invalidationMessageBuilder.append("'MQ Client Libraries path' must point to a directory. Was '" - + file.getAbsolutePath() + "'."); - } - } else { - invalidationMessageBuilder.append("'MQ Client Libraries path' must be provided. \n"); - } - String invalidationMessage = invalidationMessageBuilder.toString(); - ValidationResult vResult; - if (invalidationMessage.length() == 0) { - vResult = new ValidationResult.Builder().subject(subject).input(input) - .explanation("Client lib path is valid and points to a directory").valid(true).build(); - } else { - vResult = new ValidationResult.Builder().subject(subject).input(input) - .explanation("Client lib path is invalid. " + invalidationMessage) - .valid(false).build(); - } - return vResult; - } - } } http://git-wip-us.apache.org/repos/asf/nifi/blob/6ee6b5e5/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/src/main/java/org/apache/nifi/jms/cf/Utils.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/src/main/java/org/apache/nifi/jms/cf/Utils.java b/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/src/main/java/org/apache/nifi/jms/cf/Utils.java deleted file mode 100644 index cd191c3..0000000 --- a/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/src/main/java/org/apache/nifi/jms/cf/Utils.java +++ /dev/null @@ -1,107 +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.jms.cf; - -import java.io.File; -import java.lang.reflect.Method; -import java.net.URL; -import java.net.URLClassLoader; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - */ -public final class Utils { - - private static final Logger logger = LoggerFactory.getLogger(Utils.class); - - /** - * Creates new instance of the class specified by 'className' by first - * loading it using thread context class loader and then executing default - * constructor. - */ - @SuppressWarnings("unchecked") - static <T> T newDefaultInstance(String className) { - try { - Class<T> clazz = (Class<T>) Class.forName(className, false, Thread.currentThread().getContextClassLoader()); - return clazz.newInstance(); - } catch (Exception e) { - throw new IllegalStateException("Failed to load and/or instantiate class '" + className + "'", e); - } - } - - /** - * Finds a method by name on the target class. If more then one method - * present it will return the first one encountered. - * - * @param name method name - * @param targetClass instance of target class - * @return instance of {@link Method} - */ - public static Method findMethod(String name, Class<?> targetClass) { - Class<?> searchType = targetClass; - while (searchType != null) { - Method[] methods = (searchType.isInterface() ? searchType.getMethods() : searchType.getDeclaredMethods()); - for (Method method : methods) { - if (name.equals(method.getName())) { - return method; - } - } - searchType = searchType.getSuperclass(); - } - return null; - } - - /** - * Adds content of the directory specified with 'path' to the classpath. It - * does so by creating a new instance of the {@link URLClassLoader} using - * {@link URL}s created from listing the contents of the directory denoted - * by 'path' and setting it as thread context class loader. - */ - static void addResourcesToClasspath(String path) { - if (logger.isDebugEnabled()) { - logger.debug("Adding additional resources from '" + path + "' to the classpath."); - } - if (path == null) { - throw new IllegalArgumentException("'path' must not be null"); - } - File libraryDir = new File(path); - if (libraryDir.exists() && libraryDir.isDirectory()) { - String[] cpResourceNames = libraryDir.list(); - URL[] urls = new URL[cpResourceNames.length]; - try { - for (int i = 0; i < urls.length; i++) { - urls[i] = new File(libraryDir, cpResourceNames[i]).toURI().toURL(); - if (logger.isDebugEnabled()) { - logger.debug("Identifying additional resource to the classpath: " + urls[i]); - } - } - } catch (Exception e) { - throw new IllegalStateException( - "Failed to parse user libraries from '" + libraryDir.getAbsolutePath() + "'", e); - } - - URLClassLoader cl = new URLClassLoader(urls, Utils.class.getClassLoader()); - Thread.currentThread().setContextClassLoader(cl); - } else { - throw new IllegalArgumentException("Path '" + libraryDir.getAbsolutePath() - + "' is not valid because it doesn't exist or does not point to a directory."); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/6ee6b5e5/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService b/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService deleted file mode 100644 index f191675..0000000 --- a/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/src/main/resources/META-INF/services/org.apache.nifi.controller.ControllerService +++ /dev/null @@ -1,15 +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. -org.apache.nifi.jms.cf.JMSConnectionFactoryProvider http://git-wip-us.apache.org/repos/asf/nifi/blob/6ee6b5e5/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/src/main/resources/docs/org.apache.nifi.jms.cf.JMSConnectionFactoryProvider/additionalDetails.html ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/src/main/resources/docs/org.apache.nifi.jms.cf.JMSConnectionFactoryProvider/additionalDetails.html b/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/src/main/resources/docs/org.apache.nifi.jms.cf.JMSConnectionFactoryProvider/additionalDetails.html deleted file mode 100644 index d1e1325..0000000 --- a/nifi-nar-bundles/nifi-jms-bundle/nifi-jms-cf-service/src/main/resources/docs/org.apache.nifi.jms.cf.JMSConnectionFactoryProvider/additionalDetails.html +++ /dev/null @@ -1,56 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> - <!-- - 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. - --> - <head> - <meta charset="utf-8" /> - <title>JMSConnectionFactoryProvider</title> - <link rel="stylesheet" href="../../../../../css/component-usage.css" type="text/css" /> - </head> - - <body> - <h2>Description:</h2> - <p> - This ControllerService serves as a general factory service to serving vendor specific - instances of the <i>javax.jms.ConnectionFactory</i>. It does so by allowing user to - configure vendor specific properties as well as point to the location of the vendor - provided JMS client libraries so the correct implementation of the <i>javax.jms.ConnectionFactory</i> - can be found, loaded, instantiated and served to the dependent Processors (see PublishJMS, ConsumeJMS). - </p> - <p> - To accommodate variety of JMS vendors and their implementation of the <i>ConnectionFactory</i> - this ControllerService exposes only 3 static configuration properties that are common across many implementations - of the <i>ConnectionFactory</i>. The rest of the configuration properties are set following - <a href="http://docstore.mik.ua/orelly/java-ent/jnut/ch06_02.htm">Java Beans</a> convention (see below). - </p> - <p> - The 3 static configuration properties are: - <ul> - <li><b>MQ ConnectionFactory Implementation</b> - A fully qualified name of the JMS ConnectionFactory implementation - class (i.e., org.apache.activemq.ActiveMQConnectionFactory)</li> - <li><b>MQ Client Libraries path</b> - Path to the directory with additional resources (i.e., JARs, configuration files etc.) to be added - to the classpath. Such resources typically represent target MQ client libraries for the ConnectionFactory - implementation. It is optional if you are using Apache ActiveMQ since its libraries are distributed with this component.</li> - <li><b>Broker URI</b> - URI pointing to the network location of the JMS Message broker. For example, 'tcp://myhost:61616' for ActiveMQ or simply 'myhost:1414'.</li> - </ul> - The rest of the properties are set as Dynamic Properties following <a href="http://docstore.mik.ua/orelly/java-ent/jnut/ch06_02.htm">Java Beans</a> - convention where a property name is derived from the <i>set*</i> method of the vendor specific ConnectionFactory's implementation. - For example, <i>com.ibm.mq.jms.MQConnectionFactory.setChannel(String)</i> would imply 'channel' property and - <i>com.ibm.mq.jms.MQConnectionFactory.setTransportType(int)</i> would imply 'transportType' property. - For the list of available properties please consult vendor provided documentation. Here is an example for - <a href="https://www-01.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.javadoc.doc/WMQJMSClasses/com/ibm/mq/jms/MQQueueConnectionFactory.html">IBM's com.ibm.mq.jms.MQConnectionFactory</a> - </p> - </body> -</html>
