http://git-wip-us.apache.org/repos/asf/nifi/blob/3a7ddc6a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlProcessorDocumentationWriter.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlProcessorDocumentationWriter.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlProcessorDocumentationWriter.java index 4a15b50..6ac34a2 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlProcessorDocumentationWriter.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/html/HtmlProcessorDocumentationWriter.java @@ -1,256 +1,256 @@ -/* - * 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.documentation.html; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.nifi.annotation.behavior.DynamicRelationship; -import org.apache.nifi.annotation.behavior.ReadsAttribute; -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.components.ConfigurableComponent; -import org.apache.nifi.processor.Processor; -import org.apache.nifi.processor.Relationship; - -/** - * Writes documentation specific for a Processor. This includes everything for a - * ConfigurableComponent as well as Relationship information. - * - * - */ -public class HtmlProcessorDocumentationWriter extends HtmlDocumentationWriter { - - @Override - protected void writeAdditionalBodyInfo(final ConfigurableComponent configurableComponent, - final XMLStreamWriter xmlStreamWriter) throws XMLStreamException { - final Processor processor = (Processor) configurableComponent; - writeRelationships(processor, xmlStreamWriter); - writeDynamicRelationships(processor, xmlStreamWriter); - writeAttributeInfo(processor, xmlStreamWriter); - } - - /** - * Writes all the attributes that a processor says it reads and writes - * - * @param processor the processor to describe - * @param xmlStreamWriter the xml stream writer to use - * @throws XMLStreamException thrown if there was a problem writing the XML - */ - private void writeAttributeInfo(Processor processor, XMLStreamWriter xmlStreamWriter) - throws XMLStreamException { - - handleReadsAttributes(xmlStreamWriter, processor); - handleWritesAttributes(xmlStreamWriter, processor); - } - - private String defaultIfBlank(final String test, final String defaultValue) { - if (test == null || test.trim().isEmpty()) { - return defaultValue; - } - return test; - } - - /** - * Writes out just the attributes that are being read in a table form. - * - * @param xmlStreamWriter the xml stream writer to use - * @param processor the processor to describe - * @throws XMLStreamException xse - */ - private void handleReadsAttributes(XMLStreamWriter xmlStreamWriter, final Processor processor) - throws XMLStreamException { - List<ReadsAttribute> attributesRead = getReadsAttributes(processor); - - writeSimpleElement(xmlStreamWriter, "h3", "Reads Attributes: "); - if (attributesRead.size() > 0) { - xmlStreamWriter.writeStartElement("table"); - xmlStreamWriter.writeAttribute("id", "reads-attributes"); - xmlStreamWriter.writeStartElement("tr"); - writeSimpleElement(xmlStreamWriter, "th", "Name"); - writeSimpleElement(xmlStreamWriter, "th", "Description"); - xmlStreamWriter.writeEndElement(); - for (ReadsAttribute attribute : attributesRead) { - xmlStreamWriter.writeStartElement("tr"); - writeSimpleElement(xmlStreamWriter, "td", - defaultIfBlank(attribute.attribute(), "Not Specified")); - // TODO allow for HTML characters here. - writeSimpleElement(xmlStreamWriter, "td", - defaultIfBlank(attribute.description(), "Not Specified")); - xmlStreamWriter.writeEndElement(); - - } - xmlStreamWriter.writeEndElement(); - - } else { - xmlStreamWriter.writeCharacters("None specified."); - } - } - - /** - * Writes out just the attributes that are being written to in a table form. - * - * @param xmlStreamWriter the xml stream writer to use - * @param processor the processor to describe - * @throws XMLStreamException xse - */ - private void handleWritesAttributes(XMLStreamWriter xmlStreamWriter, final Processor processor) - throws XMLStreamException { - List<WritesAttribute> attributesRead = getWritesAttributes(processor); - - writeSimpleElement(xmlStreamWriter, "h3", "Writes Attributes: "); - if (attributesRead.size() > 0) { - xmlStreamWriter.writeStartElement("table"); - xmlStreamWriter.writeAttribute("id", "writes-attributes"); - xmlStreamWriter.writeStartElement("tr"); - writeSimpleElement(xmlStreamWriter, "th", "Name"); - writeSimpleElement(xmlStreamWriter, "th", "Description"); - xmlStreamWriter.writeEndElement(); - for (WritesAttribute attribute : attributesRead) { - xmlStreamWriter.writeStartElement("tr"); - writeSimpleElement(xmlStreamWriter, "td", - defaultIfBlank(attribute.attribute(), "Not Specified")); - // TODO allow for HTML characters here. - writeSimpleElement(xmlStreamWriter, "td", - defaultIfBlank(attribute.description(), "Not Specified")); - xmlStreamWriter.writeEndElement(); - } - xmlStreamWriter.writeEndElement(); - - } else { - xmlStreamWriter.writeCharacters("None specified."); - } - } - - /** - * Collects the attributes that a processor is reading from. - * - * @param processor the processor to describe - * @return the list of attributes that processor is reading - */ - private List<ReadsAttribute> getReadsAttributes(Processor processor) { - List<ReadsAttribute> attributes = new ArrayList<>(); - - ReadsAttributes readsAttributes = processor.getClass().getAnnotation(ReadsAttributes.class); - if (readsAttributes != null) { - attributes.addAll(Arrays.asList(readsAttributes.value())); - } - - ReadsAttribute readsAttribute = processor.getClass().getAnnotation(ReadsAttribute.class); - if (readsAttribute != null) { - attributes.add(readsAttribute); - } - - return attributes; - } - - /** - * Collects the attributes that a processor is writing to. - * - * @param processor the processor to describe - * @return the list of attributes the processor is writing - */ - private List<WritesAttribute> getWritesAttributes(Processor processor) { - List<WritesAttribute> attributes = new ArrayList<>(); - - WritesAttributes writesAttributes = processor.getClass().getAnnotation(WritesAttributes.class); - if (writesAttributes != null) { - attributes.addAll(Arrays.asList(writesAttributes.value())); - } - - WritesAttribute writeAttribute = processor.getClass().getAnnotation(WritesAttribute.class); - if (writeAttribute != null) { - attributes.add(writeAttribute); - } - - return attributes; - } - - /** - * Writes a table describing the relations a processor has. - * - * @param processor the processor to describe - * @param xmlStreamWriter the stream writer to use - * @throws XMLStreamException thrown if there was a problem writing the xml - */ - private void writeRelationships(final Processor processor, final XMLStreamWriter xmlStreamWriter) - throws XMLStreamException { - - writeSimpleElement(xmlStreamWriter, "h3", "Relationships: "); - - if (processor.getRelationships().size() > 0) { - xmlStreamWriter.writeStartElement("table"); - xmlStreamWriter.writeAttribute("id", "relationships"); - xmlStreamWriter.writeStartElement("tr"); - writeSimpleElement(xmlStreamWriter, "th", "Name"); - writeSimpleElement(xmlStreamWriter, "th", "Description"); - xmlStreamWriter.writeEndElement(); - - for (Relationship relationship : processor.getRelationships()) { - xmlStreamWriter.writeStartElement("tr"); - writeSimpleElement(xmlStreamWriter, "td", relationship.getName()); - writeSimpleElement(xmlStreamWriter, "td", relationship.getDescription()); - xmlStreamWriter.writeEndElement(); - } - xmlStreamWriter.writeEndElement(); - } else { - xmlStreamWriter.writeCharacters("This processor has no relationships."); - } - } - - private void writeDynamicRelationships(final Processor processor, final XMLStreamWriter xmlStreamWriter) throws XMLStreamException { - - List<DynamicRelationship> dynamicRelationships = getDynamicRelationships(processor); - - if (dynamicRelationships.size() > 0) { - writeSimpleElement(xmlStreamWriter, "h3", "Dynamic Relationships: "); - xmlStreamWriter.writeStartElement("p"); - xmlStreamWriter.writeCharacters("A Dynamic Relationship may be created based on how the user configures the Processor."); - xmlStreamWriter.writeStartElement("table"); - xmlStreamWriter.writeAttribute("id", "dynamic-relationships"); - xmlStreamWriter.writeStartElement("tr"); - writeSimpleElement(xmlStreamWriter, "th", "Name"); - writeSimpleElement(xmlStreamWriter, "th", "Description"); - xmlStreamWriter.writeEndElement(); - - for (DynamicRelationship dynamicRelationship : dynamicRelationships) { - xmlStreamWriter.writeStartElement("tr"); - writeSimpleElement(xmlStreamWriter, "td", dynamicRelationship.name()); - writeSimpleElement(xmlStreamWriter, "td", dynamicRelationship.description()); - xmlStreamWriter.writeEndElement(); - } - xmlStreamWriter.writeEndElement(); - xmlStreamWriter.writeEndElement(); - } - } - - private List<DynamicRelationship> getDynamicRelationships(Processor processor) { - List<DynamicRelationship> results = new ArrayList<>(); - - DynamicRelationship dynamicRelationships = processor.getClass().getAnnotation(DynamicRelationship.class); - if (dynamicRelationships != null) { - results.add(dynamicRelationships); - } - - return results; - } -} +/* + * 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.documentation.html; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamWriter; + +import org.apache.nifi.annotation.behavior.DynamicRelationship; +import org.apache.nifi.annotation.behavior.ReadsAttribute; +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.components.ConfigurableComponent; +import org.apache.nifi.processor.Processor; +import org.apache.nifi.processor.Relationship; + +/** + * Writes documentation specific for a Processor. This includes everything for a + * ConfigurableComponent as well as Relationship information. + * + * + */ +public class HtmlProcessorDocumentationWriter extends HtmlDocumentationWriter { + + @Override + protected void writeAdditionalBodyInfo(final ConfigurableComponent configurableComponent, + final XMLStreamWriter xmlStreamWriter) throws XMLStreamException { + final Processor processor = (Processor) configurableComponent; + writeRelationships(processor, xmlStreamWriter); + writeDynamicRelationships(processor, xmlStreamWriter); + writeAttributeInfo(processor, xmlStreamWriter); + } + + /** + * Writes all the attributes that a processor says it reads and writes + * + * @param processor the processor to describe + * @param xmlStreamWriter the xml stream writer to use + * @throws XMLStreamException thrown if there was a problem writing the XML + */ + private void writeAttributeInfo(Processor processor, XMLStreamWriter xmlStreamWriter) + throws XMLStreamException { + + handleReadsAttributes(xmlStreamWriter, processor); + handleWritesAttributes(xmlStreamWriter, processor); + } + + private String defaultIfBlank(final String test, final String defaultValue) { + if (test == null || test.trim().isEmpty()) { + return defaultValue; + } + return test; + } + + /** + * Writes out just the attributes that are being read in a table form. + * + * @param xmlStreamWriter the xml stream writer to use + * @param processor the processor to describe + * @throws XMLStreamException xse + */ + private void handleReadsAttributes(XMLStreamWriter xmlStreamWriter, final Processor processor) + throws XMLStreamException { + List<ReadsAttribute> attributesRead = getReadsAttributes(processor); + + writeSimpleElement(xmlStreamWriter, "h3", "Reads Attributes: "); + if (attributesRead.size() > 0) { + xmlStreamWriter.writeStartElement("table"); + xmlStreamWriter.writeAttribute("id", "reads-attributes"); + xmlStreamWriter.writeStartElement("tr"); + writeSimpleElement(xmlStreamWriter, "th", "Name"); + writeSimpleElement(xmlStreamWriter, "th", "Description"); + xmlStreamWriter.writeEndElement(); + for (ReadsAttribute attribute : attributesRead) { + xmlStreamWriter.writeStartElement("tr"); + writeSimpleElement(xmlStreamWriter, "td", + defaultIfBlank(attribute.attribute(), "Not Specified")); + // TODO allow for HTML characters here. + writeSimpleElement(xmlStreamWriter, "td", + defaultIfBlank(attribute.description(), "Not Specified")); + xmlStreamWriter.writeEndElement(); + + } + xmlStreamWriter.writeEndElement(); + + } else { + xmlStreamWriter.writeCharacters("None specified."); + } + } + + /** + * Writes out just the attributes that are being written to in a table form. + * + * @param xmlStreamWriter the xml stream writer to use + * @param processor the processor to describe + * @throws XMLStreamException xse + */ + private void handleWritesAttributes(XMLStreamWriter xmlStreamWriter, final Processor processor) + throws XMLStreamException { + List<WritesAttribute> attributesRead = getWritesAttributes(processor); + + writeSimpleElement(xmlStreamWriter, "h3", "Writes Attributes: "); + if (attributesRead.size() > 0) { + xmlStreamWriter.writeStartElement("table"); + xmlStreamWriter.writeAttribute("id", "writes-attributes"); + xmlStreamWriter.writeStartElement("tr"); + writeSimpleElement(xmlStreamWriter, "th", "Name"); + writeSimpleElement(xmlStreamWriter, "th", "Description"); + xmlStreamWriter.writeEndElement(); + for (WritesAttribute attribute : attributesRead) { + xmlStreamWriter.writeStartElement("tr"); + writeSimpleElement(xmlStreamWriter, "td", + defaultIfBlank(attribute.attribute(), "Not Specified")); + // TODO allow for HTML characters here. + writeSimpleElement(xmlStreamWriter, "td", + defaultIfBlank(attribute.description(), "Not Specified")); + xmlStreamWriter.writeEndElement(); + } + xmlStreamWriter.writeEndElement(); + + } else { + xmlStreamWriter.writeCharacters("None specified."); + } + } + + /** + * Collects the attributes that a processor is reading from. + * + * @param processor the processor to describe + * @return the list of attributes that processor is reading + */ + private List<ReadsAttribute> getReadsAttributes(Processor processor) { + List<ReadsAttribute> attributes = new ArrayList<>(); + + ReadsAttributes readsAttributes = processor.getClass().getAnnotation(ReadsAttributes.class); + if (readsAttributes != null) { + attributes.addAll(Arrays.asList(readsAttributes.value())); + } + + ReadsAttribute readsAttribute = processor.getClass().getAnnotation(ReadsAttribute.class); + if (readsAttribute != null) { + attributes.add(readsAttribute); + } + + return attributes; + } + + /** + * Collects the attributes that a processor is writing to. + * + * @param processor the processor to describe + * @return the list of attributes the processor is writing + */ + private List<WritesAttribute> getWritesAttributes(Processor processor) { + List<WritesAttribute> attributes = new ArrayList<>(); + + WritesAttributes writesAttributes = processor.getClass().getAnnotation(WritesAttributes.class); + if (writesAttributes != null) { + attributes.addAll(Arrays.asList(writesAttributes.value())); + } + + WritesAttribute writeAttribute = processor.getClass().getAnnotation(WritesAttribute.class); + if (writeAttribute != null) { + attributes.add(writeAttribute); + } + + return attributes; + } + + /** + * Writes a table describing the relations a processor has. + * + * @param processor the processor to describe + * @param xmlStreamWriter the stream writer to use + * @throws XMLStreamException thrown if there was a problem writing the xml + */ + private void writeRelationships(final Processor processor, final XMLStreamWriter xmlStreamWriter) + throws XMLStreamException { + + writeSimpleElement(xmlStreamWriter, "h3", "Relationships: "); + + if (processor.getRelationships().size() > 0) { + xmlStreamWriter.writeStartElement("table"); + xmlStreamWriter.writeAttribute("id", "relationships"); + xmlStreamWriter.writeStartElement("tr"); + writeSimpleElement(xmlStreamWriter, "th", "Name"); + writeSimpleElement(xmlStreamWriter, "th", "Description"); + xmlStreamWriter.writeEndElement(); + + for (Relationship relationship : processor.getRelationships()) { + xmlStreamWriter.writeStartElement("tr"); + writeSimpleElement(xmlStreamWriter, "td", relationship.getName()); + writeSimpleElement(xmlStreamWriter, "td", relationship.getDescription()); + xmlStreamWriter.writeEndElement(); + } + xmlStreamWriter.writeEndElement(); + } else { + xmlStreamWriter.writeCharacters("This processor has no relationships."); + } + } + + private void writeDynamicRelationships(final Processor processor, final XMLStreamWriter xmlStreamWriter) throws XMLStreamException { + + List<DynamicRelationship> dynamicRelationships = getDynamicRelationships(processor); + + if (dynamicRelationships.size() > 0) { + writeSimpleElement(xmlStreamWriter, "h3", "Dynamic Relationships: "); + xmlStreamWriter.writeStartElement("p"); + xmlStreamWriter.writeCharacters("A Dynamic Relationship may be created based on how the user configures the Processor."); + xmlStreamWriter.writeStartElement("table"); + xmlStreamWriter.writeAttribute("id", "dynamic-relationships"); + xmlStreamWriter.writeStartElement("tr"); + writeSimpleElement(xmlStreamWriter, "th", "Name"); + writeSimpleElement(xmlStreamWriter, "th", "Description"); + xmlStreamWriter.writeEndElement(); + + for (DynamicRelationship dynamicRelationship : dynamicRelationships) { + xmlStreamWriter.writeStartElement("tr"); + writeSimpleElement(xmlStreamWriter, "td", dynamicRelationship.name()); + writeSimpleElement(xmlStreamWriter, "td", dynamicRelationship.description()); + xmlStreamWriter.writeEndElement(); + } + xmlStreamWriter.writeEndElement(); + xmlStreamWriter.writeEndElement(); + } + } + + private List<DynamicRelationship> getDynamicRelationships(Processor processor) { + List<DynamicRelationship> results = new ArrayList<>(); + + DynamicRelationship dynamicRelationships = processor.getClass().getAnnotation(DynamicRelationship.class); + if (dynamicRelationships != null) { + results.add(dynamicRelationships); + } + + return results; + } +}
http://git-wip-us.apache.org/repos/asf/nifi/blob/3a7ddc6a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ControllerServiceInitializer.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ControllerServiceInitializer.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ControllerServiceInitializer.java index 441033c..6525280 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ControllerServiceInitializer.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ControllerServiceInitializer.java @@ -1,57 +1,57 @@ -/* - * 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.documentation.init; - -import org.apache.nifi.annotation.lifecycle.OnShutdown; -import org.apache.nifi.components.ConfigurableComponent; -import org.apache.nifi.controller.ControllerService; -import org.apache.nifi.documentation.ConfigurableComponentInitializer; -import org.apache.nifi.documentation.mock.MockConfigurationContext; -import org.apache.nifi.documentation.mock.MockControllerServiceInitializationContext; -import org.apache.nifi.documentation.mock.MockProcessorLogger; -import org.apache.nifi.documentation.util.ReflectionUtils; -import org.apache.nifi.logging.ProcessorLog; -import org.apache.nifi.nar.NarCloseable; -import org.apache.nifi.reporting.InitializationException; - -/** - * Initializes a ControllerService using a MockControllerServiceInitializationContext - * - * - */ -public class ControllerServiceInitializer implements ConfigurableComponentInitializer { - - @Override - public void initialize(ConfigurableComponent component) throws InitializationException { - ControllerService controllerService = (ControllerService) component; - - try (NarCloseable narCloseable = NarCloseable.withNarLoader()) { - controllerService.initialize(new MockControllerServiceInitializationContext()); - } - } - - @Override - public void teardown(ConfigurableComponent component) { - try (NarCloseable narCloseable = NarCloseable.withNarLoader()) { - ControllerService controllerService = (ControllerService) component; - - final ProcessorLog logger = new MockProcessorLogger(); - final MockConfigurationContext context = new MockConfigurationContext(); - ReflectionUtils.quietlyInvokeMethodsWithAnnotations(OnShutdown.class, org.apache.nifi.processor.annotation.OnShutdown.class, controllerService, logger, context); - } - } -} +/* + * 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.documentation.init; + +import org.apache.nifi.annotation.lifecycle.OnShutdown; +import org.apache.nifi.components.ConfigurableComponent; +import org.apache.nifi.controller.ControllerService; +import org.apache.nifi.documentation.ConfigurableComponentInitializer; +import org.apache.nifi.documentation.mock.MockConfigurationContext; +import org.apache.nifi.documentation.mock.MockControllerServiceInitializationContext; +import org.apache.nifi.documentation.mock.MockProcessorLogger; +import org.apache.nifi.documentation.util.ReflectionUtils; +import org.apache.nifi.logging.ProcessorLog; +import org.apache.nifi.nar.NarCloseable; +import org.apache.nifi.reporting.InitializationException; + +/** + * Initializes a ControllerService using a MockControllerServiceInitializationContext + * + * + */ +public class ControllerServiceInitializer implements ConfigurableComponentInitializer { + + @Override + public void initialize(ConfigurableComponent component) throws InitializationException { + ControllerService controllerService = (ControllerService) component; + + try (NarCloseable narCloseable = NarCloseable.withNarLoader()) { + controllerService.initialize(new MockControllerServiceInitializationContext()); + } + } + + @Override + public void teardown(ConfigurableComponent component) { + try (NarCloseable narCloseable = NarCloseable.withNarLoader()) { + ControllerService controllerService = (ControllerService) component; + + final ProcessorLog logger = new MockProcessorLogger(); + final MockConfigurationContext context = new MockConfigurationContext(); + ReflectionUtils.quietlyInvokeMethodsWithAnnotations(OnShutdown.class, org.apache.nifi.processor.annotation.OnShutdown.class, controllerService, logger, context); + } + } +} http://git-wip-us.apache.org/repos/asf/nifi/blob/3a7ddc6a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ProcessorInitializer.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ProcessorInitializer.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ProcessorInitializer.java index 7a0752d..00669ce 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ProcessorInitializer.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ProcessorInitializer.java @@ -1,55 +1,55 @@ -/* - * 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.documentation.init; - -import org.apache.nifi.annotation.lifecycle.OnShutdown; -import org.apache.nifi.components.ConfigurableComponent; -import org.apache.nifi.documentation.ConfigurableComponentInitializer; -import org.apache.nifi.documentation.mock.MockProcessContext; -import org.apache.nifi.documentation.mock.MockProcessorInitializationContext; -import org.apache.nifi.documentation.mock.MockProcessorLogger; -import org.apache.nifi.documentation.util.ReflectionUtils; -import org.apache.nifi.logging.ProcessorLog; -import org.apache.nifi.nar.NarCloseable; -import org.apache.nifi.processor.Processor; - -/** - * Initializes a Procesor using a MockProcessorInitializationContext - * - * - */ -public class ProcessorInitializer implements ConfigurableComponentInitializer { - - @Override - public void initialize(ConfigurableComponent component) { - Processor processor = (Processor) component; - try (NarCloseable narCloseable = NarCloseable.withNarLoader()) { - processor.initialize(new MockProcessorInitializationContext()); - } - } - - @Override - public void teardown(ConfigurableComponent component) { - Processor processor = (Processor) component; - try (NarCloseable narCloseable = NarCloseable.withNarLoader()) { - - final ProcessorLog logger = new MockProcessorLogger(); - final MockProcessContext context = new MockProcessContext(); - ReflectionUtils.quietlyInvokeMethodsWithAnnotations(OnShutdown.class, org.apache.nifi.processor.annotation.OnShutdown.class, processor, logger, context); - } - } -} +/* + * 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.documentation.init; + +import org.apache.nifi.annotation.lifecycle.OnShutdown; +import org.apache.nifi.components.ConfigurableComponent; +import org.apache.nifi.documentation.ConfigurableComponentInitializer; +import org.apache.nifi.documentation.mock.MockProcessContext; +import org.apache.nifi.documentation.mock.MockProcessorInitializationContext; +import org.apache.nifi.documentation.mock.MockProcessorLogger; +import org.apache.nifi.documentation.util.ReflectionUtils; +import org.apache.nifi.logging.ProcessorLog; +import org.apache.nifi.nar.NarCloseable; +import org.apache.nifi.processor.Processor; + +/** + * Initializes a Procesor using a MockProcessorInitializationContext + * + * + */ +public class ProcessorInitializer implements ConfigurableComponentInitializer { + + @Override + public void initialize(ConfigurableComponent component) { + Processor processor = (Processor) component; + try (NarCloseable narCloseable = NarCloseable.withNarLoader()) { + processor.initialize(new MockProcessorInitializationContext()); + } + } + + @Override + public void teardown(ConfigurableComponent component) { + Processor processor = (Processor) component; + try (NarCloseable narCloseable = NarCloseable.withNarLoader()) { + + final ProcessorLog logger = new MockProcessorLogger(); + final MockProcessContext context = new MockProcessContext(); + ReflectionUtils.quietlyInvokeMethodsWithAnnotations(OnShutdown.class, org.apache.nifi.processor.annotation.OnShutdown.class, processor, logger, context); + } + } +} http://git-wip-us.apache.org/repos/asf/nifi/blob/3a7ddc6a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ReportingTaskingInitializer.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ReportingTaskingInitializer.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ReportingTaskingInitializer.java index e9642e3..171f1d9 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ReportingTaskingInitializer.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/init/ReportingTaskingInitializer.java @@ -1,54 +1,54 @@ -/* - * 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.documentation.init; - -import org.apache.nifi.annotation.lifecycle.OnShutdown; -import org.apache.nifi.components.ConfigurableComponent; -import org.apache.nifi.documentation.ConfigurableComponentInitializer; -import org.apache.nifi.documentation.mock.MockConfigurationContext; -import org.apache.nifi.documentation.mock.MockProcessorLogger; -import org.apache.nifi.documentation.mock.MockReportingInitializationContext; -import org.apache.nifi.documentation.util.ReflectionUtils; -import org.apache.nifi.nar.NarCloseable; -import org.apache.nifi.reporting.InitializationException; -import org.apache.nifi.reporting.ReportingTask; - -/** - * Initializes a ReportingTask using a MockReportingInitializationContext; - * - * - */ -public class ReportingTaskingInitializer implements ConfigurableComponentInitializer { - - @Override - public void initialize(ConfigurableComponent component) throws InitializationException { - ReportingTask reportingTask = (ReportingTask) component; - try (NarCloseable narCloseable = NarCloseable.withNarLoader()) { - reportingTask.initialize(new MockReportingInitializationContext()); - } - } - - @Override - public void teardown(ConfigurableComponent component) { - ReportingTask reportingTask = (ReportingTask) component; - try (NarCloseable narCloseable = NarCloseable.withNarLoader()) { - - final MockConfigurationContext context = new MockConfigurationContext(); - ReflectionUtils.quietlyInvokeMethodsWithAnnotations(OnShutdown.class, org.apache.nifi.processor.annotation.OnShutdown.class, reportingTask, new MockProcessorLogger(), context); - } - } -} +/* + * 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.documentation.init; + +import org.apache.nifi.annotation.lifecycle.OnShutdown; +import org.apache.nifi.components.ConfigurableComponent; +import org.apache.nifi.documentation.ConfigurableComponentInitializer; +import org.apache.nifi.documentation.mock.MockConfigurationContext; +import org.apache.nifi.documentation.mock.MockProcessorLogger; +import org.apache.nifi.documentation.mock.MockReportingInitializationContext; +import org.apache.nifi.documentation.util.ReflectionUtils; +import org.apache.nifi.nar.NarCloseable; +import org.apache.nifi.reporting.InitializationException; +import org.apache.nifi.reporting.ReportingTask; + +/** + * Initializes a ReportingTask using a MockReportingInitializationContext; + * + * + */ +public class ReportingTaskingInitializer implements ConfigurableComponentInitializer { + + @Override + public void initialize(ConfigurableComponent component) throws InitializationException { + ReportingTask reportingTask = (ReportingTask) component; + try (NarCloseable narCloseable = NarCloseable.withNarLoader()) { + reportingTask.initialize(new MockReportingInitializationContext()); + } + } + + @Override + public void teardown(ConfigurableComponent component) { + ReportingTask reportingTask = (ReportingTask) component; + try (NarCloseable narCloseable = NarCloseable.withNarLoader()) { + + final MockConfigurationContext context = new MockConfigurationContext(); + ReflectionUtils.quietlyInvokeMethodsWithAnnotations(OnShutdown.class, org.apache.nifi.processor.annotation.OnShutdown.class, reportingTask, new MockProcessorLogger(), context); + } + } +} http://git-wip-us.apache.org/repos/asf/nifi/blob/3a7ddc6a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockConfigurationContext.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockConfigurationContext.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockConfigurationContext.java index 6c9ec9d..b8d4a9f 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockConfigurationContext.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockConfigurationContext.java @@ -1,48 +1,48 @@ -/* - * 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.documentation.mock; - -import java.util.Collections; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.apache.nifi.components.PropertyDescriptor; -import org.apache.nifi.components.PropertyValue; -import org.apache.nifi.controller.ConfigurationContext; - -public class MockConfigurationContext implements ConfigurationContext { - - @Override - public PropertyValue getProperty(PropertyDescriptor property) { - return null; - } - - @Override - public Map<PropertyDescriptor, String> getProperties() { - return Collections.emptyMap(); - } - - @Override - public String getSchedulingPeriod() { - return "0 secs"; - } - - @Override - public Long getSchedulingPeriod(final TimeUnit timeUnit) { - return 0L; - } -} +/* + * 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.documentation.mock; + +import java.util.Collections; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.PropertyValue; +import org.apache.nifi.controller.ConfigurationContext; + +public class MockConfigurationContext implements ConfigurationContext { + + @Override + public PropertyValue getProperty(PropertyDescriptor property) { + return null; + } + + @Override + public Map<PropertyDescriptor, String> getProperties() { + return Collections.emptyMap(); + } + + @Override + public String getSchedulingPeriod() { + return "0 secs"; + } + + @Override + public Long getSchedulingPeriod(final TimeUnit timeUnit) { + return 0L; + } +} http://git-wip-us.apache.org/repos/asf/nifi/blob/3a7ddc6a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockControllerServiceInitializationContext.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockControllerServiceInitializationContext.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockControllerServiceInitializationContext.java index 14076a3..56216aa 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockControllerServiceInitializationContext.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockControllerServiceInitializationContext.java @@ -1,46 +1,46 @@ -/* - * 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.documentation.mock; - -import org.apache.nifi.controller.ControllerServiceInitializationContext; -import org.apache.nifi.controller.ControllerServiceLookup; -import org.apache.nifi.logging.ComponentLog; - -/** - * A Mock ControllerServiceInitializationContext so that ControllerServices can - * be initialized for the purpose of generating documentation. - * - * - */ -public class MockControllerServiceInitializationContext implements ControllerServiceInitializationContext { - - @Override - public String getIdentifier() { - return "mock-controller-service"; - } - - @Override - public ControllerServiceLookup getControllerServiceLookup() { - return new MockControllerServiceLookup(); - } - - @Override - public ComponentLog getLogger() { - return new MockProcessorLogger(); - } - -} +/* + * 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.documentation.mock; + +import org.apache.nifi.controller.ControllerServiceInitializationContext; +import org.apache.nifi.controller.ControllerServiceLookup; +import org.apache.nifi.logging.ComponentLog; + +/** + * A Mock ControllerServiceInitializationContext so that ControllerServices can + * be initialized for the purpose of generating documentation. + * + * + */ +public class MockControllerServiceInitializationContext implements ControllerServiceInitializationContext { + + @Override + public String getIdentifier() { + return "mock-controller-service"; + } + + @Override + public ControllerServiceLookup getControllerServiceLookup() { + return new MockControllerServiceLookup(); + } + + @Override + public ComponentLog getLogger() { + return new MockProcessorLogger(); + } + +} http://git-wip-us.apache.org/repos/asf/nifi/blob/3a7ddc6a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockControllerServiceLookup.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockControllerServiceLookup.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockControllerServiceLookup.java index 5c60881..17d5527 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockControllerServiceLookup.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockControllerServiceLookup.java @@ -1,65 +1,65 @@ -/* - * 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.documentation.mock; - -import java.util.Collections; -import java.util.Set; - -import org.apache.nifi.controller.ControllerService; -import org.apache.nifi.controller.ControllerServiceLookup; - -/** - * A Mock ControllerServiceLookup that can be used so that - * ConfigurableComponents can be initialized for the purpose of generating - * documentation - * - * - */ -public class MockControllerServiceLookup implements ControllerServiceLookup { - - @Override - public ControllerService getControllerService(String serviceIdentifier) { - return null; - } - - @Override - public boolean isControllerServiceEnabled(String serviceIdentifier) { - return false; - } - - @Override - public boolean isControllerServiceEnabled(ControllerService service) { - return false; - } - - @Override - public Set<String> getControllerServiceIdentifiers(Class<? extends ControllerService> serviceType) - throws IllegalArgumentException { - return Collections.emptySet(); - } - - @Override - public boolean isControllerServiceEnabling(String serviceIdentifier) { - return false; - } - - @Override - public String getControllerServiceName(String serviceIdentifier) { - return serviceIdentifier; - } - -} +/* + * 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.documentation.mock; + +import java.util.Collections; +import java.util.Set; + +import org.apache.nifi.controller.ControllerService; +import org.apache.nifi.controller.ControllerServiceLookup; + +/** + * A Mock ControllerServiceLookup that can be used so that + * ConfigurableComponents can be initialized for the purpose of generating + * documentation + * + * + */ +public class MockControllerServiceLookup implements ControllerServiceLookup { + + @Override + public ControllerService getControllerService(String serviceIdentifier) { + return null; + } + + @Override + public boolean isControllerServiceEnabled(String serviceIdentifier) { + return false; + } + + @Override + public boolean isControllerServiceEnabled(ControllerService service) { + return false; + } + + @Override + public Set<String> getControllerServiceIdentifiers(Class<? extends ControllerService> serviceType) + throws IllegalArgumentException { + return Collections.emptySet(); + } + + @Override + public boolean isControllerServiceEnabling(String serviceIdentifier) { + return false; + } + + @Override + public String getControllerServiceName(String serviceIdentifier) { + return serviceIdentifier; + } + +} http://git-wip-us.apache.org/repos/asf/nifi/blob/3a7ddc6a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessContext.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessContext.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessContext.java index 38c9fc9..c5ec0e2 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessContext.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessContext.java @@ -1,102 +1,102 @@ -/* - * 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.documentation.mock; - -import java.util.Collections; -import java.util.Map; -import java.util.Set; - -import org.apache.nifi.components.PropertyDescriptor; -import org.apache.nifi.components.PropertyValue; -import org.apache.nifi.controller.ControllerServiceLookup; -import org.apache.nifi.processor.ProcessContext; -import org.apache.nifi.processor.Relationship; - -public class MockProcessContext implements ProcessContext { - - @Override - public PropertyValue getProperty(PropertyDescriptor descriptor) { - return null; - } - - @Override - public PropertyValue getProperty(String propertyName) { - return null; - } - - @Override - public PropertyValue newPropertyValue(String rawValue) { - return null; - } - - @Override - public void yield() { - - } - - @Override - public int getMaxConcurrentTasks() { - return 0; - } - - @Override - public String getAnnotationData() { - return ""; - } - - @Override - public Map<PropertyDescriptor, String> getProperties() { - return Collections.emptyMap(); - } - - @Override - public String encrypt(String unencrypted) { - return unencrypted; - } - - @Override - public String decrypt(String encrypted) { - return encrypted; - } - - @Override - public ControllerServiceLookup getControllerServiceLookup() { - return new MockControllerServiceLookup(); - } - - @Override - public Set<Relationship> getAvailableRelationships() { - return Collections.emptySet(); - } - - @Override - public boolean hasIncomingConnection() { - return true; - } - - @Override - public boolean hasNonLoopConnection() { - return true; - } - - @Override - public boolean hasConnection(Relationship relationship) { - return false; - } - - -} +/* + * 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.documentation.mock; + +import java.util.Collections; +import java.util.Map; +import java.util.Set; + +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.PropertyValue; +import org.apache.nifi.controller.ControllerServiceLookup; +import org.apache.nifi.processor.ProcessContext; +import org.apache.nifi.processor.Relationship; + +public class MockProcessContext implements ProcessContext { + + @Override + public PropertyValue getProperty(PropertyDescriptor descriptor) { + return null; + } + + @Override + public PropertyValue getProperty(String propertyName) { + return null; + } + + @Override + public PropertyValue newPropertyValue(String rawValue) { + return null; + } + + @Override + public void yield() { + + } + + @Override + public int getMaxConcurrentTasks() { + return 0; + } + + @Override + public String getAnnotationData() { + return ""; + } + + @Override + public Map<PropertyDescriptor, String> getProperties() { + return Collections.emptyMap(); + } + + @Override + public String encrypt(String unencrypted) { + return unencrypted; + } + + @Override + public String decrypt(String encrypted) { + return encrypted; + } + + @Override + public ControllerServiceLookup getControllerServiceLookup() { + return new MockControllerServiceLookup(); + } + + @Override + public Set<Relationship> getAvailableRelationships() { + return Collections.emptySet(); + } + + @Override + public boolean hasIncomingConnection() { + return true; + } + + @Override + public boolean hasNonLoopConnection() { + return true; + } + + @Override + public boolean hasConnection(Relationship relationship) { + return false; + } + + +} http://git-wip-us.apache.org/repos/asf/nifi/blob/3a7ddc6a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessorInitializationContext.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessorInitializationContext.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessorInitializationContext.java index 2b6ccc2..fda94a2 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessorInitializationContext.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessorInitializationContext.java @@ -1,45 +1,45 @@ -/* - * 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.documentation.mock; - -import org.apache.nifi.controller.ControllerServiceLookup; -import org.apache.nifi.logging.ProcessorLog; -import org.apache.nifi.processor.ProcessorInitializationContext; - -/** - * A Mock ProcessorInitializationContext that can be used so that Processors can - * be initialized for the purpose of generating documentation. - * - * - */ -public class MockProcessorInitializationContext implements ProcessorInitializationContext { - - @Override - public String getIdentifier() { - return "mock-processor"; - } - - @Override - public ProcessorLog getLogger() { - return new MockProcessorLogger(); - } - - @Override - public ControllerServiceLookup getControllerServiceLookup() { - return new MockControllerServiceLookup(); - } -} +/* + * 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.documentation.mock; + +import org.apache.nifi.controller.ControllerServiceLookup; +import org.apache.nifi.logging.ProcessorLog; +import org.apache.nifi.processor.ProcessorInitializationContext; + +/** + * A Mock ProcessorInitializationContext that can be used so that Processors can + * be initialized for the purpose of generating documentation. + * + * + */ +public class MockProcessorInitializationContext implements ProcessorInitializationContext { + + @Override + public String getIdentifier() { + return "mock-processor"; + } + + @Override + public ProcessorLog getLogger() { + return new MockProcessorLogger(); + } + + @Override + public ControllerServiceLookup getControllerServiceLookup() { + return new MockControllerServiceLookup(); + } +} http://git-wip-us.apache.org/repos/asf/nifi/blob/3a7ddc6a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessorLogger.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessorLogger.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessorLogger.java index 82a5f8b..f91e87c 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessorLogger.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockProcessorLogger.java @@ -1,169 +1,169 @@ -/* - * 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.documentation.mock; - -import org.apache.nifi.logging.ProcessorLog; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Stubs out the functionality of a ProcessorLog/ComponentLog so that it can - * be used during initialization of a component. - * - */ -public class MockProcessorLogger implements ProcessorLog { - - private static final Logger logger = LoggerFactory - .getLogger(MockProcessorLogger.class); - - @Override - public void warn(String msg, Throwable t) { - logger.warn(msg, t); - } - - @Override - public void warn(String msg, Object[] os) { - logger.warn(msg, os); - } - - @Override - public void warn(String msg, Object[] os, Throwable t) { - logger.warn(msg, os); - logger.warn("", t); - } - - @Override - public void warn(String msg) { - logger.warn(msg); - } - - @Override - public void trace(String msg, Throwable t) { - logger.trace(msg, t); - } - - @Override - public void trace(String msg, Object[] os) { - logger.trace(msg, os); - } - - @Override - public void trace(String msg) { - logger.trace(msg); - } - - @Override - public void trace(String msg, Object[] os, Throwable t) { - logger.trace(msg, os); - logger.trace("", t); - } - - @Override - public boolean isWarnEnabled() { - return logger.isWarnEnabled(); - } - - @Override - public boolean isTraceEnabled() { - return logger.isTraceEnabled(); - } - - @Override - public boolean isInfoEnabled() { - return logger.isInfoEnabled(); - } - - @Override - public boolean isErrorEnabled() { - return logger.isErrorEnabled(); - } - - @Override - public boolean isDebugEnabled() { - return logger.isDebugEnabled(); - } - - @Override - public void info(String msg, Throwable t) { - logger.info(msg, t); - } - - @Override - public void info(String msg, Object[] os) { - logger.info(msg, os); - } - - @Override - public void info(String msg) { - logger.info(msg); - - } - - @Override - public void info(String msg, Object[] os, Throwable t) { - logger.trace(msg, os); - logger.trace("", t); - - } - - @Override - public String getName() { - return logger.getName(); - } - - @Override - public void error(String msg, Throwable t) { - logger.error(msg, t); - } - - @Override - public void error(String msg, Object[] os) { - logger.error(msg, os); - } - - @Override - public void error(String msg) { - logger.error(msg); - } - - @Override - public void error(String msg, Object[] os, Throwable t) { - logger.error(msg, os); - logger.error("", t); - } - - @Override - public void debug(String msg, Throwable t) { - logger.debug(msg, t); - } - - @Override - public void debug(String msg, Object[] os) { - logger.debug(msg, os); - } - - @Override - public void debug(String msg, Object[] os, Throwable t) { - logger.debug(msg, os); - logger.debug("", t); - } - - @Override - public void debug(String msg) { - logger.debug(msg); - } -} +/* + * 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.documentation.mock; + +import org.apache.nifi.logging.ProcessorLog; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Stubs out the functionality of a ProcessorLog/ComponentLog so that it can + * be used during initialization of a component. + * + */ +public class MockProcessorLogger implements ProcessorLog { + + private static final Logger logger = LoggerFactory + .getLogger(MockProcessorLogger.class); + + @Override + public void warn(String msg, Throwable t) { + logger.warn(msg, t); + } + + @Override + public void warn(String msg, Object[] os) { + logger.warn(msg, os); + } + + @Override + public void warn(String msg, Object[] os, Throwable t) { + logger.warn(msg, os); + logger.warn("", t); + } + + @Override + public void warn(String msg) { + logger.warn(msg); + } + + @Override + public void trace(String msg, Throwable t) { + logger.trace(msg, t); + } + + @Override + public void trace(String msg, Object[] os) { + logger.trace(msg, os); + } + + @Override + public void trace(String msg) { + logger.trace(msg); + } + + @Override + public void trace(String msg, Object[] os, Throwable t) { + logger.trace(msg, os); + logger.trace("", t); + } + + @Override + public boolean isWarnEnabled() { + return logger.isWarnEnabled(); + } + + @Override + public boolean isTraceEnabled() { + return logger.isTraceEnabled(); + } + + @Override + public boolean isInfoEnabled() { + return logger.isInfoEnabled(); + } + + @Override + public boolean isErrorEnabled() { + return logger.isErrorEnabled(); + } + + @Override + public boolean isDebugEnabled() { + return logger.isDebugEnabled(); + } + + @Override + public void info(String msg, Throwable t) { + logger.info(msg, t); + } + + @Override + public void info(String msg, Object[] os) { + logger.info(msg, os); + } + + @Override + public void info(String msg) { + logger.info(msg); + + } + + @Override + public void info(String msg, Object[] os, Throwable t) { + logger.trace(msg, os); + logger.trace("", t); + + } + + @Override + public String getName() { + return logger.getName(); + } + + @Override + public void error(String msg, Throwable t) { + logger.error(msg, t); + } + + @Override + public void error(String msg, Object[] os) { + logger.error(msg, os); + } + + @Override + public void error(String msg) { + logger.error(msg); + } + + @Override + public void error(String msg, Object[] os, Throwable t) { + logger.error(msg, os); + logger.error("", t); + } + + @Override + public void debug(String msg, Throwable t) { + logger.debug(msg, t); + } + + @Override + public void debug(String msg, Object[] os) { + logger.debug(msg, os); + } + + @Override + public void debug(String msg, Object[] os, Throwable t) { + logger.debug(msg, os); + logger.debug("", t); + } + + @Override + public void debug(String msg) { + logger.debug(msg); + } +} http://git-wip-us.apache.org/repos/asf/nifi/blob/3a7ddc6a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockReportingInitializationContext.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockReportingInitializationContext.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockReportingInitializationContext.java index 9d0db64..abaa766 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockReportingInitializationContext.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-documentation/src/main/java/org/apache/nifi/documentation/mock/MockReportingInitializationContext.java @@ -1,67 +1,67 @@ -/* - * 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.documentation.mock; - -import java.util.concurrent.TimeUnit; - -import org.apache.nifi.controller.ControllerServiceLookup; -import org.apache.nifi.logging.ComponentLog; -import org.apache.nifi.reporting.ReportingInitializationContext; -import org.apache.nifi.scheduling.SchedulingStrategy; - -/** - * A Mock ReportingInitializationContext that can be used to initialize a - * ReportingTask for the purposes of documentation generation. - * - */ -public class MockReportingInitializationContext implements ReportingInitializationContext { - - @Override - public String getIdentifier() { - return "mock-reporting-task"; - } - - @Override - public String getName() { - return ""; - } - - @Override - public long getSchedulingPeriod(TimeUnit timeUnit) { - return 0; - } - - @Override - public ControllerServiceLookup getControllerServiceLookup() { - return new MockControllerServiceLookup(); - } - - @Override - public String getSchedulingPeriod() { - return ""; - } - - @Override - public SchedulingStrategy getSchedulingStrategy() { - return SchedulingStrategy.TIMER_DRIVEN; - } - - @Override - public ComponentLog getLogger() { - return new MockProcessorLogger(); - } -} +/* + * 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.documentation.mock; + +import java.util.concurrent.TimeUnit; + +import org.apache.nifi.controller.ControllerServiceLookup; +import org.apache.nifi.logging.ComponentLog; +import org.apache.nifi.reporting.ReportingInitializationContext; +import org.apache.nifi.scheduling.SchedulingStrategy; + +/** + * A Mock ReportingInitializationContext that can be used to initialize a + * ReportingTask for the purposes of documentation generation. + * + */ +public class MockReportingInitializationContext implements ReportingInitializationContext { + + @Override + public String getIdentifier() { + return "mock-reporting-task"; + } + + @Override + public String getName() { + return ""; + } + + @Override + public long getSchedulingPeriod(TimeUnit timeUnit) { + return 0; + } + + @Override + public ControllerServiceLookup getControllerServiceLookup() { + return new MockControllerServiceLookup(); + } + + @Override + public String getSchedulingPeriod() { + return ""; + } + + @Override + public SchedulingStrategy getSchedulingStrategy() { + return SchedulingStrategy.TIMER_DRIVEN; + } + + @Override + public ComponentLog getLogger() { + return new MockProcessorLogger(); + } +}
