Repository: airavata Updated Branches: refs/heads/master 9fcd441f1 -> 4d07c015b
Removed unused Task implementaions Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/4d07c015 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/4d07c015 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/4d07c015 Branch: refs/heads/master Commit: 4d07c015ba4d874cb3f979f56463e0fd09fac947 Parents: 9fcd441 Author: Shameera Rathnayaka <[email protected]> Authored: Mon Oct 5 15:37:31 2015 -0400 Committer: Shameera Rathnayaka <[email protected]> Committed: Mon Oct 5 15:37:31 2015 -0400 ---------------------------------------------------------------------- .../gfac/impl/task/AbstractSCPTask.java | 49 ---------- .../gfac/impl/task/SCPInputDataStageTask.java | 95 -------------------- .../gfac/impl/task/SCPOutputDataStatgeTask.java | 85 ------------------ 3 files changed, 229 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/4d07c015/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/AbstractSCPTask.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/AbstractSCPTask.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/AbstractSCPTask.java deleted file mode 100644 index 17746f4..0000000 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/AbstractSCPTask.java +++ /dev/null @@ -1,49 +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.airavata.gfac.impl.task; - -import org.apache.airavata.gfac.core.task.Task; -import org.apache.airavata.gfac.core.task.TaskException; - -import java.util.Map; - -public abstract class AbstractSCPTask implements Task { - protected static final int DEFAULT_SSH_PORT = 22; - protected String password; - protected String publicKeyPath; - protected String passPhrase; - protected String privateKeyPath; - protected String userName; - protected String hostName; - protected String inputPath; - - @Override - public void init(Map<String, String> propertyMap) throws TaskException { - password = propertyMap.get("password"); - passPhrase = propertyMap.get("passPhrase"); - privateKeyPath = propertyMap.get("privateKeyPath"); - publicKeyPath = propertyMap.get("publicKeyPath"); - userName = propertyMap.get("userName"); - hostName = propertyMap.get("hostName"); - inputPath = propertyMap.get("inputPath"); - } - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/4d07c015/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/SCPInputDataStageTask.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/SCPInputDataStageTask.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/SCPInputDataStageTask.java deleted file mode 100644 index fc4d634..0000000 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/SCPInputDataStageTask.java +++ /dev/null @@ -1,95 +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.airavata.gfac.impl.task; - -import com.jcraft.jsch.JSch; -import com.jcraft.jsch.JSchException; -import com.jcraft.jsch.Session; -import org.apache.airavata.common.utils.ThriftUtils; -import org.apache.airavata.gfac.core.SSHApiException; -import org.apache.airavata.gfac.core.context.TaskContext; -import org.apache.airavata.gfac.core.task.TaskException; -import org.apache.airavata.gfac.impl.SSHUtils; -import org.apache.airavata.model.status.TaskStatus; -import org.apache.airavata.model.task.DataStagingTaskModel; -import org.apache.airavata.model.task.TaskTypes; -import org.apache.thrift.TException; - -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; - -public class SCPInputDataStageTask extends AbstractSCPTask { - - public SCPInputDataStageTask() { - } - - @Override - public TaskStatus execute(TaskContext taskContext) { - -/* if (taskContext.getTaskModel().getTaskType() != TaskTypes.DATA_STAGING) { - throw new TaskException("Invalid task call, expected " + TaskTypes.DATA_STAGING.toString() + " but found " - + taskContext.getTaskModel().getTaskType().toString()); - } - try { - DataStagingTaskModel subTaskModel = (DataStagingTaskModel) ThriftUtils.getSubTaskModel(taskContext - .getTaskModel()); - URI sourceURI = new URI(subTaskModel.getSource()); - URI destinationURI = new URI(subTaskModel.getDestination()); - - if (sourceURI.getScheme().equalsIgnoreCase("file")) { // local --> Airavata --> RemoteCluster - taskContext.getParentProcessContext().getRemoteCluster().scpTo(sourceURI.getPath(), - subTaskModel.getDestination()); - } else { // PGA(client) --> Airavata --> RemoteCluster - // PGA(client) --> Airavata - JSch jsch = new JSch(); - jsch.addIdentity(privateKeyPath, passPhrase); - Session session = jsch.getSession(userName, hostName, DEFAULT_SSH_PORT); - SSHUtils.scpFrom(sourceURI.getPath(), taskContext.getLocalWorkingDir() , session); - - // Airavata --> RemoteCluster - taskContext.getParentProcessContext().getRemoteCluster().scpTo(destinationURI.getPath(), - taskContext.getLocalWorkingDir()); - } - } catch (SSHApiException e) { - throw new TaskException("Scp attempt failed", e); - } catch (JSchException | IOException e) { - throw new TaskException("Scp failed", e); - } catch (TException e) { - throw new TaskException("Invalid task invocation"); - } catch (URISyntaxException e) { - e.printStackTrace(); - }*/ - return null; - } - - @Override - public TaskStatus recover(TaskContext taskContext) { - return null; - } - - @Override - public TaskTypes getType() { - return TaskTypes.DATA_STAGING; - } - - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/4d07c015/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/SCPOutputDataStatgeTask.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/SCPOutputDataStatgeTask.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/SCPOutputDataStatgeTask.java deleted file mode 100644 index 6fa87c4..0000000 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/task/SCPOutputDataStatgeTask.java +++ /dev/null @@ -1,85 +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.airavata.gfac.impl.task; - -import com.jcraft.jsch.JSch; -import com.jcraft.jsch.JSchException; -import com.jcraft.jsch.Session; -import org.apache.airavata.common.utils.ThriftUtils; -import org.apache.airavata.gfac.core.SSHApiException; -import org.apache.airavata.gfac.core.context.TaskContext; -import org.apache.airavata.gfac.core.task.TaskException; -import org.apache.airavata.gfac.impl.SSHUtils; -import org.apache.airavata.model.status.TaskStatus; -import org.apache.airavata.model.task.DataStagingTaskModel; -import org.apache.airavata.model.task.TaskTypes; -import org.apache.thrift.TException; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; - -public class SCPOutputDataStatgeTask extends AbstractSCPTask { - - - @Override - public TaskStatus execute(TaskContext taskContext) { -/* if (taskContext.getTaskModel().getTaskType() != TaskTypes.DATA_STAGING) { - throw new TaskException("Invalid task call, expected " + TaskTypes.DATA_STAGING.toString() + " but found " - + taskContext.getTaskModel().getTaskType().toString()); - } - try { - DataStagingTaskModel subTaskModel = (DataStagingTaskModel) ThriftUtils.getSubTaskModel(taskContext - .getTaskModel()); - URL sourceURL = new URL(subTaskModel.getSource()); - URL destinationURL = new URL(subTaskModel.getDestination()); - JSch jsch = new JSch(); - jsch.addIdentity(privateKeyPath, passPhrase); - Session session = jsch.getSession(userName, hostName, DEFAULT_SSH_PORT); - // RemoteCluster --> Airavata - taskContext.getParentProcessContext().getRemoteCluster().scpFrom(sourceURL.getPath(), inputPath); - - if (destinationURL.getProtocol().equalsIgnoreCase("file")) { - // Airavata --> PGA(Client) - SSHUtils.scpTo(inputPath, destinationURL.getPath(), session); - } - } catch (MalformedURLException e) { - throw new TaskException("Wrong source or destination file path.", e); - } catch (SSHApiException e) { - throw new TaskException("Scp attempt failed", e); - } catch (JSchException | IOException e) { - throw new TaskException("Scp failed", e); - } catch (TException e) { - throw new TaskException("Invalid task invocation"); - }*/ - return null; - } - - @Override - public TaskStatus recover(TaskContext taskContext) { - return null; - } - - @Override - public TaskTypes getType() { - return TaskTypes.DATA_STAGING; - } -}
