Deleted unused classes
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/08cdad26 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/08cdad26 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/08cdad26 Branch: refs/heads/master Commit: 08cdad2645ffcea9b499a23afe408d9c2bd2896f Parents: 140d9bd Author: Shameera Rathnayaka <[email protected]> Authored: Mon Nov 9 10:59:30 2015 -0500 Committer: Shameera Rathnayaka <[email protected]> Committed: Mon Nov 9 10:59:30 2015 -0500 ---------------------------------------------------------------------- .../gfac/impl/AiravataJobStatusUpdator.java | 120 ---- .../gfac/impl/AiravataProcessStatusUpdator.java | 125 ----- .../gfac/impl/AiravataTaskStatusUpdator.java | 159 ------ .../ssh/handler/AdvancedSCPInputHandler.java | 229 -------- .../ssh/handler/AdvancedSCPOutputHandler.java | 225 -------- .../gfac/ssh/handler/NewSSHOutputHandler.java | 78 --- .../ssh/handler/SSHDirectorySetupHandler.java | 119 ---- .../gfac/ssh/handler/SSHInputHandler.java | 198 ------- .../gfac/ssh/handler/SSHOutputHandler.java | 256 --------- .../gfac/ssh/provider/impl/SSHProvider.java | 473 ---------------- .../airavata/gfac/ssh/util/GFACSSHUtils.java | 562 ------------------- .../airavata/gfac/ssh/util/HandleOutputs.java | 96 ---- 12 files changed, 2640 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/08cdad26/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataJobStatusUpdator.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataJobStatusUpdator.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataJobStatusUpdator.java deleted file mode 100644 index e029324..0000000 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataJobStatusUpdator.java +++ /dev/null @@ -1,120 +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; -// -//import com.google.common.eventbus.Subscribe; -//import org.apache.airavata.common.utils.AiravataUtils; -//import org.apache.airavata.common.utils.LocalEventPublisher; -//import org.apache.airavata.common.utils.listener.AbstractActivityListener; -//import org.apache.airavata.messaging.core.MessageContext; -//import org.apache.airavata.messaging.core.Publisher; -//import org.apache.airavata.model.job.JobModel; -//import org.apache.airavata.model.messaging.event.JobStatusChangeEvent; -//import org.apache.airavata.model.messaging.event.JobStatusChangeRequestEvent; -//import org.apache.airavata.model.messaging.event.MessageType; -//import org.apache.airavata.model.status.JobState; -//import org.apache.airavata.model.status.JobStatus; -//import org.apache.airavata.registry.cpi.CompositeIdentifier; -//import org.apache.airavata.registry.cpi.ExperimentCatalog; -//import org.apache.airavata.registry.cpi.ExperimentCatalogModelType; -//import org.slf4j.Logger; -//import org.slf4j.LoggerFactory; -// -//import java.util.Calendar; -// -//public class AiravataJobStatusUpdator implements AbstractActivityListener { -// private final static Logger logger = LoggerFactory.getLogger(AiravataJobStatusUpdator.class); -// private ExperimentCatalog airavataExperimentCatalog; -// -// private LocalEventPublisher localEventPublisher; -// private Publisher publisher; -// -// -// public ExperimentCatalog getAiravataExperimentCatalog() { -// return airavataExperimentCatalog; -// } -// -// public void setAiravataExperimentCatalog(ExperimentCatalog airavataExperimentCatalog) { -// this.airavataExperimentCatalog = airavataExperimentCatalog; -// } -// -// -// @Subscribe -// public void updateRegistry(JobStatusChangeRequestEvent jobStatus) throws Exception{ -// /* Here we need to parse the jobStatus message and update -// the registry accordingly, for now we are just printing to standard Out -// */ -// JobState state = jobStatus.getState(); -// if (state != null) { -// try { -// String taskID = jobStatus.getJobIdentity().getTaskId(); -// String jobID = jobStatus.getJobIdentity().getJobId(); -// String expId = jobStatus.getJobIdentity().getExperimentId(); -// updateJobStatus(expId,taskID, jobID, state); -// logger.debug("expId - {}: Publishing job status for " + jobStatus.getJobIdentity().getJobId() + ":" -// + state.toString(),jobStatus.getJobIdentity().getExperimentId()); -// JobStatusChangeEvent event = new JobStatusChangeEvent(jobStatus.getState(), jobStatus.getJobIdentity()); -// localEventPublisher.publish(event); -// String messageId = AiravataUtils.getId("JOB"); -// MessageContext msgCntxt = new MessageContext(event, MessageType.JOB, messageId, jobStatus.getJobIdentity().getGatewayId()); -// msgCntxt.setUpdatedTime(AiravataUtils.getCurrentTimestamp()); -// publisher.publish(msgCntxt); -// } catch (Exception e) { -// logger.error("expId - " + jobStatus.getJobIdentity().getExperimentId() + ": Error persisting data" -// + e.getLocalizedMessage(), e); -// throw new Exception("Error persisting job status..", e); -// } -// } -// } -// -// public void updateJobStatus(String expId, String taskId, String jobID, JobState state) throws Exception { -// logger.info("expId - {}: Updating job status for " + jobID + ":" + state.toString(), expId); -// CompositeIdentifier ids = new CompositeIdentifier(taskId, jobID); -// JobModel jobModel = (JobModel) airavataExperimentCatalog.get(ExperimentCatalogModelType.JOB_DETAIL, ids); -// if (jobModel == null) { -// jobModel = new JobModel(); -// } -// JobStatus status = new JobStatus(); -// if (JobState.CANCELED.equals(jobModel.getJobStatus().getJobState())) { -// status.setJobState(jobModel.getJobStatus().getJobState()); -// } else { -// status.setJobState(state); -// } -// status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis()); -// jobModel.setJobStatus(status); -// jobModel.setJobId(jobID); -// logger.debug("expId - {}: Updated job status for " + jobID + ":" + jobModel.getJobStatus().toString(), expId); -// airavataExperimentCatalog.update(ExperimentCatalogModelType.JOB_STATUS, status, ids); -// } -// -// @SuppressWarnings("unchecked") -// public void setup(Object... configurations) { -// for (Object configuration : configurations) { -// if (configuration instanceof ExperimentCatalog){ -// this.airavataExperimentCatalog =(ExperimentCatalog)configuration; -// } else if (configuration instanceof LocalEventPublisher){ -// this.localEventPublisher =(LocalEventPublisher) configuration; -// } else if (configuration instanceof Publisher){ -// this.publisher=(Publisher) configuration; -// } -// } -// } -//} http://git-wip-us.apache.org/repos/asf/airavata/blob/08cdad26/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataProcessStatusUpdator.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataProcessStatusUpdator.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataProcessStatusUpdator.java deleted file mode 100644 index 6f85e6c..0000000 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataProcessStatusUpdator.java +++ /dev/null @@ -1,125 +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; -// -//import com.google.common.eventbus.Subscribe; -//import org.apache.airavata.common.utils.AiravataUtils; -//import org.apache.airavata.common.utils.LocalEventPublisher; -//import org.apache.airavata.common.utils.listener.AbstractActivityListener; -//import org.apache.airavata.messaging.core.MessageContext; -//import org.apache.airavata.messaging.core.Publisher; -//import org.apache.airavata.model.messaging.event.MessageType; -//import org.apache.airavata.model.messaging.event.TaskStatusChangeEvent; -//import org.apache.airavata.model.messaging.event.WorkflowIdentifier; -//import org.apache.airavata.model.messaging.event.WorkflowNodeStatusChangeEvent; -//import org.apache.airavata.model.experiment.WorkflowNodeDetails; -//import org.apache.airavata.model.experiment.WorkflowNodeState; -//import org.apache.airavata.model.experiment.WorkflowNodeStatus; -//import org.apache.airavata.model.status.ProcessState; -//import org.apache.airavata.model.status.ProcessStatus; -//import org.apache.airavata.registry.cpi.ExperimentCatalog; -//import org.apache.airavata.registry.cpi.ExperimentCatalogModelType; -//import org.slf4j.Logger; -//import org.slf4j.LoggerFactory; -// -//import java.util.Calendar; -// -//public class AiravataProcessStatusUpdator implements AbstractActivityListener { -// private final static Logger logger = LoggerFactory.getLogger(AiravataProcessStatusUpdator.class); -// -// private ExperimentCatalog airavataExperimentCatalog; -// private LocalEventPublisher localEventPublisher; -// private Publisher publisher; -// -// -// -// -// public ExperimentCatalog getAiravataExperimentCatalog() { -// return airavataExperimentCatalog; -// } -// -// public void setAiravataExperimentCatalog(ExperimentCatalog airavataExperimentCatalog) { -// this.airavataExperimentCatalog = airavataExperimentCatalog; -// } -// -// @Subscribe -// public void setupProcessStatus(TaskStatusChangeEvent taskStatus) throws Exception{ -// ProcessState state; -// switch(taskStatus.getState()){ -// case CANCELED: -// state=ProcessState.CANCELED; break; -// case COMPLETED: -// state=ProcessState.EXECUTING; break; -// case FAILED: -// state=ProcessState.FAILED; break; -// case EXECUTING: -// state=ProcessState.EXECUTING; break; -// default: -// return; -// } -// try { -// String expId = taskStatus.getTaskIdentity().getExperimentId(); -// updateWorkflowNodeStatus(expId, taskStatus.getTaskIdentity().getWorkflowNodeId(), state); -// logger.debug("expId - {}: Publishing workflow node status for " + taskStatus.getTaskIdentity().getWorkflowNodeId() -// + ":" + state.toString(), taskStatus.getTaskIdentity().getExperimentId()); -// WorkflowIdentifier workflowIdentity = new WorkflowIdentifier(taskStatus.getTaskIdentity().getWorkflowNodeId(), -// taskStatus.getTaskIdentity().getExperimentId(), -// taskStatus.getTaskIdentity().getGatewayId()); -// WorkflowNodeStatusChangeEvent event = new WorkflowNodeStatusChangeEvent(state, workflowIdentity); -// localEventPublisher.publish(event); -// String messageId = AiravataUtils.getId("WFNODE"); -// MessageContext msgCntxt = new MessageContext(event, MessageType.WORKFLOWNODE, messageId, taskStatus.getTaskIdentity().getGatewayId()); -// msgCntxt.setUpdatedTime(AiravataUtils.getCurrentTimestamp()); -// -// publisher.publish(msgCntxt); -// } catch (Exception e) { -// logger.error("expId - " + taskStatus.getTaskIdentity().getExperimentId() + ": Error persisting data" -// + e.getLocalizedMessage(), e); -// throw new Exception("Error persisting workflow node status..", e); -// } -// } -// -// public void updateWorkflowNodeStatus(String experimentId, String workflowNodeId, WorkflowNodeState state) throws Exception { -// logger.info("expId - {}: Updating workflow node status for "+workflowNodeId+":"+state.toString(), experimentId); -// WorkflowNodeDetails details = (WorkflowNodeDetails) airavataExperimentCatalog.get(ExperimentCatalogModelType.WORKFLOW_NODE_DETAIL, workflowNodeId); -// if(details == null) { -// details = new WorkflowNodeDetails(); -// details.setNodeInstanceId(workflowNodeId); -// } -// WorkflowNodeStatus status = new WorkflowNodeStatus(); -// status.setWorkflowNodeState(state); -// status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis()); -// details.setWorkflowNodeStatus(status); -// airavataExperimentCatalog.update(ExperimentCatalogModelType.WORKFLOW_NODE_STATUS, status, workflowNodeId); -// } -// -// public void setup(Object... configurations) { -// for (Object configuration : configurations) { -// if (configuration instanceof ExperimentCatalog){ -// this.airavataExperimentCatalog =(ExperimentCatalog)configuration; -// } else if (configuration instanceof LocalEventPublisher){ -// this.localEventPublisher =(LocalEventPublisher) configuration; -// } else if (configuration instanceof Publisher){ -// this.publisher=(Publisher) configuration; -// } -// } -// } -//} http://git-wip-us.apache.org/repos/asf/airavata/blob/08cdad26/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataTaskStatusUpdator.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataTaskStatusUpdator.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataTaskStatusUpdator.java deleted file mode 100644 index 8ddacc4..0000000 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/AiravataTaskStatusUpdator.java +++ /dev/null @@ -1,159 +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; -// -//import com.google.common.eventbus.Subscribe; -//import org.apache.airavata.common.exception.AiravataException; -//import org.apache.airavata.common.utils.AiravataUtils; -//import org.apache.airavata.common.utils.LocalEventPublisher; -//import org.apache.airavata.common.utils.listener.AbstractActivityListener; -//import org.apache.airavata.messaging.core.MessageContext; -//import org.apache.airavata.messaging.core.Publisher; -//import org.apache.airavata.model.messaging.event.JobStatusChangeEvent; -//import org.apache.airavata.model.messaging.event.MessageType; -//import org.apache.airavata.model.messaging.event.TaskIdentifier; -//import org.apache.airavata.model.messaging.event.TaskOutputChangeEvent; -//import org.apache.airavata.model.messaging.event.TaskStatusChangeEvent; -//import org.apache.airavata.model.messaging.event.TaskStatusChangeRequestEvent; -//import org.apache.airavata.model.status.TaskState; -//import org.apache.airavata.registry.cpi.ExperimentCatalog; -//import org.apache.airavata.registry.cpi.ExperimentCatalogModelType; -//import org.slf4j.Logger; -//import org.slf4j.LoggerFactory; -// -//import java.util.Calendar; -// -//public class AiravataTaskStatusUpdator implements AbstractActivityListener { -// private final static Logger logger = LoggerFactory.getLogger(AiravataTaskStatusUpdator.class); -// private ExperimentCatalog airavataExperimentCatalog; -// private LocalEventPublisher localEventPublisher; -// private Publisher publisher; -// -// public ExperimentCatalog getAiravataExperimentCatalog() { -// return airavataExperimentCatalog; -// } -// -// public void setAiravataExperimentCatalog(ExperimentCatalog airavataExperimentCatalog) { -// this.airavataExperimentCatalog = airavataExperimentCatalog; -// } -// -// @Subscribe -// public void setupTaskStatus(TaskStatusChangeRequestEvent taskStatus) throws Exception{ -// try { -// updateTaskStatus(taskStatus.getTaskIdentity().getTaskId(), taskStatus.getState()); -// logger.debug("expId - {}: Publishing task status for " + taskStatus.getTaskIdentity().getTaskId() + ":" -// + taskStatus.getState().toString(), taskStatus.getTaskIdentity().getExperimentId()); -// TaskStatusChangeEvent event = new TaskStatusChangeEvent(taskStatus.getState(), taskStatus.getTaskIdentity()); -// localEventPublisher.publish(event); -// String messageId = AiravataUtils.getId("TASK"); -// MessageContext msgCntxt = new MessageContext(event, MessageType.TASK, messageId, taskStatus.getTaskIdentity().getGatewayId()); -// msgCntxt.setUpdatedTime(AiravataUtils.getCurrentTimestamp()); -// publisher.publish(msgCntxt); -// } catch (Exception e) { -// String msg = "Error persisting data task status to database..."; -// logger.error(msg + e.getLocalizedMessage(), e); -// throw new Exception(msg, e); -// } -// } -// -// @Subscribe -// public void setupTaskStatus(JobStatusChangeEvent jobStatus) throws Exception{ -// TaskState state; -// switch(jobStatus.getState()){ -// case ACTIVE: -// state=TaskState.EXECUTING; break; -// case CANCELED: -// state=TaskState.CANCELED; break; -// case COMPLETE: case FAILED: -// state=TaskState.EXECUTING; break; -// case SUSPENDED: case QUEUED: -// state=TaskState.EXECUTING; break; -// case SUBMITTED: -// state=TaskState.EXECUTING; break; -// default: -// return; -// } -// try { -// updateTaskStatus(jobStatus.getJobIdentity().getTaskId(), state); -// logger.debug("expId - {}: Publishing task status for " + jobStatus.getJobIdentity().getTaskId() + ":" -// + state.toString(), jobStatus.getJobIdentity().getExperimentId()); -// TaskIdentifier taskIdentity = new TaskIdentifier(jobStatus.getJobIdentity().getTaskId(), -// jobStatus.getJobIdentity().getWorkflowNodeId(), -// jobStatus.getJobIdentity().getExperimentId(), -// jobStatus.getJobIdentity().getGatewayId()); -// TaskStatusChangeEvent event = new TaskStatusChangeEvent(state, taskIdentity); -// localEventPublisher.publish(event); -// String messageId = AiravataUtils.getId("TASK"); -// MessageContext msgCntxt = new MessageContext(event, MessageType.TASK, messageId,jobStatus.getJobIdentity().getGatewayId()); -// msgCntxt.setUpdatedTime(AiravataUtils.getCurrentTimestamp()); -// publisher.publish(msgCntxt); -// -// } catch (Exception e) { -// logger.error("expId - " + jobStatus.getJobIdentity().getExperimentId() + ": Error persisting data" + e.getLocalizedMessage(), e); -// throw new Exception("Error persisting task status..", e); -// } -// } -// -// public TaskState updateTaskStatus(String taskId, TaskState state) throws Exception { -// TaskDetails details = (TaskDetails) airavataExperimentCatalog.get(ExperimentCatalogModelType.TASK_DETAIL, taskId); -// if(details == null) { -// logger.error("Task details cannot be null at this point"); -// throw new Exception("Task details cannot be null at this point"); -// } -// org.apache.airavata.model.workspace.experiment.TaskStatus status = new org.apache.airavata.model.workspace.experiment.TaskStatus(); -// if(!TaskState.CANCELED.equals(details.getTaskStatus().getExecutionState()) -// && !TaskState.CANCELING.equals(details.getTaskStatus().getExecutionState())){ -// status.setExecutionState(state); -// }else{ -// status.setExecutionState(details.getTaskStatus().getExecutionState()); -// } -// status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis()); -// details.setTaskStatus(status); -// logger.debug("Updating task status for "+taskId+":"+details.getTaskStatus().toString()); -// -// airavataExperimentCatalog.update(ExperimentCatalogModelType.TASK_STATUS, status, taskId); -// return status.getExecutionState(); -// } -// -// public void setup(Object... configurations) { -// for (Object configuration : configurations) { -// if (configuration instanceof ExperimentCatalog){ -// this.airavataExperimentCatalog =(ExperimentCatalog)configuration; -// } else if (configuration instanceof LocalEventPublisher){ -// this.localEventPublisher =(LocalEventPublisher) configuration; -// } else if (configuration instanceof Publisher){ -// this.publisher=(Publisher) configuration; -// } -// } -// } -// -// -// @Subscribe -// public void taskOutputChanged(TaskOutputChangeEvent taskOutputEvent) throws AiravataException { -// String taskId = taskOutputEvent.getTaskIdentity().getTaskId(); -// logger.debug("Task Output changed event received for workflow node : " + -// taskOutputEvent.getTaskIdentity().getWorkflowNodeId() + ", task : " + taskId); -// // TODO - do we need to update the output to the registry? , we do it in the workflowInterpreter too. -// MessageContext messageContext = new MessageContext(taskOutputEvent, MessageType.TASKOUTPUT, taskOutputEvent.getTaskIdentity().getTaskId(), taskOutputEvent.getTaskIdentity().getGatewayId()); -// messageContext.setUpdatedTime(AiravataUtils.getCurrentTimestamp()); -// publisher.publish(messageContext); -// } -//} http://git-wip-us.apache.org/repos/asf/airavata/blob/08cdad26/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java deleted file mode 100644 index 587bf46..0000000 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java +++ /dev/null @@ -1,229 +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.ssh.handler; -// -//import org.apache.airavata.gfac.core.GFacException; -//import org.apache.airavata.gfac.core.SSHApiException; -//import org.apache.airavata.gfac.core.cluster.RemoteCluster; -//import org.apache.airavata.gfac.core.context.JobExecutionContext; -//import org.apache.airavata.gfac.core.context.MessageContext; -//import org.apache.airavata.gfac.core.handler.AbstractHandler; -//import org.apache.airavata.gfac.core.handler.GFacHandlerException; -//import org.apache.airavata.gfac.core.GFacUtils; -//import org.apache.airavata.gfac.gsi.ssh.impl.authentication.DefaultPasswordAuthenticationInfo; -//import org.apache.airavata.gfac.gsi.ssh.impl.authentication.DefaultPublicKeyFileAuthentication; -//import org.apache.airavata.gfac.ssh.security.SSHSecurityContext; -//import org.apache.airavata.gfac.ssh.util.GFACSSHUtils; -//import org.apache.airavata.gfac.core.authentication.AuthenticationInfo; -//import org.apache.airavata.model.appcatalog.appinterface.DataType; -//import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType; -//import org.apache.airavata.model.experiment.*; -//import org.apache.airavata.registry.cpi.ExpCatChildDataType; -//import org.slf4j.Logger; -//import org.slf4j.LoggerFactory; -// -//import java.io.File; -//import java.io.PrintWriter; -//import java.io.StringWriter; -//import java.net.MalformedURLException; -//import java.net.URL; -//import java.util.*; -// -///** -// * This handler will copy input data from gateway machine to airavata -// * installed machine, later running handlers can copy the input files to computing resource -// * <Handler class="AdvancedSCPOutputHandler"> -// * <property name="privateKeyPath" value="/Users/lahirugunathilake/.ssh/id_dsa"/> -// * <property name="publicKeyPath" value="/Users/lahirugunathilake/.ssh/id_dsa.pub"/> -// * <property name="userName" value="airavata"/> -// * <property name="hostName" value="gw98.iu.xsede.org"/> -// * <property name="inputPath" value="/home/airavata/outputData"/> -// */ -//public class AdvancedSCPInputHandler extends AbstractHandler { -// private static final Logger log = LoggerFactory.getLogger(AdvancedSCPInputHandler.class); -// public static final String ADVANCED_SSH_AUTH = "advanced.ssh.auth"; -// public static final int DEFAULT_SSH_PORT = 22; -// -// private String password = null; -// -// private String publicKeyPath; -// -// private String passPhrase; -// -// private String privateKeyPath; -// -// private String userName; -// -// private String hostName; -// -// private String inputPath; -// -// public void initProperties(Properties properties) throws GFacHandlerException { -// password = (String) properties.get("password"); -// passPhrase = (String) properties.get("passPhrase"); -// privateKeyPath = (String) properties.get("privateKeyPath"); -// publicKeyPath = (String) properties.get("publicKeyPath"); -// userName = (String) properties.get("userName"); -// hostName = (String) properties.get("hostName"); -// inputPath = (String) properties.get("inputPath"); -// } -// -// public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException { -// super.invoke(jobExecutionContext); -// int index = 0; -// int oldIndex = 0; -// List<String> oldFiles = new ArrayList<String>(); -// MessageContext inputNew = new MessageContext(); -// StringBuffer data = new StringBuffer("|"); -// RemoteCluster remoteCluster = null; -// -// try { -// String pluginData = GFacUtils.getHandlerData(jobExecutionContext, this.getClass().getName()); -// if (pluginData != null) { -// try { -// oldIndex = Integer.parseInt(pluginData.split("\\|")[0].trim()); -// oldFiles = Arrays.asList(pluginData.split("\\|")[1].split(",")); -// if (oldIndex == oldFiles.size()) { -// log.info("Old data looks good !!!!"); -// } else { -// oldIndex = 0; -// oldFiles.clear(); -// } -// } catch (NumberFormatException e) { -// log.error("Previously stored data " + pluginData + " is wrong so we continue the operations"); -// } -// } -// -// AuthenticationInfo authenticationInfo = null; -// if (password != null) { -// authenticationInfo = new DefaultPasswordAuthenticationInfo(this.password); -// } else { -// authenticationInfo = new DefaultPublicKeyFileAuthentication(this.publicKeyPath, this.privateKeyPath, -// this.passPhrase); -// } -// -// // Server info -// String parentPath = inputPath + File.separator + jobExecutionContext.getExperimentID() + File.separator + jobExecutionContext.getTaskData().getTaskID(); -// if (index < oldIndex) { -// parentPath = oldFiles.get(index); -// data.append(oldFiles.get(index++)).append(","); // we get already transfered file and increment the index -// } else { -// (new File(parentPath)).mkdirs(); -// StringBuffer temp = new StringBuffer(data.append(parentPath).append(",").toString()); -// GFacUtils.saveHandlerData(jobExecutionContext, temp.insert(0, ++index), this.getClass().getName()); -// } -// DataTransferDetails detail = new DataTransferDetails(); -// TransferStatus status = new TransferStatus(); -// // here doesn't matter what the job manager is because we are only doing some file handling -// // not really dealing with monitoring or job submission, so we pa -// -// MessageContext input = jobExecutionContext.getInMessageContext(); -// Set<String> parameters = input.getParameters().keySet(); -// for (String paramName : parameters) { -// InputDataObjectType inputParamType = (InputDataObjectType) input.getParameters().get(paramName); -// String paramValue = inputParamType.getValue(); -// // TODO: Review this with type -// if (inputParamType.getType() == DataType.URI) { -// try { -// URL file = new URL(paramValue); -// String key = file.getUserInfo() + file.getHost() + DEFAULT_SSH_PORT; -// GFACSSHUtils.prepareSecurityContext(jobExecutionContext, authenticationInfo, file.getUserInfo(), file.getHost(), DEFAULT_SSH_PORT); -// remoteCluster = ((SSHSecurityContext)jobExecutionContext.getSecurityContext(key)).getRemoteCluster(); -// paramValue = file.getPath(); -// } catch (MalformedURLException e) { -// String key = this.userName + this.hostName + DEFAULT_SSH_PORT; -// GFACSSHUtils.prepareSecurityContext(jobExecutionContext, authenticationInfo, this.userName, this.hostName, DEFAULT_SSH_PORT); -// remoteCluster = ((SSHSecurityContext)jobExecutionContext.getSecurityContext(key)).getRemoteCluster(); -// log.error(e.getLocalizedMessage(), e); -// } -// -// if (index < oldIndex) { -// log.info("Input File: " + paramValue + " is already transfered, so we skip this operation !!!"); -// inputParamType.setValue(oldFiles.get(index)); -// data.append(oldFiles.get(index++)).append(","); // we get already transfered file and increment the index -// } else { -// String stageInputFile = stageInputFiles(remoteCluster, paramValue, parentPath); -// inputParamType.setValue(stageInputFile); -// StringBuffer temp = new StringBuffer(data.append(stageInputFile).append(",").toString()); -// status.setTransferState(TransferState.UPLOAD); -// detail.setTransferStatus(status); -// detail.setTransferDescription("Input Data Staged: " + stageInputFile); -// experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); -// -// GFacUtils.saveHandlerData(jobExecutionContext, temp.insert(0, ++index), this.getClass().getName()); -// } -// } -// // FIXME: what is the thrift model DataType equivalent for URIArray type? -//// else if ("URIArray".equals(actualParameter.getType().getType().toString())) { -//// List<String> split = Arrays.asList(StringUtil.getElementsFromString(paramValue)); -//// List<String> newFiles = new ArrayList<String>(); -//// for (String paramValueEach : split) { -//// try { -//// URL file = new URL(paramValue); -//// this.userName = file.getUserInfo(); -//// this.hostName = file.getHost(); -//// paramValueEach = file.getPath(); -//// } catch (MalformedURLException e) { -//// log.error(e.getLocalizedMessage(), e); -//// } -//// if (index < oldIndex) { -//// log.info("Input File: " + paramValue + " is already transfered, so we skip this operation !!!"); -//// newFiles.add(oldFiles.get(index)); -//// data.append(oldFiles.get(index++)).append(","); -//// } else { -//// String stageInputFiles = stageInputFiles(remoteCluster, paramValueEach, parentPath); -//// StringBuffer temp = new StringBuffer(data.append(stageInputFiles).append(",").toString()); -//// GFacUtils.savePluginData(jobExecutionContext, temp.insert(0, ++index), this.getClass().getName()); -//// newFiles.add(stageInputFiles); -//// } -//// } -//// ((URIArrayType) actualParameter.getType()).setValueArray(newFiles.toArray(new String[newFiles.size()])); -//// } -// inputNew.getParameters().put(paramName, inputParamType); -// } -// } catch (Exception e) { -// log.error(e.getMessage()); -// try { -// StringWriter errors = new StringWriter(); -// e.printStackTrace(new PrintWriter(errors)); -// GFacUtils.saveErrorDetails(jobExecutionContext, errors.toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR); -// } catch (GFacException e1) { -// log.error(e1.getLocalizedMessage()); -// } -// throw new GFacHandlerException("Error while input File Staging", e, e.getLocalizedMessage()); -// } -// jobExecutionContext.setInMessageContext(inputNew); -// } -// -// public void recover(JobExecutionContext jobExecutionContext) throws GFacHandlerException { -// this.invoke(jobExecutionContext); -// } -// -// private String stageInputFiles(RemoteCluster remoteCluster, String paramValue, String parentPath) throws GFacException { -// try { -// remoteCluster.scpFrom(paramValue, parentPath); -// return "file://" + parentPath + File.separator + (new File(paramValue)).getName(); -// } catch (SSHApiException e) { -// log.error("Error tranfering remote file to local file, remote path: " + paramValue); -// throw new GFacException(e); -// } -// } -//} http://git-wip-us.apache.org/repos/asf/airavata/blob/08cdad26/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java deleted file mode 100644 index 175351f..0000000 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java +++ /dev/null @@ -1,225 +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.ssh.handler; -// -//import org.apache.airavata.common.exception.ApplicationSettingsException; -//import org.apache.airavata.gfac.core.GFacException; -//import org.apache.airavata.gfac.core.SSHApiException; -//import org.apache.airavata.gfac.core.cluster.RemoteCluster; -//import org.apache.airavata.gfac.core.context.JobExecutionContext; -//import org.apache.airavata.gfac.core.handler.AbstractHandler; -//import org.apache.airavata.gfac.core.handler.GFacHandlerException; -//import org.apache.airavata.gfac.core.GFacUtils; -//import org.apache.airavata.gfac.gsi.ssh.impl.authentication.DefaultPasswordAuthenticationInfo; -//import org.apache.airavata.gfac.gsi.ssh.impl.authentication.DefaultPublicKeyFileAuthentication; -//import org.apache.airavata.gfac.ssh.security.SSHSecurityContext; -//import org.apache.airavata.gfac.ssh.util.GFACSSHUtils; -//import org.apache.airavata.gfac.core.authentication.AuthenticationInfo; -//import org.apache.airavata.model.appcatalog.appinterface.DataType; -//import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType; -//import org.apache.airavata.model.experiment.CorrectiveAction; -//import org.apache.airavata.model.experiment.ErrorCategory; -//import org.apache.airavata.registry.cpi.ExpCatChildDataType; -//import org.slf4j.Logger; -//import org.slf4j.LoggerFactory; -// -//import java.io.File; -//import java.io.PrintWriter; -//import java.io.StringWriter; -//import java.net.MalformedURLException; -//import java.net.URL; -//import java.util.*; -// -///** -// * This handler will copy outputs from airavata installed local directory -// * to a remote location, prior to this handler SCPOutputHandler should be invoked -// * Should add following configuration to gfac-config.xml and configure the keys properly -// * <Handler class="AdvancedSCPOutputHandler"> -// <property name="privateKeyPath" value="/Users/lahirugunathilake/.ssh/id_dsa"/> -// <property name="publicKeyPath" value="/Users/lahirugunathilake/.ssh/id_dsa.pub"/> -// <property name="userName" value="airavata"/> -// <property name="hostName" value="gw98.iu.xsede.org"/> -// <property name="outputPath" value="/home/airavata/outputData"/> -// <property name="passPhrase" value="/home/airavata/outputData"/> -// <property name="password" value="/home/airavata/outputData"/> -// -// */ -//public class AdvancedSCPOutputHandler extends AbstractHandler { -// private static final Logger log = LoggerFactory.getLogger(AdvancedSCPOutputHandler.class); -// -// public static final int DEFAULT_SSH_PORT = 22; -// -// private String password = null; -// -// private String publicKeyPath; -// -// private String passPhrase; -// -// private String privateKeyPath; -// -// private String userName; -// -// private String hostName; -// -// private String outputPath; -// -// -// public void initProperties(Properties properties) throws GFacHandlerException { -// password = (String)properties.get("password"); -// passPhrase = (String)properties.get("passPhrase"); -// privateKeyPath = (String)properties.get("privateKeyPath"); -// publicKeyPath = (String)properties.get("publicKeyPath"); -// userName = (String)properties.get("userName"); -// hostName = (String)properties.get("hostName"); -// outputPath = (String)properties.get("outputPath"); -// } -// -// @Override -// public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException { -// RemoteCluster remoteCluster = null; -// AuthenticationInfo authenticationInfo = null; -// if (password != null) { -// authenticationInfo = new DefaultPasswordAuthenticationInfo(this.password); -// } else { -// authenticationInfo = new DefaultPublicKeyFileAuthentication(this.publicKeyPath, this.privateKeyPath, -// this.passPhrase); -// } -// try { -// String hostName = jobExecutionContext.getHostName(); -// if (jobExecutionContext.getSecurityContext(hostName) == null) { -// try { -// GFACSSHUtils.addSecurityContext(jobExecutionContext); -// } catch (ApplicationSettingsException e) { -// log.error(e.getMessage()); -// try { -// StringWriter errors = new StringWriter(); -// e.printStackTrace(new PrintWriter(errors)); -// GFacUtils.saveErrorDetails(jobExecutionContext, errors.toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR); -// } catch (GFacException e1) { -// log.error(e1.getLocalizedMessage()); -// } -// throw new GFacHandlerException("Error while creating SSHSecurityContext", e, e.getLocalizedMessage()); -// } -// } -// String standardError = jobExecutionContext.getStandardError(); -// String standardOutput = jobExecutionContext.getStandardOutput(); -// super.invoke(jobExecutionContext); -// // Server info -// if(jobExecutionContext.getTaskData().getAdvancedOutputDataHandling() != null && jobExecutionContext.getTaskData().getAdvancedOutputDataHandling().getOutputDataDir() != null){ -// try{ -// URL outputPathURL = new URL(jobExecutionContext.getTaskData().getAdvancedOutputDataHandling().getOutputDataDir()); -// this.userName = outputPathURL.getUserInfo(); -// this.hostName = outputPathURL.getHost(); -// outputPath = outputPathURL.getPath(); -// } catch (MalformedURLException e) { -// log.error(e.getLocalizedMessage(),e); -// } -// } -// String key = GFACSSHUtils.prepareSecurityContext(jobExecutionContext, authenticationInfo, this.userName, this.hostName, DEFAULT_SSH_PORT); -// remoteCluster = ((SSHSecurityContext)jobExecutionContext.getSecurityContext(key)).getRemoteCluster(); -// if(jobExecutionContext.getTaskData().getAdvancedOutputDataHandling() != null && !jobExecutionContext.getTaskData().getAdvancedOutputDataHandling().isPersistOutputData()){ -// outputPath = outputPath + File.separator + jobExecutionContext.getExperimentID() + "-" + jobExecutionContext.getTaskData().getTaskID() -// + File.separator; -// remoteCluster.makeDirectory(outputPath); -// } -// remoteCluster.scpTo(outputPath, standardError); -// remoteCluster.scpTo(outputPath, standardOutput); -// List<OutputDataObjectType> outputArray = new ArrayList<OutputDataObjectType>(); -// Map<String, Object> output = jobExecutionContext.getOutMessageContext().getParameters(); -// Set<String> keys = output.keySet(); -// for (String paramName : keys) { -// OutputDataObjectType outputDataObjectType = (OutputDataObjectType) output.get(paramName); -// if (outputDataObjectType.getType() == DataType.URI) { -// // for failed jobs outputs are not generated. So we should not download outputs -// if (GFacUtils.isFailedJob(jobExecutionContext)){ -// continue; -// } -// String downloadFile = outputDataObjectType.getValue(); -// if(downloadFile == null || !(new File(downloadFile).isFile())){ -// GFacUtils.saveErrorDetails(jobExecutionContext, "Empty Output returned from the application", CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR); -// throw new GFacHandlerException("Empty Output returned from the application.." ); -// } -// remoteCluster.scpTo(outputPath, downloadFile); -// String fileName = downloadFile.substring(downloadFile.lastIndexOf(File.separatorChar)+1, downloadFile.length()); -// OutputDataObjectType dataObjectType = new OutputDataObjectType(); -// dataObjectType.setValue(outputPath + File.separatorChar + fileName); -// dataObjectType.setName(paramName); -// dataObjectType.setType(DataType.URI); -// dataObjectType.setIsRequired(outputDataObjectType.isIsRequired()); -// dataObjectType.setRequiredToAddedToCommandLine(outputDataObjectType.isRequiredToAddedToCommandLine()); -// dataObjectType.setApplicationArgument(outputDataObjectType.getApplicationArgument()); -// dataObjectType.setSearchQuery(outputDataObjectType.getSearchQuery()); -// outputArray.add(dataObjectType); -// }else if (outputDataObjectType.getType() == DataType.STDOUT) { -// remoteCluster.scpTo(outputPath, standardOutput); -// String fileName = standardOutput.substring(standardOutput.lastIndexOf(File.separatorChar)+1, standardOutput.length()); -// OutputDataObjectType dataObjectType = new OutputDataObjectType(); -// dataObjectType.setValue(outputPath + File.separatorChar + fileName); -// dataObjectType.setName(paramName); -// dataObjectType.setType(DataType.STDOUT); -// dataObjectType.setIsRequired(outputDataObjectType.isIsRequired()); -// dataObjectType.setRequiredToAddedToCommandLine(outputDataObjectType.isRequiredToAddedToCommandLine()); -// dataObjectType.setApplicationArgument(outputDataObjectType.getApplicationArgument()); -// dataObjectType.setSearchQuery(outputDataObjectType.getSearchQuery()); -// outputArray.add(dataObjectType); -// }else if (outputDataObjectType.getType() == DataType.STDERR) { -// remoteCluster.scpTo(outputPath, standardError); -// String fileName = standardError.substring(standardError.lastIndexOf(File.separatorChar)+1, standardError.length()); -// OutputDataObjectType dataObjectType = new OutputDataObjectType(); -// dataObjectType.setValue(outputPath + File.separatorChar + fileName); -// dataObjectType.setName(paramName); -// dataObjectType.setType(DataType.STDERR); -// dataObjectType.setIsRequired(outputDataObjectType.isIsRequired()); -// dataObjectType.setRequiredToAddedToCommandLine(outputDataObjectType.isRequiredToAddedToCommandLine()); -// dataObjectType.setApplicationArgument(outputDataObjectType.getApplicationArgument()); -// dataObjectType.setSearchQuery(outputDataObjectType.getSearchQuery()); -// outputArray.add(dataObjectType); -// } -// } -// experimentCatalog.add(ExpCatChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID()); -// } catch (SSHApiException e) { -// try { -// StringWriter errors = new StringWriter(); -// e.printStackTrace(new PrintWriter(errors)); -// GFacUtils.saveErrorDetails(jobExecutionContext, errors.toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR); -// } catch (GFacException e1) { -// log.error(e1.getLocalizedMessage()); -// } -// log.error("Error transfering files to remote host : " + hostName + " with the user: " + userName); -// log.error(e.getMessage()); -// throw new GFacHandlerException(e); -// } catch (Exception e) { -// try { -// GFacUtils.saveErrorDetails(jobExecutionContext, e.getCause().toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR); -// } catch (GFacException e1) { -// log.error(e1.getLocalizedMessage()); -// } -// throw new GFacHandlerException(e); -// } -// } -// -// @Override -// public void recover(JobExecutionContext jobExecutionContext) throws GFacHandlerException { -// // TODO: Auto generated method body. -// } -// -// -//} http://git-wip-us.apache.org/repos/asf/airavata/blob/08cdad26/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/NewSSHOutputHandler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/NewSSHOutputHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/NewSSHOutputHandler.java deleted file mode 100644 index 5dc9f2a..0000000 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/NewSSHOutputHandler.java +++ /dev/null @@ -1,78 +0,0 @@ -//package org.apache.airavata.gfac.ssh.handler; -// -//import java.io.PrintWriter; -//import java.io.StringWriter; -//import java.util.List; -//import java.util.Properties; -// -//import org.apache.airavata.gfac.core.GFacException; -//import org.apache.airavata.gfac.core.cluster.RemoteCluster; -//import org.apache.airavata.gfac.core.context.JobExecutionContext; -//import org.apache.airavata.gfac.core.handler.AbstractHandler; -//import org.apache.airavata.gfac.core.handler.GFacHandlerException; -//import org.apache.airavata.gfac.core.provider.GFacProviderException; -//import org.apache.airavata.gfac.core.GFacUtils; -//import org.apache.airavata.gfac.ssh.security.SSHSecurityContext; -//import org.apache.airavata.gfac.ssh.util.GFACSSHUtils; -//import org.apache.airavata.gfac.ssh.util.HandleOutputs; -//import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType; -//import org.apache.airavata.model.experiment.CorrectiveAction; -//import org.apache.airavata.model.experiment.ErrorCategory; -//import org.apache.airavata.registry.cpi.ExpCatChildDataType; -//import org.apache.airavata.registry.cpi.RegistryException; -//import org.slf4j.Logger; -//import org.slf4j.LoggerFactory; -// -//public class NewSSHOutputHandler extends AbstractHandler{ -// -// private static final Logger log = LoggerFactory.getLogger(NewSSHOutputHandler.class); -// -// public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException { -// String hostAddress = jobExecutionContext.getHostName(); -// RemoteCluster remoteCluster = null; -// // Security Context and connection -// try { -// if (jobExecutionContext.getSecurityContext(hostAddress) == null) { -// GFACSSHUtils.addSecurityContext(jobExecutionContext); -// } -// remoteCluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getRemoteCluster(); -// if (remoteCluster == null) { -// throw new GFacProviderException("Security context is not set properly"); -// } else { -// log.info("Successfully retrieved the Security Context"); -// } -// } catch (Exception e) { -// log.error(e.getMessage()); -// try { -// StringWriter errors = new StringWriter(); -// e.printStackTrace(new PrintWriter(errors)); -// GFacUtils.saveErrorDetails(jobExecutionContext, errors.toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR); -// } catch (GFacException e1) { -// log.error(e1.getLocalizedMessage()); -// } -// throw new GFacHandlerException("Error while creating SSHSecurityContext", e, e.getLocalizedMessage()); -// } -// -// super.invoke(jobExecutionContext); -// List<OutputDataObjectType> outputArray = HandleOutputs.handleOutputs(jobExecutionContext, remoteCluster); -// try { -// experimentCatalog.add(ExpCatChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID()); -// } catch (RegistryException e) { -// throw new GFacHandlerException(e); -// } -// -// -// } -// -// @Override -// public void recover(JobExecutionContext jobExecutionContext) throws GFacHandlerException { -// // TODO: Auto generated method body. -// } -// -// @Override -// public void initProperties(Properties properties) throws GFacHandlerException { -// // TODO Auto-generated method stub -// -// } -// -//} http://git-wip-us.apache.org/repos/asf/airavata/blob/08cdad26/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java deleted file mode 100644 index d8afb06..0000000 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java +++ /dev/null @@ -1,119 +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.ssh.handler; -// -//import org.apache.airavata.gfac.core.GFacException; -//import org.apache.airavata.gfac.core.cluster.RemoteCluster; -//import org.apache.airavata.gfac.core.context.JobExecutionContext; -//import org.apache.airavata.gfac.core.handler.AbstractHandler; -//import org.apache.airavata.gfac.core.handler.GFacHandlerException; -//import org.apache.airavata.gfac.core.GFacUtils; -//import org.apache.airavata.gfac.ssh.security.SSHSecurityContext; -//import org.apache.airavata.gfac.ssh.util.GFACSSHUtils; -//import org.apache.airavata.model.experiment.*; -//import org.apache.airavata.registry.cpi.ExpCatChildDataType; -//import org.slf4j.Logger; -//import org.slf4j.LoggerFactory; -// -//import java.io.PrintWriter; -//import java.io.StringWriter; -//import java.util.Properties; -// -//public class SSHDirectorySetupHandler extends AbstractHandler { -// private static final Logger log = LoggerFactory.getLogger(SSHDirectorySetupHandler.class); -// -// public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException { -// try { -// String hostAddress = jobExecutionContext.getHostName(); -// if (jobExecutionContext.getSecurityContext(hostAddress) == null) { -// GFACSSHUtils.addSecurityContext(jobExecutionContext); -// } -// } catch (Exception e) { -// log.error(e.getMessage()); -// try { -// StringWriter errors = new StringWriter(); -// e.printStackTrace(new PrintWriter(errors)); -// GFacUtils.saveErrorDetails(jobExecutionContext, errors.toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR); -// } catch (GFacException e1) { -// log.error(e1.getLocalizedMessage()); -// } -// throw new GFacHandlerException("Error while creating SSHSecurityContext", e, e.getLocalizedMessage()); -// } -// -// log.info("Setup SSH job directorties"); -// super.invoke(jobExecutionContext); -// makeDirectory(jobExecutionContext); -// -// } -// -// @Override -// public void recover(JobExecutionContext jobExecutionContext) throws GFacHandlerException { -// // TODO: Auto generated method body. -// } -// -// private void makeDirectory(JobExecutionContext jobExecutionContext) throws GFacHandlerException { -// RemoteCluster remoteCluster = null; -// try{ -// String hostAddress = jobExecutionContext.getHostName(); -// remoteCluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getRemoteCluster(); -// if (remoteCluster == null) { -// throw new GFacHandlerException("Security context is not set properly"); -// } else { -// log.info("Successfully retrieved the Security Context"); -// } -// String workingDirectory = jobExecutionContext.getWorkingDir(); -// remoteCluster.makeDirectory(workingDirectory); -// if(!jobExecutionContext.getInputDir().equals(workingDirectory)) -// remoteCluster.makeDirectory(jobExecutionContext.getInputDir()); -// if(!jobExecutionContext.getOutputDir().equals(workingDirectory)) -// remoteCluster.makeDirectory(jobExecutionContext.getOutputDir()); -// -// DataTransferDetails detail = new DataTransferDetails(); -// TransferStatus status = new TransferStatus(); -// status.setTransferState(TransferState.DIRECTORY_SETUP); -// detail.setTransferStatus(status); -// detail.setTransferDescription("Working directory = " + workingDirectory); -// -// experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); -// -// } catch (Exception e) { -// DataTransferDetails detail = new DataTransferDetails(); -// TransferStatus status = new TransferStatus(); -// status.setTransferState(TransferState.FAILED); -// detail.setTransferStatus(status); -// detail.setTransferDescription("Working directory = " + jobExecutionContext.getWorkingDir()); -// try { -// experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); -// StringWriter errors = new StringWriter(); -// e.printStackTrace(new PrintWriter(errors)); -// GFacUtils.saveErrorDetails(jobExecutionContext, errors.toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.FILE_SYSTEM_FAILURE); -// } catch (Exception e1) { -// throw new GFacHandlerException("Error persisting status", e1, e1.getLocalizedMessage()); -// } -// throw new GFacHandlerException("Error executing the Handler: " + SSHDirectorySetupHandler.class, e); -// } -// -// } -// -// public void initProperties(Properties properties) throws GFacHandlerException { -// -// } -//} http://git-wip-us.apache.org/repos/asf/airavata/blob/08cdad26/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java deleted file mode 100644 index b1e485a..0000000 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java +++ /dev/null @@ -1,198 +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.ssh.handler; -// -//import org.apache.airavata.common.exception.ApplicationSettingsException; -//import org.apache.airavata.gfac.core.GFacException; -//import org.apache.airavata.gfac.core.cluster.RemoteCluster; -//import org.apache.airavata.gfac.core.context.JobExecutionContext; -//import org.apache.airavata.gfac.core.context.MessageContext; -//import org.apache.airavata.gfac.core.handler.AbstractHandler; -//import org.apache.airavata.gfac.core.handler.GFacHandlerException; -//import org.apache.airavata.gfac.core.GFacUtils; -//import org.apache.airavata.gfac.ssh.security.SSHSecurityContext; -//import org.apache.airavata.gfac.ssh.util.GFACSSHUtils; -//import org.apache.airavata.model.appcatalog.appinterface.DataType; -//import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType; -//import org.apache.airavata.model.experiment.*; -//import org.apache.airavata.registry.cpi.ExpCatChildDataType; -//import org.slf4j.Logger; -//import org.slf4j.LoggerFactory; -// -//import java.io.File; -//import java.io.IOException; -//import java.io.PrintWriter; -//import java.io.StringWriter; -//import java.util.ArrayList; -//import java.util.List; -//import java.util.Properties; -//import java.util.Set; -// -//public class SSHInputHandler extends AbstractHandler { -// -// private static final Logger log = LoggerFactory.getLogger(SSHInputHandler.class); -// -// -// public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException { -// DataTransferDetails detail = new DataTransferDetails(); -// detail.setTransferDescription("Input Data Staging"); -// TransferStatus status = new TransferStatus(); -// int index = 0; -// int oldIndex = 0; -// List<String> oldFiles = new ArrayList<String>(); -// StringBuffer data = new StringBuffer("|"); -// MessageContext inputNew = new MessageContext(); -// RemoteCluster remoteCluster = null; -// -// try { -// String hostAddress = jobExecutionContext.getHostName(); -// if (jobExecutionContext.getSecurityContext(hostAddress) == null) { -// try { -// GFACSSHUtils.addSecurityContext(jobExecutionContext); -// } catch (ApplicationSettingsException e) { -// log.error(e.getMessage()); -// try { -// StringWriter errors = new StringWriter(); -// e.printStackTrace(new PrintWriter(errors)); -// GFacUtils.saveErrorDetails(jobExecutionContext, errors.toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR); -// } catch (GFacException e1) { -// log.error(e1.getLocalizedMessage()); -// } -// throw new GFacHandlerException("Error while creating SSHSecurityContext", e, e.getLocalizedMessage()); -// } -// } -// -// remoteCluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getRemoteCluster(); -// if (remoteCluster == null) { -// throw new GFacException("Security context is not set properly"); -// } else { -// log.info("Successfully retrieved the Security Context"); -// } -// log.info("Invoking SCPInputHandler"); -// super.invoke(jobExecutionContext); -// -// -// MessageContext input = jobExecutionContext.getInMessageContext(); -// Set<String> parameters = input.getParameters().keySet(); -// for (String paramName : parameters) { -// InputDataObjectType inputParamType = (InputDataObjectType) input.getParameters().get(paramName); -// String paramValue = inputParamType.getValue(); -// //TODO: Review this with type -// if (inputParamType.getType() == DataType.URI) { -// if (index < oldIndex) { -// log.info("Input File: " + paramValue + " is already transfered, so we skip this operation !!!"); -// inputParamType.setValue(oldFiles.get(index)); -// data.append(oldFiles.get(index++)).append(","); // we get already transfered file and increment the index -// } else { -// String stageInputFile = stageInputFiles(remoteCluster, jobExecutionContext, paramValue); -// inputParamType.setValue(stageInputFile); -// StringBuffer temp = new StringBuffer(data.append(stageInputFile).append(",").toString()); -// status.setTransferState(TransferState.UPLOAD); -// detail.setTransferStatus(status); -// detail.setTransferDescription("Input Data Staged: " + stageInputFile); -// experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); -// -// GFacUtils.saveHandlerData(jobExecutionContext, temp.insert(0, ++index), this.getClass().getName()); -// } -// }// FIXME: what is the thrift model DataType equivalent for URIArray type? -//// else if ("URIArray".equals(actualParameter.getType().getType().toString())) { -//// if (index < oldIndex) { -//// log.info("Input File: " + paramValue + " is already transfered, so we skip this operation !!!"); -//// ((URIParameterType) actualParameter.getType()).setValue(oldFiles.get(index)); -//// data.append(oldFiles.get(index++)).append(","); // we get already transfered file and increment the index -//// }else{ -//// List<String> split = Arrays.asList(StringUtil.getElementsFromString(paramValue)); -//// List<String> newFiles = new ArrayList<String>(); -//// for (String paramValueEach : split) { -//// String stageInputFiles = stageInputFiles(remoteCluster,jobExecutionContext, paramValueEach); -//// status.setTransferState(TransferState.UPLOAD); -//// detail.setTransferStatus(status); -//// detail.setTransferDescription("Input Data Staged: " + stageInputFiles); -//// registry.add(ChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); -//// newFiles.add(stageInputFiles); -//// StringBuffer temp = new StringBuffer(data.append(stageInputFiles).append(",").toString()); -//// GFacUtils.savePluginData(jobExecutionContext, temp.insert(0, ++index), this.getClass().getName()); -//// } -//// ((URIArrayType) actualParameter.getType()).setValueArray(newFiles.toArray(new String[newFiles.size()])); -//// } -//// } -// inputNew.getParameters().put(paramName, inputParamType); -// } -// } catch (Exception e) { -// log.error(e.getMessage()); -// status.setTransferState(TransferState.FAILED); -// detail.setTransferStatus(status); -// try { -// StringWriter errors = new StringWriter(); -// e.printStackTrace(new PrintWriter(errors)); -// GFacUtils.saveErrorDetails(jobExecutionContext, errors.toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.FILE_SYSTEM_FAILURE); -// experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); -// } catch (Exception e1) { -// throw new GFacHandlerException("Error persisting status", e1, e1.getLocalizedMessage()); -// } -// throw new GFacHandlerException("Error while input File Staging", e, e.getLocalizedMessage()); -// } -// jobExecutionContext.setInMessageContext(inputNew); -// } -// -// @Override -// public void recover(JobExecutionContext jobExecutionContext) throws GFacHandlerException { -// // TODO: Auto generated method body. -// } -// -// private static String stageInputFiles(RemoteCluster remoteCluster, JobExecutionContext jobExecutionContext, String paramValue) throws IOException, GFacException { -// int i = paramValue.lastIndexOf(File.separator); -// String substring = paramValue.substring(i + 1); -// try { -// String targetFile = jobExecutionContext.getInputDir() + File.separator + substring; -// if(paramValue.startsWith("scp:")){ -// paramValue = paramValue.substring(paramValue.indexOf(":") + 1, paramValue.length()); -// remoteCluster.scpThirdParty(paramValue, targetFile); -// }else{ -// if(paramValue.startsWith("file")){ -// paramValue = paramValue.substring(paramValue.indexOf(":") + 1, paramValue.length()); -// } -// boolean success = false; -// int j = 1; -// while(!success){ -// try { -// remoteCluster.scpTo(targetFile, paramValue); -// success = true; -// } catch (Exception e) { -// log.info(e.getLocalizedMessage()); -// Thread.sleep(2000); -// if(j==3) { -// throw new GFacHandlerException("Error while input File Staging", e, e.getLocalizedMessage()); -// } -// } -// j++; -// } -// } -// return targetFile; -// } catch (Exception e) { -// throw new GFacHandlerException("Error while input File Staging", e, e.getLocalizedMessage()); -// } -// } -// -// public void initProperties(Properties properties) throws GFacHandlerException { -// -// } -//} http://git-wip-us.apache.org/repos/asf/airavata/blob/08cdad26/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java deleted file mode 100644 index 95368f6..0000000 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java +++ /dev/null @@ -1,256 +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.ssh.handler; -// -//import org.apache.airavata.common.utils.ServerSettings; -//import org.apache.airavata.gfac.core.GFacConstants; -//import org.apache.airavata.gfac.core.GFacException; -//import org.apache.airavata.gfac.core.cluster.RemoteCluster; -//import org.apache.airavata.gfac.core.context.JobExecutionContext; -//import org.apache.airavata.gfac.core.handler.AbstractHandler; -//import org.apache.airavata.gfac.core.handler.GFacHandlerException; -//import org.apache.airavata.gfac.core.provider.GFacProviderException; -//import org.apache.airavata.gfac.core.GFacUtils; -//import org.apache.airavata.gfac.impl.OutputUtils; -//import org.apache.airavata.gfac.ssh.security.SSHSecurityContext; -//import org.apache.airavata.gfac.ssh.util.GFACSSHUtils; -//import org.apache.airavata.model.appcatalog.appinterface.DataType; -//import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType; -//import org.apache.airavata.model.experiment.CorrectiveAction; -//import org.apache.airavata.model.experiment.DataTransferDetails; -//import org.apache.airavata.model.experiment.ErrorCategory; -//import org.apache.airavata.model.experiment.TaskDetails; -//import org.apache.airavata.model.experiment.TransferState; -//import org.apache.airavata.model.experiment.TransferStatus; -//import org.apache.airavata.registry.cpi.ExpCatChildDataType; -//import org.slf4j.Logger; -//import org.slf4j.LoggerFactory; -// -//import java.io.File; -//import java.io.PrintWriter; -//import java.io.StringWriter; -//import java.util.ArrayList; -//import java.util.List; -//import java.util.Map; -//import java.util.Properties; -//import java.util.Set; -// -//public class SSHOutputHandler extends AbstractHandler { -// private static final Logger log = LoggerFactory.getLogger(SSHOutputHandler.class); -// -// public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException { -// String hostAddress = jobExecutionContext.getHostName(); -// try { -// if (jobExecutionContext.getSecurityContext(hostAddress) == null) { -// GFACSSHUtils.addSecurityContext(jobExecutionContext); -// } -// } catch (Exception e) { -// log.error(e.getMessage()); -// try { -// StringWriter errors = new StringWriter(); -// e.printStackTrace(new PrintWriter(errors)); -// GFacUtils.saveErrorDetails(jobExecutionContext, errors.toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR); -// } catch (GFacException e1) { -// log.error(e1.getLocalizedMessage()); -// } -// throw new GFacHandlerException("Error while creating SSHSecurityContext", e, e.getLocalizedMessage()); -// } -// -// super.invoke(jobExecutionContext); -// DataTransferDetails detail = new DataTransferDetails(); -// detail.setTransferDescription("Output data staging"); -// TransferStatus status = new TransferStatus(); -// -// RemoteCluster remoteCluster = null; -// try { -// remoteCluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getRemoteCluster(); -// if (remoteCluster == null) { -// throw new GFacProviderException("Security context is not set properly"); -// } else { -// log.info("Successfully retrieved the Security Context"); -// } -// -// // Get the Stdouts and StdErrs -// String timeStampedExperimentID = GFacUtils.createUniqueNameWithDate(jobExecutionContext.getExperimentID()); -// -// TaskDetails taskData = jobExecutionContext.getTaskData(); -// String outputDataDir = ServerSettings.getSetting(GFacConstants.OUTPUT_DATA_DIR, File.separator + "tmp"); -// File localStdOutFile; -// File localStdErrFile; -// //FIXME: AdvancedOutput is remote location and third party transfer should work to make this work -//// if (taskData.getAdvancedOutputDataHandling() != null) { -//// outputDataDir = taskData.getAdvancedOutputDataHandling().getOutputDataDir(); -//// } -// if (outputDataDir == null) { -// outputDataDir = File.separator + "tmp"; -// } -// outputDataDir = outputDataDir + File.separator + jobExecutionContext.getExperimentID() + "-" + jobExecutionContext.getTaskData().getTaskID(); -// (new File(outputDataDir)).mkdirs(); -// -// -// localStdOutFile = new File(outputDataDir + File.separator + timeStampedExperimentID + "stdout"); -// localStdErrFile = new File(outputDataDir + File.separator + timeStampedExperimentID + "stderr"); -//// remoteCluster.makeDirectory(outputDataDir); -// int i = 0; -// String stdOutStr = ""; -// while (stdOutStr.isEmpty()) { -// try { -// remoteCluster.scpFrom(jobExecutionContext.getStandardOutput(), localStdOutFile.getAbsolutePath()); -// stdOutStr = GFacUtils.readFileToString(localStdOutFile.getAbsolutePath()); -// } catch (Exception e) { -// log.error(e.getLocalizedMessage()); -// Thread.sleep(2000); -// } -// i++; -// if (i == 3) break; -// } -// Thread.sleep(1000); -// remoteCluster.scpFrom(jobExecutionContext.getStandardError(), localStdErrFile.getAbsolutePath()); -// Thread.sleep(1000); -// -// String stdErrStr = GFacUtils.readFileToString(localStdErrFile.getAbsolutePath()); -// status.setTransferState(TransferState.STDOUT_DOWNLOAD); -// detail.setTransferStatus(status); -// detail.setTransferDescription("STDOUT:" + localStdOutFile.getAbsolutePath()); -// experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); -// -// status.setTransferState(TransferState.STDERROR_DOWNLOAD); -// detail.setTransferStatus(status); -// detail.setTransferDescription("STDERR:" + localStdErrFile.getAbsolutePath()); -// experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); -// -// -// List<OutputDataObjectType> outputArray = new ArrayList<OutputDataObjectType>(); -// Map<String, Object> output = jobExecutionContext.getOutMessageContext().getParameters(); -// Set<String> keys = output.keySet(); -// for (String paramName : keys) { -// OutputDataObjectType actualParameter = (OutputDataObjectType) output.get(paramName); -// if (DataType.URI == actualParameter.getType()) { -// List<String> outputList = null; -// int retry = 3; -// while (retry > 0) { -// outputList = remoteCluster.listDirectory(jobExecutionContext.getOutputDir()); -// if (outputList.size() > 0) { -// break; -// } -// retry--; -// Thread.sleep(2000); -// } -// -// if (outputList.size() == 0 || outputList.get(0).isEmpty() || outputList.size() > 1) { -// OutputUtils.fillOutputFromStdout(output, stdOutStr, stdErrStr, outputArray); -// Set<String> strings = output.keySet(); -// outputArray.clear(); -// for (String key : strings) { -// OutputDataObjectType actualParameter1 = (OutputDataObjectType) output.get(key); -// if (DataType.URI == actualParameter1.getType()) { -// String downloadFile = actualParameter1.getValue(); -// remoteCluster.scpFrom(downloadFile, outputDataDir); -// String fileName = downloadFile.substring(downloadFile.lastIndexOf(File.separatorChar) + 1, downloadFile.length()); -// String localFile = outputDataDir + File.separator + fileName; -// jobExecutionContext.addOutputFile(localFile); -// actualParameter1.setValue(localFile); -// OutputDataObjectType dataObjectType = new OutputDataObjectType(); -// dataObjectType.setValue(localFile); -// dataObjectType.setName(key); -// dataObjectType.setType(DataType.URI); -// outputArray.add(dataObjectType); -// }else if (DataType.STDOUT == actualParameter.getType()) { -// String fileName = localStdOutFile.getName(); -// String localFile = outputDataDir + File.separator + fileName; -// jobExecutionContext.addOutputFile(localFile); -// actualParameter.setValue(localFile); -// OutputDataObjectType dataObjectType = new OutputDataObjectType(); -// dataObjectType.setValue(localFile); -// dataObjectType.setName(key); -// dataObjectType.setType(DataType.STDOUT); -// outputArray.add(dataObjectType); -// }else if (DataType.STDERR == actualParameter.getType()) { -// String fileName = localStdErrFile.getName(); -// String localFile = outputDataDir + File.separator + fileName; -// jobExecutionContext.addOutputFile(localFile); -// actualParameter.setValue(localFile); -// OutputDataObjectType dataObjectType = new OutputDataObjectType(); -// dataObjectType.setValue(localFile); -// dataObjectType.setName(key); -// dataObjectType.setType(DataType.STDERR); -// outputArray.add(dataObjectType); -// } -// } -// break; -// } else if (outputList.size() == 1) {//FIXME: Ultrascan case -// String valueList = outputList.get(0); -// remoteCluster.scpFrom(jobExecutionContext.getOutputDir() + File.separator + valueList, outputDataDir); -// String outputPath = outputDataDir + File.separator + valueList; -// jobExecutionContext.addOutputFile(outputPath); -// actualParameter.setValue(outputPath); -// OutputDataObjectType dataObjectType = new OutputDataObjectType(); -// dataObjectType.setValue(outputPath); -// dataObjectType.setName(paramName); -// dataObjectType.setType(DataType.URI); -// outputArray.add(dataObjectType); -// } -// } else { -// OutputUtils.fillOutputFromStdout(output, stdOutStr, stdErrStr, outputArray); -// } -// } -// if (outputArray == null || outputArray.isEmpty()) { -// log.error("Empty Output returned from the Application, Double check the application and ApplicationDescriptor output Parameter Names"); -// if (jobExecutionContext.getTaskData().getAdvancedOutputDataHandling() == null) { -// throw new GFacHandlerException( -// "Empty Output returned from the Application, Double check the application" -// + "and ApplicationDescriptor output Parameter Names"); -// } -// } -// jobExecutionContext.setStandardError(localStdErrFile.getAbsolutePath()); -// jobExecutionContext.setStandardOutput(localStdOutFile.getAbsolutePath()); -// jobExecutionContext.setOutputDir(outputDataDir); -// status.setTransferState(TransferState.DOWNLOAD); -// detail.setTransferStatus(status); -// detail.setTransferDescription(outputDataDir); -// experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); -// experimentCatalog.add(ExpCatChildDataType.EXPERIMENT_OUTPUT, outputArray, jobExecutionContext.getExperimentID()); -// -// } catch (Exception e) { -// try { -// status.setTransferState(TransferState.FAILED); -// detail.setTransferStatus(status); -// experimentCatalog.add(ExpCatChildDataType.DATA_TRANSFER_DETAIL, detail, jobExecutionContext.getTaskData().getTaskID()); -// StringWriter errors = new StringWriter(); -// e.printStackTrace(new PrintWriter(errors)); -// GFacUtils.saveErrorDetails(jobExecutionContext, errors.toString(), CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.FILE_SYSTEM_FAILURE); -// } catch (Exception e1) { -// throw new GFacHandlerException("Error persisting status", e1, e1.getLocalizedMessage()); -// } -// throw new GFacHandlerException("Error in retrieving results", e); -// } -// -// } -// -// @Override -// public void recover(JobExecutionContext jobExecutionContext) throws GFacHandlerException { -// // TODO: Auto generated method body. -// } -// -// public void initProperties(Properties properties) throws GFacHandlerException { -// -// } -//}
