This is an automated email from the ASF dual-hosted git repository. dimuthuupe pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/airavata-mft.git
commit e0c5226b58a94a57f79d1bee3f4d216489301a32 Author: DImuthuUpe <[email protected]> AuthorDate: Wed Jun 28 20:14:56 2023 -0400 Adding local outgoing streaming connector --- .../mft/agent/transport/ConnectorResolver.java | 3 ++ .../local/LocalOutgoingStreamingConnector.java | 53 ++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/agent/service/src/main/java/org/apache/airavata/mft/agent/transport/ConnectorResolver.java b/agent/service/src/main/java/org/apache/airavata/mft/agent/transport/ConnectorResolver.java index 0dee097..ba2186f 100644 --- a/agent/service/src/main/java/org/apache/airavata/mft/agent/transport/ConnectorResolver.java +++ b/agent/service/src/main/java/org/apache/airavata/mft/agent/transport/ConnectorResolver.java @@ -75,6 +75,9 @@ public final class ConnectorResolver { case "GCS": className = "org.apache.airavata.mft.transport.gcp.GCSOutgoingStreamingConnector"; break; + case "LOCAL": + className = "org.apache.airavata.mft.transport.local.LocalOutgoingStreamingConnector"; + break; } diff --git a/transport/local-transport/src/main/java/org/apache/airavata/mft/transport/local/LocalOutgoingStreamingConnector.java b/transport/local-transport/src/main/java/org/apache/airavata/mft/transport/local/LocalOutgoingStreamingConnector.java new file mode 100644 index 0000000..87d0563 --- /dev/null +++ b/transport/local-transport/src/main/java/org/apache/airavata/mft/transport/local/LocalOutgoingStreamingConnector.java @@ -0,0 +1,53 @@ +/* + * 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.airavata.mft.transport.local; + +import org.apache.airavata.mft.core.api.ConnectorConfig; +import org.apache.airavata.mft.core.api.OutgoingStreamingConnector; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.FileOutputStream; +import java.io.OutputStream; + +public class LocalOutgoingStreamingConnector implements OutgoingStreamingConnector { + + private String resourcePath; + + private static final Logger logger = LoggerFactory.getLogger(LocalOutgoingStreamingConnector.class); + + @Override + public void init(ConnectorConfig connectorConfig) throws Exception { + this.resourcePath = connectorConfig.getResourcePath(); + } + + @Override + public void complete() throws Exception { + logger.info("File {} successfully written", this.resourcePath); + } + + @Override + public void failed() throws Exception { + logger.error("Failed while writing file {}", this.resourcePath); + } + + @Override + public OutputStream fetchOutputStream() throws Exception { + return new FileOutputStream(this.resourcePath); + } +}
