You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/05/05 10:46:22 UTC

[GitHub] [nifi] Lehel44 commented on a diff in pull request #5926: NIFI-9865: Add Atlas lineage for GCS processors (PutHDFS)

Lehel44 commented on code in PR #5926:
URL: https://github.com/apache/nifi/pull/5926#discussion_r865777043


##########
nifi-nar-bundles/nifi-atlas-bundle/nifi-atlas-reporting-task/src/main/java/org/apache/nifi/atlas/provenance/analyzer/GCSDirectory.java:
##########
@@ -0,0 +1,104 @@
+/*
+ * 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.atlas.provenance.analyzer;
+
+import org.apache.atlas.model.instance.AtlasEntity;
+import org.apache.atlas.model.instance.AtlasObjectId;
+import org.apache.atlas.utils.AtlasPathExtractorUtil;
+import org.apache.atlas.utils.PathExtractorContext;
+import org.apache.atlas.v1.model.instance.Referenceable;
+import org.apache.hadoop.fs.Path;
+import org.apache.nifi.atlas.provenance.AbstractNiFiProvenanceEventAnalyzer;
+import org.apache.nifi.atlas.provenance.AnalysisContext;
+import org.apache.nifi.atlas.provenance.DataSetRefs;
+import org.apache.nifi.provenance.ProvenanceEventRecord;
+
+import java.util.Map;
+
+import static org.apache.nifi.atlas.NiFiTypes.ATTR_QUALIFIED_NAME;
+
+/**
+ * Analyzes a transit URI as a GCS bucket or directory (skipping the file name).
+ * <p>
+ * Atlas entity hierarchy v1: gcs_virtual_dir -> gcs_bucket
+ * <p>gcs_virtual_dir
+ * <ul>
+ *   <li>qualifiedName=gs://bucket/path@namespace (example: gs://mybucket/mydir1/mydir2@ns1)
+ *   <li>name=/path (example: /mydir1/mydir2)
+ * </ul>
+ * <p>gcs_bucket
+ * <ul>
+ *   <li>qualifiedName=gs://bucket@namespace (example: gs://mybucket@ns1)
+ *   <li>name=bucket (example: mybucket)
+ * </ul>
+ */
+public class GCSDirectory extends AbstractNiFiProvenanceEventAnalyzer {
+
+    static final String GCP_STORAGE_VIRTUAL_DIRECTORY = "gcp_storage_virtual_directory";
+    static final String REL_PARENT = "parent";
+
+    @Override
+    public DataSetRefs analyze(AnalysisContext context, ProvenanceEventRecord event) {

Review Comment:
   I think that is a great idea! Thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org