http://git-wip-us.apache.org/repos/asf/airavata/blob/19afc7e0/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/x2012/x12/impl/PostJobCommandsImpl.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/x2012/x12/impl/PostJobCommandsImpl.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/x2012/x12/impl/PostJobCommandsImpl.java new file mode 100644 index 0000000..0696232 --- /dev/null +++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/x2012/x12/impl/PostJobCommandsImpl.java @@ -0,0 +1,235 @@ +/* + * XML Type: postJobCommands + * Namespace: http://airavata.apache.org/gfac/core/2012/12 + * Java type: org.apache.airavata.gfac.core.x2012.x12.PostJobCommands + * + * Automatically generated - do not modify. + */ +package org.apache.airavata.gfac.core.x2012.x12.impl; +/** + * An XML postJobCommands(@http://airavata.apache.org/gfac/core/2012/12). + * + * This is a complex type. + */ +public class PostJobCommandsImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements org.apache.airavata.gfac.core.x2012.x12.PostJobCommands +{ + private static final long serialVersionUID = 1L; + + public PostJobCommandsImpl(org.apache.xmlbeans.SchemaType sType) + { + super(sType); + } + + private static final javax.xml.namespace.QName COMMAND$0 = + new javax.xml.namespace.QName("http://airavata.apache.org/gfac/core/2012/12", "command"); + + + /** + * Gets array of all "command" elements + */ + public java.lang.String[] getCommandArray() + { + synchronized (monitor()) + { + check_orphaned(); + java.util.List targetList = new java.util.ArrayList(); + get_store().find_all_element_users(COMMAND$0, targetList); + java.lang.String[] result = new java.lang.String[targetList.size()]; + for (int i = 0, len = targetList.size() ; i < len ; i++) + result[i] = ((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getStringValue(); + return result; + } + } + + /** + * Gets ith "command" element + */ + public java.lang.String getCommandArray(int i) + { + synchronized (monitor()) + { + check_orphaned(); + org.apache.xmlbeans.SimpleValue target = null; + target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(COMMAND$0, i); + if (target == null) + { + throw new IndexOutOfBoundsException(); + } + return target.getStringValue(); + } + } + + /** + * Gets (as xml) array of all "command" elements + */ + public org.apache.xmlbeans.XmlString[] xgetCommandArray() + { + synchronized (monitor()) + { + check_orphaned(); + java.util.List targetList = new java.util.ArrayList(); + get_store().find_all_element_users(COMMAND$0, targetList); + org.apache.xmlbeans.XmlString[] result = new org.apache.xmlbeans.XmlString[targetList.size()]; + targetList.toArray(result); + return result; + } + } + + /** + * Gets (as xml) ith "command" element + */ + public org.apache.xmlbeans.XmlString xgetCommandArray(int i) + { + synchronized (monitor()) + { + check_orphaned(); + org.apache.xmlbeans.XmlString target = null; + target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(COMMAND$0, i); + if (target == null) + { + throw new IndexOutOfBoundsException(); + } + return (org.apache.xmlbeans.XmlString)target; + } + } + + /** + * Returns number of "command" element + */ + public int sizeOfCommandArray() + { + synchronized (monitor()) + { + check_orphaned(); + return get_store().count_elements(COMMAND$0); + } + } + + /** + * Sets array of all "command" element + */ + public void setCommandArray(java.lang.String[] commandArray) + { + synchronized (monitor()) + { + check_orphaned(); + arraySetterHelper(commandArray, COMMAND$0); + } + } + + /** + * Sets ith "command" element + */ + public void setCommandArray(int i, java.lang.String command) + { + synchronized (monitor()) + { + check_orphaned(); + org.apache.xmlbeans.SimpleValue target = null; + target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(COMMAND$0, i); + if (target == null) + { + throw new IndexOutOfBoundsException(); + } + target.setStringValue(command); + } + } + + /** + * Sets (as xml) array of all "command" element + */ + public void xsetCommandArray(org.apache.xmlbeans.XmlString[]commandArray) + { + synchronized (monitor()) + { + check_orphaned(); + arraySetterHelper(commandArray, COMMAND$0); + } + } + + /** + * Sets (as xml) ith "command" element + */ + public void xsetCommandArray(int i, org.apache.xmlbeans.XmlString command) + { + synchronized (monitor()) + { + check_orphaned(); + org.apache.xmlbeans.XmlString target = null; + target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(COMMAND$0, i); + if (target == null) + { + throw new IndexOutOfBoundsException(); + } + target.set(command); + } + } + + /** + * Inserts the value as the ith "command" element + */ + public void insertCommand(int i, java.lang.String command) + { + synchronized (monitor()) + { + check_orphaned(); + org.apache.xmlbeans.SimpleValue target = + (org.apache.xmlbeans.SimpleValue)get_store().insert_element_user(COMMAND$0, i); + target.setStringValue(command); + } + } + + /** + * Appends the value as the last "command" element + */ + public void addCommand(java.lang.String command) + { + synchronized (monitor()) + { + check_orphaned(); + org.apache.xmlbeans.SimpleValue target = null; + target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(COMMAND$0); + target.setStringValue(command); + } + } + + /** + * Inserts and returns a new empty value (as xml) as the ith "command" element + */ + public org.apache.xmlbeans.XmlString insertNewCommand(int i) + { + synchronized (monitor()) + { + check_orphaned(); + org.apache.xmlbeans.XmlString target = null; + target = (org.apache.xmlbeans.XmlString)get_store().insert_element_user(COMMAND$0, i); + return target; + } + } + + /** + * Appends and returns a new empty value (as xml) as the last "command" element + */ + public org.apache.xmlbeans.XmlString addNewCommand() + { + synchronized (monitor()) + { + check_orphaned(); + org.apache.xmlbeans.XmlString target = null; + target = (org.apache.xmlbeans.XmlString)get_store().add_element_user(COMMAND$0); + return target; + } + } + + /** + * Removes the ith "command" element + */ + public void removeCommand(int i) + { + synchronized (monitor()) + { + check_orphaned(); + get_store().remove_element(COMMAND$0, i); + } + } +}
http://git-wip-us.apache.org/repos/asf/airavata/blob/19afc7e0/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/x2012/x12/impl/PreJobCommandsImpl.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/x2012/x12/impl/PreJobCommandsImpl.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/x2012/x12/impl/PreJobCommandsImpl.java new file mode 100644 index 0000000..e061462 --- /dev/null +++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/x2012/x12/impl/PreJobCommandsImpl.java @@ -0,0 +1,235 @@ +/* + * XML Type: preJobCommands + * Namespace: http://airavata.apache.org/gfac/core/2012/12 + * Java type: org.apache.airavata.gfac.core.x2012.x12.PreJobCommands + * + * Automatically generated - do not modify. + */ +package org.apache.airavata.gfac.core.x2012.x12.impl; +/** + * An XML preJobCommands(@http://airavata.apache.org/gfac/core/2012/12). + * + * This is a complex type. + */ +public class PreJobCommandsImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements org.apache.airavata.gfac.core.x2012.x12.PreJobCommands +{ + private static final long serialVersionUID = 1L; + + public PreJobCommandsImpl(org.apache.xmlbeans.SchemaType sType) + { + super(sType); + } + + private static final javax.xml.namespace.QName COMMAND$0 = + new javax.xml.namespace.QName("http://airavata.apache.org/gfac/core/2012/12", "command"); + + + /** + * Gets array of all "command" elements + */ + public java.lang.String[] getCommandArray() + { + synchronized (monitor()) + { + check_orphaned(); + java.util.List targetList = new java.util.ArrayList(); + get_store().find_all_element_users(COMMAND$0, targetList); + java.lang.String[] result = new java.lang.String[targetList.size()]; + for (int i = 0, len = targetList.size() ; i < len ; i++) + result[i] = ((org.apache.xmlbeans.SimpleValue)targetList.get(i)).getStringValue(); + return result; + } + } + + /** + * Gets ith "command" element + */ + public java.lang.String getCommandArray(int i) + { + synchronized (monitor()) + { + check_orphaned(); + org.apache.xmlbeans.SimpleValue target = null; + target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(COMMAND$0, i); + if (target == null) + { + throw new IndexOutOfBoundsException(); + } + return target.getStringValue(); + } + } + + /** + * Gets (as xml) array of all "command" elements + */ + public org.apache.xmlbeans.XmlString[] xgetCommandArray() + { + synchronized (monitor()) + { + check_orphaned(); + java.util.List targetList = new java.util.ArrayList(); + get_store().find_all_element_users(COMMAND$0, targetList); + org.apache.xmlbeans.XmlString[] result = new org.apache.xmlbeans.XmlString[targetList.size()]; + targetList.toArray(result); + return result; + } + } + + /** + * Gets (as xml) ith "command" element + */ + public org.apache.xmlbeans.XmlString xgetCommandArray(int i) + { + synchronized (monitor()) + { + check_orphaned(); + org.apache.xmlbeans.XmlString target = null; + target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(COMMAND$0, i); + if (target == null) + { + throw new IndexOutOfBoundsException(); + } + return (org.apache.xmlbeans.XmlString)target; + } + } + + /** + * Returns number of "command" element + */ + public int sizeOfCommandArray() + { + synchronized (monitor()) + { + check_orphaned(); + return get_store().count_elements(COMMAND$0); + } + } + + /** + * Sets array of all "command" element + */ + public void setCommandArray(java.lang.String[] commandArray) + { + synchronized (monitor()) + { + check_orphaned(); + arraySetterHelper(commandArray, COMMAND$0); + } + } + + /** + * Sets ith "command" element + */ + public void setCommandArray(int i, java.lang.String command) + { + synchronized (monitor()) + { + check_orphaned(); + org.apache.xmlbeans.SimpleValue target = null; + target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(COMMAND$0, i); + if (target == null) + { + throw new IndexOutOfBoundsException(); + } + target.setStringValue(command); + } + } + + /** + * Sets (as xml) array of all "command" element + */ + public void xsetCommandArray(org.apache.xmlbeans.XmlString[]commandArray) + { + synchronized (monitor()) + { + check_orphaned(); + arraySetterHelper(commandArray, COMMAND$0); + } + } + + /** + * Sets (as xml) ith "command" element + */ + public void xsetCommandArray(int i, org.apache.xmlbeans.XmlString command) + { + synchronized (monitor()) + { + check_orphaned(); + org.apache.xmlbeans.XmlString target = null; + target = (org.apache.xmlbeans.XmlString)get_store().find_element_user(COMMAND$0, i); + if (target == null) + { + throw new IndexOutOfBoundsException(); + } + target.set(command); + } + } + + /** + * Inserts the value as the ith "command" element + */ + public void insertCommand(int i, java.lang.String command) + { + synchronized (monitor()) + { + check_orphaned(); + org.apache.xmlbeans.SimpleValue target = + (org.apache.xmlbeans.SimpleValue)get_store().insert_element_user(COMMAND$0, i); + target.setStringValue(command); + } + } + + /** + * Appends the value as the last "command" element + */ + public void addCommand(java.lang.String command) + { + synchronized (monitor()) + { + check_orphaned(); + org.apache.xmlbeans.SimpleValue target = null; + target = (org.apache.xmlbeans.SimpleValue)get_store().add_element_user(COMMAND$0); + target.setStringValue(command); + } + } + + /** + * Inserts and returns a new empty value (as xml) as the ith "command" element + */ + public org.apache.xmlbeans.XmlString insertNewCommand(int i) + { + synchronized (monitor()) + { + check_orphaned(); + org.apache.xmlbeans.XmlString target = null; + target = (org.apache.xmlbeans.XmlString)get_store().insert_element_user(COMMAND$0, i); + return target; + } + } + + /** + * Appends and returns a new empty value (as xml) as the last "command" element + */ + public org.apache.xmlbeans.XmlString addNewCommand() + { + synchronized (monitor()) + { + check_orphaned(); + org.apache.xmlbeans.XmlString target = null; + target = (org.apache.xmlbeans.XmlString)get_store().add_element_user(COMMAND$0); + return target; + } + } + + /** + * Removes the ith "command" element + */ + public void removeCommand(int i) + { + synchronized (monitor()) + { + check_orphaned(); + get_store().remove_element(COMMAND$0, i); + } + } +} http://git-wip-us.apache.org/repos/asf/airavata/blob/19afc7e0/modules/gfac/gfac-core/src/main/resources/PBSJobDescriptor.xsd ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/resources/PBSJobDescriptor.xsd b/modules/gfac/gfac-core/src/main/resources/PBSJobDescriptor.xsd new file mode 100644 index 0000000..966dafb --- /dev/null +++ b/modules/gfac/gfac-core/src/main/resources/PBSJobDescriptor.xsd @@ -0,0 +1,114 @@ +<?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. --> + +<schema targetNamespace="http://airavata.apache.org/gfac/core/2012/12" xmlns:gsissh="http://airavata.apache.org/gfac/core/2012/12" + xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> + + <element name="JobDescriptor" type="gsissh:pbsParams" /> + + <complexType name="pbsParams"> + <sequence> + <element name="jobID" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <element name="userName" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <element name="shellName" type="xsd:string" minOccurs="0" maxOccurs="1" default="/bin/bash"/> + <element name="queueName" type="xsd:string" minOccurs="0" maxOccurs="1" default="normal"/> + <element name="jobName" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <element name="allEnvExport" type="xsd:boolean" minOccurs="0 " maxOccurs="1" default="true"/> + <element name="mailOptions" type="xsd:string" minOccurs="0" maxOccurs="1" /> + <element name="mailAddress" type="xsd:string" minOccurs="0" maxOccurs="1" /> + <element name="partition" type="xsd:string" minOccurs="0" maxOccurs="1" /> + <element name="mailType" type="xsd:string" minOccurs="0" maxOccurs="1" /> + <element name="acountString" type="xsd:string" minOccurs="0" maxOccurs="1" /> + <element name="maxWallTime" type="xsd:string" minOccurs="0" maxOccurs="1" default="1:00:00"/> + <element name="standardOutFile" type="xsd:string" minOccurs="0" maxOccurs="1" /> + <element name="standardErrorFile" type="xsd:string" minOccurs="0" maxOccurs="1" /> + <element name="outputDirectory" type="xsd:string" minOccurs="0" maxOccurs="1" /> + <element name="inputDirectory" type="xsd:string" minOccurs="0" maxOccurs="1" /> + <element name="nodes" type="xsd:int" minOccurs="0" maxOccurs="1" default="1"/> + <element name="processesPerNode" type="xsd:int" minOccurs="0" maxOccurs="1" default="1" /> + <element name="cpuCount" type="xsd:int" minOccurs="0" maxOccurs="1" default="1" /> + <element name="nodeList" type="xsd:string" minOccurs="0" maxOccurs="1" default="1" /> + <element name="workingDirectory" type="xsd:string" minOccurs="0" maxOccurs="1" /> + <element name="executablePath" type="xsd:string" minOccurs="0" maxOccurs="1" /> + <element name="inputs" type="gsissh:inputList" minOccurs="1" maxOccurs="1"/> + <element name="exports" type="gsissh:exportProperties" minOccurs="1" maxOccurs="1"/> + <element name="status" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <element name="afterAny" type="gsissh:afterAnyList" minOccurs="0" maxOccurs="1"/> + <element name="afterOKList" type="gsissh:afterOKList" minOccurs="0" maxOccurs="1"/> + <element name="cTime" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <element name="qTime" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <element name="mTime" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <element name="sTime" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <element name="compTime" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <element name="owner" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <element name="executeNode" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <element name="ellapsedTime" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <element name="usedCPUTime" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <element name="usedMem" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <element name="submitArgs" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <element name="variableList" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <element name="preJobCommands" type="gsissh:preJobCommands" minOccurs="0" maxOccurs="1"/> + <element name="moduleLoadCommands" type="gsissh:moduleLoadCommands" minOccurs="0" maxOccurs="1"/> + <element name="postJobCommands" type="gsissh:postJobCommands" minOccurs="0" maxOccurs="1"/> + <element name="jobSubmitterCommand" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <element name="callBackIp" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <element name="callBackPort" type="xsd:string" minOccurs="0" maxOccurs="1"/> + <element name="chassisName" type="xsd:string" minOccurs="0" maxOccurs="1"/> + </sequence> + </complexType> + + <complexType name="moduleLoadCommands"> + <sequence> + <element name="command" type="xsd:string" minOccurs="0" maxOccurs="unbounded" /> + </sequence> + </complexType> + <complexType name="preJobCommands"> + <sequence> + <element name="command" type="xsd:string" minOccurs="0" maxOccurs="unbounded" /> + </sequence> + </complexType> + + <complexType name="postJobCommands"> + <sequence> + <element name="command" type="xsd:string" minOccurs="0" maxOccurs="unbounded" /> + </sequence> + </complexType> + <complexType name="inputList"> + <sequence> + <element name="input" type="xsd:string" minOccurs="0" maxOccurs="unbounded" /> + </sequence> + </complexType> + <complexType name="afterAnyList"> + <sequence> + <element name="afterAny" type="xsd:string" minOccurs="0" maxOccurs="unbounded" /> + </sequence> + </complexType> + + <complexType name="afterOKList"> + <sequence> + <element name="afterOKList" type="xsd:string" minOccurs="0" maxOccurs="unbounded" /> + </sequence> + </complexType> + + <complexType name="exportProperties"> + <sequence> + + <element name="name" minOccurs="1" maxOccurs="unbounded"> + <complexType> + <simpleContent> + <extension base="xsd:string"> + <attribute name="value" type="xsd:string" use="required" /> + </extension> + </simpleContent> + </complexType> + </element> + + </sequence> + </complexType> +</schema> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/19afc7e0/modules/gfac/gfac-core/src/main/resources/gsissh-schemas.xsdconfig ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/resources/gsissh-schemas.xsdconfig b/modules/gfac/gfac-core/src/main/resources/gsissh-schemas.xsdconfig new file mode 100644 index 0000000..201d3b1 --- /dev/null +++ b/modules/gfac/gfac-core/src/main/resources/gsissh-schemas.xsdconfig @@ -0,0 +1,14 @@ +<!--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. --> + +<xb:config xmlns:xb="http://www.bea.com/2002/09/xbean/config"> + + <xb:namespace uri="http://airavata.apache.org/schemas/gfac/core/2012/12"> + <xb:package>org.apache.airavata.gfac.core</xb:package> + </xb:namespace> +</xb:config> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/19afc7e0/modules/gfac/gfac-impl/pom.xml ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/pom.xml b/modules/gfac/gfac-impl/pom.xml index 72a9f34..4733253 100644 --- a/modules/gfac/gfac-impl/pom.xml +++ b/modules/gfac/gfac-impl/pom.xml @@ -33,9 +33,39 @@ <!-- GFAC schemas --> <dependency> <groupId>org.apache.airavata</groupId> - <artifactId>airavata-gfac-core</artifactId> + <artifactId>gfac-core</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.jglobus</groupId> + <artifactId>gss</artifactId> + <version>${jglobus.version}</version> + </dependency> + <dependency> + <groupId>org.jglobus</groupId> + <artifactId>myproxy</artifactId> + <version>${jglobus.version}</version> + </dependency> + <dependency> + <groupId>com.jcraft</groupId> + <artifactId>jsch</artifactId> + <version>0.1.50</version> + </dependency> + <dependency> + <groupId>net.schmizz</groupId> + <artifactId>sshj</artifactId> + <version>0.6.1</version> + </dependency> + <dependency> + <groupId>net.schmizz</groupId> + <artifactId>sshj</artifactId> + <version>0.6.1</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>2.4.4</version> + </dependency> <!-- Test --> <dependency> http://git-wip-us.apache.org/repos/asf/airavata/blob/19afc7e0/modules/gfac/gfac-impl/src/main/java/com/jcraft/jsch/ExtendedSession.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/com/jcraft/jsch/ExtendedSession.java b/modules/gfac/gfac-impl/src/main/java/com/jcraft/jsch/ExtendedSession.java new file mode 100644 index 0000000..79ecb61 --- /dev/null +++ b/modules/gfac/gfac-impl/src/main/java/com/jcraft/jsch/ExtendedSession.java @@ -0,0 +1,42 @@ +/* + * + * 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 com.jcraft.jsch; + + +import org.apache.airavata.gfac.core.authentication.GSIAuthenticationInfo; + +public class ExtendedSession extends Session { + + private GSIAuthenticationInfo authenticationInfo; + + public ExtendedSession(JSch jsch, String username, String host, int port) throws JSchException { + super(jsch, username, host, port); + } + + public GSIAuthenticationInfo getAuthenticationInfo() { + return authenticationInfo; + } + + public void setAuthenticationInfo(GSIAuthenticationInfo authenticationInfo) { + this.authenticationInfo = authenticationInfo; + } +} http://git-wip-us.apache.org/repos/asf/airavata/blob/19afc7e0/modules/gfac/gfac-impl/src/main/java/com/jcraft/jsch/GSISSHIdentityFile.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/com/jcraft/jsch/GSISSHIdentityFile.java b/modules/gfac/gfac-impl/src/main/java/com/jcraft/jsch/GSISSHIdentityFile.java new file mode 100644 index 0000000..379eb8c --- /dev/null +++ b/modules/gfac/gfac-impl/src/main/java/com/jcraft/jsch/GSISSHIdentityFile.java @@ -0,0 +1,126 @@ +/* + * + * 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 com.jcraft.jsch; + +/** + * NOTE : This is class is directly created using com.jcraft.jsch.IdentityFile + * IdentityFile has private access. Therefore to suit our requirements we modify IdentityFile + * with public access. + */ +public class GSISSHIdentityFile implements Identity { + private JSch jsch; + private KeyPair kpair; + private String identity; + + public static GSISSHIdentityFile newInstance(String prvfile, String pubfile, JSch jsch) throws JSchException{ + KeyPair kpair = KeyPair.load(jsch, prvfile, pubfile); + return new GSISSHIdentityFile(jsch, prvfile, kpair); + } + + public static GSISSHIdentityFile newInstance(String name, byte[] prvkey, byte[] pubkey, JSch jsch) throws JSchException{ + KeyPair kpair = KeyPair.load(jsch, prvkey, pubkey); + return new GSISSHIdentityFile(jsch, name, kpair); + } + + private GSISSHIdentityFile(JSch jsch, String name, KeyPair kpair) throws JSchException{ + this.jsch = jsch; + this.identity = name; + this.kpair = kpair; + } + + /** + * Decrypts this identity with the specified pass-phrase. + * @param passphrase the pass-phrase for this identity. + * @return <tt>true</tt> if the decryption is succeeded + * or this identity is not cyphered. + */ + public boolean setPassphrase(byte[] passphrase) throws JSchException{ + return kpair.decrypt(passphrase); + } + + /** + * Returns the public-key blob. + * @return the public-key blob + */ + public byte[] getPublicKeyBlob(){ + return kpair.getPublicKeyBlob(); + } + + /** + * Signs on data with this identity, and returns the result. + * @param data data to be signed + * @return the signature + */ + public byte[] getSignature(byte[] data){ + return kpair.getSignature(data); + } + + /** + * @deprecated This method should not be invoked. + * @see #setPassphrase(byte[] passphrase) + */ + public boolean decrypt(){ + throw new RuntimeException("not implemented"); + } + + /** + * Returns the name of the key algorithm. + * @return "ssh-rsa" or "ssh-dss" + */ + public String getAlgName(){ + return new String(kpair.getKeyTypeName()); + } + + /** + * Returns the name of this identity. + * It will be useful to identify this object in the {@link IdentityRepository}. + */ + public String getName(){ + return identity; + } + + /** + * Returns <tt>true</tt> if this identity is cyphered. + * @return <tt>true</tt> if this identity is cyphered. + */ + public boolean isEncrypted(){ + return kpair.isEncrypted(); + } + + /** + * Disposes internally allocated data, like byte array for the private key. + */ + public void clear(){ + kpair.dispose(); + kpair = null; + } + + /** + * Returns an instance of {@link KeyPair} used in this {@link Identity}. + * @return an instance of {@link KeyPair} used in this {@link Identity}. + */ + public KeyPair getKeyPair(){ + return kpair; + } +} + http://git-wip-us.apache.org/repos/asf/airavata/blob/19afc7e0/modules/gfac/gfac-impl/src/main/java/com/jcraft/jsch/GSISSHIdentityRepository.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/com/jcraft/jsch/GSISSHIdentityRepository.java b/modules/gfac/gfac-impl/src/main/java/com/jcraft/jsch/GSISSHIdentityRepository.java new file mode 100644 index 0000000..89646c5 --- /dev/null +++ b/modules/gfac/gfac-impl/src/main/java/com/jcraft/jsch/GSISSHIdentityRepository.java @@ -0,0 +1,29 @@ +/* + * + * 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 com.jcraft.jsch; + +public class GSISSHIdentityRepository extends LocalIdentityRepository { + + public GSISSHIdentityRepository(JSch jsch) { + super(jsch); + } +} http://git-wip-us.apache.org/repos/asf/airavata/blob/19afc7e0/modules/gfac/gfac-impl/src/main/java/com/jcraft/jsch/UserAuthGSSAPIWithMICGSSCredentials.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/com/jcraft/jsch/UserAuthGSSAPIWithMICGSSCredentials.java b/modules/gfac/gfac-impl/src/main/java/com/jcraft/jsch/UserAuthGSSAPIWithMICGSSCredentials.java new file mode 100644 index 0000000..d0e98db --- /dev/null +++ b/modules/gfac/gfac-impl/src/main/java/com/jcraft/jsch/UserAuthGSSAPIWithMICGSSCredentials.java @@ -0,0 +1,308 @@ +/* + * + * 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 com.jcraft.jsch; + +import org.apache.airavata.gfac.core.authentication.GSIAuthenticationInfo; +import org.apache.airavata.gfac.gsi.ssh.GSSContextX509; +import org.globus.gsi.gssapi.GSSConstants; +import org.ietf.jgss.GSSException; +import org.ietf.jgss.Oid; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */ +/* + * Copyright(c)2004,2005,2006 ymnk, JCraft,Inc. All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. 2. Redistributions in + * binary form must reproduce the above copyright notice, this list of + * conditions and the following disclaimer in the documentation and/or other + * materials provided with the distribution. 3. The names of the authors may not + * be used to endorse or promote products derived from this software without + * specific prior written permission. THIS SOFTWARE IS PROVIDED ``AS IS'' AND + * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, INC. OR ANY CONTRIBUTORS TO THIS + * SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION)HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE)ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * This class now supports two mappings to the gssapi-with-mic method: x509 + * (preferred) and krb5. + * + * @author Al Rossi + * @author Jeff Overbey + */ +public class UserAuthGSSAPIWithMICGSSCredentials extends UserAuth { + + private static final int SSH_MSG_USERAUTH_GSSAPI_RESPONSE = 60; + private static final int SSH_MSG_USERAUTH_GSSAPI_TOKEN = 61; + // private static final int SSH_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE = 63; + private static final int SSH_MSG_USERAUTH_GSSAPI_ERROR = 64; + private static final int SSH_MSG_USERAUTH_GSSAPI_ERRTOK = 65; + private static final int SSH_MSG_USERAUTH_GSSAPI_MIC = 66; + + // this is the preferred order + private static String[] supportedMethods = { "gssapi-with-mic.x509", + "gssapi-with-mic.krb5" }; + private static byte[][] supportedOids; + + static { + try { + supportedOids = new byte[][] { + GSSConstants.MECH_OID.getDER(), + new Oid("1.2.840.113554.1.2.2").getDER() }; + } catch (GSSException gsse) { + gsse.printStackTrace(); + } + } + + @Override + public boolean start(Session session) throws Exception { + + // this.userinfo = userinfo; + Packet packet = session.packet; + Buffer buf = session.buf; + final String username = session.username; + byte[] _username = Util.str2byte(username); + + // checkForSupportedOIDs + List methods = new ArrayList(); + boolean found = false; + for (int i = 0; i < supportedOids.length; i++) { + found = found + || checkForSupportedOIDs(methods, packet, buf, i, + _username, session); + } + + if (!found) + return false; + + // logger.debug( "supported methods " + methods ); + + boolean success = false; + for (Iterator it = methods.iterator(); it.hasNext();) { + String method = (String) it.next(); + success = tryMethod(username, _username, method, session, packet, + buf); + if (success) + break; + } + return success; + + } + + private boolean checkForSupportedOIDs(List methods, Packet packet, + Buffer buf, int index, byte[] _username, Session session) + throws Exception { + packet.reset(); + + // byte SSH_MSG_USERAUTH_REQUEST(50) + // string user name(in ISO-10646 UTF-8 encoding) + // string service name(in US-ASCII) + // string "gssapi"(US-ASCII) + // uint32 n, the number of OIDs client supports + // string[n] mechanism OIDS + buf.putByte((byte) SSH_MSG_USERAUTH_REQUEST); + buf.putString(_username); + buf.putString("ssh-connection".getBytes()); + buf.putString("gssapi-with-mic".getBytes()); + buf.putInt(1); + buf.putString(supportedOids[index]); + session.write(packet); + + while (true) { + buf = session.read(buf); + + if (buf.buffer[5] == SSH_MSG_USERAUTH_FAILURE) { + return false; + } + + if (buf.buffer[5] == SSH_MSG_USERAUTH_GSSAPI_RESPONSE) { + buf.getInt(); + buf.getByte(); + buf.getByte(); + byte[] message = buf.getString(); + // logger.debug( "OID " + supportedOids[index] ); + if (Util.array_equals(message, supportedOids[index])) { + methods.add(supportedMethods[index]); + // logger.debug( "OID MATCH, method is " + methods ); + return true; + } + } + + if (buf.buffer[5] == SSH_MSG_USERAUTH_BANNER) { + buf.getInt(); + buf.getByte(); + buf.getByte(); + byte[] _message = buf.getString(); + buf.getString(); + String message = Util.byte2str(_message); + if (userinfo != null) { + userinfo.showMessage(message); + } + continue; + } + return false; + } + } + + private boolean tryMethod(String username, byte[] _username, String method, + Session session, Packet packet, Buffer buf) throws Exception { + GSSContext context = null; + try { + Class c = Class.forName(session.getConfig(method)); + context = (GSSContext) (c.newInstance()); + + } catch (Exception e) { + // logger.error( "could not instantiate GSSContext", e ); + return false; + } + + // Get the credentials and set them + // Not a good way, but we dont have any choice + if (session instanceof ExtendedSession) { + GSIAuthenticationInfo authenticationInfo = ((ExtendedSession) session).getAuthenticationInfo(); + + if (context instanceof GSSContextX509) { + ((GSSContextX509) context).setCredential(authenticationInfo.getCredentials()); + } + } + + // logger.debug( "GOT CONTEXT: " + context ); + + + // FIXME + // if ( userinfo instanceof IX509UserInfo ) { + // if ( context instanceof GSSContextX509 ) { + // GSSCredential credential = ( ( IX509UserInfo )userinfo + // ).getCredential(); + // logger.debug( "user info credential = " + credential ); + // ( ( GSSContextX509 )context ).setCredential( credential ); + // } + // } + + try { + context.create(username, session.host); + } catch (JSchException e) { + // logger.error( "context creation failed", e ); + return false; + } + + byte[] token = new byte[0]; + + while (!context.isEstablished()) { + try { + token = context.init(token, 0, token.length); + } catch (JSchException e) { + // logger.error( "context initialization failed", e ); + // TODO + // ERRTOK should be sent? + // byte SSH_MSG_USERAUTH_GSSAPI_ERRTOK + // string error token + return false; + } + + if (token != null) { + packet.reset(); + buf.putByte((byte) SSH_MSG_USERAUTH_GSSAPI_TOKEN); + buf.putString(token); + session.write(packet); + } + + if (!context.isEstablished()) { + buf = session.read(buf); + + if (buf.buffer[5] == SSH_MSG_USERAUTH_GSSAPI_ERROR) { + // uint32 major_status + // uint32 minor_status + // string message + // string language tag + buf = session.read(buf); + } else if (buf.buffer[5] == SSH_MSG_USERAUTH_GSSAPI_ERRTOK) { + buf = session.read(buf); + } + + if (buf.buffer[5] == SSH_MSG_USERAUTH_FAILURE) { + return false; + } + + buf.getInt(); + buf.getByte(); + buf.getByte(); + token = buf.getString(); + } + } + + Buffer mbuf = new Buffer(); + // string session identifier + // byte SSH_MSG_USERAUTH_REQUEST + // string user name + // string service + // string "gssapi-with-mic" + mbuf.putString(session.getSessionId()); + mbuf.putByte((byte) SSH_MSG_USERAUTH_REQUEST); + mbuf.putString(_username); + mbuf.putString("ssh-connection".getBytes()); + mbuf.putString("gssapi-with-mic".getBytes()); + + byte[] mic = context.getMIC(mbuf.buffer, 0, mbuf.getLength()); + + if (mic == null) { // there was an error in the getMIC call + return false; + } + + packet.reset(); + buf.putByte((byte) SSH_MSG_USERAUTH_GSSAPI_MIC); + buf.putString(mic); + session.write(packet); + + context.dispose(); + + buf = session.read(buf); + if (buf.buffer[5] == SSH_MSG_USERAUTH_SUCCESS) { + return true; + } + if (buf.buffer[5] == SSH_MSG_USERAUTH_FAILURE) { + buf.getInt(); + buf.getByte(); + buf.getByte(); + byte[] foo = buf.getString(); + int partial_success = buf.getByte(); + if (partial_success != 0) { + throw new JSchPartialAuthException(new String(foo)); + } + } + return false; + } +} + http://git-wip-us.apache.org/repos/asf/airavata/blob/19afc7e0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/GSSContextX509.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/GSSContextX509.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/GSSContextX509.java index 1c07a39..a6eea6f 100644 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/GSSContextX509.java +++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/GSSContextX509.java @@ -19,7 +19,7 @@ * */ -package org.apache.airavata.gfac.ssh; +package org.apache.airavata.gfac.gsi.ssh; import java.io.File; http://git-wip-us.apache.org/repos/asf/airavata/blob/19afc7e0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Cluster.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Cluster.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Cluster.java deleted file mode 100644 index beb5b37..0000000 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Cluster.java +++ /dev/null @@ -1,162 +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.api; - -import java.util.List; -import java.util.Map; - -import org.apache.airavata.gfac.ssh.api.job.JobDescriptor; -import org.apache.airavata.gfac.ssh.impl.JobStatus; - -import com.jcraft.jsch.Session; - -/** - * This interface represents a Cluster machine - * End users of the API can implement this and come up with their own - * implementations, but mostly this interface is for internal usage. - */ -public interface Cluster { - - /** - * This will submit a job to the cluster with a given pbs file and some parameters - * - * @param pbsFilePath path of the pbs file - * @param workingDirectory working directory where pbs should has to copy - * @return jobId after successful job submission - * @throws SSHApiException throws exception during error - */ - public String submitBatchJobWithScript(String pbsFilePath, String workingDirectory) throws SSHApiException; - - /** - * This will submit the given job and not performing any monitoring - * - * @param jobDescriptor job descriptor to submit to cluster, this contains all the parameter - * @return jobID after successful job submission. - * @throws SSHApiException throws exception during error - */ - public String submitBatchJob(JobDescriptor jobDescriptor) throws SSHApiException; - - /** - * This will copy the localFile to remoteFile location in configured cluster - * - * @param remoteFile remote file location, this can be a directory too - * @param localFile local file path of the file which needs to copy to remote location - * @throws SSHApiException throws exception during error - */ - public void scpTo(String remoteFile, String localFile) throws SSHApiException; - - /** - * This will copy a remote file in path rFile to local file lFile - * @param remoteFile remote file path, this has to be a full qualified path - * @param localFile This is the local file to copy, this can be a directory too - * @throws SSHApiException - */ - public void scpFrom(String remoteFile, String localFile) throws SSHApiException; - - /** - * This will copy a remote file in path rFile to local file lFile - * @param remoteFile remote file path, this has to be a full qualified path - * @param localFile This is the local file to copy, this can be a directory too - * @throws SSHApiException - */ - public void scpThirdParty(String remoteFileSorce, String remoteFileTarget) throws SSHApiException; - - /** - * This will create directories in computing resources - * @param directoryPath the full qualified path for the directory user wants to create - * @throws SSHApiException throws during error - */ - public void makeDirectory(String directoryPath) throws SSHApiException; - - - /** - * This will get the job description of a job which is there in the cluster - * if jbo is not available with the given ID it returns - * @param jobID jobId has to pass - * @return Returns full job description of the job which submitted successfully - * @throws SSHApiException throws exception during error - */ - public JobDescriptor getJobDescriptorById(String jobID) throws SSHApiException; - - /** - * This will delete the given job from the queue - * - * @param jobID jobId of the job which user wants to delete - * @return return the description of the deleted job - * @throws SSHApiException throws exception during error - */ - public JobDescriptor cancelJob(String jobID) throws SSHApiException; - - /** - * This will get the job status of the the job associated with this jobId - * - * @param jobID jobId of the job user want to get the status - * @return job status of the given jobID - * @throws SSHApiException throws exception during error - */ - public JobStatus getJobStatus(String jobID) throws SSHApiException; - /** - * This will get the job status of the the job associated with this jobId - * - * @param jobName jobName of the job user want to get the status - * @return jobId of the given jobName - * @throws SSHApiException throws exception during error - */ - public String getJobIdByJobName(String jobName, String userName) throws SSHApiException; - - /** - * This method can be used to poll the jobstatuses based on the given - * user but we should pass the jobID list otherwise we will get unwanted - * job statuses which submitted by different middleware outside apache - * airavata with the same uername which we are not considering - * @param userName userName of the jobs which required to get the status - * @param jobIDs precises set of jobIDs - * @return - */ - public void getJobStatuses(String userName,Map<String,JobStatus> jobIDs)throws SSHApiException; - /** - * This will list directories in computing resources - * @param directoryPath the full qualified path for the directory user wants to create - * @throws SSHApiException throws during error - */ - public List<String> listDirectory(String directoryPath) throws SSHApiException; - - /** - * This method can be used to get created ssh session - * to reuse the created session. - * @throws SSHApiException - */ - public Session getSession() throws SSHApiException; - - /** - * This method can be used to close the connections initialized - * to handle graceful shutdown of the system - * @throws SSHApiException - */ - public void disconnect() throws SSHApiException; - - /** - * This gives the server Info - * @return - */ - public ServerInfo getServerInfo(); - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/19afc7e0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/CommandExecutor.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/CommandExecutor.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/CommandExecutor.java index 024c53d..bf306ef 100644 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/CommandExecutor.java +++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/CommandExecutor.java @@ -18,14 +18,31 @@ * under the License. * */ -package org.apache.airavata.gfac.ssh.api; - -import com.jcraft.jsch.*; -import org.apache.airavata.gfac.ssh.api.authentication.*; -import org.apache.airavata.gfac.ssh.config.ConfigReader; -import org.apache.airavata.gfac.ssh.jsch.ExtendedJSch; -import org.apache.airavata.gfac.ssh.util.SSHAPIUIKeyboardInteractive; -import org.apache.airavata.gfac.ssh.util.SSHKeyPasswordHandler; +package org.apache.airavata.gfac.gsi.ssh.api; + +import com.jcraft.jsch.Channel; +import com.jcraft.jsch.ChannelExec; +import com.jcraft.jsch.ExtendedSession; +import com.jcraft.jsch.GSISSHIdentityFile; +import com.jcraft.jsch.GSISSHIdentityRepository; +import com.jcraft.jsch.Identity; +import com.jcraft.jsch.JSch; +import com.jcraft.jsch.JSchException; +import com.jcraft.jsch.Session; +import org.apache.airavata.gfac.core.SSHApiException; +import org.apache.airavata.gfac.core.authentication.AuthenticationInfo; +import org.apache.airavata.gfac.core.authentication.GSIAuthenticationInfo; +import org.apache.airavata.gfac.core.authentication.SSHKeyAuthentication; +import org.apache.airavata.gfac.core.authentication.SSHPublicKeyAuthentication; +import org.apache.airavata.gfac.core.authentication.SSHPublicKeyFileAuthentication; +import org.apache.airavata.gfac.core.cluster.CommandInfo; +import org.apache.airavata.gfac.core.cluster.CommandOutput; +import org.apache.airavata.gfac.core.authentication.SSHPasswordAuthentication; +import org.apache.airavata.gfac.core.cluster.ServerInfo; +import org.apache.airavata.gfac.gsi.ssh.config.ConfigReader; +import org.apache.airavata.gfac.gsi.ssh.jsch.ExtendedJSch; +import org.apache.airavata.gfac.gsi.ssh.util.SSHAPIUIKeyboardInteractive; +import org.apache.airavata.gfac.gsi.ssh.util.SSHKeyPasswordHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; http://git-wip-us.apache.org/repos/asf/airavata/blob/19afc7e0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/CommandInfo.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/CommandInfo.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/CommandInfo.java deleted file mode 100644 index e6797ce..0000000 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/CommandInfo.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.apache.airavata.gfac.ssh.api;/* - * - * 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. - * - */ - -/** - * Encapsulates information about - */ -public interface CommandInfo { - - /** - * Gets the executable command as a string. - * @return String encoded command. Should be able to execute - * directly on remote shell. Should includes appropriate parameters. - */ - String getCommand(); - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/19afc7e0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/CommandOutput.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/CommandOutput.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/CommandOutput.java deleted file mode 100644 index f275ff0..0000000 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/CommandOutput.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.apache.airavata.gfac.ssh.api;/* - * - * 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. - * - */ - - -import com.jcraft.jsch.Channel; - -import java.io.OutputStream; - -/** - * Output of a certain command. TODO rethink - */ -public interface CommandOutput { - - /** - * Gets the output of the command as a stream. - * @param channel Command output as a stream. - */ - void onOutput(Channel channel); - - /** - * Gets standard error as a output stream. - * @return Command error as a stream. - */ - OutputStream getStandardError(); - - /** - * The command exit code. - * @param code The program exit code - */ - void exitCode(int code); -} http://git-wip-us.apache.org/repos/asf/airavata/blob/19afc7e0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Core.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Core.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Core.java index 67dd043..5225552 100644 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Core.java +++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Core.java @@ -18,9 +18,9 @@ * under the License. * */ -package org.apache.airavata.gfac.ssh.api; +package org.apache.airavata.gfac.gsi.ssh.api; -import org.apache.airavata.gfac.ssh.api.job.JobDescriptor; +import org.apache.airavata.gfac.core.JobDescriptor; /** * This represents a CPU core of a machine in the cluster http://git-wip-us.apache.org/repos/asf/airavata/blob/19afc7e0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Node.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Node.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Node.java index 1515f39..4d2a1ca 100644 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Node.java +++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Node.java @@ -18,7 +18,7 @@ * under the License. * */ -package org.apache.airavata.gfac.ssh.api; +package org.apache.airavata.gfac.gsi.ssh.api; import java.util.HashMap; http://git-wip-us.apache.org/repos/asf/airavata/blob/19afc7e0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/SSHApiException.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/SSHApiException.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/SSHApiException.java deleted file mode 100644 index f78825b..0000000 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/SSHApiException.java +++ /dev/null @@ -1,36 +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.api; - -/** - * An exception class to wrap SSH command execution related errors. - */ -public class SSHApiException extends Exception { - - public SSHApiException(String message) { - super(message); - } - - public SSHApiException(String message, Exception e) { - super(message, e); - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/19afc7e0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/ServerInfo.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/ServerInfo.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/ServerInfo.java deleted file mode 100644 index d3c2160..0000000 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/ServerInfo.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.apache.airavata.gfac.ssh.api;/* - * - * 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. - * - */ - -/** - * Encapsulate server information. - */ -public class ServerInfo { - - private String host; - private String userName; - private int port = 22; - - public ServerInfo(String userName, String host) { - this.userName = userName; - this.host = host; - } - - public ServerInfo(String userName,String host, int port) { - this.host = host; - this.userName = userName; - this.port = port; - } - - public String getHost() { - return host; - } - - public void setHost(String host) { - this.host = host; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public int getPort() { - return port; - } - - public void setPort(int port) { - this.port = port; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/19afc7e0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/JobDescriptor.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/JobDescriptor.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/JobDescriptor.java deleted file mode 100644 index 7e936ec..0000000 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/JobDescriptor.java +++ /dev/null @@ -1,473 +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.api.job; - -import org.apache.airavata.gfac.ssh.api.CommandOutput; -import org.apache.airavata.gfac.ssh.util.CommonUtils; -import org.apache.airavata.gfac.ssh.x2012.x12.*; -import org.apache.xmlbeans.XmlException; - -import java.util.List; - -/** - * This class define a job with required parameters, based on this configuration API is generating a Pbs script and - * submit the job to the computing resource - */ -public class JobDescriptor { - - private JobDescriptorDocument jobDescriptionDocument; - - - public JobDescriptor() { - jobDescriptionDocument = JobDescriptorDocument.Factory.newInstance(); - jobDescriptionDocument.addNewJobDescriptor(); - } - - public JobDescriptor(JobDescriptorDocument jobDescriptorDocument) { - this.jobDescriptionDocument = jobDescriptorDocument; - } - - - public JobDescriptor(CommandOutput commandOutput) { - jobDescriptionDocument = JobDescriptorDocument.Factory.newInstance(); - jobDescriptionDocument.addNewJobDescriptor(); - } - - - public String toXML() { - return jobDescriptionDocument.xmlText(); - } - - public JobDescriptorDocument getJobDescriptorDocument() { - return this.jobDescriptionDocument; - } - - /** - * With new app catalog thrift object integration, we don't use this - * @param xml - * @return - * @throws XmlException - */ - @Deprecated - public static JobDescriptor fromXML(String xml) - throws XmlException { - JobDescriptorDocument parse = JobDescriptorDocument.Factory - .parse(xml); - JobDescriptor jobDescriptor = new JobDescriptor(parse); - return jobDescriptor; - } - - - //todo write bunch of setter getters to set and get jobdescription parameters - public void setWorkingDirectory(String workingDirectory) { - this.getJobDescriptorDocument().getJobDescriptor().setWorkingDirectory(workingDirectory); - } - - public String getWorkingDirectory() { - return this.getJobDescriptorDocument().getJobDescriptor().getWorkingDirectory(); - } - - public void setShellName(String shellName) { - this.getJobDescriptorDocument().getJobDescriptor().setShellName(shellName); - } - - public void setJobName(String name) { - this.getJobDescriptorDocument().getJobDescriptor().setJobName(name); - } - - public void setExecutablePath(String name) { - this.getJobDescriptorDocument().getJobDescriptor().setExecutablePath(name); - } - - public void setAllEnvExport(boolean name) { - this.getJobDescriptorDocument().getJobDescriptor().setAllEnvExport(name); - } - - public void setMailOptions(String name) { - this.getJobDescriptorDocument().getJobDescriptor().setMailOptions(name); - } - - public void setStandardOutFile(String name) { - this.getJobDescriptorDocument().getJobDescriptor().setStandardOutFile(name); - } - - public void setStandardErrorFile(String name) { - this.getJobDescriptorDocument().getJobDescriptor().setStandardErrorFile(name); - } - - public void setNodes(int name) { - this.getJobDescriptorDocument().getJobDescriptor().setNodes(name); - } - - public void setProcessesPerNode(int name) { - this.getJobDescriptorDocument().getJobDescriptor().setProcessesPerNode(name); - } - - public String getOutputDirectory() { - return this.getJobDescriptorDocument().getJobDescriptor().getOutputDirectory(); - } - - public String getInputDirectory() { - return this.getJobDescriptorDocument().getJobDescriptor().getInputDirectory(); - } - public void setOutputDirectory(String name) { - this.getJobDescriptorDocument().getJobDescriptor().setOutputDirectory(name); - } - - public void setInputDirectory(String name) { - this.getJobDescriptorDocument().getJobDescriptor().setInputDirectory(name); - } - - /** - * Users can pass the minute count for maxwalltime - * @param minutes - */ - public void setMaxWallTime(String minutes) { - this.getJobDescriptorDocument().getJobDescriptor().setMaxWallTime( - CommonUtils.maxWallTimeCalculator(Integer.parseInt(minutes))); - - } - - - public void setMaxWallTimeForLSF(String minutes) { - this.getJobDescriptorDocument().getJobDescriptor().setMaxWallTime( - CommonUtils.maxWallTimeCalculatorForLSF(Integer.parseInt(minutes))); - - } - public void setAcountString(String name) { - this.getJobDescriptorDocument().getJobDescriptor().setAcountString(name); - } - - public void setInputValues(List<String> inputValue) { - InputList inputList = this.getJobDescriptorDocument().getJobDescriptor().addNewInputs(); - inputList.setInputArray(inputValue.toArray(new String[inputValue.size()])); - } - - public void setJobID(String jobID) { - this.getJobDescriptorDocument().getJobDescriptor().setJobID(jobID); - } - - public void setQueueName(String queueName) { - this.getJobDescriptorDocument().getJobDescriptor().setQueueName(queueName); - } - - public void setStatus(String queueName) { - this.getJobDescriptorDocument().getJobDescriptor().setStatus(queueName); - } - - public void setAfterAnyList(String[] afterAnyList) { - AfterAnyList afterAny = this.getJobDescriptorDocument().getJobDescriptor().addNewAfterAny(); - afterAny.setAfterAnyArray(afterAnyList); - } - - public void setAfterOKList(String[] afterOKList) { - AfterOKList afterAnyList = this.getJobDescriptorDocument().getJobDescriptor().addNewAfterOKList(); - afterAnyList.setAfterOKListArray(afterOKList); - } - public void setCTime(String cTime) { - this.getJobDescriptorDocument().getJobDescriptor().setCTime(cTime); - } - public void setQTime(String qTime) { - this.getJobDescriptorDocument().getJobDescriptor().setQTime(qTime); - } - public void setMTime(String mTime) { - this.getJobDescriptorDocument().getJobDescriptor().setMTime(mTime); - } - public void setSTime(String sTime) { - this.getJobDescriptorDocument().getJobDescriptor().setSTime(sTime); - } - public void setCompTime(String compTime) { - this.getJobDescriptorDocument().getJobDescriptor().setCompTime(compTime); - } - public void setOwner(String owner) { - this.getJobDescriptorDocument().getJobDescriptor().setOwner(owner); - } - public void setExecuteNode(String executeNode) { - this.getJobDescriptorDocument().getJobDescriptor().setExecuteNode(executeNode); - } - public void setEllapsedTime(String ellapsedTime) { - this.getJobDescriptorDocument().getJobDescriptor().setEllapsedTime(ellapsedTime); - } - - public void setUsedCPUTime(String usedCPUTime) { - this.getJobDescriptorDocument().getJobDescriptor().setUsedCPUTime(usedCPUTime); - } - public void setCPUCount(int usedCPUTime) { - this.getJobDescriptorDocument().getJobDescriptor().setCpuCount(usedCPUTime); - } - public void setUsedMemory(String usedMemory) { - this.getJobDescriptorDocument().getJobDescriptor().setUsedMem(usedMemory); - } - public void setVariableList(String variableList) { - this.getJobDescriptorDocument().getJobDescriptor().setVariableList(variableList); - } - public void setSubmitArgs(String submitArgs) { - this.getJobDescriptorDocument().getJobDescriptor().setSubmitArgs(submitArgs); - } - - public void setPreJobCommands(String[] commands){ - if(this.getJobDescriptorDocument().getJobDescriptor().getPreJobCommands() == null){ - this.getJobDescriptorDocument().getJobDescriptor().addNewPreJobCommands(); - } - this.getJobDescriptorDocument().getJobDescriptor().getPreJobCommands().setCommandArray(commands); - } - - public void setPostJobCommands(String[] commands){ - if(this.getJobDescriptorDocument().getJobDescriptor().getPostJobCommands() == null){ - this.getJobDescriptorDocument().getJobDescriptor().addNewPostJobCommands(); - } - this.getJobDescriptorDocument().getJobDescriptor().getPostJobCommands().setCommandArray(commands); - } - - public void setModuleLoadCommands(String[] commands) { - if (this.getJobDescriptorDocument().getJobDescriptor().getModuleLoadCommands() == null) { - this.getJobDescriptorDocument().getJobDescriptor().addNewModuleLoadCommands(); - } - this.getJobDescriptorDocument().getJobDescriptor().getModuleLoadCommands().setCommandArray(commands); - } - - public void addModuleLoadCommands(String command) { - if (this.getJobDescriptorDocument().getJobDescriptor().getModuleLoadCommands() == null) { - this.getJobDescriptorDocument().getJobDescriptor().addNewModuleLoadCommands(); - } - this.getJobDescriptorDocument().getJobDescriptor().getModuleLoadCommands().addCommand(command); - } - - public void addPreJobCommand(String command){ - if(this.getJobDescriptorDocument().getJobDescriptor().getPreJobCommands() == null){ - this.getJobDescriptorDocument().getJobDescriptor().addNewPreJobCommands(); - } - this.getJobDescriptorDocument().getJobDescriptor().getPreJobCommands().addCommand(command); - } - - public void addPostJobCommand(String command){ - if(this.getJobDescriptorDocument().getJobDescriptor().getPostJobCommands() == null){ - this.getJobDescriptorDocument().getJobDescriptor().addNewPostJobCommands(); - } - this.getJobDescriptorDocument().getJobDescriptor().getPostJobCommands().addCommand(command); - } - - public void setPartition(String partition){ - this.getJobDescriptorDocument().getJobDescriptor().setPartition(partition); - } - - public void setUserName(String userName){ - this.getJobDescriptorDocument().getJobDescriptor().setUserName(userName); - } - public void setNodeList(String nodeList){ - this.getJobDescriptorDocument().getJobDescriptor().setNodeList(nodeList); - } - public void setJobSubmitter(String jobSubmitter){ - this.getJobDescriptorDocument().getJobDescriptor().setJobSubmitterCommand(jobSubmitter); - } - public String getNodeList(){ - return this.getJobDescriptorDocument().getJobDescriptor().getNodeList(); - } - public String getExecutablePath() { - return this.getJobDescriptorDocument().getJobDescriptor().getExecutablePath(); - } - - public boolean getAllEnvExport() { - return this.getJobDescriptorDocument().getJobDescriptor().getAllEnvExport(); - } - - public String getMailOptions() { - return this.getJobDescriptorDocument().getJobDescriptor().getMailOptions(); - } - - public String getStandardOutFile() { - return this.getJobDescriptorDocument().getJobDescriptor().getStandardOutFile(); - } - - public String getStandardErrorFile() { - return this.getJobDescriptorDocument().getJobDescriptor().getStandardErrorFile(); - } - - public int getNodes(int name) { - return this.getJobDescriptorDocument().getJobDescriptor().getNodes(); - } - - public int getCPUCount(int name) { - return this.getJobDescriptorDocument().getJobDescriptor().getCpuCount(); - } - - public int getProcessesPerNode() { - return this.getJobDescriptorDocument().getJobDescriptor().getProcessesPerNode(); - } - - public String getMaxWallTime() { - return this.getJobDescriptorDocument().getJobDescriptor().getMaxWallTime(); - } - - public String getAcountString() { - return this.getJobDescriptorDocument().getJobDescriptor().getAcountString(); - } - - public String[] getInputValues() { - return this.getJobDescriptorDocument().getJobDescriptor().getInputs().getInputArray(); - } - - public String getJobID() { - return this.getJobDescriptorDocument().getJobDescriptor().getJobID(); - } - - public String getQueueName() { - return this.getJobDescriptorDocument().getJobDescriptor().getQueueName(); - } - - public String getStatus() { - return this.getJobDescriptorDocument().getJobDescriptor().getStatus(); - } - - public String[] getAfterAnyList() { - return this.getJobDescriptorDocument().getJobDescriptor().getAfterAny().getAfterAnyArray(); - } - - public String[] getAfterOKList() { - return this.getJobDescriptorDocument().getJobDescriptor().getAfterOKList().getAfterOKListArray(); - } - public String getCTime() { - return this.getJobDescriptorDocument().getJobDescriptor().getCTime(); - } - public String getQTime() { - return this.getJobDescriptorDocument().getJobDescriptor().getQTime(); - } - public String getMTime() { - return this.getJobDescriptorDocument().getJobDescriptor().getMTime(); - } - public String getSTime() { - return this.getJobDescriptorDocument().getJobDescriptor().getSTime(); - } - public String getCompTime() { - return this.getJobDescriptorDocument().getJobDescriptor().getCompTime(); - } - public String getOwner() { - return this.getJobDescriptorDocument().getJobDescriptor().getOwner(); - } - public String getExecuteNode() { - return this.getJobDescriptorDocument().getJobDescriptor().getExecuteNode(); - } - public String getEllapsedTime() { - return this.getJobDescriptorDocument().getJobDescriptor().getEllapsedTime(); - } - - public String getUsedCPUTime() { - return this.getJobDescriptorDocument().getJobDescriptor().getUsedCPUTime(); - } - - public String getUsedMemory() { - return this.getJobDescriptorDocument().getJobDescriptor().getUsedMem(); - } - public void getShellName() { - this.getJobDescriptorDocument().getJobDescriptor().getShellName(); - } - - public String getJobName() { - return this.getJobDescriptorDocument().getJobDescriptor().getJobName(); - } - - public String getJobId() { - return this.getJobDescriptorDocument().getJobDescriptor().getJobID(); - } - - - public String getVariableList() { - return this.getJobDescriptorDocument().getJobDescriptor().getJobID(); - } - public String getSubmitArgs() { - return this.getJobDescriptorDocument().getJobDescriptor().getJobID(); - } - - public String[] getPostJobCommands(){ - if(this.getJobDescriptorDocument().getJobDescriptor().getPostJobCommands() != null) { - return this.getJobDescriptorDocument().getJobDescriptor().getPostJobCommands().getCommandArray(); - } - return null; - } - - public String[] getModuleCommands() { - if (this.getJobDescriptorDocument().getJobDescriptor().getModuleLoadCommands() != null) { - return this.getJobDescriptorDocument().getJobDescriptor().getModuleLoadCommands().getCommandArray(); - } - return null; - } - - public String[] getPreJobCommands(){ - if(this.getJobDescriptorDocument().getJobDescriptor().getPreJobCommands() != null) { - return this.getJobDescriptorDocument().getJobDescriptor().getPreJobCommands().getCommandArray(); - } - return null; - } - - public String getJobSubmitterCommand(){ - return this.getJobDescriptorDocument().getJobDescriptor().getJobSubmitterCommand(); - } - - public String getPartition(){ - return this.getJobDescriptorDocument().getJobDescriptor().getPartition(); - } - - public String getUserName(){ - return this.getJobDescriptorDocument().getJobDescriptor().getUserName(); - } - - public void setCallBackIp(String ip){ - this.jobDescriptionDocument.getJobDescriptor().setCallBackIp(ip); - } - - public void setCallBackPort(String ip){ - this.jobDescriptionDocument.getJobDescriptor().setCallBackPort(ip); - } - - - public String getCallBackIp(){ - return this.jobDescriptionDocument.getJobDescriptor().getCallBackIp(); - } - public String getCallBackPort(){ - return this.jobDescriptionDocument.getJobDescriptor().getCallBackPort(); - } - - public void setMailType(String emailType) { - this.getJobDescriptorDocument().getJobDescriptor().setMailType(emailType); - } - - public String getMailType() { - return this.getJobDescriptorDocument().getJobDescriptor().getMailType(); - } - public void setMailAddress(String emailAddress) { - this.getJobDescriptorDocument().getJobDescriptor().setMailAddress(emailAddress); - } - - public String getMailAddress() { - return this.getJobDescriptorDocument().getJobDescriptor().getMailAddress(); - } - - public String getChassisName() { - return this.getJobDescriptorDocument().getJobDescriptor().getChassisName(); - } - - public void setChassisName(String chassisName){ - this.getJobDescriptorDocument().getJobDescriptor().setChassisName(chassisName); - } - - -} - http://git-wip-us.apache.org/repos/asf/airavata/blob/19afc7e0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/JobManagerConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/JobManagerConfiguration.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/JobManagerConfiguration.java deleted file mode 100644 index d58a994..0000000 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/JobManagerConfiguration.java +++ /dev/null @@ -1,51 +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.api.job; - -import org.apache.airavata.gfac.ssh.impl.RawCommandInfo; - -public interface JobManagerConfiguration { - - public RawCommandInfo getCancelCommand(String jobID); - - public String getJobDescriptionTemplateName(); - - public RawCommandInfo getMonitorCommand(String jobID); - - public RawCommandInfo getUserBasedMonitorCommand(String userName); - - public RawCommandInfo getJobIdMonitorCommand(String jobName , String userName); - - public String getScriptExtension(); - - public RawCommandInfo getSubmitCommand(String workingDirectory, String pbsFilePath); - - public OutputParser getParser(); - - public String getInstalledPath(); - - public String getBaseCancelCommand(); - - public String getBaseMonitorCommand(); - - public String getBaseSubmitCommand(); - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/19afc7e0/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/JobType.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/JobType.java b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/JobType.java deleted file mode 100644 index 556f4ef..0000000 --- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/JobType.java +++ /dev/null @@ -1,32 +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.api.job; - -/** - * Created by IntelliJ IDEA. - * User: lahirugunathilake - * Date: 8/22/13 - * Time: 7:19 AM - * To change this template use File | Settings | File Templates. - */ -public enum JobType { - SERIAL, SINGLE, MPI, MULTIPLE, CONDOR -}
