rliszli commented on code in PR #6601: URL: https://github.com/apache/nifi/pull/6601#discussion_r1043354212
########## nifi-nar-bundles/nifi-deltalake-bundle/nifi-deltalake-processors/src/main/java/org/apache/nifi/processors/deltalake/storage/GcpStorageAdapter.java: ########## @@ -0,0 +1,86 @@ +/* + * 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.processors.deltalake.storage; + +import com.google.cloud.hadoop.fs.gcs.GoogleHadoopFileSystem; +import io.delta.standalone.DeltaLog; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileSystem; +import org.apache.nifi.processor.ProcessContext; + +import java.io.IOException; +import java.net.URI; + +import static org.apache.nifi.processors.deltalake.DeltaLakeMetadataWriter.GCP_ACCOUNT_JSON_KEYFILE_PATH; +import static org.apache.nifi.processors.deltalake.DeltaLakeMetadataWriter.GCP_BUCKET; +import static org.apache.nifi.processors.deltalake.DeltaLakeMetadataWriter.GCP_PATH; + +public class GcpStorageAdapter implements StorageAdapter { + + private FileSystem fileSystem; + private DeltaLog deltaLog; + private String dataPath; + private String engineInfo; + + public GcpStorageAdapter(ProcessContext processorContext, String engineInfo) { + this.engineInfo = engineInfo; + + String accountJsonKeyPath = processorContext.getProperty(GCP_ACCOUNT_JSON_KEYFILE_PATH).getValue(); + URI gcpBucketUri = URI.create(processorContext.getProperty(GCP_BUCKET).getValue()); + String gcpPath = processorContext.getProperty(GCP_PATH).getValue(); + + Configuration configuration = createConfiguration(accountJsonKeyPath); + fileSystem = new GoogleHadoopFileSystem(); + try { + fileSystem.initialize(gcpBucketUri, configuration); + } catch (IOException e) { + throw new RuntimeException(e); Review Comment: Thanks for the suggestion, applied here and at all similar places. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
