NIFI-1850 - Initial Commit for JSON-to-JSON Schema Converter Editor (merge from 0.7.0 - refactor for masterless cluster). This closes #511
Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/cb3aa8f5 Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/cb3aa8f5 Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/cb3aa8f5 Branch: refs/heads/master Commit: cb3aa8f5c9bd8632ad2f454dd3d73e33063e05e8 Parents: 274dc09 Author: Yolanda M. Davis <[email protected]> Authored: Wed Jun 8 00:53:38 2016 -0400 Committer: Matt Gilman <[email protected]> Committed: Mon Jun 20 20:30:25 2016 -0400 ---------------------------------------------------------------------- LICENSE | 45 + .../apache/nifi/web/ComponentDescriptor.java | 93 + .../org/apache/nifi/web/ComponentDetails.java | 19 + .../nifi/web/NiFiWebConfigurationContext.java | 5 +- nifi-assembly/LICENSE | 90 +- .../endpoints/ComponentStateEndpointMerger.java | 4 +- .../org/apache/nifi/web/NiFiServiceFacade.java | 10 - .../nifi/web/StandardNiFiServiceFacade.java | 39 - .../StandardNiFiWebConfigurationContext.java | 91 +- .../nifi-framework/nifi-web/nifi-web-ui/pom.xml | 2 + .../src/main/resources/META-INF/LICENSE | 21 + .../js/codemirror/addon/lint/json-lint.js | 31 + .../webapp/js/codemirror/addon/lint/lint.css | 73 + .../webapp/js/codemirror/addon/lint/lint.js | 239 ++ .../src/main/webapp/js/jsonlint/LICENSE | 21 + .../src/main/webapp/js/jsonlint/jsonlint.min.js | 1 + .../nifi-jolt-transform-json-ui/pom.xml | 227 ++ .../src/main/frontend/.bowerrc | 6 + .../src/main/frontend/bower.json | 15 + .../standard/api/AbstractStandardResource.java | 39 + .../api/processor/ProcessorResource.java | 67 + .../api/processor/ProcessorWebUtils.java | 88 + .../transformjson/TransformJSONResource.java | 89 + .../transformjson/dto/JoltSpecificationDTO.java | 63 + .../api/transformjson/dto/ValidationDTO.java | 54 + .../src/main/resources/META-INF/LICENSE | 320 +++ .../src/main/resources/META-INF/NOTICE | 53 + .../META-INF/nifi-processor-configuration | 15 + .../src/main/webapp/WEB-INF/jsp/index.jsp | 67 + .../src/main/webapp/WEB-INF/web.xml | 50 + .../src/main/webapp/app/app.js | 44 + .../webapp/app/components/error/error.state.js | 30 + .../webapp/app/components/error/error.view.html | 15 + .../components/processor/processor.service.js | 53 + .../src/main/webapp/app/main/main.controller.js | 35 + .../src/main/webapp/app/main/main.state.js | 31 + .../transformjson/transformjson.controller.js | 374 +++ .../app/transformjson/transformjson.service.js | 41 + .../app/transformjson/transformjson.state.js | 39 + .../app/transformjson/transformjson.view.html | 117 + .../src/main/webapp/css/main.css | 55 + .../src/main/webapp/js/js-beautify/LICENSE | 21 + .../src/main/webapp/js/js-beautify/beautify.js | 2333 ++++++++++++++++++ .../api/processor/TestProcessorResource.java | 148 ++ .../api/processor/TestProcessorWebUtils.java | 94 + .../TestTransformJSONResource.java | 178 ++ .../nifi-standard-nar/pom.xml | 5 + .../src/main/resources/META-INF/LICENSE | 70 +- .../nifi-standard-processors/pom.xml | 38 +- .../processors/standard/JoltTransformJSON.java | 223 ++ .../nifi/processors/standard/TransformJSON.java | 247 -- .../org.apache.nifi.processor.Processor | 2 +- .../additionalDetails.html | 36 + .../additionalDetails.html | 36 - .../standard/TestJoltTransformJSON.java | 232 ++ .../processors/standard/TestTransformJSON.java | 318 --- .../TestJoltTransformJson/cardrOutput.json | 13 + .../TestJoltTransformJson/cardrSpec.json | 7 + .../TestJoltTransformJson/chainrOutput.json | 16 + .../TestJoltTransformJson/chainrSpec.json | 29 + .../TestJoltTransformJson/defaultrOutput.json | 24 + .../TestJoltTransformJson/defaultrSpec.json | 10 + .../resources/TestJoltTransformJson/input.json | 13 + .../TestJoltTransformJson/removrOutput.json | 10 + .../TestJoltTransformJson/removrSpec.json | 5 + .../TestJoltTransformJson/shiftrOutput.json | 8 + .../TestJoltTransformJson/shiftrSpec.json | 10 + .../TestJoltTransformJson/sortrOutput.json | 13 + .../TestTransformJson/cardrOutput.json | 13 - .../resources/TestTransformJson/cardrSpec.json | 7 - .../TestTransformJson/chainrOutput.json | 16 - .../resources/TestTransformJson/chainrSpec.json | 29 - .../TestTransformJson/defaultrOutput.json | 24 - .../TestTransformJson/defaultrSpec.json | 10 - .../test/resources/TestTransformJson/input.json | 13 - .../TestTransformJson/removrOutput.json | 10 - .../resources/TestTransformJson/removrSpec.json | 5 - .../TestTransformJson/shiftrOutput.json | 8 - .../resources/TestTransformJson/shiftrSpec.json | 10 - .../TestTransformJson/sortrOutput.json | 13 - .../nifi-standard-utils/pom.xml | 65 + .../standard/util/TransformFactory.java | 46 + .../standard/util/TestTransformFactory.java | 89 + .../TestTransformFactory/cardrSpec.json | 7 + .../TestTransformFactory/chainrSpec.json | 29 + .../TestTransformFactory/defaultrSpec.json | 10 + .../TestTransformFactory/removrSpec.json | 5 + .../TestTransformFactory/shiftrSpec.json | 10 + nifi-nar-bundles/nifi-standard-bundle/pom.xml | 8 + .../update/attributes/api/RuleResource.java | 2 +- 90 files changed, 6488 insertions(+), 851 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/LICENSE ---------------------------------------------------------------------- diff --git a/LICENSE b/LICENSE index 8ea8b3c..74473f9 100644 --- a/LICENSE +++ b/LICENSE @@ -538,3 +538,48 @@ This product bundles 'Fontello' which is available under an MIT license. 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. + +This product bundles 'js-beautify' which is available under an MIT license. + + Copyright (c) 2007-2013 Einar Lielmanis and contributors. + + 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. + + +This product bundles 'jsonlint' which is available under an MIT license. + + Copyright (C) 2012 Zachary Carter + + 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/cb3aa8f5/nifi-api/src/main/java/org/apache/nifi/web/ComponentDescriptor.java ---------------------------------------------------------------------- diff --git a/nifi-api/src/main/java/org/apache/nifi/web/ComponentDescriptor.java b/nifi-api/src/main/java/org/apache/nifi/web/ComponentDescriptor.java new file mode 100644 index 0000000..9412ee1 --- /dev/null +++ b/nifi-api/src/main/java/org/apache/nifi/web/ComponentDescriptor.java @@ -0,0 +1,93 @@ +/* + * 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.web; + +import java.util.Map; + +public class ComponentDescriptor { + + private final String name; + private final String displayName; + private final String description; + private final String defaultValue; + private final Map<String,String> allowableValues; + + private ComponentDescriptor(Builder builder){ + this.name = builder.name; + this.displayName = builder.displayName; + this.description = builder.description; + this.defaultValue = builder.defaultValue; + this.allowableValues = builder.allowableValues; + } + + public String getName() { + return name; + } + + public String getDisplayName() { + return displayName; + } + + public String getDescription() { + return description; + } + + public String getDefaultValue() { + return defaultValue; + } + + public Map<String,String> getAllowableValues() { + return allowableValues; + } + + public static final class Builder{ + private String name; + private String displayName; + private String description; + private String defaultValue; + private Map<String,String> allowableValues; + + public Builder name(String name){ + this.name = name; + return this; + } + + public Builder displayName(String displayName){ + this.displayName = displayName; + return this; + } + + public Builder description(String description){ + this.description = description; + return this; + } + + public Builder defaultValue(String defaultValue){ + this.defaultValue = defaultValue; + return this; + } + + public Builder allowableValues(Map<String,String> allowableValues){ + this.allowableValues = allowableValues; + return this; + } + + public ComponentDescriptor build(){ + return new ComponentDescriptor(this); + } + } +} http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-api/src/main/java/org/apache/nifi/web/ComponentDetails.java ---------------------------------------------------------------------- diff --git a/nifi-api/src/main/java/org/apache/nifi/web/ComponentDetails.java b/nifi-api/src/main/java/org/apache/nifi/web/ComponentDetails.java index 5614fc2..9d163e4 100644 --- a/nifi-api/src/main/java/org/apache/nifi/web/ComponentDetails.java +++ b/nifi-api/src/main/java/org/apache/nifi/web/ComponentDetails.java @@ -31,6 +31,8 @@ public class ComponentDetails { private final String state; private final String annotationData; private final Map<String, String> properties; + private final Map<String, ComponentDescriptor> descriptors; + private final Collection<String> validationErrors; private ComponentDetails(final Builder builder) { @@ -40,7 +42,9 @@ public class ComponentDetails { this.state = builder.state; this.annotationData = builder.annotationData; this.properties = builder.properties; + this.descriptors = builder.descriptors; this.validationErrors = builder.validationErrors; + } /** @@ -85,6 +89,14 @@ public class ComponentDetails { return properties; } + + /** + * @return Mapping of component descriptors + */ + public Map<String,ComponentDescriptor> getDescriptors(){ + return descriptors; + } + /** * @return Current validation errors for the component */ @@ -100,6 +112,8 @@ public class ComponentDetails { private String state; private String annotationData; private Map<String, String> properties; + private Map<String,ComponentDescriptor> descriptors; + private Collection<String> validationErrors; public Builder id(final String id) { @@ -137,6 +151,11 @@ public class ComponentDetails { return this; } + public Builder descriptors(final Map<String,ComponentDescriptor> descriptors){ + this.descriptors = descriptors; + return this; + } + public ComponentDetails build() { return new ComponentDetails(this); } http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebConfigurationContext.java ---------------------------------------------------------------------- diff --git a/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebConfigurationContext.java b/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebConfigurationContext.java index e2689af..a0a605c 100644 --- a/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebConfigurationContext.java +++ b/nifi-api/src/main/java/org/apache/nifi/web/NiFiWebConfigurationContext.java @@ -17,6 +17,7 @@ package org.apache.nifi.web; import java.util.Collection; +import java.util.Map; import org.apache.nifi.controller.ControllerService; @@ -69,6 +70,7 @@ public interface NiFiWebConfigurationContext { * * @param configurationContext config context * @param annotationData the data + * @param properties component properties * @return the configuration for the underlying component * @throws ResourceNotFoundException if the underlying component does not * exit @@ -80,9 +82,10 @@ public interface NiFiWebConfigurationContext { * @throws IllegalArgumentException When the requestContext isn't fully * populated or isn't appropriate for the given request */ - ComponentDetails setAnnotationData(NiFiWebConfigurationRequestContext configurationContext, String annotationData) + ComponentDetails updateComponent(NiFiWebConfigurationRequestContext configurationContext, String annotationData, Map<String, String> properties) throws ResourceNotFoundException, InvalidRevisionException, ClusterRequestException; + /** * Gets the details for the underlying component (including configuration, * validation errors, and annotation data). http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-assembly/LICENSE ---------------------------------------------------------------------- diff --git a/nifi-assembly/LICENSE b/nifi-assembly/LICENSE index dcf296d..477b745 100644 --- a/nifi-assembly/LICENSE +++ b/nifi-assembly/LICENSE @@ -679,6 +679,50 @@ This product bundles 'Angular Messages' which is available under an MIT license. 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 +This product bundles 'AngularUI Codemirror' which is available under an MIT license. + + Copyright (c) 2012 the AngularUI Team, http://angular-ui.github.com + + 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. + +This product bundles 'AngularUI Router' which is available under an MIT license. + + Copyright (c) 2013-2015 The AngularUI Team, Karsten Sperling + + 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. + This product bundles 'Fontello' which is available under an MIT license. Copyright (C) 2011 by Vitaly Puzrin @@ -1358,4 +1402,48 @@ For details see https://github.com/bazaarvoice/jolt/blob/jolt-0.0.20/LICENSE 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. \ No newline at end of file + limitations under the License. + +This product bundles 'js-beautify' which is available under an MIT license. + + Copyright (c) 2007-2013 Einar Lielmanis and contributors. + + 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. + +This product bundles 'jsonlint' which is available under an MIT license. + + Copyright (C) 2012 Zachary Carter + + 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/cb3aa8f5/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ComponentStateEndpointMerger.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ComponentStateEndpointMerger.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ComponentStateEndpointMerger.java index 9976de2..5ab71c9 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ComponentStateEndpointMerger.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/endpoints/ComponentStateEndpointMerger.java @@ -35,8 +35,8 @@ import org.apache.nifi.web.api.entity.ComponentStateEntity; public class ComponentStateEndpointMerger extends AbstractSingleDTOEndpoint<ComponentStateEntity, ComponentStateDTO> { public static final Pattern PROCESSOR_STATE_URI_PATTERN = Pattern.compile("/nifi-api/processors/[a-f0-9\\-]{36}/state"); - public static final Pattern CONTROLLER_SERVICE_STATE_URI_PATTERN = Pattern.compile("/nifi-api/controller-services/node/[a-f0-9\\-]{36}/state"); - public static final Pattern REPORTING_TASK_STATE_URI_PATTERN = Pattern.compile("/nifi-api/reporting-tasks/node/[a-f0-9\\-]{36}/state"); + public static final Pattern CONTROLLER_SERVICE_STATE_URI_PATTERN = Pattern.compile("/nifi-api/controller-services/[a-f0-9\\-]{36}/state"); + public static final Pattern REPORTING_TASK_STATE_URI_PATTERN = Pattern.compile("/nifi-api/reporting-tasks/[a-f0-9\\-]{36}/state"); @Override public boolean canHandle(URI uri, String method) { http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java index ecd6d34..cd27e0d 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java @@ -299,16 +299,6 @@ public interface NiFiServiceFacade { */ ProcessGroupEntity createArchive(); - /** - * Sets the annotation data for a processor. - * - * @param revision the revision to compare with current base revision - * @param processorId the id of the processor to update - * @param annotationData the annotation data - * - * @return snapshot - */ - ProcessorEntity setProcessorAnnotationData(Revision revision, String processorId, String annotationData); /** * Returns the process group status. http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java index 3d5f650..21ea757 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiServiceFacade.java @@ -124,7 +124,6 @@ import org.apache.nifi.web.api.dto.NodeDTO; import org.apache.nifi.web.api.dto.PortDTO; import org.apache.nifi.web.api.dto.PreviousValueDTO; import org.apache.nifi.web.api.dto.ProcessGroupDTO; -import org.apache.nifi.web.api.dto.ProcessorConfigDTO; import org.apache.nifi.web.api.dto.ProcessorDTO; import org.apache.nifi.web.api.dto.PropertyDescriptorDTO; import org.apache.nifi.web.api.dto.PropertyHistoryDTO; @@ -1587,44 +1586,6 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade { } @Override - public ProcessorEntity setProcessorAnnotationData(final Revision revision, final String processorId, final String annotationData) { - final NiFiUser user = NiFiUserUtils.getNiFiUser(); - final String modifier = user.getUserName(); - - final RevisionUpdate<ProcessorEntity> update = revisionManager.updateRevision(new StandardRevisionClaim(revision), user, new UpdateRevisionTask<ProcessorEntity>() { - @Override - public RevisionUpdate<ProcessorEntity> update() { - // create the processor config - final ProcessorConfigDTO config = new ProcessorConfigDTO(); - config.setAnnotationData(annotationData); - - // create the processor dto - final ProcessorDTO processorDTO = new ProcessorDTO(); - processorDTO.setId(processorId); - processorDTO.setConfig(config); - - // update the processor configuration - final ProcessorNode processor = processorDAO.updateProcessor(processorDTO); - - final ProcessorDTO updatedProcDto = dtoFactory.createProcessorDto(processor); - - // save the flow - controllerFacade.save(); - - final AccessPolicyDTO accessPolicy = dtoFactory.createAccessPolicyDto(processor); - final FlowModification lastMod = new FlowModification(incrementRevision(revision), modifier); - final ProcessorStatusDTO status = dtoFactory.createProcessorStatusDto(controllerFacade.getProcessorStatus(processor.getIdentifier())); - final List<BulletinDTO> bulletins = dtoFactory.createBulletinDtos(bulletinRepository.findBulletinsForSource(processor.getIdentifier())); - final ProcessorEntity entity = entityFactory.createProcessorEntity(updatedProcDto, dtoFactory.createRevisionDTO(lastMod), accessPolicy, status, bulletins); - - return new StandardRevisionUpdate<>(entity, lastMod); - } - }); - - return update.getComponent(); - } - - @Override public ControllerServiceEntity createControllerService(final String groupId, final ControllerServiceDTO controllerServiceDTO) { controllerServiceDTO.setParentGroupId(groupId); http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiWebConfigurationContext.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiWebConfigurationContext.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiWebConfigurationContext.java index 6bcdf61..1dc9b89 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiWebConfigurationContext.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiWebConfigurationContext.java @@ -47,6 +47,7 @@ import org.apache.nifi.util.NiFiProperties; import org.apache.nifi.web.api.dto.ControllerServiceDTO; import org.apache.nifi.web.api.dto.ProcessorConfigDTO; import org.apache.nifi.web.api.dto.ProcessorDTO; +import org.apache.nifi.web.api.dto.PropertyDescriptorDTO; import org.apache.nifi.web.api.dto.ReportingTaskDTO; import org.apache.nifi.web.api.dto.RevisionDTO; import org.apache.nifi.web.api.entity.ControllerServiceEntity; @@ -71,6 +72,7 @@ import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Objects; @@ -249,7 +251,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration } @Override - public ComponentDetails setAnnotationData(final NiFiWebConfigurationRequestContext requestContext, final String annotationData) + public ComponentDetails updateComponent(final NiFiWebConfigurationRequestContext requestContext, final String annotationData, Map<String, String> properties) throws ResourceNotFoundException, InvalidRevisionException, ClusterRequestException { final String id = requestContext.getId(); @@ -281,7 +283,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration throw new IllegalArgumentException("UI extension type must support Processor, ControllerService, or ReportingTask configuration."); } - return componentFacade.setAnnotationData(requestContext, annotationData); + return componentFacade.updateComponent(requestContext, annotationData, properties); } /** @@ -302,9 +304,10 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration * * @param requestContext context * @param annotationData data + * @param properties properties * @return details */ - ComponentDetails setAnnotationData(NiFiWebConfigurationRequestContext requestContext, String annotationData); + ComponentDetails updateComponent(NiFiWebConfigurationRequestContext requestContext, String annotationData, Map<String, String> properties); } /** @@ -363,7 +366,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration } @Override - public ComponentDetails setAnnotationData(final NiFiWebConfigurationRequestContext requestContext, final String annotationData) { + public ComponentDetails updateComponent(final NiFiWebConfigurationRequestContext requestContext, final String annotationData, Map<String, String> properties) { final NiFiUser user = NiFiUserUtils.getNiFiUser(); final Revision revision = requestContext.getRevision(); final String id = requestContext.getId(); @@ -375,7 +378,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration }); final ProcessorDTO processor; - if (properties.isClustered()) { + if (StandardNiFiWebConfigurationContext.this.properties.isClustered()) { // create the request URL URI requestUrl; try { @@ -395,14 +398,8 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration processorEntity.setRevision(revisionDto); // create the processor dto - final ProcessorDTO processorDto = new ProcessorDTO(); + ProcessorDTO processorDto = buildProcessorDto(id,annotationData,properties); processorEntity.setComponent(processorDto); - processorDto.setId(id); - - // create the processor configuration with the given annotation data - final ProcessorConfigDTO configDto = new ProcessorConfigDTO(); - processorDto.setConfig(configDto); - configDto.setAnnotationData(annotationData); // set the content type to json final Map<String, String> headers = getHeaders(requestContext); @@ -429,8 +426,11 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration // claim the revision serviceFacade.claimRevision(revision, user); try { - final ProcessorEntity entity = serviceFacade.setProcessorAnnotationData(revision, id, annotationData); - processor = entity.getComponent(); + + ProcessorDTO processorDTO = buildProcessorDto(id,annotationData,properties); + final UpdateResult<ProcessorEntity> entity = serviceFacade.updateProcessor(revision,processorDTO); + processor = entity.getResult().getComponent(); + } finally { // ensure the revision is canceled.. if the operation succeed, this is a noop serviceFacade.cancelRevision(revision); @@ -441,6 +441,17 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration return getComponentConfiguration(processor); } + private ProcessorDTO buildProcessorDto(String id, final String annotationData, Map<String, String> properties){ + ProcessorDTO processorDto = new ProcessorDTO(); + processorDto.setId(id); + ProcessorConfigDTO configDto = new ProcessorConfigDTO(); + processorDto.setConfig(configDto); + configDto.setAnnotationData(annotationData); + configDto.setProperties(properties); + return processorDto; + + } + private ComponentDetails getComponentConfiguration(final ProcessorDTO processor) { final ProcessorConfigDTO processorConfig = processor.getConfig(); return new ComponentDetails.Builder() @@ -450,8 +461,40 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration .state(processor.getState()) .annotationData(processorConfig.getAnnotationData()) .properties(processorConfig.getProperties()) + .descriptors(buildComponentDescriptorMap(processorConfig)) .validateErrors(processor.getValidationErrors()).build(); } + + private Map<String,ComponentDescriptor> buildComponentDescriptorMap(final ProcessorConfigDTO processorConfig){ + + final Map<String, ComponentDescriptor> descriptors = new HashMap<>(); + + for(String key : processorConfig.getDescriptors().keySet()){ + + PropertyDescriptorDTO descriptor = processorConfig.getDescriptors().get(key); + List<PropertyDescriptorDTO.AllowableValueDTO> allowableValuesDTO = descriptor.getAllowableValues(); + Map<String,String> allowableValues = new HashMap<>(); + + if(allowableValuesDTO != null) { + for (PropertyDescriptorDTO.AllowableValueDTO value : allowableValuesDTO) { + allowableValues.put(value.getValue(), value.getDisplayName()); + } + } + + ComponentDescriptor componentDescriptor = new ComponentDescriptor.Builder() + .name(descriptor.getName()) + .displayName(descriptor.getDisplayName()) + .defaultValue(descriptor.getDefaultValue()) + .allowableValues(allowableValues) + .build(); + + + descriptors.put(key,componentDescriptor); + } + + return descriptors; + } + } /** @@ -484,7 +527,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration // create the request URL URI requestUrl; try { - final String path = "/nifi-api/controller-services/node/" + URLEncoder.encode(id, "UTF-8"); + String path = "/nifi-api/controller-services/" + URLEncoder.encode(id, "UTF-8"); requestUrl = new URI(requestContext.getScheme(), null, "localhost", 0, path, null, null); } catch (final URISyntaxException | UnsupportedEncodingException use) { throw new ClusterRequestException(use); @@ -517,7 +560,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration } @Override - public ComponentDetails setAnnotationData(final NiFiWebConfigurationRequestContext requestContext, final String annotationData) { + public ComponentDetails updateComponent(final NiFiWebConfigurationRequestContext requestContext, final String annotationData, Map<String, String> properties) { final NiFiUser user = NiFiUserUtils.getNiFiUser(); final Revision revision = requestContext.getRevision(); final String id = requestContext.getId(); @@ -533,6 +576,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration final ControllerServiceDTO controllerServiceDto = new ControllerServiceDTO(); controllerServiceDto.setId(id); controllerServiceDto.setAnnotationData(annotationData); + controllerServiceDto.setProperties(properties); // claim the revision serviceFacade.claimRevision(revision, user); @@ -547,7 +591,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration } else { // if this is a standalone instance the service should have been found above... there should // no cluster to replicate the request to - if (!properties.isClustered()) { + if (!StandardNiFiWebConfigurationContext.this.properties.isClustered()) { throw new ResourceNotFoundException(String.format("Controller service[%s] could not be found on this NiFi.", id)); } @@ -560,7 +604,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration // create the request URL URI requestUrl; try { - final String path = "/nifi-api/controller-services/node/" + URLEncoder.encode(id, "UTF-8"); + String path = "/nifi-api/controller-services/" + URLEncoder.encode(id, "UTF-8"); requestUrl = new URI(requestContext.getScheme(), null, "localhost", 0, path, null, null); } catch (final URISyntaxException | UnsupportedEncodingException use) { throw new ClusterRequestException(use); @@ -580,6 +624,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration controllerServiceEntity.setComponent(controllerServiceDto); controllerServiceDto.setId(id); controllerServiceDto.setAnnotationData(annotationData); + controllerServiceDto.setProperties(properties); // set the content type to json final Map<String, String> headers = getHeaders(requestContext); @@ -650,7 +695,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration // create the request URL URI requestUrl; try { - final String path = "/nifi-api/reporting-tasks/node/" + URLEncoder.encode(id, "UTF-8"); + String path = "/nifi-api/reporting-tasks/" + URLEncoder.encode(id, "UTF-8"); requestUrl = new URI(requestContext.getScheme(), null, "localhost", 0, path, null, null); } catch (final URISyntaxException | UnsupportedEncodingException use) { throw new ClusterRequestException(use); @@ -683,7 +728,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration } @Override - public ComponentDetails setAnnotationData(final NiFiWebConfigurationRequestContext requestContext, final String annotationData) { + public ComponentDetails updateComponent(final NiFiWebConfigurationRequestContext requestContext, final String annotationData, Map<String, String> properties) { final NiFiUser user = NiFiUserUtils.getNiFiUser(); final Revision revision = requestContext.getRevision(); final String id = requestContext.getId(); @@ -699,6 +744,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration final ReportingTaskDTO reportingTaskDto = new ReportingTaskDTO(); reportingTaskDto.setId(id); reportingTaskDto.setAnnotationData(annotationData); + reportingTaskDto.setProperties(properties); // claim the revision serviceFacade.claimRevision(revision, user); @@ -712,7 +758,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration } else { // if this is a standalone instance the task should have been found above... there should // no cluster to replicate the request to - if (!properties.isClustered()) { + if (!StandardNiFiWebConfigurationContext.this.properties.isClustered()) { throw new ResourceNotFoundException(String.format("Reporting task[%s] could not be found on this NiFi.", id)); } @@ -725,7 +771,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration // create the request URL URI requestUrl; try { - final String path = "/nifi-api/reporting-tasks/node/" + URLEncoder.encode(id, "UTF-8"); + String path = "/nifi-api/reporting-tasks/" + URLEncoder.encode(id, "UTF-8"); requestUrl = new URI(requestContext.getScheme(), null, "localhost", 0, path, null, null); } catch (final URISyntaxException | UnsupportedEncodingException use) { throw new ClusterRequestException(use); @@ -745,6 +791,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration reportingTaskEntity.setComponent(reportingTaskDto); reportingTaskDto.setId(id); reportingTaskDto.setAnnotationData(annotationData); + reportingTaskDto.setProperties(properties); // set the content type to json final Map<String, String> headers = getHeaders(requestContext); http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/pom.xml ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/pom.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/pom.xml index c52f6f0..cf3edcc 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/pom.xml +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/pom.xml @@ -675,6 +675,7 @@ js/d3/**/*, js/codemirror/**/*, js/jquery/**/*, + js/jsonlint/**/*, js/nf/nf-namespace.js, js/nf/nf-namespace.js.gz, js/nf/nf-ng-namespace.js, @@ -729,6 +730,7 @@ <exclude>src/main/webapp/js/jquery/</exclude> <exclude>src/main/webapp/js/d3/d3.min.js</exclude> <exclude>src/main/webapp/js/codemirror/</exclude> + <exclude>src/main/webapp/js/jsonlint/</exclude> <exclude>src/main/webapp/css/reset.css</exclude> <exclude>src/main/webapp/js/angular/**/*</exclude> <exclude>src/main/webapp/fonts/**/*</exclude> http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/resources/META-INF/LICENSE ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/resources/META-INF/LICENSE b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/resources/META-INF/LICENSE index a2592fe..16b808d 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/resources/META-INF/LICENSE +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/resources/META-INF/LICENSE @@ -646,3 +646,24 @@ This product bundles 'Fontello' which is available under an MIT license. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +This product bundles 'jsonlint' which is available under an MIT license. + + Copyright (C) 2012 Zachary Carter + + 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/cb3aa8f5/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/codemirror/addon/lint/json-lint.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/codemirror/addon/lint/json-lint.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/codemirror/addon/lint/json-lint.js new file mode 100644 index 0000000..9dbb616 --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/codemirror/addon/lint/json-lint.js @@ -0,0 +1,31 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +// Depends on jsonlint.js from https://github.com/zaach/jsonlint + +// declare global: jsonlint + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.registerHelper("lint", "json", function(text) { + var found = []; + jsonlint.parseError = function(str, hash) { + var loc = hash.loc; + found.push({from: CodeMirror.Pos(loc.first_line - 1, loc.first_column), + to: CodeMirror.Pos(loc.last_line - 1, loc.last_column), + message: str}); + }; + try { jsonlint.parse(text); } + catch(e) {} + return found; +}); + +}); http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/codemirror/addon/lint/lint.css ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/codemirror/addon/lint/lint.css b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/codemirror/addon/lint/lint.css new file mode 100644 index 0000000..414a9a0 --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/codemirror/addon/lint/lint.css @@ -0,0 +1,73 @@ +/* The lint marker gutter */ +.CodeMirror-lint-markers { + width: 16px; +} + +.CodeMirror-lint-tooltip { + background-color: infobackground; + border: 1px solid black; + border-radius: 4px 4px 4px 4px; + color: infotext; + font-family: monospace; + font-size: 10pt; + overflow: hidden; + padding: 2px 5px; + position: fixed; + white-space: pre; + white-space: pre-wrap; + z-index: 100; + max-width: 600px; + opacity: 0; + transition: opacity .4s; + -moz-transition: opacity .4s; + -webkit-transition: opacity .4s; + -o-transition: opacity .4s; + -ms-transition: opacity .4s; +} + +.CodeMirror-lint-mark-error, .CodeMirror-lint-mark-warning { + background-position: left bottom; + background-repeat: repeat-x; +} + +.CodeMirror-lint-mark-error { + background-image: + url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==") + ; +} + +.CodeMirror-lint-mark-warning { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII="); +} + +.CodeMirror-lint-marker-error, .CodeMirror-lint-marker-warning { + background-position: center center; + background-repeat: no-repeat; + cursor: pointer; + display: inline-block; + height: 16px; + width: 16px; + vertical-align: middle; + position: relative; +} + +.CodeMirror-lint-message-error, .CodeMirror-lint-message-warning { + padding-left: 18px; + background-position: top left; + background-repeat: no-repeat; +} + +.CodeMirror-lint-marker-error, .CodeMirror-lint-message-error { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAHlBMVEW7AAC7AACxAAC7AAC7AAAAAAC4AAC5AAD///+7AAAUdclpAAAABnRSTlMXnORSiwCK0ZKSAAAATUlEQVR42mWPOQ7AQAgDuQLx/z8csYRmPRIFIwRGnosRrpamvkKi0FTIiMASR3hhKW+hAN6/tIWhu9PDWiTGNEkTtIOucA5Oyr9ckPgAWm0GPBog6v4AAAAASUVORK5CYII="); +} + +.CodeMirror-lint-marker-warning, .CodeMirror-lint-message-warning { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAANlBMVEX/uwDvrwD/uwD/uwD/uwD/uwD/uwD/uwD/uwD6twD/uwAAAADurwD2tQD7uAD+ugAAAAD/uwDhmeTRAAAADHRSTlMJ8mN1EYcbmiixgACm7WbuAAAAVklEQVR42n3PUQqAIBBFUU1LLc3u/jdbOJoW1P08DA9Gba8+YWJ6gNJoNYIBzAA2chBth5kLmG9YUoG0NHAUwFXwO9LuBQL1giCQb8gC9Oro2vp5rncCIY8L8uEx5ZkAAAAASUVORK5CYII="); +} + +.CodeMirror-lint-marker-multiple { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAMAAADzjKfhAAAACVBMVEUAAAAAAAC/v7914kyHAAAAAXRSTlMAQObYZgAAACNJREFUeNo1ioEJAAAIwmz/H90iFFSGJgFMe3gaLZ0od+9/AQZ0ADosbYraAAAAAElFTkSuQmCC"); + background-repeat: no-repeat; + background-position: right bottom; + width: 100%; height: 100%; +} http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/codemirror/addon/lint/lint.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/codemirror/addon/lint/lint.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/codemirror/addon/lint/lint.js new file mode 100644 index 0000000..e3a4527 --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/codemirror/addon/lint/lint.js @@ -0,0 +1,239 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + var GUTTER_ID = "CodeMirror-lint-markers"; + + function showTooltip(e, content) { + var tt = document.createElement("div"); + tt.className = "CodeMirror-lint-tooltip"; + tt.appendChild(content.cloneNode(true)); + document.body.appendChild(tt); + + function position(e) { + if (!tt.parentNode) return CodeMirror.off(document, "mousemove", position); + tt.style.top = Math.max(0, e.clientY - tt.offsetHeight - 5) + "px"; + tt.style.left = (e.clientX + 5) + "px"; + } + CodeMirror.on(document, "mousemove", position); + position(e); + if (tt.style.opacity != null) tt.style.opacity = 1; + return tt; + } + function rm(elt) { + if (elt.parentNode) elt.parentNode.removeChild(elt); + } + function hideTooltip(tt) { + if (!tt.parentNode) return; + if (tt.style.opacity == null) rm(tt); + tt.style.opacity = 0; + setTimeout(function() { rm(tt); }, 600); + } + + function showTooltipFor(e, content, node) { + var tooltip = showTooltip(e, content); + function hide() { + CodeMirror.off(node, "mouseout", hide); + if (tooltip) { hideTooltip(tooltip); tooltip = null; } + } + var poll = setInterval(function() { + if (tooltip) for (var n = node;; n = n.parentNode) { + if (n && n.nodeType == 11) n = n.host; + if (n == document.body) return; + if (!n) { hide(); break; } + } + if (!tooltip) return clearInterval(poll); + }, 400); + CodeMirror.on(node, "mouseout", hide); + } + + function LintState(cm, options, hasGutter) { + this.marked = []; + this.options = options; + this.timeout = null; + this.hasGutter = hasGutter; + this.onMouseOver = function(e) { onMouseOver(cm, e); }; + this.waitingFor = 0 + } + + function parseOptions(_cm, options) { + if (options instanceof Function) return {getAnnotations: options}; + if (!options || options === true) options = {}; + return options; + } + + function clearMarks(cm) { + var state = cm.state.lint; + if (state.hasGutter) cm.clearGutter(GUTTER_ID); + for (var i = 0; i < state.marked.length; ++i) + state.marked[i].clear(); + state.marked.length = 0; + } + + function makeMarker(labels, severity, multiple, tooltips) { + var marker = document.createElement("div"), inner = marker; + marker.className = "CodeMirror-lint-marker-" + severity; + if (multiple) { + inner = marker.appendChild(document.createElement("div")); + inner.className = "CodeMirror-lint-marker-multiple"; + } + + if (tooltips != false) CodeMirror.on(inner, "mouseover", function(e) { + showTooltipFor(e, labels, inner); + }); + + return marker; + } + + function getMaxSeverity(a, b) { + if (a == "error") return a; + else return b; + } + + function groupByLine(annotations) { + var lines = []; + for (var i = 0; i < annotations.length; ++i) { + var ann = annotations[i], line = ann.from.line; + (lines[line] || (lines[line] = [])).push(ann); + } + return lines; + } + + function annotationTooltip(ann) { + var severity = ann.severity; + if (!severity) severity = "error"; + var tip = document.createElement("div"); + tip.className = "CodeMirror-lint-message-" + severity; + tip.appendChild(document.createTextNode(ann.message)); + return tip; + } + + function lintAsync(cm, getAnnotations, passOptions) { + var state = cm.state.lint + var id = ++state.waitingFor + function abort() { + id = -1 + cm.off("change", abort) + } + cm.on("change", abort) + getAnnotations(cm.getValue(), function(annotations, arg2) { + cm.off("change", abort) + if (state.waitingFor != id) return + if (arg2 && annotations instanceof CodeMirror) annotations = arg2 + updateLinting(cm, annotations) + }, passOptions, cm); + } + + function startLinting(cm) { + var state = cm.state.lint, options = state.options; + var passOptions = options.options || options; // Support deprecated passing of `options` property in options + var getAnnotations = options.getAnnotations || cm.getHelper(CodeMirror.Pos(0, 0), "lint"); + if (!getAnnotations) return; + if (options.async || getAnnotations.async) { + lintAsync(cm, getAnnotations, passOptions) + } else { + updateLinting(cm, getAnnotations(cm.getValue(), passOptions, cm)); + } + } + + function updateLinting(cm, annotationsNotSorted) { + clearMarks(cm); + var state = cm.state.lint, options = state.options; + + var annotations = groupByLine(annotationsNotSorted); + + for (var line = 0; line < annotations.length; ++line) { + var anns = annotations[line]; + if (!anns) continue; + + var maxSeverity = null; + var tipLabel = state.hasGutter && document.createDocumentFragment(); + + for (var i = 0; i < anns.length; ++i) { + var ann = anns[i]; + var severity = ann.severity; + if (!severity) severity = "error"; + maxSeverity = getMaxSeverity(maxSeverity, severity); + + if (options.formatAnnotation) ann = options.formatAnnotation(ann); + if (state.hasGutter) tipLabel.appendChild(annotationTooltip(ann)); + + if (ann.to) state.marked.push(cm.markText(ann.from, ann.to, { + className: "CodeMirror-lint-mark-" + severity, + __annotation: ann + })); + } + + if (state.hasGutter) + cm.setGutterMarker(line, GUTTER_ID, makeMarker(tipLabel, maxSeverity, anns.length > 1, + state.options.tooltips)); + } + if (options.onUpdateLinting) options.onUpdateLinting(annotationsNotSorted, annotations, cm); + } + + function onChange(cm) { + var state = cm.state.lint; + if (!state) return; + clearTimeout(state.timeout); + state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay || 500); + } + + function popupTooltips(annotations, e) { + var target = e.target || e.srcElement; + var tooltip = document.createDocumentFragment(); + for (var i = 0; i < annotations.length; i++) { + var ann = annotations[i]; + tooltip.appendChild(annotationTooltip(ann)); + } + showTooltipFor(e, tooltip, target); + } + + function onMouseOver(cm, e) { + var target = e.target || e.srcElement; + if (!/\bCodeMirror-lint-mark-/.test(target.className)) return; + var box = target.getBoundingClientRect(), x = (box.left + box.right) / 2, y = (box.top + box.bottom) / 2; + var spans = cm.findMarksAt(cm.coordsChar({left: x, top: y}, "client")); + + var annotations = []; + for (var i = 0; i < spans.length; ++i) { + var ann = spans[i].__annotation; + if (ann) annotations.push(ann); + } + if (annotations.length) popupTooltips(annotations, e); + } + + CodeMirror.defineOption("lint", false, function(cm, val, old) { + if (old && old != CodeMirror.Init) { + clearMarks(cm); + if (cm.state.lint.options.lintOnChange !== false) + cm.off("change", onChange); + CodeMirror.off(cm.getWrapperElement(), "mouseover", cm.state.lint.onMouseOver); + clearTimeout(cm.state.lint.timeout); + delete cm.state.lint; + } + + if (val) { + var gutters = cm.getOption("gutters"), hasLintGutter = false; + for (var i = 0; i < gutters.length; ++i) if (gutters[i] == GUTTER_ID) hasLintGutter = true; + var state = cm.state.lint = new LintState(cm, parseOptions(cm, val), hasLintGutter); + if (state.options.lintOnChange !== false) + cm.on("change", onChange); + if (state.options.tooltips != false) + CodeMirror.on(cm.getWrapperElement(), "mouseover", state.onMouseOver); + + startLinting(cm); + } + }); + + CodeMirror.defineExtension("performLint", function() { + if (this.state.lint) startLinting(this); + }); +}); http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jsonlint/LICENSE ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jsonlint/LICENSE b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jsonlint/LICENSE new file mode 100644 index 0000000..43f0ed5 --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jsonlint/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (C) 2012 Zachary Carter + +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. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jsonlint/jsonlint.min.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jsonlint/jsonlint.min.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jsonlint/jsonlint.min.js new file mode 100644 index 0000000..89b1b4a --- /dev/null +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jsonlint/jsonlint.min.js @@ -0,0 +1 @@ +var jsonlint=function(){var a={trace:function(){},yy:{},symbols_:{error:2,JSONString:3,STRING:4,JSONNumber:5,NUMBER:6,JSONNullLiteral:7,NULL:8,JSONBooleanLiteral:9,TRUE:10,FALSE:11,JSONText:12,JSONValue:13,EOF:14,JSONObject:15,JSONArray:16,"{":17,"}":18,JSONMemberList:19,JSONMember:20,":":21,",":22,"[":23,"]":24,JSONElementList:25,$accept:0,$end:1},terminals_:{2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"},productions_:[0,[3,1],[5,1],[7,1],[9,1],[9,1],[12,2],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[15,2],[15,3],[20,3],[19,1],[19,3],[16,2],[16,3],[25,1],[25,3]],performAction:function(a,b,c,d,e,f){var h=f.length-1;switch(e){case 1:this.$=a.replace(/\\(\\|")/g,"$1").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\t/g," ").replace(/\\v/g,"").replace(/\\f/g,"\f").replace(/\\b/g,"\b");break;case 2:this.$=Number(a);break;case 3:this.$=null;break;case 4:this.$=!0;break;case 5:this.$=!1;break;case 6:return this.$=f[h-1 ];case 13:this.$={};break;case 14:this.$=f[h-1];break;case 15:this.$=[f[h-2],f[h]];break;case 16:this.$={},this.$[f[h][0]]=f[h][1];break;case 17:this.$=f[h-2],f[h-2][f[h][0]]=f[h][1];break;case 18:this.$=[];break;case 19:this.$=f[h-1];break;case 20:this.$=[f[h]];break;case 21:this.$=f[h-2],f[h-2].push(f[h])}},table:[{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],12:1,13:2,15:7,16:8,17:[1,14],23:[1,15]},{1:[3]},{14:[1,16]},{14:[2,7],18:[2,7],22:[2,7],24:[2,7]},{14:[2,8],18:[2,8],22:[2,8],24:[2,8]},{14:[2,9],18:[2,9],22:[2,9],24:[2,9]},{14:[2,10],18:[2,10],22:[2,10],24:[2,10]},{14:[2,11],18:[2,11],22:[2,11],24:[2,11]},{14:[2,12],18:[2,12],22:[2,12],24:[2,12]},{14:[2,3],18:[2,3],22:[2,3],24:[2,3]},{14:[2,4],18:[2,4],22:[2,4],24:[2,4]},{14:[2,5],18:[2,5],22:[2,5],24:[2,5]},{14:[2,1],18:[2,1],21:[2,1],22:[2,1],24:[2,1]},{14:[2,2],18:[2,2],22:[2,2],24:[2,2]},{3:20,4:[1,12],18:[1,17],19:18,20:19},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:23,15:7,16:8 ,17:[1,14],23:[1,15],24:[1,21],25:22},{1:[2,6]},{14:[2,13],18:[2,13],22:[2,13],24:[2,13]},{18:[1,24],22:[1,25]},{18:[2,16],22:[2,16]},{21:[1,26]},{14:[2,18],18:[2,18],22:[2,18],24:[2,18]},{22:[1,28],24:[1,27]},{22:[2,20],24:[2,20]},{14:[2,14],18:[2,14],22:[2,14],24:[2,14]},{3:20,4:[1,12],20:29},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:30,15:7,16:8,17:[1,14],23:[1,15]},{14:[2,19],18:[2,19],22:[2,19],24:[2,19]},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:31,15:7,16:8,17:[1,14],23:[1,15]},{18:[2,17],22:[2,17]},{18:[2,15],22:[2,15]},{22:[2,21],24:[2,21]}],defaultActions:{16:[2,6]},parseError:function(a){throw new Error(a)},parse:function(a){function n(a){c.length=c.length-2*a,d.length=d.length-a,e.length=e.length-a}function o(){var a;return a=b.lexer.lex()||1,"number"!=typeof a&&(a=b.symbols_[a]||a),a}var b=this,c=[0],d=[null],e=[],f=this.table,g="",h=0,i=0,j=0,k=2,l=1;this.lexer.setInput(a),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,"u ndefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc={});var m=this.lexer.yylloc;e.push(m),"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var p,q,r,s,u,w,x,y,z,v={};;){if(r=c[c.length-1],this.defaultActions[r]?s=this.defaultActions[r]:(null==p&&(p=o()),s=f[r]&&f[r][p]),"undefined"==typeof s||!s.length||!s[0]){if(!j){z=[];for(w in f[r])this.terminals_[w]&&w>2&&z.push("'"+this.terminals_[w]+"'");var A="";A=this.lexer.showPosition?"Parse error on line "+(h+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+z.join(", ")+", got '"+this.terminals_[p]+"'":"Parse error on line "+(h+1)+": Unexpected "+(1==p?"end of input":"'"+(this.terminals_[p]||p)+"'"),this.parseError(A,{text:this.lexer.match,token:this.terminals_[p]||p,line:this.lexer.yylineno,loc:m,expected:z})}if(3==j){if(p==l)throw new Error(A||"Parsing halted.");i=this.lexer.yyleng,g=this.lexer.yytext,h=this.lexer.yylineno,m=this.lexer.yylloc,p=o()}for(;;){if(k.toString()in f[r])break;if(0==r)throw n ew Error(A||"Parsing halted.");n(1),r=c[c.length-1]}q=p,p=k,r=c[c.length-1],s=f[r]&&f[r][k],j=3}if(s[0]instanceof Array&&s.length>1)throw new Error("Parse Error: multiple actions possible at state: "+r+", token: "+p);switch(s[0]){case 1:c.push(p),d.push(this.lexer.yytext),e.push(this.lexer.yylloc),c.push(s[1]),p=null,q?(p=q,q=null):(i=this.lexer.yyleng,g=this.lexer.yytext,h=this.lexer.yylineno,m=this.lexer.yylloc,j>0&&j--);break;case 2:if(x=this.productions_[s[1]][1],v.$=d[d.length-x],v._$={first_line:e[e.length-(x||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(x||1)].first_column,last_column:e[e.length-1].last_column},u=this.performAction.call(v,g,i,h,this.yy,s[1],d,e),"undefined"!=typeof u)return u;x&&(c=c.slice(0,2*-1*x),d=d.slice(0,-1*x),e=e.slice(0,-1*x)),c.push(this.productions_[s[1]][0]),d.push(v.$),e.push(v._$),y=f[c[c.length-2]][c[c.length-1]],c.push(y);break;case 3:return!0}}return!0}},b=function(){var a={EOF:1,parseError:function(a,b){if(!this. yy.parseError)throw new Error(a);this.yy.parseError(a,b)},setInput:function(a){return this._input=a,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.match+=a,this.matched+=a;var b=a.match(/\n/);return b&&this.yylineno++,this._input=this._input.slice(1),a},unput:function(a){return this._input=a+this._input,this},more:function(){return this._more=!0,this},less:function(a){this._input=this.match.slice(a)+this._input},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pas tInput(),b=new Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+b+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d,f;this._more||(this.yytext="",this.match="");for(var g=this._currentRules(),h=0;h<g.length&&(c=this._input.match(this.rules[g[h]]),!c||b&&!(c[0].length>b[0].length)||(b=c,d=h,this.options.flex));h++);return b?(f=b[0].match(/\n.*/g),f&&(this.yylineno+=f.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:f?f[f.length-1].length-1:this.yylloc.last_column+b[0].length},this.yytext+=b[0],this.match+=b[0],this.yyleng=this.yytext.length,this._more=!1,this._input=this._input.slice(b[0].length),this.matched+=b[0],a=this.performAction.call(this,this.yy,this,g[d],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),a?a:void 0):""===this._input?this.EOF:(this.parseError("Lexical error on line "+(this.yylineno+1)+". U nrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno}),void 0)},lex:function(){var a=this.next();return"undefined"!=typeof a?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(a){this.begin(a)}};return a.options={},a.performAction=function(a,b,c,d){switch(c){case 0:break;case 1:return 6;case 2:return b.yytext=b.yytext.substr(1,b.yyleng-2),4;case 3:return 17;case 4:return 18;case 5:return 23;case 6:return 24;case 7:return 22;case 8:return 21;case 9:return 10;case 10:return 11;case 11:return 8;case 12:return 14;case 13:return"INVALID"}},a.rules=[/^(?:\s+)/,/^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/,/^(?:"(?:\\[\\"bfnrt/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,/^(?:\{)/,/ ^(?:\})/,/^(?:\[)/,/^(?:\])/,/^(?:,)/,/^(?::)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:$)/,/^(?:.)/],a.conditions={INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13],inclusive:!0}},a}();return a.lexer=b,a}();"undefined"!=typeof require&&"undefined"!=typeof exports&&(exports.parser=jsonlint,exports.parse=function(){return jsonlint.parse.apply(jsonlint,arguments)},exports.main=function(a){if(!a[1])throw new Error("Usage: "+a[0]+" FILE");if("undefined"!=typeof process)var b=require("fs").readFileSync(require("path").join(process.cwd(),a[1]),"utf8");else var c=require("file").path(require("file").cwd()),b=c.join(a[1]).read({charset:"utf-8"});return exports.parser.parse(b)},"undefined"!=typeof module&&require.main===module&&exports.main("undefined"!=typeof process?process.argv.slice(1):require("system").args)); http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/pom.xml ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/pom.xml b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/pom.xml new file mode 100644 index 0000000..a04432e --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/pom.xml @@ -0,0 +1,227 @@ +<?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"> + <parent> + <artifactId>nifi-standard-bundle</artifactId> + <groupId>org.apache.nifi</groupId> + <version>1.0.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>nifi-jolt-transform-json-ui</artifactId> + + <packaging>war</packaging> + <properties> + <maven.javadoc.skip>true</maven.javadoc.skip> + <source.skip>true</source.skip> + <jersey.version>1.19.1</jersey.version> + <jolt.version>0.0.20</jolt.version> + <frontend.dependency.configs>${basedir}/src/main/frontend</frontend.dependency.configs> + <frontend.working.dir>${project.build.directory}/frontend-working-directory</frontend.working.dir> + <frontend.assets>${project.build.directory}/${project.build.finalName}/assets</frontend.assets> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.nifi</groupId> + <artifactId>nifi-api</artifactId> + <version>1.0.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.nifi</groupId> + <artifactId>nifi-utils</artifactId> + <version>1.0.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.nifi</groupId> + <artifactId>nifi-custom-ui-utilities</artifactId> + <version>1.0.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.nifi</groupId> + <artifactId>nifi-processor-utils</artifactId> + <version>1.0.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.apache.nifi</groupId> + <artifactId>nifi-standard-utils</artifactId> + <version>1.0.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>javax.servlet.jsp</groupId> + <artifactId>javax.servlet.jsp-api</artifactId> + <version>2.3.1</version> + </dependency> + <dependency> + <groupId>javax.el</groupId> + <artifactId>javax.el-api</artifactId> + <version>3.0.0</version> + </dependency> + <dependency> + <groupId>javax.servlet.jsp.jstl</groupId> + <artifactId>javax.servlet.jsp.jstl-api</artifactId> + <version>1.2.1</version> + </dependency> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + <version>3.1.0</version> + </dependency> + <dependency> + <groupId>com.sun.jersey</groupId> + <artifactId>jersey-server</artifactId> + <version>${jersey.version}</version> + </dependency> + <dependency> + <groupId>com.sun.jersey</groupId> + <artifactId>jersey-core</artifactId> + <version>${jersey.version}</version> + </dependency> + <dependency> + <groupId>com.sun.jersey</groupId> + <artifactId>jersey-json</artifactId> + <version>${jersey.version}</version> + </dependency> + <dependency> + <groupId>com.sun.jersey</groupId> + <artifactId>jersey-servlet</artifactId> + <version>${jersey.version}</version> + </dependency> + <dependency> + <groupId>com.sun.jersey</groupId> + <artifactId>jersey-client</artifactId> + <version>${jersey.version}</version> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + </dependency> + <dependency> + <groupId>com.bazaarvoice.jolt</groupId> + <artifactId>jolt-core</artifactId> + <version>${jolt.version}</version> + </dependency> + <dependency> + <groupId>com.bazaarvoice.jolt</groupId> + <artifactId>json-utils</artifactId> + <version>${jolt.version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + <version>2.6.2</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + <version>2.6.2</version> + </dependency> + <dependency> + <groupId>com.sun.jersey.jersey-test-framework</groupId> + <artifactId>jersey-test-framework-inmemory</artifactId> + <version>${jersey.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>copy-bower-json</id> + <phase>generate-sources</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${frontend.working.dir}</outputDirectory> + <resources> + <resource> + <directory>${frontend.dependency.configs}</directory> + <filtering>false</filtering> + <includes> + <include>bower.json</include> + <include>.bowerrc</include> + </includes> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>com.github.eirslett</groupId> + <artifactId>frontend-maven-plugin</artifactId> + <version>1.0</version> + <configuration> + <installDirectory>${frontend.working.dir}</installDirectory> + </configuration> + + <executions> + <execution> + <id>install-node-and-npm</id> + <goals> + <goal>install-node-and-npm</goal> + </goals> + <phase>generate-resources</phase> + <configuration> + <nodeVersion>v0.10.18</nodeVersion> + <npmVersion>1.3.8</npmVersion> + </configuration> + </execution> + <execution> + <id>install-bower</id> + <goals> + <goal>npm</goal> + </goals> + <configuration> + <arguments>install bower</arguments> + <workingDirectory>${frontend.working.dir}</workingDirectory> + </configuration> + </execution> + <execution> + <id>bower-install</id> + <goals> + <goal>bower</goal> + </goals> + <configuration> + <arguments>install --config.directory=${frontend.assets}</arguments> + <workingDirectory>${frontend.working.dir}</workingDirectory> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.rat</groupId> + <artifactId>apache-rat-plugin</artifactId> + <configuration> + <excludes combine.children="append"> + <exclude>src/main/frontend/.bowerrc</exclude> + <exclude>src/main/frontend/bower.json</exclude> + <exclude>src/main/webapp/css/main.css</exclude> + <exclude>src/main/webapp/js/jsonlint/*</exclude> + <exclude>src/main/webapp/js/js-beautify/*</exclude> + <exclude>src/main/webapp/js/jquery/*</exclude> + <exclude>src/main/webapp/js/codemirror/</exclude> + <exclude>src/main/webapp/js/angular/**/*</exclude> + <exclude>src/main/webapp/js/angular-ui/**/*</exclude> + </excludes> + </configuration> + </plugin> + </plugins> + </build> + +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/frontend/.bowerrc ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/frontend/.bowerrc b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/frontend/.bowerrc new file mode 100644 index 0000000..31190ed --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/frontend/.bowerrc @@ -0,0 +1,6 @@ +{ + "ignoredDependencies": [ + "angular", + "codemirror" + ] +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/frontend/bower.json ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/frontend/bower.json b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/frontend/bower.json new file mode 100644 index 0000000..08f08c6 --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/frontend/bower.json @@ -0,0 +1,15 @@ +{ + "name": "apache-nifi", + "private": true, + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ], + "dependencies": { + "angular-ui-codemirror": "^0.3.0", + "angular-ui-router": "^0.2.18" + } +} http://git-wip-us.apache.org/repos/asf/nifi/blob/cb3aa8f5/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/AbstractStandardResource.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/AbstractStandardResource.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/AbstractStandardResource.java new file mode 100644 index 0000000..3fb1a6b --- /dev/null +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/AbstractStandardResource.java @@ -0,0 +1,39 @@ +/* + * 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.web.standard.api; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.Context; + +import org.apache.nifi.web.NiFiWebConfigurationContext; + + +public abstract class AbstractStandardResource { + + @Context + protected ServletContext servletContext; + + @Context + protected HttpServletRequest request; + + + protected NiFiWebConfigurationContext getWebConfigurationContext(){ + return (NiFiWebConfigurationContext) servletContext.getAttribute("nifi-web-configuration-context"); + } +}
