You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by di...@apache.org on 2019/08/22 16:42:21 UTC
[airavata-mft] 15/22: Adding local transport
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 5c0a238a2ea3a38131eab8db06ebe110d456d3a0
Author: isururanawaka <ir...@gmail.com>
AuthorDate: Mon Aug 19 12:59:22 2019 +0530
Adding local transport
---
.../airavata/mft/core/api/ConnectorChannel.java | 6 +++
.../airavata/mft/core/bufferedImpl/Constants.java | 7 ++-
.../{InChannel.java => AbstractChannel.java} | 36 ++++---------
.../bufferedImpl/channel/AbstractConnector.java | 1 +
.../mft/core/bufferedImpl/channel/InChannel.java | 17 ++----
.../mft/core/bufferedImpl/channel/OutChannel.java | 20 ++------
.../mediation/PassthroughMediator.java | 7 ++-
pom.xml | 1 +
transport/local-transport/pom.xml | 42 +++++++++++++++
.../mft/transport/local/FileConstants.java | 11 ++--
.../airavata/mft/transport/local/FileUtils.java | 50 ++++++++----------
.../mft/transport/local/ResourceIdentifier.java | 19 ++++---
.../mft/transport/local/SinkFileConnector.java | 60 ++++++++++++++++++++++
.../mft/transport/local/SourceFileConnector.java | 33 ++++++------
transport/pom.xml | 1 +
transport/s3-transport/pom.xml | 12 +++++
.../airavata/mft/transport/s3/S3Constants.java | 13 ++---
.../airavata/mft/transport/s3/S3SinkConnector.java | 3 +-
.../mft/transport/s3/S3SourceConnector.java | 4 +-
19 files changed, 211 insertions(+), 132 deletions(-)
diff --git a/core/src/main/java/org/apache/airavata/mft/core/api/ConnectorChannel.java b/core/src/main/java/org/apache/airavata/mft/core/api/ConnectorChannel.java
index 5e037b1..5818ee8 100644
--- a/core/src/main/java/org/apache/airavata/mft/core/api/ConnectorChannel.java
+++ b/core/src/main/java/org/apache/airavata/mft/core/api/ConnectorChannel.java
@@ -55,4 +55,10 @@ public interface ConnectorChannel {
* @return
*/
Object getChannelAttribute(String key);
+
+ /**
+ * provides the initiated connector
+ * @return Connector
+ */
+ Connector getSourceConnector();
}
diff --git a/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/Constants.java b/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/Constants.java
index 93ee219..ff7172d 100644
--- a/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/Constants.java
+++ b/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/Constants.java
@@ -22,9 +22,8 @@ package org.apache.airavata.mft.core.bufferedImpl;
/**
* Contains all the constants used in core classes.
*/
-public class Constants {
+public final class Constants {
- public static long TRANSFER_MAX_SIZE = (1024 * 1024);
- public static int BUFFER_SIZE = 8 * 1024;
- public static String CONNECTOR = "CONNECTOR";
+ public static final long TRANSFER_MAX_SIZE = (1024 * 1024);
+ public static final int BUFFER_SIZE = 8 * 1024;
}
diff --git a/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/channel/InChannel.java b/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/channel/AbstractChannel.java
similarity index 65%
copy from core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/channel/InChannel.java
copy to core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/channel/AbstractChannel.java
index 5e2ab4c..0c2c259 100644
--- a/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/channel/InChannel.java
+++ b/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/channel/AbstractChannel.java
@@ -19,41 +19,22 @@
package org.apache.airavata.mft.core.bufferedImpl.channel;
+import org.apache.airavata.mft.core.api.Connector;
import org.apache.airavata.mft.core.api.ConnectorChannel;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.channels.Channel;
-import java.nio.channels.Channels;
-import java.nio.channels.ReadableByteChannel;
import java.util.HashMap;
/**
- * A class which represents the channel of a {@Link SinkConnector}
+ * A class to implement common method of In and Out Channels
*/
-public class InChannel implements ConnectorChannel {
-
- private InputStream inputStream;
-
- private ReadableByteChannel readableByteChannel;
+public abstract class AbstractChannel implements ConnectorChannel {
private HashMap<String, Object> contextAttributeMap = new HashMap<>();
- public InChannel(InputStream inputStream) {
- this.inputStream = inputStream;
- readableByteChannel = Channels.newChannel(inputStream);
-
- }
-
-
- @Override
- public Channel getChannel() {
- return readableByteChannel;
- }
+ private Connector myConnector;
- @Override
- public void closeChannel() throws IOException {
- inputStream.close();
+ public AbstractChannel(Connector myConnector) {
+ this.myConnector = myConnector;
}
@Override
@@ -65,4 +46,9 @@ public class InChannel implements ConnectorChannel {
public Object getChannelAttribute(String key) {
return contextAttributeMap.get(key);
}
+
+ @Override
+ public Connector getSourceConnector() {
+ return myConnector;
+ }
}
diff --git a/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/channel/AbstractConnector.java b/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/channel/AbstractConnector.java
index de119a5..b0916dc 100644
--- a/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/channel/AbstractConnector.java
+++ b/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/channel/AbstractConnector.java
@@ -46,4 +46,5 @@ public abstract class AbstractConnector implements Connector {
}
+
}
diff --git a/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/channel/InChannel.java b/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/channel/InChannel.java
index 5e2ab4c..4b7803b 100644
--- a/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/channel/InChannel.java
+++ b/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/channel/InChannel.java
@@ -19,27 +19,26 @@
package org.apache.airavata.mft.core.bufferedImpl.channel;
-import org.apache.airavata.mft.core.api.ConnectorChannel;
+import org.apache.airavata.mft.core.api.Connector;
import java.io.IOException;
import java.io.InputStream;
import java.nio.channels.Channel;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
-import java.util.HashMap;
/**
* A class which represents the channel of a {@Link SinkConnector}
*/
-public class InChannel implements ConnectorChannel {
+public class InChannel extends AbstractChannel {
private InputStream inputStream;
private ReadableByteChannel readableByteChannel;
- private HashMap<String, Object> contextAttributeMap = new HashMap<>();
- public InChannel(InputStream inputStream) {
+ public InChannel(InputStream inputStream, Connector sourceConnector) {
+ super(sourceConnector);
this.inputStream = inputStream;
readableByteChannel = Channels.newChannel(inputStream);
@@ -56,13 +55,5 @@ public class InChannel implements ConnectorChannel {
inputStream.close();
}
- @Override
- public void addChannelAttribute(String key, Object value) {
- contextAttributeMap.put(key, value);
- }
- @Override
- public Object getChannelAttribute(String key) {
- return contextAttributeMap.get(key);
- }
}
diff --git a/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/channel/OutChannel.java b/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/channel/OutChannel.java
index 1df09c3..2af77d8 100644
--- a/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/channel/OutChannel.java
+++ b/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/channel/OutChannel.java
@@ -19,30 +19,28 @@
package org.apache.airavata.mft.core.bufferedImpl.channel;
-import org.apache.airavata.mft.core.api.ConnectorChannel;
+import org.apache.airavata.mft.core.api.Connector;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.channels.Channel;
import java.nio.channels.Channels;
import java.nio.channels.WritableByteChannel;
-import java.util.HashMap;
/**
* A class which represents the channel in {@Link SinkConnector}
*/
-public class OutChannel implements ConnectorChannel {
+public class OutChannel extends AbstractChannel {
private OutputStream outputStream;
private WritableByteChannel writableByteChannel;
- private HashMap<String, Object> contextAttributeMap = new HashMap();
- public OutChannel(OutputStream outputStream) {
+ public OutChannel(OutputStream outputStream, Connector sourceConnector) {
+ super(sourceConnector);
this.outputStream = outputStream;
writableByteChannel = Channels.newChannel(outputStream);
-
}
@Override
@@ -55,15 +53,5 @@ public class OutChannel implements ConnectorChannel {
outputStream.close();
}
- @Override
- public void addChannelAttribute(String key, Object value) {
- contextAttributeMap.put(key, value);
- }
-
- @Override
- public Object getChannelAttribute(String key) {
- return contextAttributeMap.get(key);
- }
-
}
diff --git a/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/mediation/PassthroughMediator.java b/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/mediation/PassthroughMediator.java
index f6e2044..b9b10de 100644
--- a/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/mediation/PassthroughMediator.java
+++ b/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/mediation/PassthroughMediator.java
@@ -21,7 +21,6 @@ package org.apache.airavata.mft.core.bufferedImpl.mediation;
import org.apache.airavata.mft.core.api.*;
import org.apache.airavata.mft.core.bufferedImpl.ConnectorException;
-import org.apache.airavata.mft.core.bufferedImpl.Constants;
import org.apache.airavata.mft.core.bufferedImpl.channel.ChannelUtils;
import java.io.IOException;
@@ -51,7 +50,7 @@ public class PassthroughMediator implements Mediator {
}
- Object obj = dst.getChannelAttribute(Constants.CONNECTOR);
+ Object obj = dst.getSourceConnector();
if (obj != null && obj instanceof SinkConnector) {
SinkConnector connector = (SinkConnector) obj;
boolean success = connector.verifyUpload(dst);
@@ -69,8 +68,8 @@ public class PassthroughMediator implements Mediator {
ConnectorException connectorException = new ConnectorException(msg, e);
callback.onComplete("Upload failed ", connectorException);
} finally {
- Connector sourceConnector = (Connector) src.getChannelAttribute(Constants.CONNECTOR);
- Connector sinkConnector = (Connector) dst.getChannelAttribute(Constants.CONNECTOR);
+ Connector sourceConnector = src.getSourceConnector();
+ Connector sinkConnector = dst.getSourceConnector();
try {
sourceConnector.closeChannel(src);
sinkConnector.closeChannel(dst);
diff --git a/pom.xml b/pom.xml
index 983b1cc..1a461a9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,6 +31,7 @@
<modules>
<module>core</module>
<module>transport</module>
+ <module>transport/local-transport</module>
</modules>
<parent>
diff --git a/transport/local-transport/pom.xml b/transport/local-transport/pom.xml
new file mode 100644
index 0000000..850fc0b
--- /dev/null
+++ b/transport/local-transport/pom.xml
@@ -0,0 +1,42 @@
+<?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>airavata-mft</artifactId>
+ <groupId>org.apache.airavata</groupId>
+ <version>0.18-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>mft-local-transport</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>mft-core</artifactId>
+ <version>0.18-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/Constants.java b/transport/local-transport/src/main/java/org/apache/airavata/mft/transport/local/FileConstants.java
similarity index 74%
copy from core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/Constants.java
copy to transport/local-transport/src/main/java/org/apache/airavata/mft/transport/local/FileConstants.java
index 93ee219..424940a 100644
--- a/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/Constants.java
+++ b/transport/local-transport/src/main/java/org/apache/airavata/mft/transport/local/FileConstants.java
@@ -17,14 +17,13 @@
* under the License.
*/
-package org.apache.airavata.mft.core.bufferedImpl;
+package org.apache.airavata.mft.transport.local;
/**
- * Contains all the constants used in core classes.
+ * A class for represent local file transport constants
*/
-public class Constants {
+public final class FileConstants {
- public static long TRANSFER_MAX_SIZE = (1024 * 1024);
- public static int BUFFER_SIZE = 8 * 1024;
- public static String CONNECTOR = "CONNECTOR";
+
+ public static final String OUTPUT_FILE = "OUT_FILE";
}
diff --git a/core/src/main/java/org/apache/airavata/mft/core/api/ConnectorChannel.java b/transport/local-transport/src/main/java/org/apache/airavata/mft/transport/local/FileUtils.java
similarity index 53%
copy from core/src/main/java/org/apache/airavata/mft/core/api/ConnectorChannel.java
copy to transport/local-transport/src/main/java/org/apache/airavata/mft/transport/local/FileUtils.java
index 5e037b1..99a6732 100644
--- a/core/src/main/java/org/apache/airavata/mft/core/api/ConnectorChannel.java
+++ b/transport/local-transport/src/main/java/org/apache/airavata/mft/transport/local/FileUtils.java
@@ -17,42 +17,36 @@
* under the License.
*/
-package org.apache.airavata.mft.core.api;
+package org.apache.airavata.mft.transport.local;
-import java.io.IOException;
-import java.nio.channels.Channel;
+import org.apache.airavata.mft.core.bufferedImpl.ConnectorException;
+
+import java.io.File;
/**
- * An interface represents a channel of a {@Link Connector}
+ * A class having utility methods of local file manipulation
*/
-public interface ConnectorChannel {
+public class FileUtils {
+
/**
- * get the NIO channel of ChannelConnector
- *
+ * Validates and provides the file
+ * @param src
* @return
+ * @throws ConnectorException
*/
- Channel getChannel();
+ public static File getFile(String src) throws ConnectorException {
+ if (src != null) {
+ final File file = new File(src);
+ if (file.isFile()) {
+ return file;
+ } else {
+ throw new ConnectorException("File " + src + " is not a valid file", null);
+ }
+ } else {
+ throw new ConnectorException("Please specify validate file name", null);
+ }
- /**
- * close the channel if open else return
- *
- * @throws IOException
- */
- void closeChannel() throws IOException;
+ }
- /**
- * Save channel attribute to ConnectorChannel context
- *
- * @param key
- * @param value
- */
- void addChannelAttribute(String key, Object value);
- /**
- * Get channel attribute from ConnectorChannel context
- *
- * @param key
- * @return
- */
- Object getChannelAttribute(String key);
}
diff --git a/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/Constants.java b/transport/local-transport/src/main/java/org/apache/airavata/mft/transport/local/ResourceIdentifier.java
similarity index 70%
copy from core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/Constants.java
copy to transport/local-transport/src/main/java/org/apache/airavata/mft/transport/local/ResourceIdentifier.java
index 93ee219..cac3b94 100644
--- a/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/Constants.java
+++ b/transport/local-transport/src/main/java/org/apache/airavata/mft/transport/local/ResourceIdentifier.java
@@ -17,14 +17,21 @@
* under the License.
*/
-package org.apache.airavata.mft.core.bufferedImpl;
+package org.apache.airavata.mft.transport.local;
/**
- * Contains all the constants used in core classes.
+ * A class used to identify the local file path. Path should be a
+ * same node local path
*/
-public class Constants {
+public class ResourceIdentifier {
+ private String filePath;
+
+ public void setFilePath(String filePath) {
+ this.filePath = filePath;
+ }
+
+ public String getFilePath() {
+ return filePath;
+ }
- public static long TRANSFER_MAX_SIZE = (1024 * 1024);
- public static int BUFFER_SIZE = 8 * 1024;
- public static String CONNECTOR = "CONNECTOR";
}
diff --git a/transport/local-transport/src/main/java/org/apache/airavata/mft/transport/local/SinkFileConnector.java b/transport/local-transport/src/main/java/org/apache/airavata/mft/transport/local/SinkFileConnector.java
new file mode 100644
index 0000000..ab94295
--- /dev/null
+++ b/transport/local-transport/src/main/java/org/apache/airavata/mft/transport/local/SinkFileConnector.java
@@ -0,0 +1,60 @@
+/*
+ * 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.ConnectorChannel;
+import org.apache.airavata.mft.core.api.SinkConnector;
+import org.apache.airavata.mft.core.bufferedImpl.channel.AbstractConnector;
+import org.apache.airavata.mft.core.bufferedImpl.channel.OutChannel;
+
+import java.io.File;
+import java.io.FileOutputStream;
+
+/**
+ * A class responsible for open up the connection for write to the given
+ * local file
+ */
+public class SinkFileConnector extends AbstractConnector implements SinkConnector {
+ private ResourceIdentifier resourceIdentifier;
+
+ public SinkFileConnector(ResourceIdentifier resourceIdentifier) {
+ this.resourceIdentifier = resourceIdentifier;
+ }
+
+ @Override
+ public boolean verifyUpload(ConnectorChannel channel) {
+ Object obj = channel.getChannelAttribute(FileConstants.OUTPUT_FILE);
+ if (obj instanceof File) {
+ File file = (File) obj;
+ return file.exists();
+ }
+ return false;
+ }
+
+ @Override
+ public ConnectorChannel openChannel() throws Exception {
+ File file = FileUtils.getFile(resourceIdentifier.getFilePath());
+ FileOutputStream outputStream = new FileOutputStream(file);
+ OutChannel outChannel = new OutChannel(outputStream, this);
+ outChannel.addChannelAttribute(FileConstants.OUTPUT_FILE, file);
+ return outChannel;
+ }
+
+}
diff --git a/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/channel/AbstractConnector.java b/transport/local-transport/src/main/java/org/apache/airavata/mft/transport/local/SourceFileConnector.java
similarity index 54%
copy from core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/channel/AbstractConnector.java
copy to transport/local-transport/src/main/java/org/apache/airavata/mft/transport/local/SourceFileConnector.java
index de119a5..6a2e1fc 100644
--- a/core/src/main/java/org/apache/airavata/mft/core/bufferedImpl/channel/AbstractConnector.java
+++ b/transport/local-transport/src/main/java/org/apache/airavata/mft/transport/local/SourceFileConnector.java
@@ -17,33 +17,34 @@
* under the License.
*/
-package org.apache.airavata.mft.core.bufferedImpl.channel;
+package org.apache.airavata.mft.transport.local;
-import org.apache.airavata.mft.core.api.Connector;
import org.apache.airavata.mft.core.api.ConnectorChannel;
-import org.apache.airavata.mft.core.api.SinkConnector;
import org.apache.airavata.mft.core.api.SourceConnector;
-import org.apache.airavata.mft.core.bufferedImpl.ConnectorException;
+import org.apache.airavata.mft.core.bufferedImpl.channel.AbstractConnector;
+import org.apache.airavata.mft.core.bufferedImpl.channel.InChannel;
-import java.io.IOException;
+import java.io.File;
+import java.io.FileInputStream;
/**
- * Common class for {@link SinkConnector} and {@link SourceConnector} implementations
- * This overrides closeChannel method and release all resources allocated to releasing channel
+ * A class responsible for open up the connection to read from file
*/
-public abstract class AbstractConnector implements Connector {
+public class SourceFileConnector extends AbstractConnector implements SourceConnector {
- @Override
- public void closeChannel(ConnectorChannel channel) throws ConnectorException {
-
- try {
- channel.closeChannel();
+ private ResourceIdentifier resourceIdentifier;
- } catch (IOException e) {
- throw new ConnectorException("Error occurred while closing stream", e);
- }
+ public SourceFileConnector(ResourceIdentifier resourceIdentifier) {
+ this.resourceIdentifier = resourceIdentifier;
+ }
+ @Override
+ public ConnectorChannel openChannel() throws Exception {
+ File file = FileUtils.getFile(resourceIdentifier.getFilePath());
+ FileInputStream inputStream = new FileInputStream(file);
+ return new InChannel(inputStream, this);
}
+
}
diff --git a/transport/pom.xml b/transport/pom.xml
index 0d4952a..2e93966 100644
--- a/transport/pom.xml
+++ b/transport/pom.xml
@@ -35,6 +35,7 @@
<modules>
<module>scp-transport</module>
<module>s3-transport</module>
+ <module>local-transport</module>
</modules>
diff --git a/transport/s3-transport/pom.xml b/transport/s3-transport/pom.xml
index 9395db8..8f50b85 100644
--- a/transport/s3-transport/pom.xml
+++ b/transport/s3-transport/pom.xml
@@ -31,6 +31,18 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>mft-s3-transport</artifactId>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>8</source>
+ <target>8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
<dependencies>
<dependency>
diff --git a/transport/s3-transport/src/main/java/org/apache/airavata/mft/transport/s3/S3Constants.java b/transport/s3-transport/src/main/java/org/apache/airavata/mft/transport/s3/S3Constants.java
index 9103319..5e7aec0 100644
--- a/transport/s3-transport/src/main/java/org/apache/airavata/mft/transport/s3/S3Constants.java
+++ b/transport/s3-transport/src/main/java/org/apache/airavata/mft/transport/s3/S3Constants.java
@@ -22,14 +22,9 @@ package org.apache.airavata.mft.transport.s3;
/**
* Includes constants related to S3 SDK
*/
-public class S3Constants {
+public final class S3Constants {
- public static String ACCESS_KEY = "ACCESS_KEY";
- public static String SECRET_KEY = "SECRET_KEY";
- public static String BUCKET = "BUCKET";
- public static String REGION = "REGION";
- public static String REMOTE_FILE = "REMOTE_FILE";
- public static int CONNECTION_EXPIRE_TIME = 1000 * 60 * 60;
- public static String HTTP_CONNECTION = "HTTP_CONNECTION";
- public static int HTTP_SUCCESS_RESPONSE_CODE = 200;
+ public static final int CONNECTION_EXPIRE_TIME = 1000 * 60 * 60;
+ public static final String HTTP_CONNECTION = "HTTP_CONNECTION";
+ public static final int HTTP_SUCCESS_RESPONSE_CODE = 200;
}
diff --git a/transport/s3-transport/src/main/java/org/apache/airavata/mft/transport/s3/S3SinkConnector.java b/transport/s3-transport/src/main/java/org/apache/airavata/mft/transport/s3/S3SinkConnector.java
index 2434332..b6cc3fd 100644
--- a/transport/s3-transport/src/main/java/org/apache/airavata/mft/transport/s3/S3SinkConnector.java
+++ b/transport/s3-transport/src/main/java/org/apache/airavata/mft/transport/s3/S3SinkConnector.java
@@ -63,9 +63,8 @@ public class S3SinkConnector extends AbstractConnector implements SinkConnector
connection.setDoOutput(true);
connection.setRequestMethod("PUT");
OutputStream outputStream = connection.getOutputStream();
- OutChannel outChannel = new OutChannel(outputStream);
+ OutChannel outChannel = new OutChannel(outputStream,this);
outChannel.addChannelAttribute(S3Constants.HTTP_CONNECTION, connection);
- outChannel.addChannelAttribute(Constants.CONNECTOR, this);
return outChannel;
}
diff --git a/transport/s3-transport/src/main/java/org/apache/airavata/mft/transport/s3/S3SourceConnector.java b/transport/s3-transport/src/main/java/org/apache/airavata/mft/transport/s3/S3SourceConnector.java
index 8f486be..c1dc2e9 100644
--- a/transport/s3-transport/src/main/java/org/apache/airavata/mft/transport/s3/S3SourceConnector.java
+++ b/transport/s3-transport/src/main/java/org/apache/airavata/mft/transport/s3/S3SourceConnector.java
@@ -23,7 +23,6 @@ import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.model.S3Object;
import org.apache.airavata.mft.core.api.ConnectorChannel;
import org.apache.airavata.mft.core.api.SourceConnector;
-import org.apache.airavata.mft.core.bufferedImpl.Constants;
import org.apache.airavata.mft.core.bufferedImpl.channel.AbstractConnector;
import org.apache.airavata.mft.core.bufferedImpl.channel.InChannel;
@@ -52,8 +51,7 @@ public class S3SourceConnector extends AbstractConnector implements SourceConnec
InputStream inputStream;
if (s3object != null && s3object.getObjectContent() != null) {
inputStream = s3object.getObjectContent();
- InChannel inChannel = new InChannel(inputStream);
- inChannel.addChannelAttribute(Constants.CONNECTOR, this);
+ InChannel inChannel = new InChannel(inputStream,this);
return inChannel;
}
return null;