You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by tk...@apache.org on 2015/10/17 15:44:51 UTC

nifi git commit: NIFI-612 Remove FlowUnmarshaller. Builds, runs, could not find any latent references using reflection or other ways of loading classes without direct references. This closes #103. Signed off by Tony Kurc

Repository: nifi
Updated Branches:
  refs/heads/master ce7d098a4 -> 9a8d763d8


NIFI-612 Remove FlowUnmarshaller. Builds, runs, could not find any latent references using reflection or other ways of loading classes without direct references. This closes #103. Signed off by Tony Kurc <tk...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/9a8d763d
Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/9a8d763d
Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/9a8d763d

Branch: refs/heads/master
Commit: 9a8d763d8dddb8feb7e4b176cd97a7790436f60c
Parents: ce7d098
Author: Venkatesh Sellappa <VS...@outlook.com>
Authored: Sat Oct 17 09:43:10 2015 -0400
Committer: Tony Kurc <tr...@gmail.com>
Committed: Sat Oct 17 09:43:10 2015 -0400

----------------------------------------------------------------------
 .../nifi/controller/FlowUnmarshaller.java       | 77 --------------------
 1 file changed, 77 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nifi/blob/9a8d763d/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowUnmarshaller.java
----------------------------------------------------------------------
diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowUnmarshaller.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowUnmarshaller.java
deleted file mode 100644
index c8d90d7..0000000
--- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowUnmarshaller.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.controller;
-
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Objects;
-import java.util.Set;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.nifi.encrypt.StringEncryptor;
-import org.apache.nifi.stream.io.ByteArrayInputStream;
-import org.apache.nifi.web.api.dto.FlowSnippetDTO;
-import org.apache.nifi.web.api.dto.ProcessGroupDTO;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-
-public class FlowUnmarshaller {
-
-    /**
-     * Interprets the given byte array as an XML document that conforms to the Flow Configuration schema and returns a FlowSnippetDTO representing the flow
-     *
-     * @param flowContents contents
-     * @param encryptor encryptor
-     * @return snippet dto
-     * @throws NullPointerException if <code>flowContents</code> is null
-     * @throws IOException ioe
-     * @throws SAXException sax
-     * @throws ParserConfigurationException pe
-     */
-    public static FlowSnippetDTO unmarshal(final byte[] flowContents, final StringEncryptor encryptor) throws IOException, SAXException, ParserConfigurationException {
-        if (Objects.requireNonNull(flowContents).length == 0) {
-            return new FlowSnippetDTO();
-        }
-
-        final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
-        dbf.setNamespaceAware(true);
-
-        final DocumentBuilder docBuilder = dbf.newDocumentBuilder();
-        final Document document = docBuilder.parse(new ByteArrayInputStream(flowContents));
-        final FlowSnippetDTO flowDto = new FlowSnippetDTO();
-
-        final NodeList nodeList = document.getElementsByTagName("rootGroup");
-        if (nodeList.getLength() == 0) {
-            return flowDto;
-        }
-        if (nodeList.getLength() > 1) {
-            throw new IllegalArgumentException("Contents contain multiple rootGroup elements");
-        }
-
-        final Set<ProcessGroupDTO> rootGroupSet = new HashSet<>();
-        flowDto.setProcessGroups(rootGroupSet);
-        rootGroupSet.add(FlowFromDOMFactory.getProcessGroup(null, (Element) nodeList.item(0), encryptor));
-
-        return flowDto;
-    }
-}