You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sh...@apache.org on 2015/06/05 07:26:53 UTC
[1/6] airavata git commit: Removed gsissh module from tools
Repository: airavata
Updated Branches:
refs/heads/master 2835d09ef -> 13c2e79e4
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/util/SSHUtils.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/util/SSHUtils.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/util/SSHUtils.java
deleted file mode 100644
index 35f6a41..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/util/SSHUtils.java
+++ /dev/null
@@ -1,757 +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.util;
-
-import com.jcraft.jsch.*;
-
-import org.apache.airavata.gfac.ssh.api.authentication.GSIAuthenticationInfo;
-import org.apache.airavata.gfac.ssh.api.SSHApiException;
-import org.apache.airavata.gfac.ssh.api.ServerInfo;
-import org.apache.airavata.gfac.ssh.config.ConfigReader;
-import org.apache.airavata.gfac.ssh.impl.StandardOutReader;
-import org.slf4j.*;
-
-import java.io.*;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * This class is going to be useful to SCP a file to a remote grid machine using my proxy credentials
- */
-public class SSHUtils {
- private static final org.slf4j.Logger log = LoggerFactory.getLogger(SSHUtils.class);
-
- static {
- JSch.setConfig("gssapi-with-mic.x509", "org.apache.airavata.gfac.ssh.GSSContextX509");
- JSch.setConfig("userauth.gssapi-with-mic", "com.jcraft.jsch.UserAuthGSSAPIWithMICGSSCredentials");
-
- }
-
- private ServerInfo serverInfo;
-
- private GSIAuthenticationInfo authenticationInfo;
-
- private ConfigReader configReader;
-
- /**
- * We need to pass certificateLocation when we use SCPTo method standalone
- *
- * @param serverInfo
- * @param authenticationInfo
- * @param certificateLocation
- * @param configReader
- */
- public SSHUtils(ServerInfo serverInfo, GSIAuthenticationInfo authenticationInfo, String certificateLocation, ConfigReader configReader) {
- System.setProperty("X509_CERT_DIR", certificateLocation);
- this.serverInfo = serverInfo;
- this.authenticationInfo = authenticationInfo;
- this.configReader = configReader;
- }
-
- /**
- * This can be used when use SCPTo method within SSHAPi because SSHApiFactory already set the system property certificateLocation
- *
- * @param serverInfo
- * @param authenticationInfo
- * @param configReader
- */
- public SSHUtils(ServerInfo serverInfo, GSIAuthenticationInfo authenticationInfo
- , ConfigReader configReader) {
- this.serverInfo = serverInfo;
- this.authenticationInfo = authenticationInfo;
- this.configReader = configReader;
- }
-
- /**
- * This method will scp the lFile to the rFile location
- *
- * @param rFile remote file Path to use in scp
- * @param lFile local file path to use in scp
- * @throws IOException
- * @throws JSchException
- * @throws org.apache.airavata.gfac.ssh.api.SSHApiException
- *
- */
- public void scpTo(String rFile, String lFile) throws IOException, JSchException, SSHApiException {
- FileInputStream fis = null;
- String prefix = null;
- if (new File(lFile).isDirectory()) {
- prefix = lFile + File.separator;
- }
- JSch jsch = new JSch();
-
- log.debug("Connecting to server - " + serverInfo.getHost() + ":" + serverInfo.getPort() + " with user name - "
- + serverInfo.getUserName());
-
- Session session = null;
-
- try {
- session = jsch.getSession(serverInfo.getUserName(), serverInfo.getHost(), serverInfo.getPort());
- } catch (JSchException e) {
- throw new SSHApiException("An exception occurred while creating SSH session." +
- "Connecting server - " + serverInfo.getHost() + ":" + serverInfo.getPort() +
- " connecting user name - "
- + serverInfo.getUserName(), e);
- }
-
- java.util.Properties config = this.configReader.getProperties();
- session.setConfig(config);
-
- // Not a good way, but we dont have any choice
- if (session instanceof ExtendedSession) {
- ((ExtendedSession) session).setAuthenticationInfo(authenticationInfo);
- }
-
- try {
- session.connect();
- } catch (JSchException e) {
- throw new SSHApiException("An exception occurred while connecting to server." +
- "Connecting server - " + serverInfo.getHost() + ":" + serverInfo.getPort() +
- " connecting user name - "
- + serverInfo.getUserName(), e);
- }
-
- boolean ptimestamp = true;
-
- // exec 'scp -t rfile' remotely
- String command = "scp " + (ptimestamp ? "-p" : "") + " -t " + rFile;
- Channel channel = session.openChannel("exec");
-
- StandardOutReader stdOutReader = new StandardOutReader();
- ((ChannelExec) channel).setErrStream(stdOutReader.getStandardError());
- ((ChannelExec) channel).setCommand(command);
-
- // get I/O streams for remote scp
- OutputStream out = channel.getOutputStream();
- InputStream in = channel.getInputStream();
-
- channel.connect();
-
- if (checkAck(in) != 0) {
- String error = "Error Reading input Stream";
- log.error(error);
- throw new SSHApiException(error);
- }
-
- File _lfile = new File(lFile);
-
- if (ptimestamp) {
- command = "T" + (_lfile.lastModified() / 1000) + " 0";
- // The access time should be sent here,
- // but it is not accessible with JavaAPI ;-<
- command += (" " + (_lfile.lastModified() / 1000) + " 0\n");
- out.write(command.getBytes());
- out.flush();
- if (checkAck(in) != 0) {
- String error = "Error Reading input Stream";
- log.error(error);
- throw new SSHApiException(error);
- }
- }
-
- // send "C0644 filesize filename", where filename should not include '/'
- long filesize = _lfile.length();
- command = "C0644 " + filesize + " ";
- if (lFile.lastIndexOf('/') > 0) {
- command += lFile.substring(lFile.lastIndexOf('/') + 1);
- } else {
- command += lFile;
- }
- command += "\n";
- out.write(command.getBytes());
- out.flush();
- if (checkAck(in) != 0) {
- String error = "Error Reading input Stream";
- log.error(error);
- throw new SSHApiException(error);
- }
-
- // send a content of lFile
- fis = new FileInputStream(lFile);
- byte[] buf = new byte[1024];
- while (true) {
- int len = fis.read(buf, 0, buf.length);
- if (len <= 0) break;
- out.write(buf, 0, len); //out.flush();
- }
- fis.close();
- fis = null;
- // send '\0'
- buf[0] = 0;
- out.write(buf, 0, 1);
- out.flush();
- if (checkAck(in) != 0) {
- String error = "Error Reading input Stream";
- log.error(error);
- throw new SSHApiException(error);
- }
- out.close();
-
- stdOutReader.onOutput(channel);
-
-
- if (stdOutReader.getStdErrorString().contains("scp:")) {
- throw new SSHApiException(stdOutReader.getStdErrorString());
- }
- channel.disconnect();
- }
-
- /**
- * This will copy a local file to a remote location
- *
- * @param remoteFile remote location you want to transfer the file, this cannot be a directory, if user pass
- * a dirctory we do copy it to that directory but we simply return the directory name
- * todo handle the directory name as input and return the proper final output file name
- * @param localFile Local file to transfer, this can be a directory
- * @param session
- * @return returns the final remote file path, so that users can use the new file location
- * @throws IOException
- * @throws JSchException
- * @throws SSHApiException
- */
- public static String scpTo(String remoteFile, String localFile, Session session) throws IOException, JSchException, SSHApiException {
- FileInputStream fis = null;
- String prefix = null;
- if (new File(localFile).isDirectory()) {
- prefix = localFile + File.separator;
- }
- boolean ptimestamp = true;
-
- // exec 'scp -t rfile' remotely
- String command = "scp " + (ptimestamp ? "-p" : "") + " -t " + remoteFile;
- Channel channel = session.openChannel("exec");
-
- StandardOutReader stdOutReader = new StandardOutReader();
- ((ChannelExec) channel).setErrStream(stdOutReader.getStandardError());
- ((ChannelExec) channel).setCommand(command);
-
- // get I/O streams for remote scp
- OutputStream out = channel.getOutputStream();
- InputStream in = channel.getInputStream();
-
- channel.connect();
-
- if (checkAck(in) != 0) {
- String error = "Error Reading input Stream";
- log.error(error);
- throw new SSHApiException(error);
- }
-
- File _lfile = new File(localFile);
-
- if (ptimestamp) {
- command = "T" + (_lfile.lastModified() / 1000) + " 0";
- // The access time should be sent here,
- // but it is not accessible with JavaAPI ;-<
- command += (" " + (_lfile.lastModified() / 1000) + " 0\n");
- out.write(command.getBytes());
- out.flush();
- if (checkAck(in) != 0) {
- String error = "Error Reading input Stream";
- log.error(error);
- throw new SSHApiException(error);
- }
- }
-
- // send "C0644 filesize filename", where filename should not include '/'
- long filesize = _lfile.length();
- command = "C0644 " + filesize + " ";
- if (localFile.lastIndexOf('/') > 0) {
- command += localFile.substring(localFile.lastIndexOf('/') + 1);
- } else {
- command += localFile;
- }
- command += "\n";
- out.write(command.getBytes());
- out.flush();
- if (checkAck(in) != 0) {
- String error = "Error Reading input Stream";
- log.error(error);
- throw new SSHApiException(error);
- }
-
- // send a content of lFile
- fis = new FileInputStream(localFile);
- byte[] buf = new byte[1024];
- while (true) {
- int len = fis.read(buf, 0, buf.length);
- if (len <= 0) break;
- out.write(buf, 0, len); //out.flush();
- }
- fis.close();
- fis = null;
- // send '\0'
- buf[0] = 0;
- out.write(buf, 0, 1);
- out.flush();
- if (checkAck(in) != 0) {
- String error = "Error Reading input Stream";
- log.error(error);
- throw new SSHApiException(error);
- }
- out.close();
- stdOutReader.onOutput(channel);
-
-
- channel.disconnect();
- if (stdOutReader.getStdErrorString().contains("scp:")) {
- throw new SSHApiException(stdOutReader.getStdErrorString());
- }
- //since remote file is always a file we just return the file
- return remoteFile;
- }
-
- /**
- * This method will copy a remote file to a local directory
- *
- * @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
- * @param session
- * @return returns the final local file path of the new file came from the remote resource
- */
- public static void scpFrom(String remoteFile, String localFile, Session session) throws IOException, JSchException, SSHApiException {
- FileOutputStream fos = null;
- try {
- String prefix = null;
- if (new File(localFile).isDirectory()) {
- prefix = localFile + File.separator;
- }
-
- // exec 'scp -f remotefile' remotely
- String command = "scp -f " + remoteFile;
- Channel channel = session.openChannel("exec");
- ((ChannelExec) channel).setCommand(command);
-
- StandardOutReader stdOutReader = new StandardOutReader();
- ((ChannelExec) channel).setErrStream(stdOutReader.getStandardError());
- // get I/O streams for remote scp
- OutputStream out = channel.getOutputStream();
- InputStream in = channel.getInputStream();
-
- channel.connect();
-
- byte[] buf = new byte[1024];
-
- // send '\0'
- buf[0] = 0;
- out.write(buf, 0, 1);
- out.flush();
-
- while (true) {
- int c = checkAck(in);
- if (c != 'C') {
- break;
- }
-
- // read '0644 '
- in.read(buf, 0, 5);
-
- long filesize = 0L;
- while (true) {
- if (in.read(buf, 0, 1) < 0) {
- // error
- break;
- }
- if (buf[0] == ' ') break;
- filesize = filesize * 10L + (long) (buf[0] - '0');
- }
-
- String file = null;
- for (int i = 0; ; i++) {
- in.read(buf, i, 1);
- if (buf[i] == (byte) 0x0a) {
- file = new String(buf, 0, i);
- break;
- }
- }
-
- //System.out.println("filesize="+filesize+", file="+file);
-
- // send '\0'
- buf[0] = 0;
- out.write(buf, 0, 1);
- out.flush();
-
- // read a content of lfile
- fos = new FileOutputStream(prefix == null ? localFile : prefix + file);
- int foo;
- while (true) {
- if (buf.length < filesize) foo = buf.length;
- else foo = (int) filesize;
- foo = in.read(buf, 0, foo);
- if (foo < 0) {
- // error
- break;
- }
- fos.write(buf, 0, foo);
- filesize -= foo;
- if (filesize == 0L) break;
- }
- fos.close();
- fos = null;
-
- if (checkAck(in) != 0) {
- String error = "Error transfering the file content";
- log.error(error);
- throw new SSHApiException(error);
- }
-
- // send '\0'
- buf[0] = 0;
- out.write(buf, 0, 1);
- out.flush();
- }
- stdOutReader.onOutput(channel);
- if (stdOutReader.getStdErrorString().contains("scp:")) {
- throw new SSHApiException(stdOutReader.getStdErrorString());
- }
-
- } catch (Exception e) {
- log.error(e.getMessage(), e);
- } finally {
- try {
- if (fos != null) fos.close();
- } catch (Exception ee) {
- }
- }
- }
-
- /**
- * This method will copy a remote file to a local directory
- *
- * @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
- */
- public void scpFrom(String remoteFile, String localFile) throws SSHApiException {
- JSch jsch = new JSch();
-
- log.debug("Connecting to server - " + serverInfo.getHost() + ":" + serverInfo.getPort() + " with user name - "
- + serverInfo.getUserName());
-
- Session session = null;
-
- try {
- session = jsch.getSession(serverInfo.getUserName(), serverInfo.getHost(), serverInfo.getPort());
- } catch (JSchException e) {
- throw new SSHApiException("An exception occurred while creating SSH session." +
- "Connecting server - " + serverInfo.getHost() + ":" + serverInfo.getPort() +
- " connecting user name - "
- + serverInfo.getUserName(), e);
- }
-
- java.util.Properties config = this.configReader.getProperties();
- session.setConfig(config);
-
- // Not a good way, but we dont have any choice
- if (session instanceof ExtendedSession) {
- ((ExtendedSession) session).setAuthenticationInfo(authenticationInfo);
- }
-
- try {
- session.connect();
- } catch (JSchException e) {
- throw new SSHApiException("An exception occurred while connecting to server." +
- "Connecting server - " + serverInfo.getHost() + ":" + serverInfo.getPort() +
- " connecting user name - "
- + serverInfo.getUserName(), e);
- }
-
- FileOutputStream fos = null;
- try {
- String prefix = null;
- if (new File(localFile).isDirectory()) {
- prefix = localFile + File.separator;
- }
-
- // exec 'scp -f remotefile' remotely
- StandardOutReader stdOutReader = new StandardOutReader();
- String command = "scp -f " + remoteFile;
- Channel channel = session.openChannel("exec");
- ((ChannelExec) channel).setCommand(command);
- ((ChannelExec) channel).setErrStream(stdOutReader.getStandardError());
- // get I/O streams for remote scp
- OutputStream out = channel.getOutputStream();
- InputStream in = channel.getInputStream();
-
- channel.connect();
-
- byte[] buf = new byte[1024];
-
- // send '\0'
- buf[0] = 0;
- out.write(buf, 0, 1);
- out.flush();
-
- while (true) {
- int c = checkAck(in);
- if (c != 'C') {
- break;
- }
-
- // read '0644 '
- in.read(buf, 0, 5);
-
- long filesize = 0L;
- while (true) {
- if (in.read(buf, 0, 1) < 0) {
- // error
- break;
- }
- if (buf[0] == ' ') break;
- filesize = filesize * 10L + (long) (buf[0] - '0');
- }
-
- String file = null;
- for (int i = 0; ; i++) {
- in.read(buf, i, 1);
- if (buf[i] == (byte) 0x0a) {
- file = new String(buf, 0, i);
- break;
- }
- }
-
- //System.out.println("filesize="+filesize+", file="+file);
-
- // send '\0'
- buf[0] = 0;
- out.write(buf, 0, 1);
- out.flush();
-
- // read a content of lfile
- fos = new FileOutputStream(prefix == null ? localFile : prefix + file);
- int foo;
- while (true) {
- if (buf.length < filesize) foo = buf.length;
- else foo = (int) filesize;
- foo = in.read(buf, 0, foo);
- if (foo < 0) {
- // error
- break;
- }
- fos.write(buf, 0, foo);
- filesize -= foo;
- if (filesize == 0L) break;
- }
- fos.close();
- fos = null;
-
- if (checkAck(in) != 0) {
- String error = "Error transfering the file content";
- log.error(error);
- throw new SSHApiException(error);
- }
-
- // send '\0'
- buf[0] = 0;
- out.write(buf, 0, 1);
- out.flush();
- }
-
-// session.disconnect();
-
- stdOutReader.onOutput(channel);
- if (stdOutReader.getStdErrorString().contains("scp:")) {
- throw new SSHApiException(stdOutReader.getStdErrorString());
- }
- } catch (Exception e) {
- log.error(e.getMessage(), e);
- } finally {
- try {
- if (fos != null) fos.close();
- } catch (Exception ee) {
- }
- }
- }
-
- /**
- * This method will copy a remote file to a local directory
- *
- * @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
- * @param session
- * @return returns the final local file path of the new file came from the remote resource
- */
- public static void scpThirdParty(String remoteFileSource, String remoteFileTarget, Session session) throws IOException, JSchException, SSHApiException {
- FileOutputStream fos = null;
- try {
- String prefix = null;
-
- // exec 'scp -f remotefile' remotely
- String command = "scp -3 " + remoteFileSource + " " + remoteFileTarget;
- Channel channel = session.openChannel("exec");
- ((ChannelExec) channel).setCommand(command);
-
- StandardOutReader stdOutReader = new StandardOutReader();
- ((ChannelExec) channel).setErrStream(stdOutReader.getStandardError());
- // get I/O streams for remote scp
- OutputStream out = channel.getOutputStream();
- InputStream in = channel.getInputStream();
-
- channel.connect();
-
- byte[] buf = new byte[1024];
-
- // send '\0'
- buf[0] = 0;
- out.write(buf, 0, 1);
- out.flush();
-
- while (true) {
- int c = checkAck(in);
- if (c != 'C') {
- break;
- }
-
- // read '0644 '
- in.read(buf, 0, 5);
-
- long filesize = 0L;
- while (true) {
- if (in.read(buf, 0, 1) < 0) {
- // error
- break;
- }
- if (buf[0] == ' ') break;
- filesize = filesize * 10L + (long) (buf[0] - '0');
- }
- int foo;
- while (true) {
- if (buf.length < filesize) foo = buf.length;
- else foo = (int) filesize;
-
- int len = in.read(buf, 0, foo);
- if (len <= 0) break;
- out.write(buf, 0, len);
- }
- // send '\0'
- buf[0] = 0;
- out.write(buf, 0, 1);
- out.flush();
- if (checkAck(in) != 0) {
- String error = "Error transfering the file content";
- log.error(error);
- throw new SSHApiException(error);
- }
-
- }
- out.close();
-
- stdOutReader.onOutput(channel);
- if (stdOutReader.getStdErrorString().contains("scp:")) {
- throw new SSHApiException(stdOutReader.getStdErrorString());
- }
-
- } catch (Exception e) {
- log.error(e.getMessage(), e);
- } finally {
- try {
- if (fos != null) fos.close();
- } catch (Exception ee) {
- }
- }
- }
-
- public static void makeDirectory(String path, Session session) throws IOException, JSchException, SSHApiException {
-
- // exec 'scp -t rfile' remotely
- String command = "mkdir -p " + path;
- Channel channel = session.openChannel("exec");
- StandardOutReader stdOutReader = new StandardOutReader();
-
- ((ChannelExec) channel).setCommand(command);
-
-
- ((ChannelExec) channel).setErrStream(stdOutReader.getStandardError());
- try {
- channel.connect();
- } catch (JSchException e) {
-
- channel.disconnect();
-// session.disconnect();
-
- throw new SSHApiException("Unable to retrieve command output. Command - " + command +
- " on server - " + session.getHost() + ":" + session.getPort() +
- " connecting user name - "
- + session.getUserName(), e);
- }
- stdOutReader.onOutput(channel);
- if (stdOutReader.getStdErrorString().contains("mkdir:")) {
- throw new SSHApiException(stdOutReader.getStdErrorString());
- }
-
- channel.disconnect();
- }
-
- public static List<String> listDirectory(String path, Session session) throws IOException, JSchException, SSHApiException {
-
- // exec 'scp -t rfile' remotely
- String command = "ls " + path;
- Channel channel = session.openChannel("exec");
- StandardOutReader stdOutReader = new StandardOutReader();
-
- ((ChannelExec) channel).setCommand(command);
-
-
- ((ChannelExec) channel).setErrStream(stdOutReader.getStandardError());
- try {
- channel.connect();
- } catch (JSchException e) {
-
- channel.disconnect();
-// session.disconnect();
-
- throw new SSHApiException("Unable to retrieve command output. Command - " + command +
- " on server - " + session.getHost() + ":" + session.getPort() +
- " connecting user name - "
- + session.getUserName(), e);
- }
- stdOutReader.onOutput(channel);
- stdOutReader.getStdOutputString();
- if (stdOutReader.getStdErrorString().contains("ls:")) {
- throw new SSHApiException(stdOutReader.getStdErrorString());
- }
- channel.disconnect();
- return Arrays.asList(stdOutReader.getStdOutputString().split("\n"));
- }
-
- static int checkAck(InputStream in) throws IOException {
- int b = in.read();
- if (b == 0) return b;
- if (b == -1) return b;
-
- if (b == 1 || b == 2) {
- StringBuffer sb = new StringBuffer();
- int c;
- do {
- c = in.read();
- sb.append((char) c);
- }
- while (c != '\n');
- if (b == 1) { // error
- System.out.print(sb.toString());
- }
- if (b == 2) { // fatal error
- System.out.print(sb.toString());
- }
- }
- return b;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/resources/LSFTemplate.xslt
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/resources/LSFTemplate.xslt b/tools/gsissh/src/main/resources/LSFTemplate.xslt
deleted file mode 100644
index c548d8e..0000000
--- a/tools/gsissh/src/main/resources/LSFTemplate.xslt
+++ /dev/null
@@ -1,93 +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. -->
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns="http://airavata.apache.org/gsi/ssh/2012/12">
- <xsl:output method="text" />
- <xsl:template match="/ns:JobDescriptor">
- <xsl:param name="quote">"</xsl:param>
-#! /bin/bash
-# LSF batch job submission script generated by Apache Airavata
-#
- <xsl:choose>
- <xsl:when test="ns:shellName">
-#BSUB -L <xsl:value-of select="ns:shellName"/>
- </xsl:when></xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:queueName">
-#BSUB -q <xsl:value-of select="ns:queueName"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:nodes">
-#BSUB -n <xsl:value-of select="ns:nodes"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:mailAddress">
-#BSUB -u <xsl:value-of select="ns:mailAddress"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:jobName">
-#BSUB -J <xsl:value-of select="ns:jobName"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:acountString">
-#BSUB -P <xsl:value-of select="ns:acountString"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:maxWallTime">
-#BSUB -W <xsl:value-of select="ns:maxWallTime"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:standardOutFile">
-#BSUB -o "<xsl:value-of select="ns:standardOutFile"/>"
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:standardOutFile">
-#BSUB -e "<xsl:value-of select="ns:standardErrorFile"/>"
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:chassisName">
-#BSUB -m c<xsl:value-of select="ns:chassisName"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:usedMem">
-#BSUB -R rusage[mem=<xsl:value-of select="ns:usedMem"/>]
- </xsl:when>
- </xsl:choose>
-
- <xsl:text>
</xsl:text>
-
- <xsl:text>
</xsl:text>
- <xsl:for-each select="ns:moduleLoadCommands/ns:command">
- <xsl:text>
</xsl:text>
- <xsl:value-of select="."/><xsl:text> </xsl:text>
- </xsl:for-each>
- <xsl:text>
</xsl:text>
-cd <xsl:text> </xsl:text><xsl:value-of select="ns:workingDirectory"/><xsl:text>
</xsl:text>
- <xsl:for-each select="ns:preJobCommands/ns:command">
- <xsl:value-of select="."/><xsl:text> </xsl:text>
- <xsl:text>
</xsl:text>
- </xsl:for-each>
- <xsl:text>
</xsl:text>
- <xsl:choose><xsl:when test="ns:jobSubmitterCommand != ''">
- <xsl:value-of select="ns:jobSubmitterCommand"/><xsl:text> </xsl:text>
- </xsl:when></xsl:choose><xsl:value-of select="ns:executablePath"/><xsl:text> </xsl:text>
- <xsl:for-each select="ns:inputs/ns:input">
- <xsl:value-of select="."/><xsl:text> </xsl:text>
- </xsl:for-each>
- <xsl:text>
</xsl:text>
- </xsl:template>
-
-</xsl:stylesheet>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/resources/PBSTemplate.xslt
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/resources/PBSTemplate.xslt b/tools/gsissh/src/main/resources/PBSTemplate.xslt
deleted file mode 100644
index 73c5eb6..0000000
--- a/tools/gsissh/src/main/resources/PBSTemplate.xslt
+++ /dev/null
@@ -1,82 +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. -->
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns="http://airavata.apache.org/gsi/ssh/2012/12">
-<xsl:output method="text" />
-<xsl:template match="/ns:JobDescriptor">
-#! /bin/sh
-# <xsl:choose>
- <xsl:when test="ns:shellName">
-##PBS -S <xsl:value-of select="ns:shellName"/>
- </xsl:when></xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:queueName">
-#PBS -q <xsl:value-of select="ns:queueName"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:mailOptions">
-#PBS -m <xsl:value-of select="ns:mailOptions"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
-<xsl:when test="ns:acountString">
-#PBS -A <xsl:value-of select="ns:acountString"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:maxWallTime">
-#PBS -l walltime=<xsl:value-of select="ns:maxWallTime"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:jobName">
-#PBS -N <xsl:value-of select="ns:jobName"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:standardOutFile">
-#PBS -o <xsl:value-of select="ns:standardOutFile"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:standardOutFile">
-#PBS -e <xsl:value-of select="ns:standardErrorFile"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:usedMem">
-#PBS -l mem=<xsl:value-of select="ns:usedMem"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="(ns:nodes) and (ns:processesPerNode)">
-#PBS -l nodes=<xsl:value-of select="ns:nodes"/>:ppn=<xsl:value-of select="ns:processesPerNode"/>
-<xsl:text>
</xsl:text>
- </xsl:when>
- </xsl:choose>
-<xsl:for-each select="ns:exports/ns:name">
-<xsl:value-of select="."/>=<xsl:value-of select="./@value"/><xsl:text>
</xsl:text>
-export<xsl:text> </xsl:text><xsl:value-of select="."/>
-<xsl:text>
</xsl:text>
-</xsl:for-each>
-<xsl:for-each select="ns:preJobCommands/ns:command">
- <xsl:value-of select="."/><xsl:text> </xsl:text>
- </xsl:for-each>
-cd <xsl:text> </xsl:text><xsl:value-of select="ns:workingDirectory"/><xsl:text>
</xsl:text>
- <xsl:choose><xsl:when test="ns:jobSubmitterCommand">
-<xsl:value-of select="ns:jobSubmitterCommand"/><xsl:text> </xsl:text></xsl:when></xsl:choose><xsl:value-of select="ns:executablePath"/><xsl:text> </xsl:text>
-<xsl:for-each select="ns:inputs/ns:input">
- <xsl:value-of select="."/><xsl:text> </xsl:text>
- </xsl:for-each>
-<xsl:for-each select="ns:postJobCommands/ns:command">
- <xsl:value-of select="."/><xsl:text> </xsl:text>
-</xsl:for-each>
-
-</xsl:template>
-
-</xsl:stylesheet>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/resources/SLURMTemplate.xslt
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/resources/SLURMTemplate.xslt b/tools/gsissh/src/main/resources/SLURMTemplate.xslt
deleted file mode 100644
index 4a62722..0000000
--- a/tools/gsissh/src/main/resources/SLURMTemplate.xslt
+++ /dev/null
@@ -1,78 +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. -->
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns="http://airavata.apache.org/gsi/ssh/2012/12">
-<xsl:output method="text" />
-<xsl:template match="/ns:JobDescriptor">
-<xsl:choose>
-<xsl:when test="ns:shellName">
-#!<xsl:value-of select="ns:shellName"/>
- </xsl:when>
- </xsl:choose>
-<xsl:choose>
- <xsl:when test="ns:queueName">
-#SBATCH -p <xsl:value-of select="ns:queueName"/>
- </xsl:when>
- </xsl:choose>
-<xsl:choose>
- <xsl:when test="ns:nodes">
-#SBATCH -N <xsl:value-of select="ns:nodes"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:cpuCount">
-#SBATCH -n <xsl:value-of select="ns:cpuCount"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:mailAddress">
-#SBATCH -mail-user=<xsl:value-of select="ns:mailAddress"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:mailType">
-#SBATCH -mail-type=<xsl:value-of select="ns:mailType"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
-<xsl:when test="ns:acountString">
-#SBATCH -A <xsl:value-of select="ns:acountString"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:maxWallTime">
-#SBATCH -t <xsl:value-of select="ns:maxWallTime"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:jobName">
-#SBATCH -J <xsl:value-of select="ns:jobName"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:standardOutFile">
-#SBATCH -o <xsl:value-of select="ns:standardOutFile"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:standardOutFile">
-#SBATCH -e <xsl:value-of select="ns:standardErrorFile"/>
- </xsl:when>
- </xsl:choose>
- <xsl:for-each select="ns:preJobCommands/ns:command">
- <xsl:text>
</xsl:text>
- <xsl:value-of select="."/><xsl:text> </xsl:text>
- </xsl:for-each>
-cd <xsl:text> </xsl:text><xsl:value-of select="ns:workingDirectory"/><xsl:text>
</xsl:text>
- <xsl:choose><xsl:when test="ns:jobSubmitterCommand">
-<xsl:value-of select="ns:jobSubmitterCommand"/><xsl:text> </xsl:text></xsl:when></xsl:choose><xsl:value-of select="ns:executablePath"/><xsl:text> </xsl:text>
-<xsl:for-each select="ns:inputs/ns:input">
- <xsl:value-of select="."/><xsl:text> </xsl:text>
- </xsl:for-each>
-</xsl:template>
-
-</xsl:stylesheet>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/resources/UGETemplate.xslt
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/resources/UGETemplate.xslt b/tools/gsissh/src/main/resources/UGETemplate.xslt
deleted file mode 100644
index 5b57265..0000000
--- a/tools/gsissh/src/main/resources/UGETemplate.xslt
+++ /dev/null
@@ -1,74 +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. -->
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns="http://airavata.apache.org/gsi/ssh/2012/12">
-<xsl:output method="text" />
-<xsl:template match="/ns:JobDescriptor">
-#! /bin/bash
-# Grid Engine batch job script built by Apache Airavata
-# <xsl:choose>
- <xsl:when test="ns:shellName">
-#$ -S <xsl:value-of select="ns:shellName"/>
- </xsl:when></xsl:choose>
-#$ -V
- <xsl:choose>
- <xsl:when test="ns:queueName">
-#$ -q <xsl:value-of select="ns:queueName"/>
- </xsl:when>
- </xsl:choose>
-#$ -m beas <xsl:choose>
-<xsl:when test="ns:acountString">
-#$ -A <xsl:value-of select="ns:acountString"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:maxWallTime">
-#$ -l h_rt=<xsl:value-of select="ns:maxWallTime"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:jobName">
-#$ -N <xsl:value-of select="ns:jobName"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:standardOutFile">
-#$ -o <xsl:value-of select="ns:standardOutFile"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="ns:standardOutFile">
-#$ -e <xsl:value-of select="ns:standardErrorFile"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="(ns:nodes) and (ns:processesPerNode)">
-#$ -pe <xsl:value-of select="ns:processesPerNode"/>way <xsl:value-of select="12 * ns:nodes"/>
-<xsl:text>
</xsl:text>
- </xsl:when>
- </xsl:choose>
-<xsl:for-each select="ns:exports/ns:name">
-<xsl:value-of select="."/>=<xsl:value-of select="./@value"/><xsl:text>
</xsl:text>
-export<xsl:text> </xsl:text><xsl:value-of select="."/>
-<xsl:text>
</xsl:text>
-</xsl:for-each>
-<xsl:for-each select="ns:preJobCommands/ns:command">
- <xsl:value-of select="."/><xsl:text> </xsl:text>
- </xsl:for-each>
-cd <xsl:text> </xsl:text><xsl:value-of select="ns:workingDirectory"/><xsl:text>
</xsl:text>
- <xsl:choose><xsl:when test="ns:jobSubmitterCommand">
-<xsl:value-of select="ns:jobSubmitterCommand"/><xsl:text> </xsl:text></xsl:when></xsl:choose><xsl:value-of select="ns:executablePath"/><xsl:text> </xsl:text>
-<xsl:for-each select="ns:inputs/ns:input">
- <xsl:value-of select="."/><xsl:text> </xsl:text>
- </xsl:for-each>
-<xsl:for-each select="ns:postJobCommands/ns:command">
- <xsl:value-of select="."/><xsl:text> </xsl:text>
-</xsl:for-each>
-
-</xsl:template>
-
-</xsl:stylesheet>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/resources/schemas/PBSJobDescriptor.xsd
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/resources/schemas/PBSJobDescriptor.xsd b/tools/gsissh/src/main/resources/schemas/PBSJobDescriptor.xsd
deleted file mode 100644
index d5c5992..0000000
--- a/tools/gsissh/src/main/resources/schemas/PBSJobDescriptor.xsd
+++ /dev/null
@@ -1,114 +0,0 @@
-<?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/gsi/ssh/2012/12" xmlns:gsissh="http://airavata.apache.org/gsi/ssh/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/13c2e79e/tools/gsissh/src/main/resources/schemas/gsissh-schemas.xsdconfig
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/resources/schemas/gsissh-schemas.xsdconfig b/tools/gsissh/src/main/resources/schemas/gsissh-schemas.xsdconfig
deleted file mode 100644
index a46cadc..0000000
--- a/tools/gsissh/src/main/resources/schemas/gsissh-schemas.xsdconfig
+++ /dev/null
@@ -1,14 +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. -->
-
-<xb:config xmlns:xb="http://www.bea.com/2002/09/xbean/config">
-
- <xb:namespace uri="http://airavata.apache.org/schemas/gsi/ssh/2012/12">
- <xb:package>org.apache.airavata.gfac.ssh</xb:package>
- </xb:namespace>
-</xb:config>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/test/java/org/apache/airavata/gfac/ssh/config/ConfigReaderTest.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/test/java/org/apache/airavata/gfac/ssh/config/ConfigReaderTest.java b/tools/gsissh/src/test/java/org/apache/airavata/gfac/ssh/config/ConfigReaderTest.java
deleted file mode 100644
index a90dcba..0000000
--- a/tools/gsissh/src/test/java/org/apache/airavata/gfac/ssh/config/ConfigReaderTest.java
+++ /dev/null
@@ -1,37 +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.config;
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-public class ConfigReaderTest {
-
- @Test
- public void testGetConfiguration() throws Exception {
-
- System.out.println("Test case name " + this.getClass().getName());
- ConfigReader configReader = new ConfigReader();
- Assert.assertEquals(configReader.getConfiguration("StrictHostKeyChecking"), "no");
-
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/test/java/org/apache/airavata/gfac/ssh/impl/DefaultSSHApiTestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/test/java/org/apache/airavata/gfac/ssh/impl/DefaultSSHApiTestWithMyProxyAuth.java b/tools/gsissh/src/test/java/org/apache/airavata/gfac/ssh/impl/DefaultSSHApiTestWithMyProxyAuth.java
deleted file mode 100644
index 61a7437..0000000
--- a/tools/gsissh/src/test/java/org/apache/airavata/gfac/ssh/impl/DefaultSSHApiTestWithMyProxyAuth.java
+++ /dev/null
@@ -1,77 +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.impl;
-
-import org.apache.airavata.gfac.ssh.api.*;
-import org.apache.airavata.gfac.ssh.config.ConfigReader;
-import org.apache.airavata.gfac.ssh.impl.authentication.DefaultPublicKeyAuthentication;
-import org.apache.commons.io.IOUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.*;
-
-public class DefaultSSHApiTestWithMyProxyAuth {
- private static final Logger log = LoggerFactory.getLogger(PBSCluster.class);
-
-
-
- public void tearDown() throws Exception {
- }
-
-
- public static void main(String[]ars) throws IOException {
- String myProxyUserName = "lg11w";
-
-// DefaultPasswordAuthenticationInfo authenticationInfo
-// = new DefaultPasswordAuthenticationInfo("");
- byte[] privateKey = IOUtils.toByteArray(new BufferedInputStream(new FileInputStream("/Users/lginnali/.ssh/id_dsa")));
- byte[] publicKey = IOUtils.toByteArray(new BufferedInputStream(new FileInputStream("/Users/lginnali/.ssh/id_dsa.pub")));
- DefaultPublicKeyAuthentication authenticationInfo = new DefaultPublicKeyAuthentication(privateKey,publicKey,"");
-
- // Create command
- CommandInfo commandInfo = new RawCommandInfo("source /etc/bashrc; bsub </home/lg11w/mywork/sshEchoExperiment_9d267072-ca65-4ca8-847a-cd3d130f6050/366787899.lsf");
-
- // Server info
- //Stampede
-// ServerInfo serverInfo = new ServerInfo(myProxyUserName, "stampede.tacc.utexas.edu", 2222);
- //Trestles
-// ServerInfo serverInfo = new ServerInfo(myProxyUserName, "trestles.sdsc.xsede.org", 22);
-
- //Lonestar
- ServerInfo serverInfo = new ServerInfo(myProxyUserName, "ghpcc06.umassrc.org", 22);
- // Output
- CommandOutput commandOutput = new SystemCommandOutput();
-
- // Execute command
- try {
- CommandExecutor.executeCommand(commandInfo, serverInfo, authenticationInfo, commandOutput, new ConfigReader());
- } catch (SSHApiException e) {
- log.error(e.getMessage(), e);
- } catch (IOException e) {
- log.error(e.getMessage(), e);
- }
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/test/java/org/apache/airavata/gfac/ssh/impl/VanilaTestWithSSHAuth.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/test/java/org/apache/airavata/gfac/ssh/impl/VanilaTestWithSSHAuth.java b/tools/gsissh/src/test/java/org/apache/airavata/gfac/ssh/impl/VanilaTestWithSSHAuth.java
deleted file mode 100644
index 6f2840f..0000000
--- a/tools/gsissh/src/test/java/org/apache/airavata/gfac/ssh/impl/VanilaTestWithSSHAuth.java
+++ /dev/null
@@ -1,262 +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.impl;
-
-import org.apache.airavata.gfac.ssh.api.*;
-import org.apache.airavata.gfac.ssh.api.authentication.AuthenticationInfo;
-import org.apache.airavata.gfac.ssh.api.job.JobDescriptor;
-import org.apache.airavata.gfac.ssh.impl.authentication.DefaultPasswordAuthenticationInfo;
-import org.apache.airavata.gfac.ssh.impl.authentication.DefaultPublicKeyFileAuthentication;
-import org.apache.airavata.gfac.ssh.util.CommonUtils;
-import org.testng.AssertJUnit;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
-
-public class VanilaTestWithSSHAuth {
-
- private String userName;
- private String password;
- private String passPhrase;
- private String hostName;
- private String workingDirectory;
- private String privateKeyPath;
- private String publicKeyPath;
- private String path;
-
- @BeforeTest
- public void setUp() throws Exception {
- System.out.println("Test case name " + this.getClass().getName());
- //Trestles
- this.hostName = "trestles.sdsc.xsede.org";
- this.userName = "ogce";
- this.path="/opt/torque/bin/";
- //Stampede:
-// this.hostName = "stampede.tacc.xsede.org";
-// this.userName = "ogce";
-// this.path="/usr/bin";
- //Lonestar:
-// this.hostName = "lonestar.tacc.utexas.edu";
-// this.userName = "us3";
-// this.path="/opt/sge6.2/bin/lx24-amd64";
- //Alamo:
-// this.hostName = "alamo.uthscsa.edu";
-// this.userName = "raminder";
-// this.path="/opt/torque/bin/";
- //Bigred:
-// this.hostName = "bigred2.uits.iu.edu";
-// this.userName = "cgateway";
-// this.path="/opt/torque/torque-5.0.1/bin/";
-
- System.setProperty("ssh.host",hostName);
- System.setProperty("ssh.username", userName);
- System.setProperty("private.ssh.key", "/home/lginnali/.ssh/id_dsa");
- System.setProperty("public.ssh.key", "/home/lginnali/.ssh/id_dsa.pub");
- System.setProperty("ssh.working.directory", "/tmp");
-
- this.hostName = System.getProperty("ssh.host");
- this.userName = System.getProperty("ssh.username");
- this.password = System.getProperty("ssh.password");
- this.privateKeyPath = System.getProperty("private.ssh.key");
- this.publicKeyPath = System.getProperty("public.ssh.key");
-
- System.setProperty("ssh.keypass", "");
- this.passPhrase = System.getProperty("ssh.keypass");
- this.workingDirectory = System.getProperty("ssh.working.directory");
-
-
- if (this.userName == null
- || (this.password==null && (this.publicKeyPath == null || this.privateKeyPath == null)) || this.workingDirectory == null) {
- System.out.println("########### In order to test you have to either username password or private,public keys");
- System.out.println("Use -Dssh.user=xxx -Dssh.password=yyy -Dssh.private.key.passphrase=zzz " +
- "-Dssh.private.key.path -Dssh.public.key.path -Dssh.working.directory ");
- }
- }
-
-
- @Test
- public void testSimplePBSJob() throws Exception {
-
- AuthenticationInfo authenticationInfo = null;
- if (password != null) {
- authenticationInfo = new DefaultPasswordAuthenticationInfo(this.password);
- } else {
- authenticationInfo = new DefaultPublicKeyFileAuthentication(this.publicKeyPath, this.privateKeyPath,
- this.passPhrase);
- }
- // Server info
- ServerInfo serverInfo = new ServerInfo(this.userName, this.hostName);
- Cluster pbsCluster = new PBSCluster(serverInfo, authenticationInfo, CommonUtils.getPBSJobManager(path));
-
- String date = new Date().toString();
- date = date.replaceAll(" ", "_");
- date = date.replaceAll(":", "_");
-
- String pomFile = new File("").getAbsolutePath() + File.separator + "pom.xml";
-
- workingDirectory = workingDirectory + File.separator
- + date + "_" + UUID.randomUUID();
- pbsCluster.makeDirectory(workingDirectory);
- Thread.sleep(1000);
- pbsCluster.makeDirectory(workingDirectory + File.separator + "inputs");
- Thread.sleep(1000);
- pbsCluster.makeDirectory(workingDirectory + File.separator + "outputs");
-
-
- // doing file transfer to the remote resource
- String remoteLocation = workingDirectory + File.separator + "inputs";
- pbsCluster.scpTo(remoteLocation, pomFile);
-
- int i = pomFile.lastIndexOf(File.separator);
- String fileName = pomFile.substring(i + 1);
- // constructing the job object
- JobDescriptor jobDescriptor = new JobDescriptor();
- jobDescriptor.setWorkingDirectory(workingDirectory);
- jobDescriptor.setShellName("/bin/bash");
- jobDescriptor.setJobName("GSI_SSH_SLEEP_JOB");
- jobDescriptor.setExecutablePath("/bin/echo");
- jobDescriptor.setAllEnvExport(true);
- jobDescriptor.setMailOptions("n");
- jobDescriptor.setStandardOutFile(workingDirectory + File.separator + "application.out");
- jobDescriptor.setStandardErrorFile(workingDirectory + File.separator + "application.err");
- jobDescriptor.setNodes(1);
- jobDescriptor.setProcessesPerNode(1);
- jobDescriptor.setQueueName("normal");
- jobDescriptor.setMaxWallTime("5");
- //jobDescriptor.setJobSubmitter("aprun -n 1");
- List<String> inputs = new ArrayList<String>();
- inputs.add(remoteLocation + File.separator + fileName);
- jobDescriptor.setInputValues(inputs);
- //finished construction of job object
- System.out.println(jobDescriptor.toXML());
- if(hostName.contains("trestles")){
- String jobID = pbsCluster.submitBatchJob(jobDescriptor);
- System.out.println("JobID returned : " + jobID);
-
-// Cluster cluster = sshApi.getCluster(serverInfo, authenticationInfo);
- Thread.sleep(1000);
- JobDescriptor jobById = pbsCluster.getJobDescriptorById(jobID);
-
- //printing job data got from previous call
- AssertJUnit.assertEquals(jobById.getJobId(), jobID);
- System.out.println(jobById.getAcountString());
- System.out.println(jobById.getAllEnvExport());
- System.out.println(jobById.getCompTime());
- System.out.println(jobById.getExecutablePath());
- System.out.println(jobById.getEllapsedTime());
- System.out.println(jobById.getQueueName());
- System.out.println(jobById.getExecuteNode());
- System.out.println(jobById.getJobName());
- System.out.println(jobById.getCTime());
- System.out.println(jobById.getSTime());
- System.out.println(jobById.getMTime());
- System.out.println(jobById.getCompTime());
- System.out.println(jobById.getOwner());
- System.out.println(jobById.getQTime());
- System.out.println(jobById.getUsedCPUTime());
- System.out.println(jobById.getUsedMemory());
- System.out.println(jobById.getVariableList());
- }
- }
-
- @Test
- public void testSimpleLSFJob() throws Exception {
-
- AuthenticationInfo authenticationInfo = null;
- if (password != null) {
- authenticationInfo = new DefaultPasswordAuthenticationInfo(this.password);
- } else {
- authenticationInfo = new DefaultPublicKeyFileAuthentication(this.publicKeyPath, this.privateKeyPath,
- this.passPhrase);
- }
- // Server info
- ServerInfo serverInfo = new ServerInfo(this.userName, this.hostName);
-
-
- // constructing the job object
- JobDescriptor jobDescriptor = new JobDescriptor();
- jobDescriptor.setWorkingDirectory(workingDirectory);
- jobDescriptor.setShellName("/bin/bash");
- jobDescriptor.setJobName("GSI_SSH_SLEEP_JOB");
- jobDescriptor.setExecutablePath("/bin/echo");
- jobDescriptor.setAllEnvExport(true);
- jobDescriptor.setMailOptions("n");
- jobDescriptor.setMailAddress("test@gmail.com");
- jobDescriptor.setStandardOutFile(workingDirectory + File.separator + "application.out");
- jobDescriptor.setStandardErrorFile(workingDirectory + File.separator + "application.err");
- jobDescriptor.setNodes(1);
- jobDescriptor.setProcessesPerNode(1);
- jobDescriptor.setQueueName("long");
- jobDescriptor.setMaxWallTimeForLSF("5");
- jobDescriptor.setJobSubmitter("mpiexec");
- jobDescriptor.setModuleLoadCommands(new String[]{"module load openmpi/1.6.5"});
- jobDescriptor.setUsedMemory("1000");
- jobDescriptor.setChassisName("01");
-
- //jobDescriptor.setJobSubmitter("aprun -n 1");
- List<String> inputs = new ArrayList<String>();
- jobDescriptor.setInputValues(inputs);
- //finished construction of job object
- System.out.println(jobDescriptor.toXML());
- Cluster pbsCluster = new PBSCluster(CommonUtils.getLSFJobManager(""));
- ((PBSCluster) pbsCluster).generateJobScript(jobDescriptor);
- }
-
- @Test
- public void testSCPFromAndSCPTo() throws Exception {
-
- AuthenticationInfo authenticationInfo = null;
- if (password != null) {
- authenticationInfo = new DefaultPasswordAuthenticationInfo(this.password);
- } else {
- authenticationInfo = new DefaultPublicKeyFileAuthentication(this.publicKeyPath, this.privateKeyPath,
- this.passPhrase);
- }
- // Server info
- ServerInfo serverInfo = new ServerInfo(this.userName, this.hostName);
- Cluster pbsCluster = new PBSCluster(serverInfo, authenticationInfo, CommonUtils.getPBSJobManager(path));
- new PBSCluster(serverInfo, authenticationInfo, CommonUtils.getPBSJobManager(path));;
-
- String date = new Date().toString();
- date = date.replaceAll(" ", "_");
- date = date.replaceAll(":", "_");
-
- String pomFile = (new File(".")).getAbsolutePath() + File.separator + "pom.xml";
- File file = new File(pomFile);
- if(!file.exists()){
- file.createNewFile();
- }
- // Constructing theworking directory for demonstration and creating directories in the remote
- // resource
- workingDirectory = workingDirectory + File.separator
- + date + "_" + UUID.randomUUID();
- pbsCluster.makeDirectory(workingDirectory);
- pbsCluster.scpTo(workingDirectory, pomFile);
- Thread.sleep(1000);
- pbsCluster.scpFrom(workingDirectory + File.separator + "pom.xml", (new File(".")).getAbsolutePath());
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/test/resources/gsissh.properties
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/test/resources/gsissh.properties b/tools/gsissh/src/test/resources/gsissh.properties
deleted file mode 100644
index 3fdf76d..0000000
--- a/tools/gsissh/src/test/resources/gsissh.properties
+++ /dev/null
@@ -1,26 +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.
-#
-
-###########################################################################
-# Specifies system level configurations as a key/value pairs.
-###########################################################################
-
-StrictHostKeyChecking=no
-ssh.session.timeout=360000
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/test/resources/log4j.properties b/tools/gsissh/src/test/resources/log4j.properties
deleted file mode 100644
index 257802c..0000000
--- a/tools/gsissh/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,34 +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.
-#
-
-# Set root category priority to INFO and its only appender to CONSOLE.
-log4j.rootCategory=ALL, CONSOLE,LOGFILE
-log4j.rootLogger=ALL, CONSOLE, LOGFILE
-
-
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=[%p] %m%n
-
-# LOGFILE is set to be a File appender using a PatternLayout.
-log4j.appender.LOGFILE=org.apache.log4j.FileAppender
-log4j.appender.LOGFILE.File=./target/integration-tests.log
-log4j.appender.LOGFILE.Append=true
-log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
-log4j.appender.LOGFILE.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/test/resources/sleep.pbs
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/test/resources/sleep.pbs b/tools/gsissh/src/test/resources/sleep.pbs
deleted file mode 100644
index 126e045..0000000
--- a/tools/gsissh/src/test/resources/sleep.pbs
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-#
-#
-# 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.
-#
-
-#$ -S /bin/bash
-#$ -V
-#$ -pe 1way 32
-#$ -m n
-#$ -q normal
-#$ -A
-#$ -l h_rt=0:60:00
-#$ -o application.stdout
-#$ -e application.stderr
-#PBS -N GSI_SSH_SLEEP_JOB
-/bin/sleep 60
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/test/resources/test.pbs
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/test/resources/test.pbs b/tools/gsissh/src/test/resources/test.pbs
deleted file mode 100644
index d18269b..0000000
--- a/tools/gsissh/src/test/resources/test.pbs
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-#
-#
-# 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.
-#
-
-#PBS -q normal
-#PBS -A sds128
-#PBS -l nodes=1:ppn=1
-#PBS -l walltime=00:00:01
-#PBS -o job_output
-#PBS -N GSI_SSH_JOB
-#PBS -V
-
-/bin/date
[5/6] airavata git commit: Removed gsissh module from tools
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/edu/illinois/ncsa/BCGSS/BCGSSContextImpl.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/edu/illinois/ncsa/BCGSS/BCGSSContextImpl.java b/tools/gsissh/src/main/java/edu/illinois/ncsa/BCGSS/BCGSSContextImpl.java
deleted file mode 100644
index be8478f..0000000
--- a/tools/gsissh/src/main/java/edu/illinois/ncsa/BCGSS/BCGSSContextImpl.java
+++ /dev/null
@@ -1,1447 +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 edu.illinois.ncsa.BCGSS;
-//
-//import org.bouncycastle.jce.provider.X509CertificateObject;
-//import org.globus.gsi.*;
-//import org.globus.gsi.bc.*;
-//import org.globus.gsi.gssapi.*;
-//import org.globus.gsi.util.*;
-//import org.gridforum.jgss.*;
-//import org.ietf.jgss.*;
-//import org.ietf.jgss.Oid;
-//import sun.reflect.generics.reflectiveObjects.NotImplementedException;
-//
-//import java.io.*;
-//import java.security.*;
-//import java.security.cert.*;
-//import java.security.cert.Certificate;
-//import java.util.*;
-//
-//public class BCGSSContextImpl implements ExtendedGSSContext {
-// /**
-// * Used to distinguish between a token created by
-// * <code>wrap</code> with {@link GSSConstants#GSI_BIG
-// * GSSConstants.GSI_BIG}
-// * QoP and a regular token created by <code>wrap</code>.
-// */
-// public static final int GSI_WRAP = 26;
-// /**
-// * SSL3_RT_GSSAPI_OPENSSL
-// */
-//
-// private static final int GSI_SEQUENCE_SIZE = 8;
-//
-// private static final int GSI_MESSAGE_DIGEST_PADDING = 12;
-//
-// private static final byte[] SSLHANDSHAKE_PAD_1 = {0x36};
-//
-// private static final String[] NO_ENCRYPTION = {"SSL_RSA_WITH_NULL_MD5"};
-//
-// private static final String[] ENABLED_PROTOCOLS = {"TLSv1", "SSLv3"};
-//
-// private static final byte[] DELEGATION_TOKEN =
-// new byte[]{GSIConstants.DELEGATION_CHAR};
-//
-// /**
-// * Handshake state
-// */
-// protected int state = HANDSHAKE;
-//
-// /* handshake states */
-// private static final int
-// HANDSHAKE = 0,
-// CLIENT_START_DEL = 2,
-// CLIENT_END_DEL = 3,
-// SERVER_START_DEL = 4,
-// SERVER_END_DEL = 5;
-//
-// /**
-// * Delegation state
-// */
-// protected int delegationState = DELEGATION_START;
-//
-// /* delegation states */
-// private static final int
-// DELEGATION_START = 0,
-// DELEGATION_SIGN_CERT = 1,
-// DELEGATION_COMPLETE_CRED = 2;
-//
-// /**
-// * Delegation finished indicator
-// */
-// protected boolean delegationFinished = false;
-//
-// // gss context state variables
-// protected boolean credentialDelegation = false;
-// protected boolean anonymity = false;
-// protected boolean encryption = false;
-// protected boolean established = false;
-//
-// /**
-// * The name of the context initiator
-// */
-// protected GSSName sourceName = null;
-//
-// /**
-// * The name of the context acceptor
-// */
-// protected GSSName targetName = null;
-//
-// // these can be set via setOption
-// protected GSIConstants.DelegationType delegationType =
-// GSIConstants.DelegationType.LIMITED;
-// protected Integer gssMode = GSIConstants.MODE_GSI;
-// protected Boolean checkContextExpiration = Boolean.FALSE;
-// protected Boolean rejectLimitedProxy = Boolean.FALSE;
-// protected Boolean requireClientAuth = Boolean.TRUE;
-// protected Boolean acceptNoClientCerts = Boolean.FALSE;
-// protected Boolean requireAuthzWithDelegation = Boolean.TRUE;
-//
-// // *** implementation-specific variables ***
-//
-// /**
-// * Credential of this context. Might be anonymous
-// */
-// protected GlobusGSSCredentialImpl ctxCred;
-//
-// /**
-// * Expected target name. Used for authorization in initiator
-// */
-// protected GSSName expectedTargetName = null;
-//
-// /**
-// * Context expiration date.
-// */
-// protected Date goodUntil = null;
-//
-// protected boolean conn = false;
-//
-// protected BouncyCastleCertProcessingFactory certFactory;
-//
-// protected Map proxyPolicyHandlers;
-//
-// /**
-// * Limited peer credentials
-// */
-// protected Boolean peerLimited = null;
-//
-// private TlsHandlerUtil tlsHU = null;
-// private GlobusTlsClient tlsClient = null;
-// private GlobusTlsCipherFactory cipherFactory = null;
-//
-// /**
-// *
-// * @param target
-// * @param cred
-// * @throws org.ietf.jgss.GSSException
-// */
-// public BCGSSContextImpl(GSSName target, GlobusGSSCredentialImpl cred)
-// throws GSSException {
-// if (cred == null) {
-// throw new GSSException(GSSException.NO_CRED);
-// }
-//
-// this.expectedTargetName = target;
-// this.ctxCred = cred;
-// }
-//
-// /**
-// *
-// * @throws org.globus.gsi.gssapi.GlobusGSSException
-// */
-// private void init() throws GlobusGSSException {
-// this.certFactory = BouncyCastleCertProcessingFactory.getDefault();
-// this.state = HANDSHAKE;
-//
-//
-// try {
-// this.cipherFactory = new GlobusTlsCipherFactory();
-// this.tlsClient =
-// new GlobusTlsClient(this.ctxCred.getX509Credential(),
-// this.cipherFactory);
-// } catch (Exception e) {
-// throw new GlobusGSSException(GSSException.FAILURE, e);
-// }
-//
-// // TODO: set enabled cipher suites in client?
-// // TODO: enable null encryption ciphers on user request?
-//
-// /*
-// TlsProtocolVersion[] tlsVersion =
-// new TlsProtocolVersion[] {TlsProtocolVersion.TLSv10,
-// TlsProtocolVersion.SSLv3};
-// */
-// //new TlsProtocolVersion[] {TlsProtocolVersion.TLSv10};
-// //new TlsProtocolVersion[] {TlsProtocolVersion.SSLv3};
-//
-// //this.tlsHU = new TlsHandlerUtil(this.tlsClient, tlsVersion);
-// this.tlsHU = new TlsHandlerUtil(this.tlsClient);
-// }
-//
-// /**
-// *
-// * @param cert
-// * @return
-// * @throws GSSException
-// */
-// private X509Certificate bcConvert(X509Certificate cert)
-// throws GSSException {
-// if (!(cert instanceof X509CertificateObject)) {
-// try {
-// return CertificateLoadUtil.loadCertificate(new ByteArrayInputStream(cert.getEncoded()));
-// } catch (Exception e) {
-// throw new GlobusGSSException(GSSException.FAILURE, e);
-// }
-// } else {
-// return cert;
-// }
-// }
-//
-// private void handshakeFinished()
-// throws IOException {
-// //TODO: enable encryption depending on cipher suite decided in handshake
-// this.encryption = true;
-// //System.out.println("encryption alg: " + cs);
-// }
-//
-// /**
-// *
-// */
-// private void setDone() {
-// this.established = true;
-// }
-//
-// /**
-// *
-// * @param date
-// */
-// private void setGoodUntil(Date date) {
-// if (this.goodUntil == null) {
-// this.goodUntil = date;
-// } else if (date.before(this.goodUntil)) {
-// this.goodUntil = date;
-// }
-// }
-//
-// /**
-// *
-// * @throws GSSException
-// */
-// protected void checkContext()
-// throws GSSException {
-// if (!this.conn || !isEstablished()) {
-// throw new GSSException(GSSException.NO_CONTEXT);
-// }
-//
-// if (this.checkContextExpiration && getLifetime() <= 0) {
-// throw new GSSException(GSSException.CONTEXT_EXPIRED);
-// }
-// }
-//
-// /**
-// *
-// * @param value
-// * @throws GSSException
-// */
-// protected void setGssMode(Object value)
-// throws GSSException {
-// if (!(value instanceof Integer)) {
-// throw new GlobusGSSException(GSSException.FAILURE,
-// GlobusGSSException.BAD_OPTION_TYPE,
-// "badType",
-// new Object[]{"GSS mode", Integer.class});
-// }
-// Integer v = (Integer) value;
-// if (v.equals(GSIConstants.MODE_GSI) ||
-// v.equals(GSIConstants.MODE_SSL)) {
-// this.gssMode = v;
-// } else {
-// throw new GlobusGSSException(GSSException.FAILURE,
-// GlobusGSSException.BAD_OPTION,
-// "badGssMode");
-// }
-// }
-//
-// /**
-// *
-// * @param value
-// * @throws GSSException
-// */
-// protected void setDelegationType(Object value)
-// throws GSSException {
-// GSIConstants.DelegationType v;
-// if (value instanceof GSIConstants.DelegationType)
-// v = (GSIConstants.DelegationType) value;
-// else if (value instanceof Integer) {
-// v = GSIConstants.DelegationType.get(((Integer) value).intValue());
-// } else {
-// throw new GlobusGSSException(GSSException.FAILURE,
-// GlobusGSSException.BAD_OPTION_TYPE,
-// "badType",
-// new Object[]{"delegation type",
-// GSIConstants.DelegationType.class});
-// }
-// if (v == GSIConstants.DelegationType.FULL ||
-// v == GSIConstants.DelegationType.LIMITED) {
-// this.delegationType = v;
-// } else {
-// throw new GlobusGSSException(GSSException.FAILURE,
-// GlobusGSSException.BAD_OPTION,
-// "badDelegType");
-// }
-// }
-//
-// /**
-// *
-// * @param value
-// * @throws GSSException
-// */
-// protected void setCheckContextExpired(Object value)
-// throws GSSException {
-// if (!(value instanceof Boolean)) {
-// throw new GlobusGSSException(GSSException.FAILURE,
-// GlobusGSSException.BAD_OPTION_TYPE,
-// "badType",
-// new Object[]{"check context expired", Boolean.class});
-// }
-// this.checkContextExpiration = (Boolean) value;
-// }
-//
-// /**
-// *
-// * @param value
-// * @throws GSSException
-// */
-// protected void setRejectLimitedProxy(Object value)
-// throws GSSException {
-// if (!(value instanceof Boolean)) {
-// throw new GlobusGSSException(GSSException.FAILURE,
-// GlobusGSSException.BAD_OPTION_TYPE,
-// "badType",
-// new Object[]{"reject limited proxy", Boolean.class});
-// }
-// this.rejectLimitedProxy = (Boolean) value;
-// }
-//
-// /**
-// *
-// * @param value
-// * @throws GSSException
-// */
-// protected void setRequireClientAuth(Object value)
-// throws GSSException {
-// if (!(value instanceof Boolean)) {
-// throw new GlobusGSSException(GSSException.FAILURE,
-// GlobusGSSException.BAD_OPTION_TYPE,
-// "badType",
-// new Object[]{"require client auth", Boolean.class});
-// }
-// this.requireClientAuth = (Boolean) value;
-// }
-//
-// /**
-// *
-// * @param value
-// * @throws GSSException
-// */
-// protected void setRequireAuthzWithDelegation(Object value)
-// throws GSSException {
-//
-// if (!(value instanceof Boolean)) {
-// throw new GlobusGSSException(GSSException.FAILURE,
-// GlobusGSSException.BAD_OPTION_TYPE,
-// "badType",
-// new Object[]{"require authz with delehation",
-// Boolean.class});
-// }
-// this.requireAuthzWithDelegation = (Boolean) value;
-// }
-//
-// /**
-// *
-// * @param value
-// * @throws GSSException
-// */
-// protected void setAcceptNoClientCerts(Object value)
-// throws GSSException {
-// if (!(value instanceof Boolean)) {
-// throw new GlobusGSSException(GSSException.FAILURE,
-// GlobusGSSException.BAD_OPTION_TYPE,
-// "badType",
-// new Object[]{"accept no client certs", Boolean.class});
-// }
-// this.acceptNoClientCerts = (Boolean) value;
-// }
-//
-// /**
-// *
-// * @param value
-// * @throws GSSException
-// */
-// protected void setProxyPolicyHandlers(Object value)
-// throws GSSException {
-// if (!(value instanceof Map)) {
-// throw new GlobusGSSException(GSSException.FAILURE,
-// GlobusGSSException.BAD_OPTION_TYPE,
-// "badType",
-// new Object[]{"Proxy policy handlers",
-// Map.class});
-// }
-// this.proxyPolicyHandlers = (Map) value;
-// }
-//
-// /////////////////////////////////////////////////////////////////////
-// /////////////////////////////////////////////////////////////////////
-// /////////////////////////////////////////////////////////////////////
-//
-// // Methods below are part of the (Extended)GSSContext implementation
-//
-// /////////////////////////////////////////////////////////////////////
-// /////////////////////////////////////////////////////////////////////
-// /////////////////////////////////////////////////////////////////////
-//
-// /**
-// *
-// * @param option
-// * option type.
-// * @param value
-// * option value.
-// * @throws GSSException
-// */
-// public void setOption(Oid option, Object value) throws GSSException {
-// if (option == null) {
-// throw new GlobusGSSException(GSSException.FAILURE,
-// GlobusGSSException.BAD_ARGUMENT,
-// "nullOption");
-// }
-// if (value == null) {
-// throw new GlobusGSSException(GSSException.FAILURE,
-// GlobusGSSException.BAD_ARGUMENT,
-// "nullOptionValue");
-// }
-//
-// if (option.equals(GSSConstants.GSS_MODE)) {
-// setGssMode(value);
-// } else if (option.equals(GSSConstants.DELEGATION_TYPE)) {
-// setDelegationType(value);
-// } else if (option.equals(GSSConstants.CHECK_CONTEXT_EXPIRATION)) {
-// setCheckContextExpired(value);
-// } else if (option.equals(GSSConstants.REJECT_LIMITED_PROXY)) {
-// setRejectLimitedProxy(value);
-// } else if (option.equals(GSSConstants.REQUIRE_CLIENT_AUTH)) {
-// setRequireClientAuth(value);
-// } else if (option.equals(GSSConstants.TRUSTED_CERTIFICATES)) {
-// // setTrustedCertificates(value);
-// throw new GSSException(GSSException.UNAVAILABLE);
-// } else if (option.equals(GSSConstants.PROXY_POLICY_HANDLERS)) {
-// setProxyPolicyHandlers(value);
-// } else if (option.equals(GSSConstants.ACCEPT_NO_CLIENT_CERTS)) {
-// setAcceptNoClientCerts(value);
-// } else if (option.equals(GSSConstants
-// .AUTHZ_REQUIRED_WITH_DELEGATION)) {
-// setRequireAuthzWithDelegation(value);
-// } else {
-// throw new GlobusGSSException(GSSException.FAILURE,
-// GlobusGSSException.UNKNOWN_OPTION,
-// "unknownOption",
-// new Object[]{option});
-// }
-// }
-//
-// /**
-// *
-// * @param option
-// * @return
-// * @throws GSSException
-// */
-// public Object getOption(Oid option) throws GSSException {
-// if (option == null) {
-// throw new GlobusGSSException(GSSException.FAILURE,
-// GlobusGSSException.BAD_ARGUMENT,
-// "nullOption");
-// }
-//
-// if (option.equals(GSSConstants.GSS_MODE)) {
-// return this.gssMode;
-// } else if (option.equals(GSSConstants.DELEGATION_TYPE)) {
-// return this.delegationType;
-// } else if (option.equals(GSSConstants.CHECK_CONTEXT_EXPIRATION)) {
-// return this.checkContextExpiration;
-// } else if (option.equals(GSSConstants.REJECT_LIMITED_PROXY)) {
-// return this.rejectLimitedProxy;
-// } else if (option.equals(GSSConstants.REQUIRE_CLIENT_AUTH)) {
-// return this.requireClientAuth;
-// } else if (option.equals(GSSConstants.TRUSTED_CERTIFICATES)) {
-// // return this.tc;
-// throw new GSSException(GSSException.UNAVAILABLE);
-// } else if (option.equals(GSSConstants.PROXY_POLICY_HANDLERS)) {
-// // return this.proxyPolicyHandlers;
-// throw new GSSException(GSSException.UNAVAILABLE);
-// } else if (option.equals(GSSConstants.ACCEPT_NO_CLIENT_CERTS)) {
-// return this.acceptNoClientCerts;
-// }
-//
-// return null;
-// }
-//
-// /**
-// * Initiate the delegation of a credential.
-// *
-// * This function drives the initiating side of the credential
-// * delegation process. It is expected to be called in tandem with the
-// * {@link #acceptDelegation(int, byte[], int, int) acceptDelegation}
-// * function.
-// * <BR>
-// * The behavior of this function can be modified by
-// * {@link GSSConstants#DELEGATION_TYPE GSSConstants.DELEGATION_TYPE}
-// * and
-// * {@link GSSConstants#GSS_MODE GSSConstants.GSS_MODE} context
-// * options.
-// * The {@link GSSConstants#DELEGATION_TYPE GSSConstants.DELEGATION_TYPE}
-// * option controls delegation type to be performed. The
-// * {@link GSSConstants#GSS_MODE GSSConstants.GSS_MODE}
-// * option if set to
-// * {@link org.globus.gsi.GSIConstants#MODE_SSL GSIConstants.MODE_SSL}
-// * results in tokens that are not wrapped.
-// *
-// * @param credential
-// * The credential to be delegated. May be null
-// * in which case the credential associated with the security
-// * context is used.
-// * @param mechanism
-// * The desired security mechanism. May be null.
-// * @param lifetime
-// * The requested period of validity (seconds) of the delegated
-// * credential.
-// * @return A token that should be passed to <code>acceptDelegation</code> if
-// * <code>isDelegationFinished</code> returns false. May be null.
-// * @exception GSSException containing the following major error codes:
-// * <code>GSSException.FAILURE</code>
-// */
-// public byte[] initDelegation(GSSCredential credential, Oid mechanism,
-// int lifetime, byte[] buf, int off, int len)
-// throws GSSException {
-// //TODO: implement this
-// return new byte[0];
-// }
-//
-// /*
-// * acceptDelegation unimplemented
-// */
-// public byte[] acceptDelegation(int i, byte[] bytes, int i1, int i2)
-// throws GSSException {
-// throw new GSSException(GSSException.UNAVAILABLE);
-// }
-//
-// /*
-// getDelegatedCredential unimplemented (would be set by acceptDelegation)
-// */
-// public GSSCredential getDelegatedCredential() {
-// return null;
-// }
-//
-// /**
-// *
-// * @return
-// */
-// public boolean isDelegationFinished() {
-// return this.delegationFinished;
-// }
-//
-// /**
-// * Retrieves arbitrary data about this context.
-// * Currently supported oid: <UL>
-// * <LI>
-// * {@link GSSConstants#X509_CERT_CHAIN GSSConstants.X509_CERT_CHAIN}
-// * returns certificate chain of the peer (<code>X509Certificate[]</code>).
-// * </LI>
-// * </UL>
-// *
-// * @param oid the oid of the information desired.
-// * @return the information desired. Might be null.
-// * @exception GSSException containing the following major error codes:
-// * <code>GSSException.FAILURE</code>
-// */
-// public Object inquireByOid(Oid oid) throws GSSException {
-// if (oid == null) {
-// throw new GlobusGSSException(GSSException.FAILURE,
-// GlobusGSSException.BAD_ARGUMENT,
-// "nullOption");
-// }
-//
-// if (oid.equals(GSSConstants.X509_CERT_CHAIN)) {
-// if (isEstablished()) {
-// // converting certs is slower but keeping converted certs
-// // takes lots of memory.
-// try {
-// Certificate[] peerCerts;
-// //TODO: used to get this from
-// // SSLEngine.getSession().getPeerCertificates()
-// peerCerts = null;
-// if (peerCerts != null && peerCerts.length > 0) {
-// return (X509Certificate[]) peerCerts;
-// } else {
-// return null;
-// }
-// } catch (Exception e) {
-// throw new GlobusGSSException(
-// GSSException.DEFECTIVE_CREDENTIAL,
-// e
-// );
-// }
-// }
-// } else if (oid.equals(GSSConstants.RECEIVED_LIMITED_PROXY)) {
-// return this.peerLimited;
-// }
-//
-// return null;
-// }
-//
-// public void setBannedCiphers(String[] strings) {
-// //To change body of implemented methods use File | Settings | File Templates.
-// throw new NotImplementedException();
-// }
-//
-// /**
-// * This function drives the initiating side of the context establishment
-// * process. It is expected to be called in tandem with the
-// * {@link #acceptSecContext(byte[], int, int) acceptSecContext} function.
-// * <BR>
-// * The behavior of context establishment process can be modified by
-// * {@link GSSConstants#GSS_MODE GSSConstants.GSS_MODE},
-// * {@link GSSConstants#DELEGATION_TYPE GSSConstants.DELEGATION_TYPE}, and
-// * {@link GSSConstants#REJECT_LIMITED_PROXY GSSConstants.REJECT_LIMITED_PROXY}
-// * context options. If the {@link GSSConstants#GSS_MODE GSSConstants.GSS_MODE}
-// * option is set to
-// * {@link org.globus.gsi.GSIConstants#MODE_SSL GSIConstants.MODE_SSL}
-// * the context establishment process will be compatible with regular SSL
-// * (no credential delegation support). If the option is set to
-// * {@link org.globus.gsi.GSIConstants#MODE_GSI GSIConstants.GSS_MODE_GSI}
-// * credential delegation during context establishment process will performed.
-// * The delegation type to be performed can be set using the
-// * {@link GSSConstants#DELEGATION_TYPE GSSConstants.DELEGATION_TYPE}
-// * context option. If the {@link GSSConstants#REJECT_LIMITED_PROXY
-// * GSSConstants.REJECT_LIMITED_PROXY} option is enabled,
-// * a peer presenting limited proxy credential will be automatically
-// * rejected and the context establishment process will be aborted.
-// *
-// * @return a byte[] containing the token to be sent to the peer.
-// * null indicates that no token is generated (needs more data).
-// */
-// public byte[] initSecContext(byte[] inBuff, int off, int len)
-// throws GSSException {
-//
-// if (!this.conn) {
-// //System.out.println("enter initializing in initSecContext");
-// if (this.credentialDelegation) {
-// if (this.gssMode.equals(GSIConstants.MODE_SSL)) {
-// throw new GlobusGSSException(GSSException.FAILURE,
-// GlobusGSSException.BAD_ARGUMENT,
-// "initCtx00");
-// }
-// if (this.anonymity) {
-// throw new GlobusGSSException(GSSException.FAILURE,
-// GlobusGSSException.BAD_ARGUMENT,
-// "initCtx01");
-// }
-// }
-//
-// if (this.anonymity || this.ctxCred.getName().isAnonymous()) {
-// this.anonymity = true;
-// } else {
-// this.anonymity = false;
-//
-// if (ctxCred.getUsage() != GSSCredential.INITIATE_ONLY &&
-// ctxCred.getUsage() != GSSCredential.INITIATE_AND_ACCEPT) {
-// throw new GlobusGSSException(
-// GSSException.DEFECTIVE_CREDENTIAL,
-// GlobusGSSException.UNKNOWN,
-// "badCredUsage");
-// }
-// }
-//
-// init();
-//
-// this.conn = true;
-// }
-//
-// // Unless explicitly disabled, check if delegation is
-// // requested and expected target is null
-// if (!Boolean.FALSE.equals(this.requireAuthzWithDelegation)) {
-//
-// if (this.expectedTargetName == null &&
-// this.credentialDelegation) {
-// throw new GlobusGSSException(GSSException.FAILURE,
-// GlobusGSSException.BAD_ARGUMENT,
-// "initCtx02");
-// }
-// }
-//
-// byte[] returnToken = null;
-//
-// switch (state) {
-// case HANDSHAKE:
-// try {
-// returnToken = this.tlsHU.nextHandshakeToken(inBuff);
-//
-// if (this.tlsHU.isHandshakeFinished()) {
-// //System.out.println("initSecContext handshake finished");
-// handshakeFinished(); // just enable encryption
-//
-// Certificate[] chain = this.tlsClient.getPeerCerts();
-// if (!(chain instanceof X509Certificate[])) {
-// throw new Exception(
-// "Certificate chain not of type X509Certificate");
-// }
-//
-// for (X509Certificate cert : (X509Certificate[]) chain) {
-// setGoodUntil(cert.getNotAfter());
-// }
-//
-// String identity = BouncyCastleUtil.getIdentity(
-// bcConvert(
-// BouncyCastleUtil.getIdentityCertificate(
-// (X509Certificate[]) chain)));
-// this.targetName =
-// new GlobusGSSName(CertificateUtil.toGlobusID(
-// identity, false));
-//
-// this.peerLimited = ProxyCertificateUtil.isLimitedProxy(
-// BouncyCastleUtil.getCertificateType(
-// (X509Certificate) chain[0]));
-//
-// // initiator
-// if (this.anonymity) {
-// this.sourceName = new GlobusGSSName();
-// } else {
-// for (X509Certificate cert :
-// ctxCred.getCertificateChain()) {
-// setGoodUntil(cert.getNotAfter());
-// }
-// this.sourceName = this.ctxCred.getName();
-// }
-//
-// // mutual authentication test
-// if (this.expectedTargetName != null &&
-// !this.expectedTargetName.equals(this.targetName)) {
-// throw new GlobusGSSException(
-// GSSException.UNAUTHORIZED,
-// GlobusGSSException.BAD_NAME,
-// "authFailed00",
-// new Object[]{this.expectedTargetName,
-// this.targetName});
-// }
-//
-// if (this.gssMode.equals(GSIConstants.MODE_GSI)) {
-// this.state = CLIENT_START_DEL;
-// // if there is a token to return then break
-// // otherwise we fall through to delegation
-// if (returnToken != null && returnToken.length > 0) {
-// break;
-// }
-// } else {
-// setDone();
-// break;
-// }
-//
-// } else { // handshake not complete yet
-// break;
-// }
-// } catch (IOException e) {
-// throw new GlobusGSSException(GSSException.FAILURE, e);
-// } catch (Exception e) {
-// throw new GlobusGSSException(GSSException.FAILURE, e);
-// }
-//
-// case CLIENT_START_DEL:
-//
-// // sanity check - might be invalid state
-// if (this.state != CLIENT_START_DEL ||
-// (returnToken != null && returnToken.length > 0) ) {
-// throw new GSSException(GSSException.FAILURE);
-// }
-//
-// try {
-// String deleg;
-//
-// if (getCredDelegState()) {
-// deleg = Character.toString(
-// GSIConstants.DELEGATION_CHAR);
-// this.state = CLIENT_END_DEL;
-// } else {
-// deleg = Character.toString('0');
-// setDone();
-// }
-//
-// // TODO: Force ASCII encoding?
-// byte[] a = deleg.getBytes();
-// // SSL wrap the delegation token
-// returnToken = this.tlsHU.wrap(a);
-// } catch (Exception e) {
-// throw new GlobusGSSException(GSSException.FAILURE, e);
-// }
-//
-// break;
-//
-// case CLIENT_END_DEL:
-//
-// if (inBuff == null || inBuff.length == 0) {
-// throw new GSSException(GSSException.DEFECTIVE_TOKEN);
-// }
-//
-// try {
-// // SSL unwrap the token on the inBuff (it's a CSR)
-// byte[] certReq = this.tlsHU.unwrap(inBuff);
-//
-// if (certReq.length == 0) break;
-//
-// X509Certificate[] chain =
-// this.ctxCred.getCertificateChain();
-//
-// X509Certificate cert = this.certFactory.createCertificate(
-// new ByteArrayInputStream(certReq),
-// chain[0],
-// this.ctxCred.getPrivateKey(),
-// -1,
-// BouncyCastleCertProcessingFactory.decideProxyType(
-// chain[0], this.delegationType));
-//
-// byte[] enc = cert.getEncoded();
-// // SSL wrap the encoded cert and return that buffer
-// returnToken = this.tlsHU.wrap(enc);
-// setDone();
-// } catch (GeneralSecurityException e) {
-// throw new GlobusGSSException(GSSException.FAILURE, e);
-// } catch (IOException e) {
-// throw new GlobusGSSException(GSSException.FAILURE, e);
-// }
-//
-// break;
-//
-// default:
-// throw new GSSException(GSSException.FAILURE);
-// }
-//
-// //TODO: Why is there a check for CLIENT_START_DEL?
-// if (returnToken != null && returnToken.length > 0 ||
-// this.state == CLIENT_START_DEL) {
-// return returnToken;
-// } else
-// return null;
-// }
-//
-// /**
-// * It works just like
-// * {@link #initSecContext(byte[], int, int) initSecContext} method.
-// * It reads one SSL token from input stream, calls
-// * {@link #initSecContext(byte[], int, int) acceptSecContext} method and
-// * writes the output token to the output stream (if any)
-// * SSL token is not read on the initial call.
-// */
-// public int initSecContext(InputStream in, OutputStream out)
-// throws GSSException {
-// byte[] inToken = null;
-// try {
-// if (!this.conn) {
-// inToken = new byte[0];
-// } else {
-// inToken = SSLUtil.readSslMessage(in);
-// }
-// byte[] outToken = initSecContext(inToken, 0, inToken.length);
-// if (outToken != null) {
-// out.write(outToken);
-// return outToken.length;
-// } else {
-// return 0;
-// }
-// } catch (IOException e) {
-// throw new GlobusGSSException(GSSException.FAILURE, e);
-// }
-// }
-//
-// /*
-// acceptSecContext not implemented
-// */
-// public byte[] acceptSecContext(byte[] bytes, int i, int i1)
-// throws GSSException {
-// throw new GSSException(GSSException.UNAVAILABLE);
-// }
-//
-// /*
-// acceptSecContext not implemented
-// */
-// public void acceptSecContext(InputStream in, OutputStream out)
-// throws GSSException {
-// throw new GSSException(GSSException.UNAVAILABLE);
-// }
-//
-// /**
-// *
-// * @return
-// */
-// public boolean isEstablished() {
-// return this.established;
-// }
-//
-// /**
-// *
-// * @throws GSSException
-// */
-// public void dispose() throws GSSException {
-// // does nothing
-// }
-//
-// /*
-// getWrapSizeLimit unimplemented
-// */
-// public int getWrapSizeLimit(int i, boolean b, int i1) throws GSSException {
-// throw new GSSException(GSSException.UNAVAILABLE);
-// }
-//
-//
-// /**
-// * Wraps a message for integrity and protection.
-// * Returns a GSI-wrapped token when privacy is not requested and
-// * QOP requested is set to
-// * {@link GSSConstants#GSI_BIG GSSConstants.GSI_BIG}. Otherwise
-// * a regular SSL-wrapped token is returned.
-// */
-// public byte[] wrap(byte[] inBuf, int off, int len, MessageProp prop)
-// throws GSSException {
-// checkContext();
-//
-// byte[] token = null;
-// boolean doGSIWrap = false;
-//
-// if (prop != null) {
-// if (prop.getQOP() != 0 && prop.getQOP() != GSSConstants.GSI_BIG) {
-// throw new GSSException(GSSException.BAD_QOP);
-// }
-// doGSIWrap = (!prop.getPrivacy() &&
-// prop.getQOP() == GSSConstants.GSI_BIG);
-// }
-//
-// if (doGSIWrap) {
-// throw new GSSException(GSSException.UNAVAILABLE);
-// } else {
-// try {
-// token = this.tlsHU.wrap(inBuf, off, len);
-// } catch (IOException e) {
-// throw new GlobusGSSException(GSSException.FAILURE, e);
-// }
-//
-// if (prop != null) {
-// prop.setPrivacy(this.encryption);
-// prop.setQOP(0);
-// }
-// }
-//
-// return token;
-// }
-//
-// /*
-// wrap(InputStream, OutputStream) unimplemented
-// */
-// public void wrap(InputStream in, OutputStream out, MessageProp msgProp)
-// throws GSSException {
-// throw new GSSException(GSSException.UNAVAILABLE);
-// }
-//
-// /**
-// * Unwraps a token generated by <code>wrap</code> method on the other side
-// * of the context. The input token can either be a regular SSL-wrapped
-// * token or GSI-wrapped token. Upon return from the method the
-// * <code>MessageProp</code> object will contain the applied QOP and privacy
-// * state of the message. In case of GSI-wrapped token the applied QOP will
-// * be set to {@link GSSConstants#GSI_BIG GSSConstants.GSI_BIG}
-// */
-// public byte[] unwrap(byte[] inBuf, int off, int len, MessageProp prop)
-// throws GSSException {
-// checkContext();
-//
-// byte[] token = null;
-//
-// /*
-// * see if the token is a straight SSL packet or
-// * one of ours made by wrap using get_mic
-// */
-// if (inBuf[off] == GSI_WRAP &&
-// inBuf[off + 1] == 3 &&
-// inBuf[off + 2] == 0) {
-// throw new GSSException(GSSException.UNAVAILABLE);
-// } else {
-// try {
-// token = this.tlsHU.unwrap(inBuf, off, len);
-// } catch (IOException e) {
-// throw new GlobusGSSException(GSSException.FAILURE, e);
-// }
-//
-// if (prop != null) {
-// prop.setPrivacy(this.encryption);
-// prop.setQOP(0);
-// }
-// }
-//
-// return token;
-// }
-//
-// /*
-// unwrap(InputStream, OutputStream) unimplemented
-// */
-// public void unwrap(InputStream in, OutputStream out, MessageProp msgProp)
-// throws GSSException {
-// throw new GSSException(GSSException.UNAVAILABLE);
-// }
-//
-// /**
-// *
-// * @param inBuf
-// * @param off
-// * @param len
-// * @param prop
-// * @return
-// * @throws GSSException
-// */
-// public byte[] getMIC(byte[] inBuf, int off, int len, MessageProp prop)
-// throws GSSException {
-// checkContext();
-//
-// if (prop != null && (prop.getQOP() != 0 || prop.getPrivacy())) {
-// throw new GSSException(GSSException.BAD_QOP);
-// }
-//
-// long sequence = this.cipherFactory.getTlsBlockCipher().getWriteMac()
-// .getSequenceNumber();
-//
-// int md_size = this.cipherFactory.getDigest().getDigestSize();
-//
-// byte[] mic = new byte[GSI_MESSAGE_DIGEST_PADDING + md_size];
-//
-// System.arraycopy(toBytes(sequence), 0, mic, 0, GSI_SEQUENCE_SIZE);
-// System.arraycopy(toBytes(len, 4), 0, mic, GSI_SEQUENCE_SIZE, 4);
-//
-// this.cipherFactory.getTlsBlockCipher().getWriteMac().incSequence();
-//
-// int pad_ct = (48 / md_size) * md_size;
-//
-// try {
-// MessageDigest md = MessageDigest.getInstance(
-// this.cipherFactory.getDigest().getAlgorithmName());
-//
-// md.update(this.cipherFactory.getTlsBlockCipher().getWriteMac()
-// .getMACSecret());
-// for (int i = 0; i < pad_ct; i++) {
-// md.update(SSLHANDSHAKE_PAD_1);
-// }
-// md.update(mic, 0, GSI_MESSAGE_DIGEST_PADDING);
-// md.update(inBuf, off, len);
-//
-// byte[] digest = md.digest();
-//
-// System.arraycopy(digest, 0, mic, GSI_MESSAGE_DIGEST_PADDING, digest.length);
-// } catch (NoSuchAlgorithmException e) {
-// throw new GlobusGSSException(GSSException.FAILURE, e);
-// }
-//
-// if (prop != null) {
-// prop.setPrivacy(false);
-// prop.setQOP(0);
-// }
-//
-// return mic;
-// }
-//
-// /*
-// getMIC(InputStream, OutputStream) unimplemented
-// */
-// public void getMIC(InputStream in, OutputStream out, MessageProp msgProp)
-// throws GSSException {
-// throw new GSSException(GSSException.UNAVAILABLE);
-// }
-//
-// /**
-// *
-// * @param inTok
-// * @param tokOff
-// * @param tokLen
-// * @param inMsg
-// * @param msgOff
-// * @param msgLen
-// * @param prop
-// * @throws GSSException
-// */
-// public void verifyMIC(byte[] inTok, int tokOff, int tokLen,
-// byte[] inMsg, int msgOff, int msgLen,
-// MessageProp prop) throws GSSException {
-// checkContext();
-//
-// String digestAlg = this.cipherFactory.getDigest().getAlgorithmName();
-// int md_size = this.cipherFactory.getDigest().getDigestSize();
-//
-// if (tokLen != (GSI_MESSAGE_DIGEST_PADDING + md_size)) {
-// throw new GlobusGSSException(GSSException.DEFECTIVE_TOKEN,
-// GlobusGSSException.TOKEN_FAIL,
-// "tokenFail00",
-// new Object[] {new Integer(tokLen),
-// new Integer(GSI_MESSAGE_DIGEST_PADDING +
-// md_size)});
-// }
-//
-// int bufLen = SSLUtil.toInt(inTok, tokOff + GSI_SEQUENCE_SIZE);
-// if (bufLen != msgLen) {
-// throw new GlobusGSSException(GSSException.DEFECTIVE_TOKEN,
-// GlobusGSSException.TOKEN_FAIL,
-// "tokenFail01",
-// new Object[] {new Integer(msgLen), new Integer(bufLen)});
-// }
-//
-// int pad_ct = (48 / md_size) * md_size;
-//
-// byte [] digest = null;
-//
-// try {
-// MessageDigest md =
-// MessageDigest.getInstance(digestAlg);
-//
-// md.update(this.cipherFactory.getTlsBlockCipher().getReadMac()
-// .getMACSecret());
-// for(int i=0;i<pad_ct;i++) {
-// md.update(SSLHANDSHAKE_PAD_1);
-// }
-// md.update(inTok, tokOff, GSI_MESSAGE_DIGEST_PADDING);
-// md.update(inMsg, msgOff, msgLen);
-//
-// digest = md.digest();
-// } catch (NoSuchAlgorithmException e) {
-// throw new GlobusGSSException(GSSException.FAILURE, e);
-// }
-//
-// byte [] token = new byte[tokLen-GSI_MESSAGE_DIGEST_PADDING];
-// System.arraycopy(inTok, tokOff+GSI_MESSAGE_DIGEST_PADDING, token, 0, token.length);
-//
-// if (!Arrays.equals(digest, token)) {
-// throw new GlobusGSSException(GSSException.BAD_MIC,
-// GlobusGSSException.BAD_MIC,
-// "tokenFail02");
-// }
-//
-// long tokSeq = SSLUtil.toLong(inTok, tokOff);
-// long readSeq = this.cipherFactory.getTlsBlockCipher().getReadMac()
-// .getSequenceNumber();
-// long seqTest = tokSeq - readSeq;
-//
-// if (seqTest > 0) {
-// // gap token
-// throw new GSSException(GSSException.GAP_TOKEN);
-// } else if (seqTest < 0) {
-// // old token
-// throw new GSSException(GSSException.OLD_TOKEN);
-// } else {
-// this.cipherFactory.getTlsBlockCipher().getReadMac().incSequence();
-// }
-//
-// if (prop != null) {
-// prop.setPrivacy(false);
-// prop.setQOP(0);
-// }
-// }
-//
-// /*
-// verifyMIC(InputStream, InputStream) unimplemented
-// */
-// public void verifyMIC(InputStream tokStream, InputStream msgStream,
-// MessageProp msgProp) throws GSSException {
-// throw new GSSException(GSSException.UNAVAILABLE);
-// }
-//
-// /*
-// export not implemented
-// */
-// public byte[] export() throws GSSException {
-// throw new GSSException(GSSException.UNAVAILABLE);
-// }
-//
-// /**
-// *
-// * @param state
-// * @throws GSSException
-// */
-// public void requestMutualAuth(boolean state) throws GSSException {
-// if (!state) {
-// throw new GlobusGSSException(GSSException.FAILURE,
-// GlobusGSSException.BAD_OPTION,
-// "mutualAuthOn");
-// }
-// }
-//
-// /**
-// *
-// * @param state
-// * @throws GSSException
-// */
-// public void requestReplayDet(boolean state) throws GSSException {
-// if (!state) {
-// throw new GlobusGSSException(GSSException.FAILURE,
-// GlobusGSSException.BAD_OPTION,
-// "replayDet");
-// }
-// }
-//
-// /**
-// *
-// * @param state
-// * @throws GSSException
-// */
-// public void requestSequenceDet(boolean state) throws GSSException {
-// if (!state) {
-// throw new GlobusGSSException(GSSException.FAILURE,
-// GlobusGSSException.BAD_OPTION,
-// "seqDet");
-// }
-// }
-//
-// /**
-// *
-// * @param state
-// * @throws GSSException
-// */
-// public void requestCredDeleg(boolean state) throws GSSException {
-// this.credentialDelegation = state;
-// }
-//
-// /**
-// *
-// * @param state
-// * @throws GSSException
-// */
-// public void requestAnonymity(boolean state) throws GSSException {
-// this.anonymity = state;
-// }
-//
-// /**
-// *
-// * @param state
-// * @throws GSSException
-// */
-// public void requestConf(boolean state) throws GSSException {
-// //TODO: unencrypted not possible
-// this.encryption = true;
-// }
-//
-// /**
-// *
-// * @param state
-// * @throws GSSException
-// */
-// public void requestInteg(boolean state) throws GSSException {
-// if (!state) {
-// throw new GlobusGSSException(GSSException.FAILURE,
-// GlobusGSSException.BAD_OPTION,
-// "integOn");
-// }
-// }
-//
-// /**
-// *
-// * @param lifetime
-// * @throws GSSException
-// */
-// public void requestLifetime(int lifetime) throws GSSException {
-// if (lifetime == GSSContext.INDEFINITE_LIFETIME) {
-// throw new GlobusGSSException(GSSException.FAILURE,
-// GlobusGSSException.UNKNOWN,
-// "badLifetime00");
-// }
-//
-// if (lifetime != GSSContext.DEFAULT_LIFETIME) {
-// Calendar calendar = Calendar.getInstance();
-// calendar.add(Calendar.SECOND, lifetime);
-// setGoodUntil(calendar.getTime());
-// }
-// }
-//
-// /*
-// setChannelBinding unimplemented
-// */
-// public void setChannelBinding(ChannelBinding cb) throws GSSException {
-// throw new GSSException(GSSException.UNAVAILABLE);
-// }
-//
-// /**
-// *
-// * @return
-// */
-// public boolean getCredDelegState() {
-// return this.credentialDelegation;
-// }
-//
-// /**
-// *
-// * @return
-// */
-// public boolean getMutualAuthState() {
-// return true; // always on with gsi
-// }
-//
-// /**
-// *
-// * @return
-// */
-// public boolean getReplayDetState() {
-// return true; // always on with ssl
-// }
-//
-// /**
-// *
-// * @return
-// */
-// public boolean getSequenceDetState() {
-// return true; // always on with ssl
-// }
-//
-// /**
-// *
-// * @return
-// */
-// public boolean getAnonymityState() {
-// return this.anonymity;
-// }
-//
-// /*
-// isTransferable unimplemented
-// */
-// public boolean isTransferable() throws GSSException {
-// throw new GSSException(GSSException.UNAVAILABLE);
-// }
-//
-// /**
-// *
-// * @return
-// */
-// public boolean isProtReady() {
-// return isEstablished();
-// }
-//
-// /**
-// *
-// * @return
-// */
-// public boolean getConfState() {
-// return this.encryption;
-// }
-//
-// public boolean getIntegState() {
-// return true; // always on with ssl
-// }
-//
-// /**
-// *
-// * @return
-// */
-// public int getLifetime() {
-// if (goodUntil != null) {
-// return (int) ((goodUntil.getTime() - System.currentTimeMillis())
-// / 1000);
-// } else {
-// return -1;
-// }
-// }
-//
-// /**
-// *
-// * @return
-// * @throws GSSException
-// */
-// public GSSName getSrcName() throws GSSException {
-// return this.sourceName;
-// }
-//
-// /**
-// *
-// * @return
-// * @throws GSSException
-// */
-// public GSSName getTargName() throws GSSException {
-// return this.targetName;
-// }
-//
-// /**
-// *
-// * @return
-// * @throws GSSException
-// */
-// public Oid getMech() throws GSSException {
-// return GSSConstants.MECH_OID;
-// }
-//
-// /*
-// getDelegCred unimplemented (would have been set by acceptSecContext
-// */
-// public GSSCredential getDelegCred() throws GSSException {
-// throw new GSSException(GSSException.UNAVAILABLE);
-// }
-//
-// /**
-// *
-// * @return
-// * @throws GSSException
-// */
-// public boolean isInitiator() throws GSSException {
-// return true; // acceptor side currently isn't implemented
-// }
-//
-// /**
-// *
-// * @param val
-// * @return
-// */
-// public static byte[] toBytes(long val){
-// return toBytes(val,8);
-// }
-//
-// /**
-// *
-// * @param val
-// * @return
-// */
-// public static byte[] toBytes(short val){
-// return toBytes((long)val,2);
-// }
-//
-// /**
-// *
-// * @param val
-// * @param bytes
-// * @return
-// */
-// public static byte[] toBytes(long val,int bytes){
-// byte[] retval=new byte[bytes];
-//
-// while(bytes-->0){
-// retval[bytes]=(byte)(val & 0xff);
-// val>>=8;
-// }
-//
-// return retval;
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/edu/illinois/ncsa/BCGSS/CircularByteBuffer.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/edu/illinois/ncsa/BCGSS/CircularByteBuffer.java b/tools/gsissh/src/main/java/edu/illinois/ncsa/BCGSS/CircularByteBuffer.java
deleted file mode 100644
index 47a946f..0000000
--- a/tools/gsissh/src/main/java/edu/illinois/ncsa/BCGSS/CircularByteBuffer.java
+++ /dev/null
@@ -1,824 +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 edu.illinois.ncsa.BCGSS;
-///*
-// * Circular Byte Buffer
-// * Copyright (C) 2002 Stephen Ostermiller
-// * http://ostermiller.org/contact.pl?regarding=Java+Utilities
-// *
-// * This program is free software; you can redistribute it and/or modify
-// * it under the terms of the GNU General Public License as published by
-// * the Free Software Foundation; either version 2 of the License, or
-// * (at your option) any later version.
-// *
-// * This program is distributed in the hope that it will be useful,
-// * but WITHOUT ANY WARRANTY; without even the implied warranty of
-// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// * GNU General Public License for more details.
-// *
-// * See COPYING.TXT for details.
-// */
-//
-//
-//import java.io.*;
-//import java.nio.*;
-//
-///**
-// * Implements the Circular Buffer producer/consumer model for bytes.
-// * More information about this class is available from <a target="_top" href=
-// * "http://ostermiller.org/utils/CircularByteBuffer.html">ostermiller.org</a>.
-// * <p>
-// * Using this class is a simpler alternative to using a PipedInputStream
-// * and a PipedOutputStream. PipedInputStreams and PipedOutputStreams don't support the
-// * mark operation, don't allow you to control buffer sizes that they use,
-// * and have a more complicated API that requires instantiating two
-// * classes and connecting them.
-// * <p>
-// * This class is thread safe.
-// *
-// */
-//public class CircularByteBuffer {
-//
-// /**
-// * The default size for a circular byte buffer.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// private final static int DEFAULT_SIZE = 1024;
-//
-// /**
-// * A buffer that will grow as things are added.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// public final static int INFINITE_SIZE = -1;
-//
-// /**
-// * The circular buffer.
-// * <p>
-// * The actual capacity of the buffer is one less than the actual length
-// * of the buffer so that an empty and a full buffer can be
-// * distinguished. An empty buffer will have the markPostion and the
-// * writePosition equal to each other. A full buffer will have
-// * the writePosition one less than the markPostion.
-// * <p>
-// * There are three important indexes into the buffer:
-// * The readPosition, the writePosition, and the markPosition.
-// * If the InputStream has never been marked, the readPosition and
-// * the markPosition should always be the same. The bytes
-// * available to be read go from the readPosition to the writePosition,
-// * wrapping around the end of the buffer. The space available for writing
-// * goes from the write position to one less than the markPosition,
-// * wrapping around the end of the buffer. The bytes that have
-// * been saved to support a reset() of the InputStream go from markPosition
-// * to readPosition, wrapping around the end of the buffer.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// protected byte[] buffer;
-// /**
-// * Index of the first byte available to be read.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// protected volatile int readPosition = 0;
-// /**
-// * Index of the first byte available to be written.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// protected volatile int writePosition = 0;
-// /**
-// * Index of the first saved byte. (To support stream marking.)
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// protected volatile int markPosition = 0;
-// /**
-// * Number of bytes that have to be saved
-// * to support mark() and reset() on the InputStream.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// protected volatile int markSize = 0;
-// /**
-// * If this buffer is infinite (should resize itself when full)
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// protected volatile boolean infinite = false;
-// /**
-// * True if a write to a full buffer should block until the buffer
-// * has room, false if the write method should throw an IOException
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// protected boolean blockingWrite = true;
-// /**
-// * The InputStream that can empty this buffer.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// protected InputStream in = new CircularByteBufferInputStream();
-// /**
-// * true if the close() method has been called on the InputStream
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// protected boolean inputStreamClosed = false;
-// /**
-// * The OutputStream that can fill this buffer.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// protected OutputStream out = new CircularByteBufferOutputStream();
-// /**
-// * true if the close() method has been called on the OutputStream
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// protected boolean outputStreamClosed = false;
-//
-// /**
-// * Make this buffer ready for reuse. The contents of the buffer
-// * will be cleared and the streams associated with this buffer
-// * will be reopened if they had been closed.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// public void clear(){
-// synchronized (this){
-// readPosition = 0;
-// writePosition = 0;
-// markPosition = 0;
-// outputStreamClosed = false;
-// inputStreamClosed = false;
-// }
-// }
-//
-// /**
-// * Retrieve a OutputStream that can be used to fill
-// * this buffer.
-// * <p>
-// * Write methods may throw a BufferOverflowException if
-// * the buffer is not large enough. A large enough buffer
-// * size must be chosen so that this does not happen or
-// * the caller must be prepared to catch the exception and
-// * try again once part of the buffer has been consumed.
-// *
-// *
-// * @return the producer for this buffer.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// public OutputStream getOutputStream(){
-// return out;
-// }
-//
-// /**
-// * Retrieve a InputStream that can be used to empty
-// * this buffer.
-// * <p>
-// * This InputStream supports marks at the expense
-// * of the buffer size.
-// *
-// * @return the consumer for this buffer.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// public InputStream getInputStream(){
-// return in;
-// }
-//
-// /**
-// * Get number of bytes that are available to be read.
-// * <p>
-// * Note that the number of bytes available plus
-// * the number of bytes free may not add up to the
-// * capacity of this buffer, as the buffer may reserve some
-// * space for other purposes.
-// *
-// * @return the size in bytes of this buffer
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// public int getAvailable(){
-// synchronized (this){
-// return available();
-// }
-// }
-//
-// /**
-// * Get the number of bytes this buffer has free for
-// * writing.
-// * <p>
-// * Note that the number of bytes available plus
-// * the number of bytes free may not add up to the
-// * capacity of this buffer, as the buffer may reserve some
-// * space for other purposes.
-// *
-// * @return the available space in bytes of this buffer
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// public int getSpaceLeft(){
-// synchronized (this){
-// return spaceLeft();
-// }
-// }
-//
-// /**
-// * Get the capacity of this buffer.
-// * <p>
-// * Note that the number of bytes available plus
-// * the number of bytes free may not add up to the
-// * capacity of this buffer, as the buffer may reserve some
-// * space for other purposes.
-// *
-// * @return the size in bytes of this buffer
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// public int getSize(){
-// synchronized (this){
-// return buffer.length;
-// }
-// }
-//
-// /**
-// * double the size of the buffer
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// private void resize(){
-// byte[] newBuffer = new byte[buffer.length * 2];
-// int marked = marked();
-// int available = available();
-// if (markPosition <= writePosition){
-// // any space between the mark and
-// // the first write needs to be saved.
-// // In this case it is all in one piece.
-// int length = writePosition - markPosition;
-// System.arraycopy(buffer, markPosition, newBuffer, 0, length);
-// } else {
-// int length1 = buffer.length - markPosition;
-// System.arraycopy(buffer, markPosition, newBuffer, 0, length1);
-// int length2 = writePosition;
-// System.arraycopy(buffer, 0, newBuffer, length1, length2);
-// }
-// buffer = newBuffer;
-// markPosition = 0;
-// readPosition = marked;
-// writePosition = marked + available;
-// }
-//
-// /**
-// * Space available in the buffer which can be written.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// private int spaceLeft(){
-// if (writePosition < markPosition){
-// // any space between the first write and
-// // the mark except one byte is available.
-// // In this case it is all in one piece.
-// return (markPosition - writePosition - 1);
-// }
-// // space at the beginning and end.
-// return ((buffer.length - 1) - (writePosition - markPosition));
-// }
-//
-// /**
-// * Bytes available for reading.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// private int available(){
-// if (readPosition <= writePosition){
-// // any space between the first read and
-// // the first write is available. In this case i
-// // is all in one piece.
-// return (writePosition - readPosition);
-// }
-// // space at the beginning and end.
-// return (buffer.length - (readPosition - writePosition));
-// }
-//
-// /**
-// * Bytes saved for supporting marks.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// private int marked(){
-// if (markPosition <= readPosition){
-// // any space between the markPosition and
-// // the first write is marked. In this case i
-// // is all in one piece.
-// return (readPosition - markPosition);
-// }
-// // space at the beginning and end.
-// return (buffer.length - (markPosition - readPosition));
-// }
-//
-// /**
-// * If we have passed the markSize reset the
-// * mark so that the space can be used.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// private void ensureMark(){
-// if (marked() >= markSize){
-// markPosition = readPosition;
-// markSize = 0;
-// }
-// }
-//
-// /**
-// * Create a new buffer with a default capacity.
-// * Writing to a full buffer will block until space
-// * is available rather than throw an exception.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// public CircularByteBuffer(){
-// this (DEFAULT_SIZE, true);
-// }
-//
-// /**
-// * Create a new buffer with given capacity.
-// * Writing to a full buffer will block until space
-// * is available rather than throw an exception.
-// * <p>
-// * Note that the buffer may reserve some bytes for
-// * special purposes and capacity number of bytes may
-// * not be able to be written to the buffer.
-// * <p>
-// * Note that if the buffer is of INFINITE_SIZE it will
-// * neither block or throw exceptions, but rather grow
-// * without bound.
-// *
-// * @param size desired capacity of the buffer in bytes or CircularByteBuffer.INFINITE_SIZE.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// public CircularByteBuffer(int size){
-// this (size, true);
-// }
-//
-// /**
-// * Create a new buffer with a default capacity and
-// * given blocking behavior.
-// *
-// * @param blockingWrite true writing to a full buffer should block
-// * until space is available, false if an exception should
-// * be thrown instead.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// public CircularByteBuffer(boolean blockingWrite){
-// this (DEFAULT_SIZE, blockingWrite);
-// }
-//
-// /**
-// * Create a new buffer with the given capacity and
-// * blocking behavior.
-// * <p>
-// * Note that the buffer may reserve some bytes for
-// * special purposes and capacity number of bytes may
-// * not be able to be written to the buffer.
-// * <p>
-// * Note that if the buffer is of INFINITE_SIZE it will
-// * neither block or throw exceptions, but rather grow
-// * without bound.
-// *
-// * @param size desired capacity of the buffer in bytes or CircularByteBuffer.INFINITE_SIZE.
-// * @param blockingWrite true writing to a full buffer should block
-// * until space is available, false if an exception should
-// * be thrown instead.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// public CircularByteBuffer(int size, boolean blockingWrite){
-// if (size == INFINITE_SIZE){
-// buffer = new byte[DEFAULT_SIZE];
-// infinite = true;
-// } else {
-// buffer = new byte[size];
-// infinite = false;
-// }
-// this.blockingWrite = blockingWrite;
-// }
-//
-// /**
-// * Class for reading from a circular byte buffer.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// protected class CircularByteBufferInputStream extends InputStream {
-//
-// /**
-// * Returns the number of bytes that can be read (or skipped over) from this
-// * input stream without blocking by the next caller of a method for this input
-// * stream. The next caller might be the same thread or or another thread.
-// *
-// * @return the number of bytes that can be read from this input stream without blocking.
-// * @throws IOException if the stream is closed.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// @Override public int available() throws IOException {
-// synchronized (CircularByteBuffer.this){
-// if (inputStreamClosed) throw new IOException("InputStream has been closed, it is not ready.");
-// return (CircularByteBuffer.this.available());
-// }
-// }
-//
-// /**
-// * Close the stream. Once a stream has been closed, further read(), available(),
-// * mark(), or reset() invocations will throw an IOException. Closing a
-// * previously-closed stream, however, has no effect.
-// *
-// * @throws IOException never.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// @Override public void close() throws IOException {
-// synchronized (CircularByteBuffer.this){
-// inputStreamClosed = true;
-// }
-// }
-//
-// /**
-// * Mark the present position in the stream. Subsequent calls to reset() will
-// * attempt to reposition the stream to this point.
-// * <p>
-// * The readAheadLimit must be less than the size of circular buffer, otherwise
-// * this method has no effect.
-// *
-// * @param readAheadLimit Limit on the number of bytes that may be read while
-// * still preserving the mark. After reading this many bytes, attempting to
-// * reset the stream will fail.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// @Override public void mark(int readAheadLimit) {
-// synchronized (CircularByteBuffer.this){
-// //if (inputStreamClosed) throw new IOException("InputStream has been closed; cannot mark a closed InputStream.");
-// if (buffer.length - 1 > readAheadLimit) {
-// markSize = readAheadLimit;
-// markPosition = readPosition;
-// }
-// }
-// }
-//
-// /**
-// * Tell whether this stream supports the mark() operation.
-// *
-// * @return true, mark is supported.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// @Override public boolean markSupported() {
-// return true;
-// }
-//
-// /**
-// * Read a single byte.
-// * This method will block until a byte is available, an I/O error occurs,
-// * or the end of the stream is reached.
-// *
-// * @return The byte read, as an integer in the range 0 to 255 (0x00-0xff),
-// * or -1 if the end of the stream has been reached
-// * @throws IOException if the stream is closed.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// @Override public int read() throws IOException {
-// while (true){
-// synchronized (CircularByteBuffer.this){
-// if (inputStreamClosed) throw new IOException("InputStream has been closed; cannot read from a closed InputStream.");
-// int available = CircularByteBuffer.this.available();
-// if (available > 0){
-// int result = buffer[readPosition] & 0xff;
-// readPosition++;
-// if (readPosition == buffer.length){
-// readPosition = 0;
-// }
-// ensureMark();
-// return result;
-// } else if (outputStreamClosed){
-// return -1;
-// }
-// }
-// try {
-// Thread.sleep(100);
-// } catch(Exception x){
-// throw new IOException("Blocking read operation interrupted.");
-// }
-// }
-// }
-//
-// /**
-// * Read bytes into an array.
-// * This method will block until some input is available,
-// * an I/O error occurs, or the end of the stream is reached.
-// *
-// * @param cbuf Destination buffer.
-// * @return The number of bytes read, or -1 if the end of
-// * the stream has been reached
-// * @throws IOException if the stream is closed.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// @Override public int read(byte[] cbuf) throws IOException {
-// return read(cbuf, 0, cbuf.length);
-// }
-//
-// /**
-// * Read bytes into a portion of an array.
-// * This method will block until some input is available,
-// * an I/O error occurs, or the end of the stream is reached.
-// *
-// * @param cbuf Destination buffer.
-// * @param off Offset at which to start storing bytes.
-// * @param len Maximum number of bytes to read.
-// * @return The number of bytes read, or -1 if the end of
-// * the stream has been reached
-// * @throws IOException if the stream is closed.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// @Override public int read(byte[] cbuf, int off, int len) throws IOException {
-// while (true){
-// synchronized (CircularByteBuffer.this){
-// if (inputStreamClosed) throw new IOException("InputStream has been closed; cannot read from a closed InputStream.");
-// int available = CircularByteBuffer.this.available();
-// if (available > 0){
-// int length = Math.min(len, available);
-// int firstLen = Math.min(length, buffer.length - readPosition);
-// int secondLen = length - firstLen;
-// System.arraycopy(buffer, readPosition, cbuf, off, firstLen);
-// if (secondLen > 0){
-// System.arraycopy(buffer, 0, cbuf, off+firstLen, secondLen);
-// readPosition = secondLen;
-// } else {
-// readPosition += length;
-// }
-// if (readPosition == buffer.length) {
-// readPosition = 0;
-// }
-// ensureMark();
-// return length;
-// } else if (outputStreamClosed){
-// return -1;
-// }
-// }
-// try {
-// Thread.sleep(100);
-// } catch(Exception x){
-// throw new IOException("Blocking read operation interrupted.");
-// }
-// }
-// }
-//
-// /**
-// * Reset the stream.
-// * If the stream has been marked, then attempt to reposition i
-// * at the mark. If the stream has not been marked, or more bytes
-// * than the readAheadLimit have been read, this method has no effect.
-// *
-// * @throws IOException if the stream is closed.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// @Override public void reset() throws IOException {
-// synchronized (CircularByteBuffer.this){
-// if (inputStreamClosed) throw new IOException("InputStream has been closed; cannot reset a closed InputStream.");
-// readPosition = markPosition;
-// }
-// }
-//
-// /**
-// * Skip bytes.
-// * This method will block until some bytes are available,
-// * an I/O error occurs, or the end of the stream is reached.
-// *
-// * @param n The number of bytes to skip
-// * @return The number of bytes actually skipped
-// * @throws IllegalArgumentException if n is negative.
-// * @throws IOException if the stream is closed.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// @Override public long skip(long n) throws IOException, IllegalArgumentException {
-// while (true){
-// synchronized (CircularByteBuffer.this){
-// if (inputStreamClosed) throw new IOException("InputStream has been closed; cannot skip bytes on a closed InputStream.");
-// int available = CircularByteBuffer.this.available();
-// if (available > 0){
-// int length = Math.min((int)n, available);
-// int firstLen = Math.min(length, buffer.length - readPosition);
-// int secondLen = length - firstLen;
-// if (secondLen > 0){
-// readPosition = secondLen;
-// } else {
-// readPosition += length;
-// }
-// if (readPosition == buffer.length) {
-// readPosition = 0;
-// }
-// ensureMark();
-// return length;
-// } else if (outputStreamClosed){
-// return 0;
-// }
-// }
-// try {
-// Thread.sleep(100);
-// } catch(Exception x){
-// throw new IOException("Blocking read operation interrupted.");
-// }
-// }
-// }
-// }
-//
-// /**
-// * Class for writing to a circular byte buffer.
-// * If the buffer is full, the writes will either block
-// * until there is some space available or throw an IOException
-// * based on the CircularByteBuffer's preference.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// protected class CircularByteBufferOutputStream extends OutputStream {
-//
-// /**
-// * Close the stream, flushing it first.
-// * This will cause the InputStream associated with this circular buffer
-// * to read its last bytes once it empties the buffer.
-// * Once a stream has been closed, further write() or flush() invocations
-// * will cause an IOException to be thrown. Closing a previously-closed stream,
-// * however, has no effect.
-// *
-// * @throws IOException never.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// @Override public void close() throws IOException {
-// synchronized (CircularByteBuffer.this){
-// if (!outputStreamClosed){
-// flush();
-// }
-// outputStreamClosed = true;
-// }
-// }
-//
-// /**
-// * Flush the stream.
-// *
-// * @throws IOException if the stream is closed.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// @Override public void flush() throws IOException {
-// if (outputStreamClosed) throw new IOException("OutputStream has been closed; cannot flush a closed OutputStream.");
-// if (inputStreamClosed) throw new IOException("Buffer closed by inputStream; cannot flush.");
-// // this method needs to do nothing
-// }
-//
-// /**
-// * Write an array of bytes.
-// * If the buffer allows blocking writes, this method will block until
-// * all the data has been written rather than throw an IOException.
-// *
-// * @param cbuf Array of bytes to be written
-// * @throws BufferOverflowException if buffer does not allow blocking writes
-// * and the buffer is full. If the exception is thrown, no data
-// * will have been written since the buffer was set to be non-blocking.
-// * @throws IOException if the stream is closed, or the write is interrupted.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// @Override public void write(byte[] cbuf) throws IOException {
-// write(cbuf, 0, cbuf.length);
-// }
-//
-// /**
-// * Write a portion of an array of bytes.
-// * If the buffer allows blocking writes, this method will block until
-// * all the data has been written rather than throw an IOException.
-// *
-// * @param cbuf Array of bytes
-// * @param off Offset from which to start writing bytes
-// * @param len - Number of bytes to write
-// * @throws BufferOverflowException if buffer does not allow blocking writes
-// * and the buffer is full. If the exception is thrown, no data
-// * will have been written since the buffer was set to be non-blocking.
-// * @throws IOException if the stream is closed, or the write is interrupted.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// @Override public void write(byte[] cbuf, int off, int len) throws IOException {
-// while (len > 0){
-// synchronized (CircularByteBuffer.this){
-// if (outputStreamClosed) throw new IOException("OutputStream has been closed; cannot write to a closed OutputStream.");
-// if (inputStreamClosed) throw new IOException("Buffer closed by InputStream; cannot write to a closed buffer.");
-// int spaceLeft = spaceLeft();
-// while (infinite && spaceLeft < len){
-// resize();
-// spaceLeft = spaceLeft();
-// }
-// if (!blockingWrite && spaceLeft < len) throw new BufferOverflowException();
-// int realLen = Math.min(len, spaceLeft);
-// int firstLen = Math.min(realLen, buffer.length - writePosition);
-// int secondLen = Math.min(realLen - firstLen, buffer.length - markPosition - 1);
-// int written = firstLen + secondLen;
-// if (firstLen > 0){
-// System.arraycopy(cbuf, off, buffer, writePosition, firstLen);
-// }
-// if (secondLen > 0){
-// System.arraycopy(cbuf, off+firstLen, buffer, 0, secondLen);
-// writePosition = secondLen;
-// } else {
-// writePosition += written;
-// }
-// if (writePosition == buffer.length) {
-// writePosition = 0;
-// }
-// off += written;
-// len -= written;
-// }
-// if (len > 0){
-// try {
-// Thread.sleep(100);
-// } catch(Exception x){
-// throw new IOException("Waiting for available space in buffer interrupted.");
-// }
-// }
-// }
-// }
-//
-// /**
-// * Write a single byte.
-// * The byte to be written is contained in the 8 low-order bits of the
-// * given integer value; the 24 high-order bits are ignored.
-// * If the buffer allows blocking writes, this method will block until
-// * all the data has been written rather than throw an IOException.
-// *
-// * @param c number of bytes to be written
-// * @throws BufferOverflowException if buffer does not allow blocking writes
-// * and the buffer is full.
-// * @throws IOException if the stream is closed, or the write is interrupted.
-// *
-// * @since ostermillerutils 1.00.00
-// */
-// @Override public void write(int c) throws IOException {
-// boolean written = false;
-// while (!written){
-// synchronized (CircularByteBuffer.this){
-// if (outputStreamClosed) throw new IOException("OutputStream has been closed; cannot write to a closed OutputStream.");
-// if (inputStreamClosed) throw new IOException("Buffer closed by InputStream; cannot write to a closed buffer.");
-// int spaceLeft = spaceLeft();
-// while (infinite && spaceLeft < 1){
-// resize();
-// spaceLeft = spaceLeft();
-// }
-// if (!blockingWrite && spaceLeft < 1) throw new BufferOverflowException();
-// if (spaceLeft > 0){
-// buffer[writePosition] = (byte)(c & 0xff);
-// writePosition++;
-// if (writePosition == buffer.length) {
-// writePosition = 0;
-// }
-// written = true;
-// }
-// }
-// if (!written){
-// try {
-// Thread.sleep(100);
-// } catch(Exception x){
-// throw new IOException("Waiting for available space in buffer interrupted.");
-// }
-// }
-// }
-// }
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/edu/illinois/ncsa/BCGSS/GlobusTlsCipherFactory.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/edu/illinois/ncsa/BCGSS/GlobusTlsCipherFactory.java b/tools/gsissh/src/main/java/edu/illinois/ncsa/BCGSS/GlobusTlsCipherFactory.java
deleted file mode 100644
index 18d282a..0000000
--- a/tools/gsissh/src/main/java/edu/illinois/ncsa/BCGSS/GlobusTlsCipherFactory.java
+++ /dev/null
@@ -1,63 +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 edu.illinois.ncsa.BCGSS;
-//
-//import edu.illinois.ncsa.bouncycastle.crypto.Digest;
-//import edu.illinois.ncsa.bouncycastle.crypto.tls.AlertDescription;
-//import edu.illinois.ncsa.bouncycastle.crypto.tls.DefaultTlsCipherFactory;
-//import edu.illinois.ncsa.bouncycastle.crypto.tls.TlsBlockCipher;
-//import edu.illinois.ncsa.bouncycastle.crypto.tls.TlsCipher;
-//import edu.illinois.ncsa.bouncycastle.crypto.tls.TlsClientContext;
-//import edu.illinois.ncsa.bouncycastle.crypto.tls.TlsFatalAlert;
-//
-//import java.io.IOException;
-//
-//public class GlobusTlsCipherFactory extends DefaultTlsCipherFactory {
-// protected TlsBlockCipher tlsBlockCipher;
-// protected Digest digest;
-//
-// public TlsBlockCipher getTlsBlockCipher() {
-// return tlsBlockCipher;
-// }
-//
-// public Digest getDigest() {
-// return digest;
-// }
-//
-// public TlsCipher createCipher(TlsClientContext context,
-// int encAlg, int digestAlg)
-// throws IOException {
-// TlsCipher cipher = super.createCipher(context, encAlg, digestAlg);
-// if (cipher instanceof TlsBlockCipher) {
-// tlsBlockCipher = (TlsBlockCipher) cipher;
-// } else {
-// throw new TlsFatalAlert(AlertDescription.internal_error);
-// }
-//
-// return cipher;
-// }
-//
-// protected Digest createDigest(int digestAlgorithm) throws IOException {
-// digest = super.createDigest(digestAlgorithm);
-// return digest;
-// }
-//}
[2/6] airavata git commit: Removed gsissh module from tools
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/GSISSHAbstractCluster.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/GSISSHAbstractCluster.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/GSISSHAbstractCluster.java
deleted file mode 100644
index c7d6279..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/GSISSHAbstractCluster.java
+++ /dev/null
@@ -1,767 +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.impl;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.net.URL;
-import java.security.SecureRandom;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.airavata.gfac.ssh.api.Cluster;
-import org.apache.airavata.gfac.ssh.api.CommandExecutor;
-import org.apache.airavata.gfac.ssh.api.SSHApiException;
-import org.apache.airavata.gfac.ssh.api.ServerInfo;
-import org.apache.airavata.gfac.ssh.api.authentication.AuthenticationInfo;
-import org.apache.airavata.gfac.ssh.api.authentication.GSIAuthenticationInfo;
-import org.apache.airavata.gfac.ssh.api.authentication.SSHKeyAuthentication;
-import org.apache.airavata.gfac.ssh.api.authentication.SSHPasswordAuthentication;
-import org.apache.airavata.gfac.ssh.api.authentication.SSHPublicKeyAuthentication;
-import org.apache.airavata.gfac.ssh.api.authentication.SSHPublicKeyFileAuthentication;
-import org.apache.airavata.gfac.ssh.api.job.JobDescriptor;
-import org.apache.airavata.gfac.ssh.api.job.JobManagerConfiguration;
-import org.apache.airavata.gfac.ssh.api.job.OutputParser;
-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;
-import org.apache.airavata.gfac.ssh.util.SSHUtils;
-import org.apache.commons.io.FileUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-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;
-
-public class GSISSHAbstractCluster implements Cluster {
-
- private static final Logger log = LoggerFactory.getLogger(GSISSHAbstractCluster.class);
- public static final String X509_CERT_DIR = "X509_CERT_DIR";
- public static final String SSH_SESSION_TIMEOUT = "ssh.session.timeout";
-
- public JobManagerConfiguration jobManagerConfiguration;
-
- private ServerInfo serverInfo;
-
- private AuthenticationInfo authenticationInfo;
-
- private Session session;
-
- private ConfigReader configReader;
-
- private JSch defaultJSch;
-
- private static Identity identityFile = null;
-
- public GSISSHAbstractCluster(ServerInfo serverInfo, AuthenticationInfo authenticationInfo, JobManagerConfiguration config) throws SSHApiException {
- this(serverInfo, authenticationInfo);
- this.jobManagerConfiguration = config;
- }
-
- public GSISSHAbstractCluster(ServerInfo serverInfo, AuthenticationInfo authenticationInfo) throws SSHApiException {
-
- reconnect(serverInfo, authenticationInfo);
- }
-
- public GSISSHAbstractCluster(JobManagerConfiguration config) {
- this.jobManagerConfiguration = config;
- }
- private synchronized void reconnect(ServerInfo serverInfo, AuthenticationInfo authenticationInfo) throws SSHApiException {
- this.serverInfo = serverInfo;
-
- this.authenticationInfo = authenticationInfo;
-
- if (authenticationInfo instanceof GSIAuthenticationInfo) {
- JSch.setConfig("gssapi-with-mic.x509", "org.apache.airavata.gfac.ssh.GSSContextX509");
- JSch.setConfig("userauth.gssapi-with-mic", "com.jcraft.jsch.UserAuthGSSAPIWithMICGSSCredentials");
- System.setProperty(X509_CERT_DIR, (String) ((GSIAuthenticationInfo) authenticationInfo).getProperties().
- get("X509_CERT_DIR"));
- }
-
-
- try {
- this.configReader = new ConfigReader();
- } catch (IOException e) {
- throw new SSHApiException("Unable to load system configurations.", e);
- }
- try {
- if(defaultJSch == null){
- defaultJSch = createJSch(authenticationInfo);
- }
- log.debug("Connecting to server - " + serverInfo.getHost() + ":" + serverInfo.getPort() + " with user name - "
- + serverInfo.getUserName());
-
- session = createSession(defaultJSch,serverInfo.getUserName(), serverInfo.getHost(), serverInfo.getPort());
- }
- catch (Exception e) {
- throw new SSHApiException("An exception occurred while creating SSH session." +
- "Connecting server - " + serverInfo.getHost() + ":" + serverInfo.getPort() +
- " connecting user name - "
- + serverInfo.getUserName(), e);
- }
-
- //=============================================================
- // Handling vanilla SSH pieces
- //=============================================================
- if (authenticationInfo instanceof SSHPasswordAuthentication) {
- String password = ((SSHPasswordAuthentication) authenticationInfo).
- getPassword(serverInfo.getUserName(), serverInfo.getHost());
-
- session.setUserInfo(new SSHAPIUIKeyboardInteractive(password));
-
- // TODO figure out why we need to set password to session
- session.setPassword(password);
-
- } else if (authenticationInfo instanceof SSHPublicKeyFileAuthentication) {
-
- SSHPublicKeyFileAuthentication sshPublicKeyFileAuthentication
- = (SSHPublicKeyFileAuthentication) authenticationInfo;
- String privateKeyFile = sshPublicKeyFileAuthentication.
- getPrivateKeyFile(serverInfo.getUserName(), serverInfo.getHost());
-
- logDebug("The private key file for vanilla SSH " + privateKeyFile);
-
- String publicKeyFile = sshPublicKeyFileAuthentication.
- getPublicKeyFile(serverInfo.getUserName(), serverInfo.getHost());
-
- logDebug("The public key file for vanilla SSH " + publicKeyFile);
-
- try {
- identityFile = GSISSHIdentityFile.newInstance(privateKeyFile, null, defaultJSch);
- } catch (JSchException e) {
- throw new SSHApiException("An exception occurred while initializing keys using files. " +
- "(private key and public key)." +
- "Connecting server - " + serverInfo.getHost() + ":" + serverInfo.getPort() +
- " connecting user name - "
- + serverInfo.getUserName() + " private key file - " + privateKeyFile + ", public key file - " +
- publicKeyFile, e);
- }
-
- // Add identity to identity repository
- GSISSHIdentityRepository identityRepository = new GSISSHIdentityRepository(defaultJSch);
- identityRepository.add(identityFile);
-
- // Set repository to session
- session.setIdentityRepository(identityRepository);
-
- // Set the user info
- SSHKeyPasswordHandler sshKeyPasswordHandler
- = new SSHKeyPasswordHandler((SSHKeyAuthentication) authenticationInfo);
-
- session.setUserInfo(sshKeyPasswordHandler);
-
- } else if (authenticationInfo instanceof SSHPublicKeyAuthentication) {
-
- SSHPublicKeyAuthentication sshPublicKeyAuthentication
- = (SSHPublicKeyAuthentication) authenticationInfo;
- try {
- String name = serverInfo.getUserName() + "_" + serverInfo.getHost();
- identityFile = GSISSHIdentityFile.newInstance(name,
- sshPublicKeyAuthentication.getPrivateKey(serverInfo.getUserName(), serverInfo.getHost()),
- sshPublicKeyAuthentication.getPublicKey(serverInfo.getUserName(), serverInfo.getHost()), defaultJSch);
- } catch (JSchException e) {
- throw new SSHApiException("An exception occurred while initializing keys using byte arrays. " +
- "(private key and public key)." +
- "Connecting server - " + serverInfo.getHost() + ":" + serverInfo.getPort() +
- " connecting user name - "
- + serverInfo.getUserName(), e);
- }
-
- // Add identity to identity repository
- GSISSHIdentityRepository identityRepository = new GSISSHIdentityRepository(defaultJSch);
- identityRepository.add(identityFile);
-
- // Set repository to session
- session.setIdentityRepository(identityRepository);
-
- // Set the user info
- SSHKeyPasswordHandler sshKeyPasswordHandler
- = new SSHKeyPasswordHandler((SSHKeyAuthentication) authenticationInfo);
-
- session.setUserInfo(sshKeyPasswordHandler);
-
- }
-
- // Not a good way, but we dont have any choice
- if (session instanceof ExtendedSession) {
- if (authenticationInfo instanceof GSIAuthenticationInfo) {
- ((ExtendedSession) session).setAuthenticationInfo((GSIAuthenticationInfo) authenticationInfo);
- }
- }
-
- try {
- session.connect(Integer.parseInt(configReader.getConfiguration(SSH_SESSION_TIMEOUT)));
- } catch (Exception e) {
- throw new SSHApiException("An exception occurred while connecting to server." +
- "Connecting server - " + serverInfo.getHost() + ":" + serverInfo.getPort() +
- " connecting user name - "
- + serverInfo.getUserName(), e);
- }
- }
-
- public synchronized JobDescriptor cancelJob(String jobID) throws SSHApiException {
- JobStatus jobStatus = getJobStatus(jobID);
- if (jobStatus == null || jobStatus == JobStatus.U) {
- log.info("Validation before cancel is failed, couldn't found job in remote host to cancel. Job may be already completed|failed|canceled");
- return null;
- }
- RawCommandInfo rawCommandInfo = jobManagerConfiguration.getCancelCommand(jobID);
-
- StandardOutReader stdOutReader = new StandardOutReader();
- log.info("Executing RawCommand : " + rawCommandInfo.getCommand());
- CommandExecutor.executeCommand(rawCommandInfo, this.getSession(), stdOutReader);
- String outputifAvailable = getOutputifAvailable(stdOutReader, "Error reading output of job submission", jobManagerConfiguration.getBaseCancelCommand());
- // this might not be the case for all teh resources, if so Cluster implementation can override this method
- // because here after cancelling we try to get the job description and return it back
- try {
- return this.getJobDescriptorById(jobID);
- } catch (Exception e) {
- //its ok to fail to get status when the job is gone
- return null;
- }
- }
-
- public synchronized String submitBatchJobWithScript(String scriptPath, String workingDirectory) throws SSHApiException {
- this.scpTo(workingDirectory, scriptPath);
-
- // since this is a constant we do not ask users to fill this
-
-// RawCommandInfo rawCommandInfo = new RawCommandInfo(this.installedPath + this.jobManagerConfiguration.getSubmitCommand() + " " +
-// workingDirectory + File.separator + FilenameUtils.getName(scriptPath));
-
- RawCommandInfo rawCommandInfo = jobManagerConfiguration.getSubmitCommand(workingDirectory,scriptPath);
- StandardOutReader standardOutReader = new StandardOutReader();
- log.info("Executing RawCommand : " + rawCommandInfo.getCommand());
- CommandExecutor.executeCommand(rawCommandInfo, this.session, standardOutReader);
-
- //Check whether pbs submission is successful or not, if it failed throw and exception in submitJob method
- // with the error thrown in qsub command
- //
- String outputifAvailable = getOutputifAvailable(standardOutReader,"Error reading output of job submission",jobManagerConfiguration.getBaseSubmitCommand());
- OutputParser outputParser = jobManagerConfiguration.getParser();
- return outputParser.parseJobSubmission(outputifAvailable);
- }
-
- public synchronized String submitBatchJob(JobDescriptor jobDescriptor) throws SSHApiException {
- TransformerFactory factory = TransformerFactory.newInstance();
- URL resource = this.getClass().getClassLoader().getResource(jobManagerConfiguration.getJobDescriptionTemplateName());
-
- if (resource == null) {
- String error = "System configuration file '" + jobManagerConfiguration.getJobDescriptionTemplateName()
- + "' not found in the classpath";
- throw new SSHApiException(error);
- }
-
- Source xslt = new StreamSource(new File(resource.getPath()));
- Transformer transformer;
- StringWriter results = new StringWriter();
- File tempPBSFile = null;
- try {
- // generate the pbs script using xslt
- transformer = factory.newTransformer(xslt);
- Source text = new StreamSource(new ByteArrayInputStream(jobDescriptor.toXML().getBytes()));
- transformer.transform(text, new StreamResult(results));
- String scriptContent = results.toString().replaceAll("^[ |\t]*\n$", "");
- if (scriptContent.startsWith("\n")) {
- scriptContent = scriptContent.substring(1);
- }
-// log.debug("generated PBS:" + results.toString());
-
- // creating a temporary file using pbs script generated above
- int number = new SecureRandom().nextInt();
- number = (number < 0 ? -number : number);
-
- tempPBSFile = new File(Integer.toString(number) + jobManagerConfiguration.getScriptExtension());
- FileUtils.writeStringToFile(tempPBSFile, scriptContent);
-
- //reusing submitBatchJobWithScript method to submit a job
- String jobID = null;
- int retry = 3;
- while(retry>0) {
- try {
- jobID = this.submitBatchJobWithScript(tempPBSFile.getAbsolutePath(),
- jobDescriptor.getWorkingDirectory());
- retry=0;
- } catch (SSHApiException e) {
- retry--;
- if(retry==0) {
- throw e;
- }else{
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e1) {
- log.error(e1.getMessage(), e1);
- }
- log.error("Error occured during job submission but doing a retry");
- }
- }
- }
- log.debug("Job has successfully submitted, JobID : " + jobID);
- if (jobID != null) {
- return jobID.replace("\n", "");
- } else {
- return null;
- }
- } catch (TransformerConfigurationException e) {
- throw new SSHApiException("Error parsing PBS transformation", e);
- } catch (TransformerException e) {
- throw new SSHApiException("Error generating PBS script", e);
- } catch (IOException e) {
- throw new SSHApiException("An exception occurred while connecting to server." +
- "Connecting server - " + serverInfo.getHost() + ":" + serverInfo.getPort() +
- " connecting user name - "
- + serverInfo.getUserName(), e);
- } finally {
- if (tempPBSFile != null) {
- tempPBSFile.delete();
- }
- }
- }
-
-
- public void generateJobScript(JobDescriptor jobDescriptor) throws SSHApiException {
- TransformerFactory factory = TransformerFactory.newInstance();
- URL resource = this.getClass().getClassLoader().getResource(jobManagerConfiguration.getJobDescriptionTemplateName());
-
- if (resource == null) {
- String error = "System configuration file '" + jobManagerConfiguration.getJobDescriptionTemplateName()
- + "' not found in the classpath";
- throw new SSHApiException(error);
- }
-
- Source xslt = new StreamSource(new File(resource.getPath()));
- Transformer transformer;
- StringWriter results = new StringWriter();
- File tempPBSFile = null;
- try {
- // generate the pbs script using xslt
- transformer = factory.newTransformer(xslt);
- Source text = new StreamSource(new ByteArrayInputStream(jobDescriptor.toXML().getBytes()));
- transformer.transform(text, new StreamResult(results));
- String scriptContent = results.toString().replaceAll("^[ |\t]*\n$", "");
- if (scriptContent.startsWith("\n")) {
- scriptContent = scriptContent.substring(1);
- }
-// log.debug("generated PBS:" + results.toString());
-
- // creating a temporary file using pbs script generated above
- int number = new SecureRandom().nextInt();
- number = (number < 0 ? -number : number);
-
- tempPBSFile = new File(Integer.toString(number) + jobManagerConfiguration.getScriptExtension());
- log.info("File Path: " + tempPBSFile.getAbsolutePath());
- log.info("File Content: " + scriptContent);
- FileUtils.writeStringToFile(tempPBSFile, scriptContent);
- } catch (TransformerConfigurationException e) {
- throw new SSHApiException("Error parsing PBS transformation", e);
- } catch (TransformerException e) {
- throw new SSHApiException("Error generating PBS script", e);
- } catch (IOException e) {
- throw new SSHApiException("An exception occurred while connecting to server." +
- "Connecting server - " + serverInfo.getHost() + ":" + serverInfo.getPort() +
- " connecting user name - "
- + serverInfo.getUserName(), e);
- } finally {
- if (tempPBSFile != null) {
- tempPBSFile.delete();
- }
- }
- }
-
-
-
- public synchronized JobDescriptor getJobDescriptorById(String jobID) throws SSHApiException {
- RawCommandInfo rawCommandInfo = jobManagerConfiguration.getMonitorCommand(jobID);
- StandardOutReader stdOutReader = new StandardOutReader();
- log.info("Executing RawCommand : " + rawCommandInfo.getCommand());
- CommandExecutor.executeCommand(rawCommandInfo, this.getSession(), stdOutReader);
- String result = getOutputifAvailable(stdOutReader, "Error getting job information from the resource !",jobManagerConfiguration.getBaseMonitorCommand());
- JobDescriptor jobDescriptor = new JobDescriptor();
- jobManagerConfiguration.getParser().parseSingleJob(jobDescriptor, result);
- return jobDescriptor;
- }
-
- public synchronized JobStatus getJobStatus(String jobID) throws SSHApiException {
- RawCommandInfo rawCommandInfo = jobManagerConfiguration.getMonitorCommand(jobID);
- StandardOutReader stdOutReader = new StandardOutReader();
- log.info("Executing RawCommand : " + rawCommandInfo.getCommand());
- CommandExecutor.executeCommand(rawCommandInfo, this.getSession(), stdOutReader);
- String result = getOutputifAvailable(stdOutReader, "Error getting job information from the resource !", jobManagerConfiguration.getBaseMonitorCommand());
- return jobManagerConfiguration.getParser().parseJobStatus(jobID, result);
- }
-
- @Override
- public String getJobIdByJobName(String jobName, String userName) throws SSHApiException {
- RawCommandInfo rawCommandInfo = jobManagerConfiguration.getJobIdMonitorCommand(jobName, userName);
- StandardOutReader stdOutReader = new StandardOutReader();
- log.info("Executing RawCommand : " + rawCommandInfo.getCommand());
- CommandExecutor.executeCommand(rawCommandInfo, this.getSession(), stdOutReader);
- String result = getOutputifAvailable(stdOutReader, "Error getting job information from the resource !",
- jobManagerConfiguration.getJobIdMonitorCommand(jobName,userName).getCommand());
- return jobManagerConfiguration.getParser().parseJobId(jobName, result);
- }
-
- private static void logDebug(String message) {
- if (log.isDebugEnabled()) {
- log.debug(message);
- }
- }
-
- public JobManagerConfiguration getJobManagerConfiguration() {
- return jobManagerConfiguration;
- }
-
- public void setJobManagerConfiguration(JobManagerConfiguration jobManagerConfiguration) {
- this.jobManagerConfiguration = jobManagerConfiguration;
- }
-
- public synchronized void scpTo(String remoteFile, String localFile) throws SSHApiException {
- int retry = 3;
- while (retry > 0) {
- try {
- if (!session.isConnected()) {
- session.connect();
- }
- log.info("Transfering file:/" + localFile + " To:" + serverInfo.getHost() + ":" + remoteFile);
- SSHUtils.scpTo(remoteFile, localFile, session);
- retry = 0;
- } catch (IOException e) {
- retry--;
- reconnect(serverInfo, authenticationInfo);
- if (retry == 0) {
- throw new SSHApiException("Failed during scping local file:" + localFile + " to remote file "
- + serverInfo.getHost() + ":rFile : " + remoteFile, e);
- }
- } catch (JSchException e) {
- retry--;
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e1) {
- log.error(e1.getMessage(), e1);
- }
- reconnect(serverInfo, authenticationInfo);
- if (retry == 0) {
- throw new SSHApiException("Failed during scping local file:" + localFile + " to remote file "
- + serverInfo.getHost() + ":rFile : " + remoteFile, e);
- }
- }
- }
- }
-
- public synchronized void scpFrom(String remoteFile, String localFile) throws SSHApiException {
- int retry = 3;
- while(retry>0) {
- try {
- if (!session.isConnected()) {
- session.connect();
- }
- log.info("Transfering from:" + serverInfo.getHost() + ":" + remoteFile + " To:" + "file:/" + localFile);
- SSHUtils.scpFrom(remoteFile, localFile, session);
- retry=0;
- } catch (IOException e) {
- retry--;
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e1) {
- log.error(e1.getMessage(), e1);
- }
- reconnect(serverInfo, authenticationInfo);
- if (retry == 0) {
- throw new SSHApiException("Failed during scping local file:" + localFile + " to remote file "
- + serverInfo.getHost() + ":rFile", e);
- }else{
- log.error("Error performing scp but doing a retry");
- }
- } catch (JSchException e) {
- retry--;
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e1) {
- log.error(e1.getMessage(), e1);
- }
- reconnect(serverInfo, authenticationInfo);
- if(retry==0) {
- throw new SSHApiException("Failed during scping local file:" + localFile + " to remote file "
- + serverInfo.getHost() + ":rFile", e);
- }else{
- log.error("Error performing scp but doing a retry");
- }
- }
- }
- }
-
- public synchronized void scpThirdParty(String remoteFileSource, String remoteFileTarget) throws SSHApiException {
- try {
- if(!session.isConnected()){
- session.connect();
- }
- log.info("Transfering from:" + remoteFileSource + " To: " + remoteFileTarget);
- SSHUtils.scpThirdParty(remoteFileSource, remoteFileTarget, session);
- } catch (IOException e) {
- throw new SSHApiException("Failed during scping file:" + remoteFileSource + " to remote file "
- +remoteFileTarget , e);
- } catch (JSchException e) {
- throw new SSHApiException("Failed during scping file:" + remoteFileSource + " to remote file "
- +remoteFileTarget, e);
- }
- }
-
- public synchronized void makeDirectory(String directoryPath) throws SSHApiException {
- int retry = 3;
- while (retry > 0) {
- try {
- if (!session.isConnected()) {
- session.connect();
- }
- log.info("Creating directory: " + serverInfo.getHost() + ":" + directoryPath);
- SSHUtils.makeDirectory(directoryPath, session);
- retry = 0;
- } catch (IOException e) {
- throw new SSHApiException("Failed during creating directory:" + directoryPath + " to remote file "
- + serverInfo.getHost() + ":rFile", e);
- } catch (JSchException e) {
- retry--;
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e1) {
- log.error(e1.getMessage(), e1);
- }
- reconnect(serverInfo, authenticationInfo);
- if (retry == 0) {
- throw new SSHApiException("Failed during creating directory :" + directoryPath + " to remote file "
- + serverInfo.getHost() + ":rFile", e);
- }
- } catch (SSHApiException e) {
- retry--;
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e1) {
- log.error(e1.getMessage(), e1);
- }
- reconnect(serverInfo, authenticationInfo);
- if (retry == 0) {
- throw new SSHApiException("Failed during creating directory :" + directoryPath + " to remote file "
- + serverInfo.getHost() + ":rFile", e);
- }
- }
- }
- }
-
- public synchronized List<String> listDirectory(String directoryPath) throws SSHApiException {
- int retry = 3;
- List<String> files = null;
- while (retry > 0) {
- try {
- if (!session.isConnected()) {
- session.connect();
- }
- log.info("Listing directory: " + serverInfo.getHost() + ":" + directoryPath);
- files = SSHUtils.listDirectory(directoryPath, session);
- retry=0;
- } catch (IOException e) {
- log.error(e.getMessage(), e);
- retry--;
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e1) {
- log.error(e1.getMessage(), e1);
- }
- reconnect(serverInfo, authenticationInfo);
- if (retry == 0) {
- throw new SSHApiException("Failed during listing directory:" + directoryPath + " to remote file ", e);
- }
- } catch (JSchException e) {
- retry--;
- reconnect(serverInfo, authenticationInfo);
- if (retry == 0) {
- throw new SSHApiException("Failed during listing directory :" + directoryPath + " to remote file ", e);
- }
- }catch (SSHApiException e) {
- retry--;
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e1) {
- log.error(e1.getMessage(), e1);
- }
- reconnect(serverInfo, authenticationInfo);
- if (retry == 0) {
- throw new SSHApiException("Failed during listing directory :" + directoryPath + " to remote file "
- + serverInfo.getHost() + ":rFile", e);
- }
- }
- }
- return files;
- }
-
- public synchronized void getJobStatuses(String userName, Map<String,JobStatus> jobIDs)throws SSHApiException {
- int retry = 3;
- RawCommandInfo rawCommandInfo = jobManagerConfiguration.getUserBasedMonitorCommand(userName);
- StandardOutReader stdOutReader = new StandardOutReader();
- while (retry > 0){
- try {
- log.info("Executing RawCommand : " + rawCommandInfo.getCommand());
- CommandExecutor.executeCommand(rawCommandInfo, this.getSession(), stdOutReader);
- retry=0;
- } catch (SSHApiException e) {
- retry--;
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e1) {
- log.error(e1.getMessage(), e1);
- }
- reconnect(serverInfo, authenticationInfo);
- if (retry == 0) {
- throw new SSHApiException("Failed Getting statuses to remote file", e);
- }
- }
- }
- String result = getOutputifAvailable(stdOutReader, "Error getting job information from the resource !", jobManagerConfiguration.getBaseMonitorCommand());
- jobManagerConfiguration.getParser().parseJobStatuses(userName, jobIDs, result);
- }
-
- public ServerInfo getServerInfo() {
- return serverInfo;
- }
-
- public AuthenticationInfo getAuthenticationInfo() {
- return authenticationInfo;
- }
-
- /**
- * This gaurantee to return a valid session
- *
- * @return
- */
- public Session getSession() {
- return this.session;
- }
-
- /**
- * This method will read standard output and if there's any it will be parsed
- *
- * @param jobIDReaderCommandOutput
- * @param errorMsg
- * @return
- * @throws SSHApiException
- */
- private String getOutputifAvailable(StandardOutReader jobIDReaderCommandOutput, String errorMsg, String command) throws SSHApiException {
- String stdOutputString = jobIDReaderCommandOutput.getStdOutputString();
- String stdErrorString = jobIDReaderCommandOutput.getStdErrorString();
- log.info("StandardOutput Returned:" + stdOutputString);
- log.info("StandardError Returned:" +stdErrorString);
- String[] list = command.split(File.separator);
- command = list[list.length - 1];
- // We are checking for stderr containing the command issued. Thus ignores the verbose logs in stderr.
- if (stdErrorString != null && stdErrorString.contains(command.trim()) && !stdErrorString.contains("Warning")) {
- log.error("Standard Error output : " + stdErrorString);
- throw new SSHApiException(errorMsg + "\n\r StandardOutput: "+ stdOutputString + "\n\r StandardError: "+ stdErrorString);
- }else if(stdOutputString.contains("error")){
- throw new SSHApiException(errorMsg + "\n\r StandardOutput: "+ stdOutputString + "\n\r StandardError: "+ stdErrorString);
- }
- return stdOutputString;
- }
-
- public void disconnect() throws SSHApiException {
- if(getSession().isConnected()){
- getSession().disconnect();
- }
- }
- /**
-
- * the file system abstraction which will be necessary to
- * perform certain file system operations.
- * @return the new default JSch implementation.
- * @throws JSchException
- * known host keys cannot be loaded.
- */
- protected JSch createJSch(AuthenticationInfo authenticationInfo) throws JSchException {
-// final File fs = new File(System.getProperty("user.home"));
- if(authenticationInfo instanceof GSIAuthenticationInfo){
- final JSch jsch = new ExtendedJSch();
-// knownHosts(jsch, fs);
- return jsch;
- }else{
- final JSch jsch = new JSch();
-// knownHosts(jsch, fs);
- return jsch;
- }
-
- }
- /**
- * Create a new remote session for the requested address.
- *
- * @param user
- * login to authenticate as.
- * @param host
- * server name to connect to.
- * @param port
- * port number of the SSH daemon (typically 22).
- * @return new session instance, but otherwise unconfigured.
- * @throws JSchException
- * the session could not be created.
- */
- private Session createSession(JSch jsch, String user, String host, int port) throws JSchException {
- final Session session = jsch.getSession(user, host, port);
- // We retry already in getSession() method. JSch must not retry
- // on its own.
- session.setConfig("MaxAuthTries", "1"); //$NON-NLS-1$ //$NON-NLS-2$
- session.setTimeout(Integer.parseInt(configReader.getConfiguration(SSH_SESSION_TIMEOUT)));
- java.util.Properties config = this.configReader.getProperties();
- session.setConfig(config);
-
- return session;
- }
- private static void knownHosts(final JSch sch,final File home) throws JSchException {
- if (home == null)
- return;
- final File known_hosts = new File(new File(home, ".ssh"), "known_hosts"); //$NON-NLS-1$ //$NON-NLS-2$
- try {
- final FileInputStream in = new FileInputStream(known_hosts);
- try {
- sch.setKnownHosts(in);
- } finally {
- in.close();
- }
- } catch (FileNotFoundException none) {
- // Oh well. They don't have a known hosts in home.
- } catch (IOException err) {
- // Oh well. They don't have a known hosts in home.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/JobStatus.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/JobStatus.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/JobStatus.java
deleted file mode 100644
index 648d955..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/JobStatus.java
+++ /dev/null
@@ -1,110 +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.impl;
-
- /**
- * This will contains all the PBS specific job statuses.
- * C - Job is completed after having run/
- * E - Job is exiting after having run.
- * H - Job is held.
- * Q - job is queued, eligible to run or routed.
- * R - job is running.
- * T - job is being moved to new location.
- * W - job is waiting for its execution time
- * (-a option) to be reached.
- * S - (Unicos only) job is suspend.
- */
- public enum JobStatus {
- C, E, H, Q, R, T, W, S,U,F,CA,CD,CF,CG,NF,PD,PR,TO,qw,t,r,h,Er,Eqw,PEND,RUN,PSUSP,USUSP,SSUSP,DONE,EXIT,UNKWN,ZOMBI;
-
- public static JobStatus fromString(String status){
- if(status != null){
- if("C".equals(status)){
- return JobStatus.C;
- }else if("E".equals(status)){
- return JobStatus.E;
- }else if("H".equals(status)){
- return JobStatus.H;
- }else if("Q".equals(status)){
- return JobStatus.Q;
- }else if("R".equals(status)){
- return JobStatus.R;
- }else if("T".equals(status)){
- return JobStatus.T;
- }else if("W".equals(status)){
- return JobStatus.W;
- }else if("S".equals(status)){
- return JobStatus.S;
- }else if("F".equals(status)){
- return JobStatus.F;
- }else if("S".equals(status)){
- return JobStatus.S;
- }else if("CA".equals(status)){
- return JobStatus.CA;
- }else if("CF".equals(status)){
- return JobStatus.CF;
- }else if("CD".equals(status)){
- return JobStatus.CD;
- }else if("CG".equals(status)){
- return JobStatus.CG;
- }else if("NF".equals(status)){
- return JobStatus.NF;
- }else if("PD".equals(status)){
- return JobStatus.PD;
- }else if("PR".equals(status)){
- return JobStatus.PR;
- }else if("TO".equals(status)){
- return JobStatus.TO;
- }else if("U".equals(status)){
- return JobStatus.U;
- }else if("qw".equals(status)){
- return JobStatus.qw;
- }else if("t".equals(status)){
- return JobStatus.t;
- }else if("r".equals(status)){
- return JobStatus.r;
- }else if("h".equals(status)){
- return JobStatus.h;
- }else if("Er".equals(status)){
- return JobStatus.Er;
- }else if("Eqw".equals(status)){
- return JobStatus.Er;
- }else if("RUN".equals(status)){ // LSF starts here
- return JobStatus.RUN;
- }else if("PEND".equals(status)){
- return JobStatus.PEND;
- }else if("DONE".equals(status)){
- return JobStatus.DONE;
- }else if("PSUSP".equals(status)){
- return JobStatus.PSUSP;
- }else if("USUSP".equals(status)){
- return JobStatus.USUSP;
- }else if("SSUSP".equals(status)){
- return JobStatus.SSUSP;
- }else if("EXIT".equals(status)){
- return JobStatus.EXIT;
- }else if("ZOMBI".equals(status)){
- return JobStatus.ZOMBI;
- }
- }
- return JobStatus.U;
- }
- }
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/PBSCluster.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/PBSCluster.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/PBSCluster.java
deleted file mode 100644
index def84d5..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/PBSCluster.java
+++ /dev/null
@@ -1,45 +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.impl;
-
-import org.apache.airavata.gfac.ssh.api.*;
-import org.apache.airavata.gfac.ssh.api.authentication.*;
-import org.apache.airavata.gfac.ssh.api.job.JobManagerConfiguration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * This is the default implementation of a cluster.
- * this has most of the methods to be used by the end user of the
- * library.
- */
-public class PBSCluster extends GSISSHAbstractCluster {
- private static final Logger log = LoggerFactory.getLogger(PBSCluster.class);
-
-
- public PBSCluster(JobManagerConfiguration jobManagerConfiguration) {
- super(jobManagerConfiguration);
- }
- public PBSCluster(ServerInfo serverInfo, AuthenticationInfo authenticationInfo, JobManagerConfiguration config) throws SSHApiException {
- super(serverInfo, authenticationInfo,config);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/RawCommandInfo.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/RawCommandInfo.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/RawCommandInfo.java
deleted file mode 100644
index 9ac2ba0..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/RawCommandInfo.java
+++ /dev/null
@@ -1,55 +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.impl;
-
-import org.apache.airavata.gfac.ssh.api.CommandInfo;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 8/14/13
- * Time: 5:18 PM
- */
-
-/**
- * The raw command information. String returned by getCommand is directly executed in SSH
- * shell. E.g :- getCommand return string set for rawCommand - "/opt/torque/bin/qsub /home/ogce/test.pbs".
- */
-public class RawCommandInfo implements CommandInfo {
-
- private String rawCommand;
-
- public RawCommandInfo(String cmd) {
- this.rawCommand = cmd;
- }
-
- public String getCommand() {
- return this.rawCommand;
- }
-
- public String getRawCommand() {
- return rawCommand;
- }
-
- public void setRawCommand(String rawCommand) {
- this.rawCommand = rawCommand;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/SSHUserInfo.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/SSHUserInfo.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/SSHUserInfo.java
deleted file mode 100644
index e878dff..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/SSHUserInfo.java
+++ /dev/null
@@ -1,63 +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.impl;
-
-import com.jcraft.jsch.UserInfo;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 9/20/13
- * Time: 2:31 PM
- */
-
-public class SSHUserInfo implements UserInfo {
-
- private String password;
-
- public SSHUserInfo(String pwd) {
- this.password = pwd;
- }
-
- public String getPassphrase() {
- return this.password;
- }
-
- public String getPassword() {
- return this.password;
- }
-
- public boolean promptPassword(String message) {
- return false; //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public boolean promptPassphrase(String message) {
- return false; //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public boolean promptYesNo(String message) {
- return false; //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public void showMessage(String message) {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/StandardOutReader.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/StandardOutReader.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/StandardOutReader.java
deleted file mode 100644
index 265a57d..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/StandardOutReader.java
+++ /dev/null
@@ -1,79 +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.impl;
-
-import com.jcraft.jsch.Channel;
-
-import org.apache.airavata.gfac.ssh.api.CommandOutput;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-public class StandardOutReader implements CommandOutput {
-
- private static final Logger logger = LoggerFactory.getLogger(StandardOutReader.class);
- String stdOutputString = null;
- ByteArrayOutputStream errorStream = new ByteArrayOutputStream();
- public void onOutput(Channel channel) {
- try {
- StringBuffer pbsOutput = new StringBuffer("");
- InputStream inputStream = channel.getInputStream();
- byte[] tmp = new byte[1024];
- do {
- while (inputStream.available() > 0) {
- int i = inputStream.read(tmp, 0, 1024);
- if (i < 0) break;
- pbsOutput.append(new String(tmp, 0, i));
- }
- } while (!channel.isClosed()) ;
- String output = pbsOutput.toString();
- this.setStdOutputString(output);
- } catch (IOException e) {
- logger.error(e.getMessage(), e);
- }
-
- }
-
-
- public void exitCode(int code) {
- System.out.println("Program exit code - " + code);
- }
-
- public String getStdOutputString() {
- return stdOutputString;
- }
-
- public void setStdOutputString(String stdOutputString) {
- this.stdOutputString = stdOutputString;
- }
-
- public String getStdErrorString() {
- return errorStream.toString();
- }
-
- public OutputStream getStandardError() {
- return errorStream;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/SystemCommandOutput.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/SystemCommandOutput.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/SystemCommandOutput.java
deleted file mode 100644
index 24d218b..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/SystemCommandOutput.java
+++ /dev/null
@@ -1,78 +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.impl;
-
-import com.jcraft.jsch.Channel;
-import org.apache.airavata.gfac.ssh.api.CommandOutput;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 8/15/13
- * Time: 10:44 AM
- */
-
-public class SystemCommandOutput implements CommandOutput {
-
- private static final Logger logger = LoggerFactory.getLogger(SystemCommandOutput.class);
- public void onOutput(Channel channel) {
- try {
- InputStream inputStream = channel.getInputStream();
-
- byte[] tmp = new byte[1024];
- while (true) {
- while (inputStream.available() > 0) {
- int i = inputStream.read(tmp, 0, 1024);
- if (i < 0) break;
- System.out.print(new String(tmp, 0, i));
- }
- if (channel.isClosed()) {
- System.out.println("exit-status: " + channel.getExitStatus());
- break;
- }
- try {
- Thread.sleep(1000);
- } catch (Exception ignored) {
- }
- }
-
- } catch (IOException e) {
- logger.error(e.getMessage(), e);
- }
-
- }
-
- public OutputStream getStandardError() {
- return System.err;
- }
-
- public void exitCode(int code) {
- System.out.println("Program exit code - " + code);
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/authentication/DefaultPasswordAuthenticationInfo.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/authentication/DefaultPasswordAuthenticationInfo.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/authentication/DefaultPasswordAuthenticationInfo.java
deleted file mode 100644
index 8e76528..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/authentication/DefaultPasswordAuthenticationInfo.java
+++ /dev/null
@@ -1,48 +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.impl.authentication;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 9/20/13
- * Time: 12:15 PM
- */
-
-import org.apache.airavata.gfac.ssh.api.authentication.SSHPasswordAuthentication;
-
-/**
- * An authenticator used for raw SSH sessions. Gives SSH user name, password
- * directly.
- * This is only an example implementation.
- */
-public class DefaultPasswordAuthenticationInfo implements SSHPasswordAuthentication {
-
- private String password;
-
- public DefaultPasswordAuthenticationInfo(String pwd) {
- this.password = pwd;
- }
-
- public String getPassword(String userName, String hostName) {
- return password;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/authentication/DefaultPublicKeyAuthentication.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/authentication/DefaultPublicKeyAuthentication.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/authentication/DefaultPublicKeyAuthentication.java
deleted file mode 100644
index be8e1f9..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/authentication/DefaultPublicKeyAuthentication.java
+++ /dev/null
@@ -1,68 +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.impl.authentication;
-
-import org.apache.airavata.gfac.ssh.api.authentication.SSHPublicKeyAuthentication;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 10/4/13
- * Time: 11:44 AM
- */
-
-/**
- * Default public key authentication.
- * Note : This is only a sample implementation.
- */
-public class DefaultPublicKeyAuthentication implements SSHPublicKeyAuthentication {
-
- private byte[] privateKey;
- private byte[] publicKey;
- private String passPhrase = null;
-
- public DefaultPublicKeyAuthentication(byte[] priv, byte[] pub) {
- this.privateKey = priv;
- this.publicKey = pub;
- }
-
- public DefaultPublicKeyAuthentication(byte[] priv, byte[] pub, String pass) {
- this.privateKey = priv;
- this.publicKey = pub;
- this.passPhrase = pass;
- }
-
- public String getPassPhrase() {
- return passPhrase;
- }
-
- public void bannerMessage(String message) {
- System.out.println(message);
- }
-
- public byte[] getPrivateKey(String userName, String hostName) {
- return privateKey;
- }
-
- public byte[] getPublicKey(String userName, String hostName) {
- return publicKey;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/authentication/DefaultPublicKeyFileAuthentication.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/authentication/DefaultPublicKeyFileAuthentication.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/authentication/DefaultPublicKeyFileAuthentication.java
deleted file mode 100644
index 5351dd2..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/authentication/DefaultPublicKeyFileAuthentication.java
+++ /dev/null
@@ -1,70 +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.impl.authentication;
-
-import org.apache.airavata.gfac.ssh.api.authentication.SSHPublicKeyFileAuthentication;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 10/4/13
- * Time: 11:40 AM
- */
-
-/**
- * Default public key authentication using files.
- * Note : This is only a sample implementation.
- */
-public class DefaultPublicKeyFileAuthentication implements SSHPublicKeyFileAuthentication {
-
- private String publicKeyFile;
- private String privateKeyFile;
- private String passPhrase = null;
-
- public DefaultPublicKeyFileAuthentication(String pubFile, String privFile) {
- this.publicKeyFile = pubFile;
- this.privateKeyFile = privFile;
-
- }
-
- public DefaultPublicKeyFileAuthentication(String pubFile, String privFile, String pass) {
- this.publicKeyFile = pubFile;
- this.privateKeyFile = privFile;
- this.passPhrase = pass;
-
- }
-
- public String getPassPhrase() {
- return passPhrase;
- }
-
- public void bannerMessage(String message) {
- System.out.println(message);
- }
-
- public String getPublicKeyFile(String userName, String hostName) {
- return publicKeyFile;
- }
-
- public String getPrivateKeyFile(String userName, String hostName) {
- return privateKeyFile;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/authentication/MyProxyAuthenticationInfo.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/authentication/MyProxyAuthenticationInfo.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/authentication/MyProxyAuthenticationInfo.java
deleted file mode 100644
index 5e47a86..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/authentication/MyProxyAuthenticationInfo.java
+++ /dev/null
@@ -1,108 +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.impl.authentication;
-
-import org.apache.airavata.gfac.ssh.api.authentication.GSIAuthenticationInfo;
-import org.globus.myproxy.MyProxy;
-import org.globus.myproxy.MyProxyException;
-import org.ietf.jgss.GSSCredential;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 8/14/13
- * Time: 5:22 PM
- */
-
-public class MyProxyAuthenticationInfo extends GSIAuthenticationInfo {
-
- public static final String X509_CERT_DIR = "X509_CERT_DIR";
- private String userName;
- private String password;
- private String myProxyUrl;
- private int myProxyPort;
- private int lifeTime;
-
- public MyProxyAuthenticationInfo(String userName, String password, String myProxyUrl, int myProxyPort,
- int life, String certificatePath) {
- this.userName = userName;
- this.password = password;
- this.myProxyUrl = myProxyUrl;
- this.myProxyPort = myProxyPort;
- this.lifeTime = life;
- properties.setProperty(X509_CERT_DIR, certificatePath);
- }
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public String getMyProxyUrl() {
- return myProxyUrl;
- }
-
- public void setMyProxyUrl(String myProxyUrl) {
- this.myProxyUrl = myProxyUrl;
- }
-
- public int getMyProxyPort() {
- return myProxyPort;
- }
-
- public void setMyProxyPort(int myProxyPort) {
- this.myProxyPort = myProxyPort;
- }
-
- public int getLifeTime() {
- return lifeTime;
- }
-
- public void setLifeTime(int lifeTime) {
- this.lifeTime = lifeTime;
- }
-
- public GSSCredential getCredentials() throws SecurityException {
- return getMyProxyCredentials();
- }
-
- private GSSCredential getMyProxyCredentials() throws SecurityException {
- MyProxy myproxy = new MyProxy(this.myProxyUrl, this.myProxyPort);
- try {
- return myproxy.get(this.getUserName(), this.password, this.lifeTime);
- } catch (MyProxyException e) {
- throw new SecurityException("Error getting proxy credentials", e);
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/jsch/ExtendedJSch.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/jsch/ExtendedJSch.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/jsch/ExtendedJSch.java
deleted file mode 100644
index cee852f..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/jsch/ExtendedJSch.java
+++ /dev/null
@@ -1,64 +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.jsch;
-
-import com.jcraft.jsch.ExtendedSession;
-import com.jcraft.jsch.JSch;
-import com.jcraft.jsch.JSchException;
-import com.jcraft.jsch.Session;
-import org.apache.airavata.gfac.ssh.api.authentication.GSIAuthenticationInfo;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 8/15/13
- * Time: 10:03 AM
- */
-
-/**
- * Extended JSch to incorporate authentication info.
- */
-public class ExtendedJSch extends JSch {
-
- private GSIAuthenticationInfo authenticationInfo;
-
- public ExtendedJSch() {
- super();
- }
-
- public GSIAuthenticationInfo getAuthenticationInfo() {
- return authenticationInfo;
- }
-
- public void setAuthenticationInfo(GSIAuthenticationInfo authenticationInfo) {
- this.authenticationInfo = authenticationInfo;
- }
-
- public Session getSession(String username, String host, int port) throws JSchException {
-
- if(host==null){
- throw new JSchException("host must not be null.");
- }
- Session s = new ExtendedSession(this, username, host, port);
- return s;
-
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/listener/JobSubmissionListener.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/listener/JobSubmissionListener.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/listener/JobSubmissionListener.java
deleted file mode 100644
index 21aa1e3..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/listener/JobSubmissionListener.java
+++ /dev/null
@@ -1,81 +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.listener;
-
-import org.apache.airavata.gfac.ssh.api.SSHApiException;
-import org.apache.airavata.gfac.ssh.api.job.JobDescriptor;
-import org.apache.airavata.gfac.ssh.impl.JobStatus;
-
-/**
- * This interface can be implemented by the end user of the API
- * to do desired operations based on the job status change. API has a
- * default joblistener which can be used by the end users, but its
- * configurable and can be parseSingleJob to jobsubmission methods.
- */
-public abstract class JobSubmissionListener {
-
- private JobStatus jobStatus = JobStatus.U;
-
- /**
- * This can be usd to perform some operation during status change
- *
- * @param jobDescriptor
- * @throws SSHApiException
- */
- public abstract void statusChanged(JobDescriptor jobDescriptor) throws SSHApiException;
-
- /**
- * This can be usd to perform some operation during status change
- * @param jobStatus
- * @throws SSHApiException
- */
- public abstract void statusChanged(JobStatus jobStatus) throws SSHApiException;
-
-
- public JobStatus getJobStatus() {
- return jobStatus;
- }
-
- public void setJobStatus(JobStatus jobStatus) {
- this.jobStatus = jobStatus;
- }
-
- /**
- * This method is used to block the process until the currentStatus of the job is DONE or FAILED
- */
- public void waitFor() throws SSHApiException{
- while (!isJobDone()) {
- synchronized (this) {
- try {
- wait();
- } catch (InterruptedException e) {}
- }
- }
- }
-
- /**
- * BAsed on the implementation user can define how to decide the job done
- * scenario
- * @return
- * @throws SSHApiException
- */
- public abstract boolean isJobDone() throws SSHApiException;
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/util/CommonUtils.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/util/CommonUtils.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/util/CommonUtils.java
deleted file mode 100644
index 6ff4fa6..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/util/CommonUtils.java
+++ /dev/null
@@ -1,81 +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.util;
-
-import org.apache.airavata.gfac.ssh.api.job.*;
-import org.apache.airavata.gfac.ssh.impl.JobStatus;
-
-public class CommonUtils {
- /**
- * This returns true if the give job is finished
- * otherwise false
- *
- * @param job
- * @return
- */
- public static boolean isJobFinished(JobDescriptor job) {
- if (JobStatus.C.toString().equals(job.getStatus())) {
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * This will read
- *
- * @param maxWalltime
- * @return
- */
- public static String maxWallTimeCalculator(int maxWalltime) {
- if (maxWalltime < 60) {
- return "00:" + maxWalltime + ":00";
- } else {
- int minutes = maxWalltime % 60;
- int hours = maxWalltime / 60;
- return hours + ":" + minutes + ":00";
- }
- }
- public static String maxWallTimeCalculatorForLSF(int maxWalltime) {
- if (maxWalltime < 60) {
- return "00:" + maxWalltime;
- } else {
- int minutes = maxWalltime % 60;
- int hours = maxWalltime / 60;
- return hours + ":" + minutes;
- }
- }
- public static JobManagerConfiguration getPBSJobManager(String installedPath) {
- return new PBSJobConfiguration("PBSTemplate.xslt",".pbs", installedPath, new PBSOutputParser());
- }
-
- public static JobManagerConfiguration getSLURMJobManager(String installedPath) {
- return new SlurmJobConfiguration("SLURMTemplate.xslt", ".slurm", installedPath, new SlurmOutputParser());
- }
-
- public static JobManagerConfiguration getUGEJobManager(String installedPath) {
- return new UGEJobConfiguration("UGETemplate.xslt", ".pbs", installedPath, new UGEOutputParser());
- }
-
- public static JobManagerConfiguration getLSFJobManager(String installedPath) {
- return new LSFJobConfiguration("LSFTemplate.xslt", ".lsf", installedPath, new LSFOutputParser());
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/util/SSHAPIUIKeyboardInteractive.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/util/SSHAPIUIKeyboardInteractive.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/util/SSHAPIUIKeyboardInteractive.java
deleted file mode 100644
index bd700e9..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/util/SSHAPIUIKeyboardInteractive.java
+++ /dev/null
@@ -1,73 +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.util;
-
-import com.jcraft.jsch.UIKeyboardInteractive;
-import com.jcraft.jsch.UserInfo;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 10/4/13
- * Time: 8:34 AM
- */
-
-/**
- * This is dummy class, the keyboard interactivity is not really used when acting as an API.
- * But to get things working we have this.
- */
-public class SSHAPIUIKeyboardInteractive implements UIKeyboardInteractive, UserInfo {
-
- private String password;
-
- public SSHAPIUIKeyboardInteractive(String pwd) {
- this.password = pwd;
- }
-
- public String[] promptKeyboardInteractive(String destination, String name,
- String instruction, String[] prompt, boolean[] echo) {
- return null;
- }
-
- public String getPassphrase() {
- return password;
- }
-
- public String getPassword() {
- return password;
- }
-
- public boolean promptPassword(String message) {
- return false; //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public boolean promptPassphrase(String message) {
- return false; //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public boolean promptYesNo(String message) {
- return false; //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public void showMessage(String message) {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/util/SSHKeyPasswordHandler.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/util/SSHKeyPasswordHandler.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/util/SSHKeyPasswordHandler.java
deleted file mode 100644
index 569cd3c..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/util/SSHKeyPasswordHandler.java
+++ /dev/null
@@ -1,68 +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.util;
-
-import com.jcraft.jsch.UserInfo;
-import org.apache.airavata.gfac.ssh.api.authentication.SSHKeyAuthentication;
-import sun.reflect.generics.reflectiveObjects.NotImplementedException;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 10/4/13
- * Time: 2:22 PM
- */
-
-/**
- * This class is used to get the pass phrase to decrypt public/private keys.
- */
-public class SSHKeyPasswordHandler implements UserInfo {
-
- private SSHKeyAuthentication keyAuthenticationHandler;
-
- public SSHKeyPasswordHandler(SSHKeyAuthentication handler) {
- this.keyAuthenticationHandler = handler;
- }
-
- public String getPassphrase() {
- return keyAuthenticationHandler.getPassPhrase();
- }
-
- public String getPassword() {
- throw new NotImplementedException();
- }
-
- public boolean promptPassword(String message) {
- return false;
- }
-
- public boolean promptPassphrase(String message) {
- return true;
- }
-
- public boolean promptYesNo(String message) {
- return false;
- }
-
- public void showMessage(String message) {
- keyAuthenticationHandler.bannerMessage(message);
- }
-}
[3/6] airavata git commit: Removed gsissh module from tools
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/JobDescriptor.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/JobDescriptor.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/JobDescriptor.java
deleted file mode 100644
index 7e936ec..0000000
--- a/tools/gsissh/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/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/JobManagerConfiguration.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/JobManagerConfiguration.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/JobManagerConfiguration.java
deleted file mode 100644
index d58a994..0000000
--- a/tools/gsissh/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/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/JobType.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/JobType.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/JobType.java
deleted file mode 100644
index 556f4ef..0000000
--- a/tools/gsissh/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
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/LSFJobConfiguration.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/LSFJobConfiguration.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/LSFJobConfiguration.java
deleted file mode 100644
index f9c7f33..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/LSFJobConfiguration.java
+++ /dev/null
@@ -1,121 +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;
-import org.apache.commons.io.FilenameUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-
-public class LSFJobConfiguration implements JobManagerConfiguration {
- private final static Logger logger = LoggerFactory.getLogger(LSFJobConfiguration.class);
-
- private String jobDescriptionTemplateName;
-
- private String scriptExtension;
-
- private String installedPath;
-
- private OutputParser parser;
-
- public LSFJobConfiguration(){
- // this can be used to construct and use setter methods to set all the params in order
- }
- public LSFJobConfiguration(String jobDescriptionTemplateName,
- String scriptExtension,String installedPath,OutputParser parser) {
- this.jobDescriptionTemplateName = jobDescriptionTemplateName;
- this.scriptExtension = scriptExtension;
- this.parser = parser;
- if (installedPath.endsWith("/") || installedPath.isEmpty()) {
- this.installedPath = installedPath;
- } else {
- this.installedPath = installedPath + "/";
- }
- }
-
- @Override
- public RawCommandInfo getCancelCommand(String jobID) {
- return new RawCommandInfo(this.installedPath + "bkill " + jobID);
- }
-
- @Override
- public String getJobDescriptionTemplateName() {
- return jobDescriptionTemplateName;
- }
-
- @Override
- public RawCommandInfo getMonitorCommand(String jobID) {
- return new RawCommandInfo(this.installedPath + "bjobs " + jobID);
- }
-
- @Override
- public RawCommandInfo getUserBasedMonitorCommand(String userName) {
- return new RawCommandInfo(this.installedPath + "bjobs -u " + userName);
- }
-
- @Override
- public RawCommandInfo getJobIdMonitorCommand(String jobName, String userName) {
- return new RawCommandInfo(this.installedPath + "bjobs -J " + jobName);
- }
-
- @Override
- public String getScriptExtension() {
- return scriptExtension;
- }
-
- @Override
- public RawCommandInfo getSubmitCommand(String workingDirectory, String pbsFilePath) {
- return new RawCommandInfo(this.installedPath + "bsub < " +
- workingDirectory + File.separator + FilenameUtils.getName(pbsFilePath));
- }
-
- @Override
- public OutputParser getParser() {
- return parser;
- }
-
- public void setParser(OutputParser parser) {
- this.parser = parser;
- }
-
- @Override
- public String getInstalledPath() {
- return installedPath;
- }
-
-
- @Override
- public String getBaseCancelCommand() {
- return "bkill";
- }
-
- @Override
- public String getBaseMonitorCommand() {
- return "bjobs";
- }
-
- @Override
- public String getBaseSubmitCommand() {
- return "bsub";
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/LSFOutputParser.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/LSFOutputParser.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/LSFOutputParser.java
deleted file mode 100644
index c6dea17..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/LSFOutputParser.java
+++ /dev/null
@@ -1,130 +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.SSHApiException;
-import org.apache.airavata.gfac.ssh.impl.JobStatus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class LSFOutputParser implements OutputParser {
- private final static Logger logger = LoggerFactory.getLogger(LSFOutputParser.class);
-
- @Override
- public void parseSingleJob(JobDescriptor jobDescriptor, String rawOutput) throws SSHApiException {
- logger.debug(rawOutput);
- //todo we need to implement this but we are not using it airavata runtime
- // if someone is using the gsissh as a tool this will be useful to get a descriptive information about a single job
- }
-
- @Override
- public String parseJobSubmission(String rawOutput) throws SSHApiException {
- logger.debug(rawOutput);
- return rawOutput.substring(rawOutput.indexOf("<")+1,rawOutput.indexOf(">"));
- }
-
- @Override
- public JobStatus parseJobStatus(String jobID, String rawOutput) throws SSHApiException {
- boolean jobFount = false;
- logger.debug(rawOutput);
- //todo this is not used anymore
- return JobStatus.C;
- }
-
- @Override
- public void parseJobStatuses(String userName, Map<String, JobStatus> statusMap, String rawOutput) throws SSHApiException {
- logger.debug(rawOutput);
-
- String[] info = rawOutput.split("\n");
-// int lastStop = 0;
- for (String jobID : statusMap.keySet()) {
- String jobName = jobID.split(",")[1];
- boolean found = false;
- for (int i = 0; i < info.length; i++) {
- if (info[i].contains(jobName.substring(0,8))) {
- // now starts processing this line
- logger.info(info[i]);
- String correctLine = info[i];
- String[] columns = correctLine.split(" ");
- List<String> columnList = new ArrayList<String>();
- for (String s : columns) {
- if (!"".equals(s)) {
- columnList.add(s);
- }
- }
-// lastStop = i + 1;
- try {
- statusMap.put(jobID, JobStatus.valueOf(columnList.get(2)));
- }catch(IndexOutOfBoundsException e){
- statusMap.put(jobID, JobStatus.valueOf("U"));
- }
- found = true;
- break;
- }
- }
- if(!found)
- logger.error("Couldn't find the status of the Job with JobName: " + jobName + "Job Id: " + jobID.split(",")[0]);
- }
- }
-
- @Override
- public String parseJobId(String jobName, String rawOutput) throws SSHApiException {
- String regJobId = "jobId";
- Pattern pattern = Pattern.compile("(?=(?<" + regJobId + ">\\d+)\\s+\\w+\\s+" + jobName + ")"); // regex - look ahead and match
- if (rawOutput != null) {
- Matcher matcher = pattern.matcher(rawOutput);
- if (matcher.find()) {
- return matcher.group(regJobId);
- } else {
- logger.error("No match is found for JobName");
- return null;
- }
- } else {
- logger.error("Error: RawOutput shouldn't be null");
- return null;
- }
- }
-
- public static void main(String[] args) {
- String test = "Job <2477982> is submitted to queue <short>.";
- System.out.println(test.substring(test.indexOf("<")+1, test.indexOf(">")));
- String test1 = "JOBID USER STAT QUEUE FROM_HOST EXEC_HOST JOB_NAME SUBMIT_TIME\n" +
- "2636607 lg11w RUN long ghpcc06 c11b02 *069656647 Mar 7 00:58\n" +
- "2636582 lg11w RUN long ghpcc06 c02b01 2134490944 Mar 7 00:48";
- Map<String, JobStatus> statusMap = new HashMap<String, JobStatus>();
- statusMap.put("2477983,2134490944", JobStatus.U);
- LSFOutputParser lsfOutputParser = new LSFOutputParser();
- try {
- lsfOutputParser.parseJobStatuses("cjh", statusMap, test1);
- } catch (SSHApiException e) {
- logger.error(e.getMessage(), e);
- }
- System.out.println(statusMap.get("2477983,2134490944"));
-
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/OutputParser.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/OutputParser.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/OutputParser.java
deleted file mode 100644
index 9730c33..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/OutputParser.java
+++ /dev/null
@@ -1,67 +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.SSHApiException;
-import org.apache.airavata.gfac.ssh.impl.JobStatus;
-
-import java.util.Map;
-
-public interface OutputParser {
-
- /**
- * Tihs can be used to fill a jobdescriptor based on the output
- * @param descriptor
- * @return
- */
- public void parseSingleJob(JobDescriptor descriptor, String rawOutput)throws SSHApiException;
-
- /**
- * This can be used to parseSingleJob the result of a job submission to get the JobID
- * @param rawOutput
- * @return
- */
- public String parseJobSubmission(String rawOutput)throws SSHApiException;
-
-
- /**
- * This can be used to get the job status from the output
- * @param jobID
- * @param rawOutput
- */
- public JobStatus parseJobStatus(String jobID, String rawOutput)throws SSHApiException;
-
- /**
- * This can be used to parseSingleJob a big output and get multipleJob statuses
- * @param statusMap list of status map will return and key will be the job ID
- * @param rawOutput
- */
- public void parseJobStatuses(String userName, Map<String, JobStatus> statusMap, String rawOutput)throws SSHApiException;
-
- /**
- * filter the jobId value of given JobName from rawOutput
- * @param jobName
- * @param rawOutput
- * @return
- * @throws SSHApiException
- */
- public String parseJobId(String jobName, String rawOutput) throws SSHApiException;
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/PBSJobConfiguration.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/PBSJobConfiguration.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/PBSJobConfiguration.java
deleted file mode 100644
index 0179e01..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/PBSJobConfiguration.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.api.job;
-
-import org.apache.airavata.gfac.ssh.impl.RawCommandInfo;
-import org.apache.commons.io.FilenameUtils;
-
-import java.io.File;
-
-public class PBSJobConfiguration implements JobManagerConfiguration {
-
- private String jobDescriptionTemplateName;
-
- private String scriptExtension;
-
- private String installedPath;
-
- private OutputParser parser;
-
- public PBSJobConfiguration() {
- // this can be used to construct and use setter methods to set all the params in order
- }
-
- public PBSJobConfiguration(String jobDescriptionTemplateName,
- String scriptExtension, String installedPath, OutputParser parser) {
- this.jobDescriptionTemplateName = jobDescriptionTemplateName;
- this.scriptExtension = scriptExtension;
- this.parser = parser;
- if (installedPath.endsWith("/")) {
- this.installedPath = installedPath;
- } else {
- this.installedPath = installedPath + "/";
- }
- }
-
- public RawCommandInfo getCancelCommand(String jobID) {
- return new RawCommandInfo(this.installedPath + "qdel " + jobID);
- }
-
- public String getJobDescriptionTemplateName() {
- return jobDescriptionTemplateName;
- }
-
- public void setJobDescriptionTemplateName(String jobDescriptionTemplateName) {
- this.jobDescriptionTemplateName = jobDescriptionTemplateName;
- }
-
- public RawCommandInfo getMonitorCommand(String jobID) {
- return new RawCommandInfo(this.installedPath + "qstat -f " + jobID);
- }
-
- public String getScriptExtension() {
- return scriptExtension;
- }
-
- public RawCommandInfo getSubmitCommand(String workingDirectory, String pbsFilePath) {
- return new RawCommandInfo(this.installedPath + "qsub " +
- workingDirectory + File.separator + FilenameUtils.getName(pbsFilePath));
- }
-
- public String getInstalledPath() {
- return installedPath;
- }
-
- public void setInstalledPath(String installedPath) {
- this.installedPath = installedPath;
- }
-
- public OutputParser getParser() {
- return parser;
- }
-
- public void setParser(OutputParser parser) {
- this.parser = parser;
- }
-
- public RawCommandInfo getUserBasedMonitorCommand(String userName) {
- return new RawCommandInfo(this.installedPath + "qstat -u " + userName);
- }
-
- @Override
- public RawCommandInfo getJobIdMonitorCommand(String jobName, String userName) {
- // For PBS there is no option to get jobDetails by JobName, so we search with userName
- return new RawCommandInfo(this.installedPath + "qstat -u " + userName);
- }
-
- @Override
- public String getBaseCancelCommand() {
- return "qdel";
- }
-
- @Override
- public String getBaseMonitorCommand() {
- return "qstat";
- }
-
- @Override
- public String getBaseSubmitCommand() {
- return "qsub ";
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/PBSOutputParser.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/PBSOutputParser.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/PBSOutputParser.java
deleted file mode 100644
index 2f17787..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/PBSOutputParser.java
+++ /dev/null
@@ -1,212 +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.SSHApiException;
-import org.apache.airavata.gfac.ssh.impl.JobStatus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class PBSOutputParser implements OutputParser {
- private static final Logger log = LoggerFactory.getLogger(PBSOutputParser.class);
-
- public void parseSingleJob(JobDescriptor jobDescriptor, String rawOutput) {
- log.debug(rawOutput);
- String[] info = rawOutput.split("\n");
- String[] line;
- for (int i = 0; i < info.length; i++) {
- if (info[i].contains("=")) {
- line = info[i].split("=", 2);
- } else {
- line = info[i].split(":", 2);
- }
- if (line.length >= 2) {
- String header = line[0].trim();
- log.debug("Header = " + header);
- String value = line[1].trim();
- log.debug("value = " + value);
-
- if (header.equals("Variable_List")) {
- while (info[i + 1].startsWith("\t")) {
- value += info[i + 1];
- i++;
- }
- value = value.replaceAll("\t", "");
- jobDescriptor.setVariableList(value);
- } else if ("Job Id".equals(header)) {
- jobDescriptor.setJobID(value);
- } else if ("Job_Name".equals(header)) {
- jobDescriptor.setJobName(value);
- } else if ("Account_Name".equals(header)) {
- jobDescriptor.setAcountString(value);
- } else if ("job_state".equals(header)) {
- jobDescriptor.setStatus(value);
- } else if ("Job_Owner".equals(header)) {
- jobDescriptor.setOwner(value);
- } else if ("resources_used.cput".equals(header)) {
- jobDescriptor.setUsedCPUTime(value);
- } else if ("resources_used.mem".equals(header)) {
- jobDescriptor.setUsedMemory(value);
- } else if ("resources_used.walltime".equals(header)) {
- jobDescriptor.setEllapsedTime(value);
- } else if ("job_state".equals(header)) {
- jobDescriptor.setStatus(value);
- } else if ("queue".equals(header))
- jobDescriptor.setQueueName(value);
- else if ("ctime".equals(header)) {
- jobDescriptor.setCTime(value);
- } else if ("qtime".equals(header)) {
- jobDescriptor.setQTime(value);
- } else if ("mtime".equals(header)) {
- jobDescriptor.setMTime(value);
- } else if ("start_time".equals(header)) {
- jobDescriptor.setSTime(value);
- } else if ("comp_time".equals(header)) {
- jobDescriptor.setCompTime(value);
- } else if ("exec_host".equals(header)) {
- jobDescriptor.setExecuteNode(value);
- } else if ("Output_Path".equals(header)) {
- if (info[i + 1].contains("=") || info[i + 1].contains(":"))
- jobDescriptor.setStandardOutFile(value);
- else {
- jobDescriptor.setStandardOutFile(value + info[i + 1].trim());
- i++;
- }
- } else if ("Error_Path".equals(header)) {
- if (info[i + 1].contains("=") || info[i + 1].contains(":"))
- jobDescriptor.setStandardErrorFile(value);
- else {
- String st = info[i + 1].trim();
- jobDescriptor.setStandardErrorFile(value + st);
- i++;
- }
-
- } else if ("submit_args".equals(header)) {
- while (i + 1 < info.length) {
- if (info[i + 1].startsWith("\t")) {
- value += info[i + 1];
- i++;
- } else
- break;
- }
- value = value.replaceAll("\t", "");
- jobDescriptor.setSubmitArgs(value);
- }
- }
- }
- }
-
- public String parseJobSubmission(String rawOutput) {
- log.debug(rawOutput);
- return rawOutput; //In PBS stdout is going to be directly the jobID
- }
-
- public JobStatus parseJobStatus(String jobID, String rawOutput) {
- boolean jobFount = false;
- log.debug(rawOutput);
- String[] info = rawOutput.split("\n");
- String[] line = null;
- int index = 0;
- for (String anInfo : info) {
- index++;
- if (anInfo.contains("Job Id:")) {
- if (anInfo.contains(jobID)) {
- jobFount = true;
- break;
- }
- }
- }
- if (jobFount) {
- for (int i=index;i<info.length;i++) {
- String anInfo = info[i];
- if (anInfo.contains("=")) {
- line = anInfo.split("=", 2);
- if (line.length != 0) {
- if (line[0].contains("job_state")) {
- return JobStatus.valueOf(line[1].replaceAll(" ", ""));
- }
- }
- }
- }
- }
- return null;
- }
-
- public void parseJobStatuses(String userName, Map<String, JobStatus> statusMap, String rawOutput) {
- log.debug(rawOutput);
- String[] info = rawOutput.split("\n");
-// int lastStop = 0;
- for (String jobID : statusMap.keySet()) {
- String jobName = jobID.split(",")[1];
- boolean found = false;
- for (int i = 0; i < info.length; i++) {
- if (info[i].contains(jobName.substring(0,8))) {
- // now starts processing this line
- log.info(info[i]);
- String correctLine = info[i];
- String[] columns = correctLine.split(" ");
- List<String> columnList = new ArrayList<String>();
- for (String s : columns) {
- if (!"".equals(s)) {
- columnList.add(s);
- }
- }
-// lastStop = i + 1;
- try {
- statusMap.put(jobID, JobStatus.valueOf(columnList.get(9)));
- }catch(IndexOutOfBoundsException e){
- statusMap.put(jobID, JobStatus.valueOf("U"));
- }
- found = true;
- break;
- }
- }
- if(!found)
- log.error("Couldn't find the status of the Job with JobName: " + jobName + "Job Id: " + jobID.split(",")[0]);
- }
- }
-
- @Override
- public String parseJobId(String jobName, String rawOutput) throws SSHApiException {
- String regJobId = "jobId";
- Pattern pattern = Pattern.compile("\\s*(?<" + regJobId + ">[^\\s]*).* " + jobName + " "); // regex , JOB_ID will come as first column
- if (rawOutput != null) {
- Matcher matcher = pattern.matcher(rawOutput);
- if (matcher.find()) {
- return matcher.group(regJobId);
- } else {
- log.error("No match is found for JobName");
- return null;
- }
- } else {
- log.error("Error: RawOutput shouldn't be null");
- return null;
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/SlurmJobConfiguration.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/SlurmJobConfiguration.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/SlurmJobConfiguration.java
deleted file mode 100644
index 54d8f40..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/SlurmJobConfiguration.java
+++ /dev/null
@@ -1,117 +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;
-import org.apache.commons.io.FilenameUtils;
-
-import java.io.File;
-
-public class SlurmJobConfiguration implements JobManagerConfiguration{
-
- private String jobDescriptionTemplateName;
-
- private String scriptExtension;
-
- private String installedPath;
-
- private OutputParser parser;
-
- public SlurmJobConfiguration(){
- // this can be used to construct and use setter methods to set all the params in order
- }
- public SlurmJobConfiguration(String jobDescriptionTemplateName,
- String scriptExtension,String installedPath,OutputParser parser) {
- this.jobDescriptionTemplateName = jobDescriptionTemplateName;
- this.scriptExtension = scriptExtension;
- this.parser = parser;
- if (installedPath.endsWith("/")) {
- this.installedPath = installedPath;
- } else {
- this.installedPath = installedPath + "/";
- }
- }
-
- public RawCommandInfo getCancelCommand(String jobID) {
- return new RawCommandInfo(this.installedPath + "scancel " + jobID);
- }
-
- public String getJobDescriptionTemplateName() {
- return jobDescriptionTemplateName;
- }
-
- public void setJobDescriptionTemplateName(String jobDescriptionTemplateName) {
- this.jobDescriptionTemplateName = jobDescriptionTemplateName;
- }
-
- public RawCommandInfo getMonitorCommand(String jobID) {
- return new RawCommandInfo(this.installedPath + "squeue -j " + jobID);
- }
-
- public String getScriptExtension() {
- return scriptExtension;
- }
-
- public RawCommandInfo getSubmitCommand(String workingDirectory,String pbsFilePath) {
- return new RawCommandInfo(this.installedPath + "sbatch " +
- workingDirectory + File.separator + FilenameUtils.getName(pbsFilePath));
- }
-
- public String getInstalledPath() {
- return installedPath;
- }
-
- public void setInstalledPath(String installedPath) {
- this.installedPath = installedPath;
- }
-
- public OutputParser getParser() {
- return parser;
- }
-
- public void setParser(OutputParser parser) {
- this.parser = parser;
- }
-
- public RawCommandInfo getUserBasedMonitorCommand(String userName) {
- return new RawCommandInfo(this.installedPath + "squeue -u " + userName);
- }
-
- @Override
- public RawCommandInfo getJobIdMonitorCommand(String jobName, String userName) {
- return new RawCommandInfo(this.installedPath + "squeue -n " + jobName + " -u " + userName);
- }
-
- @Override
- public String getBaseCancelCommand() {
- return "scancel";
- }
-
- @Override
- public String getBaseMonitorCommand() {
- return "squeue";
- }
-
- @Override
- public String getBaseSubmitCommand() {
- return "sbatch";
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/SlurmOutputParser.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/SlurmOutputParser.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/SlurmOutputParser.java
deleted file mode 100644
index 11fb4ce..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/SlurmOutputParser.java
+++ /dev/null
@@ -1,190 +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.SSHApiException;
-import org.apache.airavata.gfac.ssh.impl.JobStatus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class SlurmOutputParser implements OutputParser {
- private static final Logger log = LoggerFactory.getLogger(SlurmOutputParser.class);
- public static final int JOB_NAME_OUTPUT_LENGTH = 8;
- public static final String STATUS = "status";
-
- public void parseSingleJob(JobDescriptor descriptor, String rawOutput) throws SSHApiException {
- log.info(rawOutput);
- String[] info = rawOutput.split("\n");
- String lastString = info[info.length - 1];
- if (lastString.contains("JOB ID")) {
- // because there's no state
- descriptor.setStatus("U");
- } else {
- int column = 0;
- System.out.println(lastString);
- for (String each : lastString.split(" ")) {
- if (each.trim().isEmpty()) {
- continue;
- } else {
- switch (column) {
- case 0:
- descriptor.setJobID(each);
- column++;
- break;
- case 1:
- descriptor.setPartition(each);
- column++;
- break;
- case 2:
- descriptor.setJobName(each);
- column++;
- break;
- case 3:
- descriptor.setUserName(each);
- column++;
- break;
- case 4:
- descriptor.setStatus(each);
- column++;
- break;
- case 5:
- descriptor.setUsedCPUTime(each);
- column++;
- break;
- case 6:
- try {
- int nodes = Integer.parseInt(each);
- descriptor.setNodes(nodes);
- }catch (Exception e){
- log.error("Node count read from command output is not an integer !!!");
- }
- column++;
- break;
- case 7:
- descriptor.setNodeList(each);
- column++;
- break;
- }
- }
- }
- }
-
- }
-
- /**
- * This can be used to parseSingleJob the outpu of sbatch and extrac the jobID from the content
- *
- * @param rawOutput
- * @return
- */
- public String parseJobSubmission(String rawOutput) throws SSHApiException {
- // FIXME : use regex to match correct jobId;
- log.info(rawOutput);
- String[] info = rawOutput.split("\n");
- for (String anInfo : info) {
- if (anInfo.contains("Submitted batch job")) {
- String[] split = anInfo.split("Submitted batch job");
- return split[1].trim();
- }
- }
- return "";
-// throw new SSHApiException(rawOutput); //todo//To change body of implemented methods use File | Settings | File Templates.
- }
-
- public JobStatus parseJobStatus(String jobID, String rawOutput) throws SSHApiException {
- log.info(rawOutput);
- Pattern pattern = Pattern.compile(jobID + "(?=\\s+\\S+\\s+\\S+\\s+\\S+\\s+(?<" + STATUS + ">\\w+))");
- Matcher matcher = pattern.matcher(rawOutput);
- if (matcher.find()) {
- return JobStatus.valueOf(matcher.group(STATUS));
- }
- return null;
- }
-
- public void parseJobStatuses(String userName, Map<String, JobStatus> statusMap, String rawOutput) throws SSHApiException {
- log.debug(rawOutput);
- String[] info = rawOutput.split("\n");
- String lastString = info[info.length - 1];
- if (lastString.contains("JOBID") || lastString.contains("PARTITION")) {
- log.info("There are no jobs with this username ... ");
- return;
- }
-// int lastStop = 0;
- for (String jobID : statusMap.keySet()) {
- String jobId = jobID.split(",")[0];
- String jobName = jobID.split(",")[1];
- boolean found = false;
- for (int i = 0; i < info.length; i++) {
- if (info[i].contains(jobName.substring(0, 8))) {
- // now starts processing this line
- log.info(info[i]);
- String correctLine = info[i];
- String[] columns = correctLine.split(" ");
- List<String> columnList = new ArrayList<String>();
- for (String s : columns) {
- if (!"".equals(s)) {
- columnList.add(s);
- }
- }
- try {
- statusMap.put(jobID, JobStatus.valueOf(columnList.get(4)));
- } catch (IndexOutOfBoundsException e) {
- statusMap.put(jobID, JobStatus.valueOf("U"));
- }
- found = true;
- break;
- }
- }
- if (!found) {
- log.error("Couldn't find the status of the Job with JobName: " + jobName + "Job Id: " + jobId);
- }
- }
- }
-
- @Override
- public String parseJobId(String jobName, String rawOutput) throws SSHApiException {
- String regJobId = "jobId";
- if (jobName == null) {
- return null;
- } else if(jobName.length() > JOB_NAME_OUTPUT_LENGTH) {
- jobName = jobName.substring(0, JOB_NAME_OUTPUT_LENGTH);
- }
- Pattern pattern = Pattern.compile("(?=(?<" + regJobId + ">\\d+)\\s+\\w+\\s+" + jobName + ")"); // regex - look ahead and match
- if (rawOutput != null) {
- Matcher matcher = pattern.matcher(rawOutput);
- if (matcher.find()) {
- return matcher.group(regJobId);
- } else {
- log.error("No match is found for JobName");
- return null;
- }
- } else {
- log.error("Error: RawOutput shouldn't be null");
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/UGEJobConfiguration.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/UGEJobConfiguration.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/UGEJobConfiguration.java
deleted file mode 100644
index 4fbbe30..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/UGEJobConfiguration.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.api.job;
-
-import org.apache.airavata.gfac.ssh.impl.RawCommandInfo;
-import org.apache.commons.io.FilenameUtils;
-
-import java.io.File;
-
-public class UGEJobConfiguration implements JobManagerConfiguration {
-
- private String jobDescriptionTemplateName;
-
- private String scriptExtension;
-
- private String installedPath;
-
- private OutputParser parser;
-
- public UGEJobConfiguration() {
- // this can be used to construct and use setter methods to set all the params in order
- }
-
- public UGEJobConfiguration(String jobDescriptionTemplateName,
- String scriptExtension, String installedPath, OutputParser parser) {
- this.jobDescriptionTemplateName = jobDescriptionTemplateName;
- this.scriptExtension = scriptExtension;
- this.parser = parser;
- if (installedPath.endsWith("/")) {
- this.installedPath = installedPath;
- } else {
- this.installedPath = installedPath + "/";
- }
- }
-
- public RawCommandInfo getCancelCommand(String jobID) {
- return new RawCommandInfo(this.installedPath + "qdel " + jobID);
- }
-
- public String getJobDescriptionTemplateName() {
- return jobDescriptionTemplateName;
- }
-
- public void setJobDescriptionTemplateName(String jobDescriptionTemplateName) {
- this.jobDescriptionTemplateName = jobDescriptionTemplateName;
- }
-
- public RawCommandInfo getMonitorCommand(String jobID) {
- return new RawCommandInfo(this.installedPath + "qstat -j " + jobID);
- }
-
- public String getScriptExtension() {
- return scriptExtension;
- }
-
- public RawCommandInfo getSubmitCommand(String workingDirectory, String pbsFilePath) {
- return new RawCommandInfo(this.installedPath + "qsub " +
- workingDirectory + File.separator + FilenameUtils.getName(pbsFilePath));
- }
-
- public String getInstalledPath() {
- return installedPath;
- }
-
- public void setInstalledPath(String installedPath) {
- this.installedPath = installedPath;
- }
-
- public OutputParser getParser() {
- return parser;
- }
-
- public void setParser(OutputParser parser) {
- this.parser = parser;
- }
-
- public RawCommandInfo getUserBasedMonitorCommand(String userName) {
- return new RawCommandInfo(this.installedPath + "qstat -u " + userName);
- }
-
- @Override
- public RawCommandInfo getJobIdMonitorCommand(String jobName, String userName) {
- // For PBS there is no option to get jobDetails by JobName, so we search with userName
- return new RawCommandInfo(this.installedPath + "qstat -u " + userName);
- }
-
- @Override
- public String getBaseCancelCommand() {
- return "qdel";
- }
-
- @Override
- public String getBaseMonitorCommand() {
- return "qstat";
- }
-
- @Override
- public String getBaseSubmitCommand() {
- return "qsub ";
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/UGEOutputParser.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/UGEOutputParser.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/UGEOutputParser.java
deleted file mode 100644
index a6cc3ed..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/job/UGEOutputParser.java
+++ /dev/null
@@ -1,188 +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.SSHApiException;
-import org.apache.airavata.gfac.ssh.impl.JobStatus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class UGEOutputParser implements OutputParser{
- private static final Logger log = LoggerFactory.getLogger(PBSOutputParser.class);
- public static final String JOB_ID = "jobId";
-
- public void parseSingleJob(JobDescriptor jobDescriptor, String rawOutput) {
- log.debug(rawOutput);
- String[] info = rawOutput.split("\n");
- String[] line;
- for (int i = 0; i < info.length; i++) {
- if (info[i].contains("=")) {
- line = info[i].split("=", 2);
- } else {
- line = info[i].split(":", 2);
- }
- if (line.length >= 2) {
- String header = line[0].trim();
- log.debug("Header = " + header);
- String value = line[1].trim();
- log.debug("value = " + value);
-
- if (header.equals("Variable_List")) {
- while (info[i + 1].startsWith("\t")) {
- value += info[i + 1];
- i++;
- }
- value = value.replaceAll("\t", "");
- jobDescriptor.setVariableList(value);
- } else if ("Job Id".equals(header)) {
- jobDescriptor.setJobID(value);
- } else if ("Job_Name".equals(header)) {
- jobDescriptor.setJobName(value);
- } else if ("Account_Name".equals(header)) {
- jobDescriptor.setAcountString(value);
- } else if ("job_state".equals(header)) {
- jobDescriptor.setStatus(value);
- } else if ("Job_Owner".equals(header)) {
- jobDescriptor.setOwner(value);
- } else if ("resources_used.cput".equals(header)) {
- jobDescriptor.setUsedCPUTime(value);
- } else if ("resources_used.mem".equals(header)) {
- jobDescriptor.setUsedMemory(value);
- } else if ("resources_used.walltime".equals(header)) {
- jobDescriptor.setEllapsedTime(value);
- } else if ("job_state".equals(header)) {
- jobDescriptor.setStatus(value);
- } else if ("queue".equals(header))
- jobDescriptor.setQueueName(value);
- else if ("ctime".equals(header)) {
- jobDescriptor.setCTime(value);
- } else if ("qtime".equals(header)) {
- jobDescriptor.setQTime(value);
- } else if ("mtime".equals(header)) {
- jobDescriptor.setMTime(value);
- } else if ("start_time".equals(header)) {
- jobDescriptor.setSTime(value);
- } else if ("comp_time".equals(header)) {
- jobDescriptor.setCompTime(value);
- } else if ("exec_host".equals(header)) {
- jobDescriptor.setExecuteNode(value);
- } else if ("Output_Path".equals(header)) {
- if (info[i + 1].contains("=") || info[i + 1].contains(":"))
- jobDescriptor.setStandardOutFile(value);
- else {
- jobDescriptor.setStandardOutFile(value + info[i + 1].trim());
- i++;
- }
- } else if ("Error_Path".equals(header)) {
- if (info[i + 1].contains("=") || info[i + 1].contains(":"))
- jobDescriptor.setStandardErrorFile(value);
- else {
- String st = info[i + 1].trim();
- jobDescriptor.setStandardErrorFile(value + st);
- i++;
- }
-
- } else if ("submit_args".equals(header)) {
- while (i + 1 < info.length) {
- if (info[i + 1].startsWith("\t")) {
- value += info[i + 1];
- i++;
- } else
- break;
- }
- value = value.replaceAll("\t", "");
- jobDescriptor.setSubmitArgs(value);
- }
- }
- }
- }
-
- public String parseJobSubmission(String rawOutput) {
- log.debug(rawOutput);
- if (rawOutput != null && !rawOutput.isEmpty()) {
- String[] info = rawOutput.split("\n");
- String lastLine = info[info.length - 1];
- return lastLine.split(" ")[2]; // In PBS stdout is going to be directly the jobID
- } else {
- return "";
- }
- }
-
- public JobStatus parseJobStatus(String jobID, String rawOutput) {
- Pattern pattern = Pattern.compile("job_number:[\\s]+" + jobID);
- Matcher matcher = pattern.matcher(rawOutput);
- if (matcher.find()) {
- return JobStatus.Q; // fixme; return correct status.
- }
- return JobStatus.U;
- }
-
- public void parseJobStatuses(String userName, Map<String, JobStatus> statusMap, String rawOutput) {
- log.debug(rawOutput);
- String[] info = rawOutput.split("\n");
- int lastStop = 0;
- for (String jobID : statusMap.keySet()) {
- for(int i=lastStop;i<info.length;i++){
- if(jobID.split(",")[0].contains(info[i].split(" ")[0]) && !"".equals(info[i].split(" ")[0])){
- // now starts processing this line
- log.info(info[i]);
- String correctLine = info[i];
- String[] columns = correctLine.split(" ");
- List<String> columnList = new ArrayList<String>();
- for (String s : columns) {
- if (!"".equals(s)) {
- columnList.add(s);
- }
- }
- lastStop = i+1;
- if ("E".equals(columnList.get(4))) {
- // There is another status with the same letter E other than error status
- // to avoid that we make a small tweek to the job status
- columnList.set(4, "Er");
- }
- statusMap.put(jobID, JobStatus.valueOf(columnList.get(4)));
- break;
- }
- }
- }
- }
-
- @Override
- public String parseJobId(String jobName, String rawOutput) throws SSHApiException {
- if (jobName.length() > 10) {
- jobName = jobName.substring(0, 10);
- }
- Pattern pattern = Pattern.compile("(?<" + JOB_ID + ">\\S+)\\s+\\S+\\s+(" + jobName + ")");
- Matcher matcher = pattern.matcher(rawOutput);
- if (matcher.find()) {
- return matcher.group(JOB_ID);
- }
- return null;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/config/ConfigReader.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/config/ConfigReader.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/config/ConfigReader.java
deleted file mode 100644
index 9658fba..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/config/ConfigReader.java
+++ /dev/null
@@ -1,76 +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.config;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Properties;
-
-/**
- * Reads basic configurations.
- */
-public class ConfigReader {
-
- private static final String CONFIGURATION_FILE = "gsissh.properties";
-
-
- private Properties properties;
-
- /**
- * Reads configurations from the class path configuration file.
- * @throws IOException If an error occurred while reading configurations.
- */
- public ConfigReader() throws IOException {
- this.properties = getPropertiesFromClasspath(CONFIGURATION_FILE);
- }
-
- private Properties getPropertiesFromClasspath(String propFileName) throws IOException {
- Properties props = new Properties();
- InputStream inputStream = this.getClass().getClassLoader()
- .getResourceAsStream(propFileName);
-
- if (inputStream == null) {
- throw new FileNotFoundException("System configuration file '" + propFileName
- + "' not found in the classpath");
- }
-
- props.load(inputStream);
-
- return props;
- }
-
- public String getConfiguration(String key) {
- return this.properties.getProperty(key);
- }
-
-
- /**
- * Gets all the SSH related properties used by JSch.
- * @return All properties.
- */
- public Properties getProperties() {
- return this.properties;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/DefaultJobSubmissionListener.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/DefaultJobSubmissionListener.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/DefaultJobSubmissionListener.java
deleted file mode 100644
index d60ea32..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/impl/DefaultJobSubmissionListener.java
+++ /dev/null
@@ -1,42 +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.impl;
-
-import org.apache.airavata.gfac.ssh.api.SSHApiException;
-import org.apache.airavata.gfac.ssh.api.job.JobDescriptor;
-import org.apache.airavata.gfac.ssh.listener.JobSubmissionListener;
-
-public class DefaultJobSubmissionListener extends JobSubmissionListener {
-
- public void statusChanged(JobDescriptor jobDescriptor) throws SSHApiException {
- System.out.println("Job status has changed to : " + jobDescriptor.getStatus());
- }
-
- @Override
- public void statusChanged(JobStatus jobStatus) throws SSHApiException {
- System.out.println("Job status has changed to : " + jobStatus.toString());
- }
-
- @Override
- public boolean isJobDone() throws SSHApiException {
- return getJobStatus().equals(JobStatus.C);
- }
-}
[6/6] airavata git commit: Removed gsissh module from tools
Posted by sh...@apache.org.
Removed gsissh module from tools
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/13c2e79e
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/13c2e79e
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/13c2e79e
Branch: refs/heads/master
Commit: 13c2e79e416d95cc04a8b0fabd8bac5df862cd87
Parents: 2835d09
Author: Shameera Rathanyaka <sh...@gmail.com>
Authored: Fri Jun 5 01:26:34 2015 -0400
Committer: Shameera Rathanyaka <sh...@gmail.com>
Committed: Fri Jun 5 01:26:34 2015 -0400
----------------------------------------------------------------------
modules/distribution/server/pom.xml | 632 --------
.../gfac/gfac-monitor/gfac-hpc-monitor/pom.xml | 158 --
tools/gsissh/README.txt | 8 -
tools/gsissh/pom.xml | 156 --
tools/gsissh/src/main/java/SSHDemo.java | 242 ---
.../java/com/jcraft/jsch/ExtendedSession.java | 41 -
.../com/jcraft/jsch/GSISSHIdentityFile.java | 129 --
.../jcraft/jsch/GSISSHIdentityRepository.java | 29 -
.../UserAuthGSSAPIWithMICGSSCredentials.java | 308 ----
.../illinois/ncsa/BCGSS/BCGSSContextImpl.java | 1447 ------------------
.../illinois/ncsa/BCGSS/CircularByteBuffer.java | 824 ----------
.../ncsa/BCGSS/GlobusTlsCipherFactory.java | 63 -
.../illinois/ncsa/BCGSS/GlobusTlsClient.java | 247 ---
.../edu/illinois/ncsa/BCGSS/TlsHandlerUtil.java | 282 ----
.../airavata/gfac/gsi/ssh/GSSContextX509.java | 210 ---
.../airavata/gfac/gsi/ssh/api/Cluster.java | 162 --
.../gfac/gsi/ssh/api/CommandExecutor.java | 278 ----
.../airavata/gfac/gsi/ssh/api/CommandInfo.java | 34 -
.../gfac/gsi/ssh/api/CommandOutput.java | 49 -
.../apache/airavata/gfac/gsi/ssh/api/Core.java | 59 -
.../apache/airavata/gfac/gsi/ssh/api/Node.java | 104 --
.../gfac/gsi/ssh/api/SSHApiException.java | 36 -
.../airavata/gfac/gsi/ssh/api/ServerInfo.java | 65 -
.../api/authentication/AuthenticationInfo.java | 32 -
.../authentication/GSIAuthenticationInfo.java | 43 -
.../authentication/SSHKeyAuthentication.java | 46 -
.../SSHPasswordAuthentication.java | 43 -
.../SSHPublicKeyAuthentication.java | 54 -
.../SSHPublicKeyFileAuthentication.java | 52 -
.../gfac/gsi/ssh/api/job/JobDescriptor.java | 473 ------
.../ssh/api/job/JobManagerConfiguration.java | 51 -
.../airavata/gfac/gsi/ssh/api/job/JobType.java | 32 -
.../gsi/ssh/api/job/LSFJobConfiguration.java | 121 --
.../gfac/gsi/ssh/api/job/LSFOutputParser.java | 130 --
.../gfac/gsi/ssh/api/job/OutputParser.java | 67 -
.../gsi/ssh/api/job/PBSJobConfiguration.java | 119 --
.../gfac/gsi/ssh/api/job/PBSOutputParser.java | 212 ---
.../gsi/ssh/api/job/SlurmJobConfiguration.java | 117 --
.../gfac/gsi/ssh/api/job/SlurmOutputParser.java | 190 ---
.../gsi/ssh/api/job/UGEJobConfiguration.java | 119 --
.../gfac/gsi/ssh/api/job/UGEOutputParser.java | 188 ---
.../gfac/gsi/ssh/config/ConfigReader.java | 76 -
.../ssh/impl/DefaultJobSubmissionListener.java | 42 -
.../gsi/ssh/impl/GSISSHAbstractCluster.java | 767 ----------
.../airavata/gfac/gsi/ssh/impl/JobStatus.java | 110 --
.../airavata/gfac/gsi/ssh/impl/PBSCluster.java | 45 -
.../gfac/gsi/ssh/impl/RawCommandInfo.java | 55 -
.../airavata/gfac/gsi/ssh/impl/SSHUserInfo.java | 63 -
.../gfac/gsi/ssh/impl/StandardOutReader.java | 79 -
.../gfac/gsi/ssh/impl/SystemCommandOutput.java | 78 -
.../DefaultPasswordAuthenticationInfo.java | 48 -
.../DefaultPublicKeyAuthentication.java | 68 -
.../DefaultPublicKeyFileAuthentication.java | 70 -
.../MyProxyAuthenticationInfo.java | 108 --
.../gfac/gsi/ssh/jsch/ExtendedJSch.java | 64 -
.../gsi/ssh/listener/JobSubmissionListener.java | 81 -
.../airavata/gfac/gsi/ssh/util/CommonUtils.java | 81 -
.../ssh/util/SSHAPIUIKeyboardInteractive.java | 73 -
.../gsi/ssh/util/SSHKeyPasswordHandler.java | 68 -
.../airavata/gfac/gsi/ssh/util/SSHUtils.java | 757 ---------
.../gsissh/src/main/resources/LSFTemplate.xslt | 93 --
.../gsissh/src/main/resources/PBSTemplate.xslt | 82 -
.../src/main/resources/SLURMTemplate.xslt | 78 -
.../gsissh/src/main/resources/UGETemplate.xslt | 74 -
.../main/resources/schemas/PBSJobDescriptor.xsd | 114 --
.../resources/schemas/gsissh-schemas.xsdconfig | 14 -
.../gfac/ssh/config/ConfigReaderTest.java | 37 -
.../impl/DefaultSSHApiTestWithMyProxyAuth.java | 77 -
.../gfac/ssh/impl/VanilaTestWithSSHAuth.java | 262 ----
.../gsissh/src/test/resources/gsissh.properties | 26 -
.../gsissh/src/test/resources/log4j.properties | 34 -
tools/gsissh/src/test/resources/sleep.pbs | 32 -
tools/gsissh/src/test/resources/test.pbs | 30 -
73 files changed, 11338 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/modules/distribution/server/pom.xml
----------------------------------------------------------------------
diff --git a/modules/distribution/server/pom.xml b/modules/distribution/server/pom.xml
deleted file mode 100644
index 8d645df..0000000
--- a/modules/distribution/server/pom.xml
+++ /dev/null
@@ -1,632 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- you under the Apache License, Version 2.0 (theÏ "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of
- the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
- by applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY ~ KIND, either express or implied. See the License for the specific
- language governing permissions and limitations under the License. -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.apache.airavata</groupId>
- <artifactId>distribution</artifactId>
- <version>0.16-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>apache-airavata-server</artifactId>
- <name>Airavata server distribution</name>
- <packaging>pom</packaging>
- <url>http://airavata.apache.org/</url>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>2.8</version>
- <executions>
- <execution>
- <id>unpack</id>
- <phase>compile</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-server-configuration</artifactId>
- <version>${project.version}</version>
- <type>jar</type>
- </artifactItem>
- </artifactItems>
- <!--includes>**/*.war</includes -->
- <outputDirectory>${project.build.directory}/conf</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.codehaus.gmaven</groupId>
- <artifactId>gmaven-plugin</artifactId>
- <version>1.4</version>
- <executions>
- <execution>
- <id>generate-timestamp</id>
- <phase>package</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- <configuration>
- <source>
- import java.util.Date
- import java.text.MessageFormat
- project.properties['buildTimestamp'] =
- MessageFormat.format("{0,date,dd-MM-yyyy}", new
- Date())
- </source>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>distribution-package</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <finalName>${archieve.name}-${project.version}</finalName>
- <descriptors>
- <descriptor>src/main/assembly/bin-assembly.xml</descriptor>
- <!-- <descriptor>src/main/assembly/src-assembly.xml</descriptor> -->
- </descriptors>
- <attach>false</attach>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.7</version>
- <executions>
- <execution>
- <id>attach-artifacts</id>
- <phase>package</phase>
- <goals>
- <goal>attach-artifact</goal>
- </goals>
- <configuration>
- <artifacts>
- <artifact>
- <file>${airavata.bin.zip}</file>
- <type>zip</type>
- <classifier>bin</classifier>
- </artifact>
- <artifact>
- <file>${airavata.bin.tar.gz}</file>
- <type>tar.gz</type>
- <classifier>bin</classifier>
- </artifact>
- </artifacts>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>${derby.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derbyclient</artifactId>
- <version>${derby.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derbynet</artifactId>
- <version>${derby.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derbytools</artifactId>
- <version>${derby.version}</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </dependency>
- <dependency>
- <groupId>com.amazonaws</groupId>
- <artifactId>aws-java-sdk</artifactId>
- <version>1.9.0</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>net.java.dev.jets3t</groupId>
- <artifactId>jets3t</artifactId>
- <version>0.8.0</version>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>3.2.1</version>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.4</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>2.4</version>
- </dependency>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.6</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-standalone-server</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>app-catalog-cpi</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-messaging-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>app-catalog-data</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-common-utils</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.ws.commons.schema</groupId>
- <artifactId>XmlSchema</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xmlParserAPIs</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.neethi</groupId>
- <artifactId>neethi</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-orchestrator-service</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.ws.commons.schema</groupId>
- <artifactId>XmlSchema</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xmlParserAPIs</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.neethi</groupId>
- <artifactId>neethi</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-orchestrator-stubs</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-gfac-stubs</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-orchestrator-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-registry-cpi</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-experiment-catalog</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-data-models</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-credential-store</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-gfac-ssh</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!--<dependency> -->
- <!--<groupId>org.apache.airavata</groupId> -->
- <!--<artifactId>airavata-gfac-gram</artifactId> -->
- <!--<version>${project.version}</version> -->
- <!--</dependency> -->
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-gfac-bes</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-gfac-gsissh</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-gfac-hpc-monitor</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-gfac-local</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!--<dependency> -->
- <!--<groupId>org.apache.airavata</groupId> -->
- <!--<artifactId>airavata-gfac-hadoop</artifactId> -->
- <!--<version>${project.version}</version> -->
- <!--</dependency> -->
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-gfac-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-gfac-service</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!--<dependency> -->
- <!--<groupId>org.apache.airavata</groupId> -->
- <!--<artifactId>airavata-message-monitor</artifactId> -->
- <!--<version>${project.version}</version> -->
- <!--</dependency> -->
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-workflow-model-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!--<dependency> -->
- <!--<groupId>org.apache.airavata</groupId> -->
- <!--<artifactId>airavata-messenger-commons</artifactId> -->
- <!--<version>${project.version}</version> -->
- <!--</dependency> -->
- <!--<dependency> -->
- <!--<groupId>org.apache.airavata</groupId> -->
- <!--<artifactId>airavata-messenger-client</artifactId> -->
- <!--<version>${project.version}</version> -->
- <!--</dependency> -->
- <!--<dependency> -->
- <!--<groupId>org.apache.airavata</groupId> -->
- <!--<artifactId>airavata-workflow-tracking</artifactId> -->
- <!--<version>${project.version}</version> -->
- <!--</dependency> -->
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>gsissh</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-model-utils</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-api-server</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!--dependency> <groupId>org.apache.airavata</groupId> <artifactId>apache-airavata-samples</artifactId>
- <type>zip</type> <version>${project.version}</version> </dependency -->
- <dependency>
- <groupId>org.bouncycastle</groupId>
- <artifactId>bcprov-jdk15on</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa-all</artifactId>
- <version>2.2.0</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.shiro</groupId>
- <artifactId>shiro-core</artifactId>
- <version>1.2.1</version>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-client</artifactId>
- <version>${jersey.version}</version>
- </dependency>
- <!--dependency> <groupId>org.apache.airavata</groupId> <artifactId>airavata-common-utils</artifactId>
- <version>${project.version}</version> </dependency -->
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <version>3.0.1</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-logging-juli</artifactId>
- <version>7.0.22</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat.embed</groupId>
- <artifactId>tomcat-embed-jasper</artifactId>
- <version>7.0.22</version>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-servlet</artifactId>
- <version>${jersey.version}</version>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-json</artifactId>
- <version>${jersey.version}</version>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
-
- </dependency>
- <dependency>
- <groupId>com.sun.jersey.contribs</groupId>
- <artifactId>jersey-multipart</artifactId>
- <version>${jersey.version}</version>
- </dependency>
- <dependency>
- <groupId>com.sun.jersey</groupId>
- <artifactId>jersey-server</artifactId>
- <version>${jersey.version}</version>
- </dependency>
- <!--dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-client</artifactId>
- <version>${jersey.version}</version> </dependency -->
- <dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-mapper-asl</artifactId>
- <version>1.9.2</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-xc</artifactId>
- <version>1.9.2</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-jaxrs</artifactId>
- <version>1.9.2</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-core-asl</artifactId>
- <version>1.9.2</version>
- </dependency>
- <dependency>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- <version>2.9.1</version>
- <exclusions>
- <exclusion>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>com.ibm.icu</groupId>
- <artifactId>icu4j</artifactId>
- <version>3.4.4</version>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>12.0</version>
- </dependency>
-
- <!-- Hadoop provider related dependencies -->
- <dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-core</artifactId>
- <version>1.0.3</version>
- </dependency>
- <dependency>
- <groupId>org.apache.hadoop</groupId>
- <artifactId>hadoop-client</artifactId>
- <version>1.0.3</version>
- </dependency>
- <dependency>
- <groupId>org.apache.whirr</groupId>
- <artifactId>whirr-core</artifactId>
- <version>0.7.1</version>
- <exclusions>
- <exclusion>
- <groupId>org.bouncycastle</groupId>
- <artifactId>bcprov-jdk16</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jclouds.driver</groupId>
- <artifactId>jclouds-bouncycastle</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.whirr</groupId>
- <artifactId>whirr-hadoop</artifactId>
- <version>0.7.1</version>
- </dependency>
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-all</artifactId>
- <version>1.1</version>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- <version>1.8.5</version>
- </dependency>
- <dependency>
- <groupId>commons-configuration</groupId>
- <artifactId>commons-configuration</artifactId>
- <version>1.7</version>
- </dependency>
- <dependency>
- <groupId>net.sf.jopt-simple</groupId>
- <artifactId>jopt-simple</artifactId>
- <version>3.2</version>
- </dependency>
- <dependency>
- <groupId>org.ebaysf.web</groupId>
- <artifactId>cors-filter</artifactId>
- <version>${ebay.cors.filter}</version>
- </dependency>
- <dependency>
- <groupId>com.jcraft</groupId>
- <artifactId>jsch</artifactId>
- <version>0.1.50</version>
- </dependency>
- <!-- dependency> <groupId>org.ogce</groupId> <artifactId>bcgss</artifactId>
- <version>146</version> </dependency> -->
- <dependency>
- <groupId>org.apache.xmlbeans</groupId>
- <artifactId>xmlbeans</artifactId>
- <version>${xmlbeans.version}</version>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.thrift</groupId>
- <artifactId>libthrift</artifactId>
- <version>0.9.1</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>2.0.0</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>2.0.0</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- <version>2.0.0</version>
- </dependency>
- <!-- zookeeper dependencies -->
-
- <dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- <version>3.4.0</version>
- </dependency>
- <dependency>
- <groupId>commons-cli</groupId>
- <artifactId>commons-cli</artifactId>
- <version>1.2</version>
- </dependency>
-
- <dependency>
- <groupId>com.rabbitmq</groupId>
- <artifactId>amqp-client</artifactId>
- <version>${amqp.client.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.curator</groupId>
- <artifactId>curator-framework</artifactId>
- <version>${curator.version}</version>
- </dependency>
-
- <!-- ======================== Sample =================== -->
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-client-samples</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
-
- <properties>
- <jersey.version>1.13</jersey.version>
- <grizzly.version>2.0.0-M3</grizzly.version>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <archieve.name>apache-airavata-server</archieve.name>
- <airavata.dist.name>${archieve.name}-${project.version}</airavata.dist.name>
- <airavata.work.dir>${project.build.directory}/tests/${airavata.dist.name}</airavata.work.dir>
- <airavata.bin.zip>${project.build.directory}/${airavata.dist.name}-bin.zip</airavata.bin.zip>
- <airavata.bin.tar.gz>${project.build.directory}/${airavata.dist.name}-bin.tar.gz</airavata.bin.tar.gz>
- </properties>
-</project>
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/modules/gfac/gfac-monitor/gfac-hpc-monitor/pom.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/pom.xml b/modules/gfac/gfac-monitor/gfac-hpc-monitor/pom.xml
deleted file mode 100644
index c051783..0000000
--- a/modules/gfac/gfac-monitor/gfac-hpc-monitor/pom.xml
+++ /dev/null
@@ -1,158 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <artifactId>airavata-gfac-monitor</artifactId>
- <groupId>org.apache.airavata</groupId>
- <version>0.16-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>airavata-gfac-hpc-monitor</artifactId>
- <name>Airavata GFac Grid Job Monitor</name>
- <description>The Grid related monitoring implementation</description>
- <url>http://airavata.apache.org/</url>
-
- <dependencies>
- <!-- Logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- <!-- GFAC schemas -->
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-gfac-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-gfac-gsissh</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-gfac-ssh</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-registry-cpi</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-experiment-catalog</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!-- Workflow Tracking -->
- <!--<dependency>-->
- <!--<groupId>org.apache.airavata</groupId>-->
- <!--<artifactId>airavata-workflow-tracking</artifactId>-->
- <!--<version>${project.version}</version>-->
- <!--</dependency>-->
- <!-- Credential Store -->
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-credential-store</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!-- Test -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <version>6.1.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-server-configuration</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-client-configuration</artifactId>
- <scope>test</scope>
- </dependency>
-
- <!-- Guava -->
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>12.0</version>
- </dependency>
- <!-- gsi-ssh api dependencies -->
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>gsissh</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-data-models</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>com.jcraft</groupId>
- <artifactId>jsch</artifactId>
- <version>0.1.50</version>
- </dependency>
- <dependency>
- <groupId>org.apache.xmlbeans</groupId>
- <artifactId>xmlbeans</artifactId>
- <version>${xmlbeans.version}</version>
- </dependency>
- <!-- this is the dependency for amqp implementation -->
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>2.0.0</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skip>false</skip>
- <forkMode>always</forkMode>
- <failIfNoTests>false</failIfNoTests>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.jsonschema2pojo</groupId>
- <artifactId>jsonschema2pojo-maven-plugin</artifactId>
- <version>0.4.0</version>
- <configuration>
- <sourceDirectory>${basedir}/src/main/resources/schema</sourceDirectory>
- <targetPackage>org.apache.airavata</targetPackage>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>generate</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/README.txt
----------------------------------------------------------------------
diff --git a/tools/gsissh/README.txt b/tools/gsissh/README.txt
deleted file mode 100644
index daf65d5..0000000
--- a/tools/gsissh/README.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-To Run
-
-1. Go to lib and give execution permission to install.sh.
- chmod +x install.sh
-2. Execute install.sh
- ./install.sh
-3. Go to parent directory (gsissh) and executed following command;
- mvn clean install -Dmyproxy.user=xxx -Dmyproxy.password=xxx
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/pom.xml
----------------------------------------------------------------------
diff --git a/tools/gsissh/pom.xml b/tools/gsissh/pom.xml
deleted file mode 100644
index 7e5382b..0000000
--- a/tools/gsissh/pom.xml
+++ /dev/null
@@ -1,156 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- you under the Apache License, Version 2.0 (theÏ "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of
- the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
- by applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY ~ KIND, either express or implied. See the License for the specific
- language governing permissions and limitations under the License. -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <!-- the version of maven's project object model -->
-
- <parent>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata</artifactId>
- <version>0.16-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>gsissh</artifactId>
- <name>GSISSH Library</name>
- <description>The core function of the library is to do GSISSH interactions.</description>
- <url>http://airavata.apache.org/</url>
-
- <prerequisites>
- <maven>3.0</maven>
- </prerequisites>
-
- <dependencies>
- <dependency>
- <groupId>com.jcraft</groupId>
- <artifactId>jsch</artifactId>
- <version>0.1.51</version>
- </dependency>
- <dependency>
- <groupId>org.jglobus</groupId>
- <artifactId>myproxy</artifactId>
- <version>${jglobus.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jglobus</groupId>
- <artifactId>gss</artifactId>
- <version>${jglobus.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jglobus</groupId>
- <artifactId>gram</artifactId>
- <version>${jglobus.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jglobus</groupId>
- <artifactId>gridftp</artifactId>
- <version>${jglobus.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </dependency>
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <version>6.1.1</version>
- <scope>test</scope>
- </dependency>
- <!-- dependency>
- <groupId>org.ogce</groupId>
- <artifactId>bcgss</artifactId>
- <version>146</version>
- </dependency> -->
- <dependency>
- <groupId>org.bouncycastle</groupId>
- <artifactId>bcprov-jdk15on</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.xmlbeans</groupId>
- <artifactId>xmlbeans</artifactId>
- <version>${xmlbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>com.jcabi</groupId>
- <artifactId>jcabi-aspects</artifactId>
- <version>0.9</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjrt</artifactId>
- <version>1.6.12</version>
- <scope>runtime</scope>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>xmlbeans-maven-plugin</artifactId>
- <version>2.3.3</version>
- <executions>
- <execution>
- <goals>
- <goal>xmlbeans</goal>
- </goals>
- </execution>
- </executions>
- <inherited>true</inherited>
- <configuration>
- <schemaDirectory>src/main/resources/schemas</schemaDirectory>
- <xmlConfigs>
- <xmlConfig implementation="java.io.File">src/main/resources/schemas/gsissh-schemas.xsdconfig
- </xmlConfig>
- </xmlConfigs>
- <outputJar>target/generated/${project.artifactId}-${project.version}.jar</outputJar>
- </configuration>
- </plugin>
- </plugins>
- <testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
- <testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory>
- <testResources>
- <testResource>
- <directory>${project.basedir}/src/test/resources</directory>
- </testResource>
- </testResources>
- </build>
-
- <properties>
- <jglobus.version>2.1.0</jglobus.version>
- <surefire.version>2.12</surefire.version>
- <junit.version>4.7</junit.version>
- <log4j.version>1.2.17</log4j.version>
- <org.slf4j.version>1.7.2</org.slf4j.version>
- <skipTests>false</skipTests>
- <xmlbeans.version>2.5.0</xmlbeans.version>
- </properties>
-</project>
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/SSHDemo.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/SSHDemo.java b/tools/gsissh/src/main/java/SSHDemo.java
deleted file mode 100644
index ea73e3c..0000000
--- a/tools/gsissh/src/main/java/SSHDemo.java
+++ /dev/null
@@ -1,242 +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.
- *
- */
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 8/6/13
- * Time: 1:08 PM
- */
-
-
-
-/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
-/**
- * This program will demonstrate remote exec.
- * $ CLASSPATH=.:../build javac Exec.java
- * $ CLASSPATH=.:../build java Exec
- * You will be asked username, hostname, displayname, passwd and command.
- * If everything works fine, given command will be invoked
- * on the remote side and outputs will be printed out.
- *
- */
-
-import com.jcraft.jsch.*;
-import org.apache.airavata.gfac.ssh.jsch.ExtendedJSch;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.swing.*;
-import java.awt.*;
-import java.io.InputStream;
-
-/**
- * A main class that demonstrates GSI-SSH execution.
- */
-public class SSHDemo {
-
- private static final Logger logger = LoggerFactory.getLogger(SSHDemo.class);
- static {
- JSch.setConfig("gssapi-with-mic.x509", "org.apache.airavata.gfac.ssh.GSSContextX509");
- JSch.setConfig("userauth.gssapi-with-mic", "com.jcraft.jsch.UserAuthGSSAPIWithMICGSSCredentials");
- System.setProperty("X509_CERT_DIR",
- "/Users/smarru/deploy/certificates");
- }
-
- public static void main(String[] arg) {
- try {
-
- JSch jsch = new ExtendedJSch();
-
- String host;
- int port = 22;
-
- String inputString = JOptionPane.showInputDialog("Enter username@hostname:port",
- "ogce@trestles.sdsc.edu");
- String user = inputString.substring(0, inputString.indexOf('@'));
-
- if (inputString.contains(":")) {
- host = inputString.substring(inputString.indexOf('@') + 1, inputString.indexOf(':'));
- String strPort = inputString.substring(inputString.indexOf(':') + 1);
- port = Integer.parseInt(strPort);
-
- } else {
- host = inputString.substring(inputString.indexOf('@') + 1);
- }
-
- Session session = jsch.getSession(user, host, port);
- HostKey hostKey = session.getHostKey();
-
- java.util.Properties config = new java.util.Properties();
- config.put("StrictHostKeyChecking", "no");
- session.setConfig(config);
-
- session.connect();
-
- String command = JOptionPane.showInputDialog("Enter command",
- "echo \"Hello World\"");
-
- Channel channel = session.openChannel("exec");
- ((ChannelExec) channel).setCommand(command);
-
- // X Forwarding
- // channel.setXForwarding(true);
-
- //channel.setInputStream(System.in);
- channel.setInputStream(null);
-
- //channel.setOutputStream(System.out);
-
- //FileOutputStream fos=new FileOutputStream("/tmp/stderr");
- //((ChannelExec)channel).setErrStream(fos);
- ((ChannelExec) channel).setErrStream(System.err);
-
- InputStream in = channel.getInputStream();
-
- channel.connect();
-
- byte[] tmp = new byte[1024];
- while (true) {
- while (in.available() > 0) {
- int i = in.read(tmp, 0, 1024);
- if (i < 0) break;
- System.out.print(new String(tmp, 0, i));
- }
- if (channel.isClosed()) {
- System.out.println("exit-status: " + channel.getExitStatus());
- break;
- }
- try {
- Thread.sleep(1000);
- } catch (Exception ignored) {
- logger.debug(ignored.getMessage(), ignored);
- }
- }
- channel.disconnect();
- session.disconnect();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- }
- }
-
- public static class MyUserInfo implements UserInfo, UIKeyboardInteractive {
- public String getPassword() {
- return passwd;
- }
-
- public boolean promptYesNo(String str) {
- Object[] options = {"yes", "no"};
- int foo = JOptionPane.showOptionDialog(null,
- str,
- "Warning",
- JOptionPane.DEFAULT_OPTION,
- JOptionPane.WARNING_MESSAGE,
- null, options, options[0]);
- return foo == 0;
- }
-
- String passwd;
- JTextField passwordField = (JTextField) new JPasswordField(20);
-
- public String getPassphrase() {
- return null;
- }
-
- public boolean promptPassphrase(String message) {
- return true;
- }
-
- public boolean promptPassword(String message) {
- Object[] ob = {passwordField};
- int result =
- JOptionPane.showConfirmDialog(null, ob, message,
- JOptionPane.OK_CANCEL_OPTION);
- if (result == JOptionPane.OK_OPTION) {
- passwd = passwordField.getText();
- return true;
- } else {
- return false;
- }
- }
-
- public void showMessage(String message) {
- JOptionPane.showMessageDialog(null, message);
- }
-
- final GridBagConstraints gbc =
- new GridBagConstraints(0, 0, 1, 1, 1, 1,
- GridBagConstraints.NORTHWEST,
- GridBagConstraints.NONE,
- new Insets(0, 0, 0, 0), 0, 0);
- private Container panel;
-
- public String[] promptKeyboardInteractive(String destination,
- String name,
- String instruction,
- String[] prompt,
- boolean[] echo) {
- panel = new JPanel();
- panel.setLayout(new GridBagLayout());
-
- gbc.weightx = 1.0;
- gbc.gridwidth = GridBagConstraints.REMAINDER;
- gbc.gridx = 0;
- panel.add(new JLabel(instruction), gbc);
- gbc.gridy++;
-
- gbc.gridwidth = GridBagConstraints.RELATIVE;
-
- JTextField[] texts = new JTextField[prompt.length];
- for (int i = 0; i < prompt.length; i++) {
- gbc.fill = GridBagConstraints.NONE;
- gbc.gridx = 0;
- gbc.weightx = 1;
- panel.add(new JLabel(prompt[i]), gbc);
-
- gbc.gridx = 1;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbc.weighty = 1;
- if (echo[i]) {
- texts[i] = new JTextField(20);
- } else {
- texts[i] = new JPasswordField(20);
- }
- panel.add(texts[i], gbc);
- gbc.gridy++;
- }
-
- if (JOptionPane.showConfirmDialog(null, panel,
- destination + ": " + name,
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE)
- == JOptionPane.OK_OPTION) {
- String[] response = new String[prompt.length];
- for (int i = 0; i < prompt.length; i++) {
- response[i] = texts[i].getText();
- }
- return response;
- } else {
- return null; // cancel
- }
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/com/jcraft/jsch/ExtendedSession.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/com/jcraft/jsch/ExtendedSession.java b/tools/gsissh/src/main/java/com/jcraft/jsch/ExtendedSession.java
deleted file mode 100644
index 5b7f7d7..0000000
--- a/tools/gsissh/src/main/java/com/jcraft/jsch/ExtendedSession.java
+++ /dev/null
@@ -1,41 +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 com.jcraft.jsch;
-
-import org.apache.airavata.gfac.ssh.api.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/13c2e79e/tools/gsissh/src/main/java/com/jcraft/jsch/GSISSHIdentityFile.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/com/jcraft/jsch/GSISSHIdentityFile.java b/tools/gsissh/src/main/java/com/jcraft/jsch/GSISSHIdentityFile.java
deleted file mode 100644
index 8601973..0000000
--- a/tools/gsissh/src/main/java/com/jcraft/jsch/GSISSHIdentityFile.java
+++ /dev/null
@@ -1,129 +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 com.jcraft.jsch;
-
-import java.io.*;
-import 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/13c2e79e/tools/gsissh/src/main/java/com/jcraft/jsch/GSISSHIdentityRepository.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/com/jcraft/jsch/GSISSHIdentityRepository.java b/tools/gsissh/src/main/java/com/jcraft/jsch/GSISSHIdentityRepository.java
deleted file mode 100644
index 89646c5..0000000
--- a/tools/gsissh/src/main/java/com/jcraft/jsch/GSISSHIdentityRepository.java
+++ /dev/null
@@ -1,29 +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 com.jcraft.jsch;
-
-public class GSISSHIdentityRepository extends LocalIdentityRepository {
-
- public GSISSHIdentityRepository(JSch jsch) {
- super(jsch);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/com/jcraft/jsch/UserAuthGSSAPIWithMICGSSCredentials.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/com/jcraft/jsch/UserAuthGSSAPIWithMICGSSCredentials.java b/tools/gsissh/src/main/java/com/jcraft/jsch/UserAuthGSSAPIWithMICGSSCredentials.java
deleted file mode 100644
index d9fb822..0000000
--- a/tools/gsissh/src/main/java/com/jcraft/jsch/UserAuthGSSAPIWithMICGSSCredentials.java
+++ /dev/null
@@ -1,308 +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 com.jcraft.jsch;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.airavata.gfac.ssh.GSSContextX509;
-import org.apache.airavata.gfac.ssh.api.authentication.GSIAuthenticationInfo;
-import org.globus.gsi.gssapi.GSSConstants;
-import org.ietf.jgss.GSSException;
-import org.ietf.jgss.Oid;
-
-/* -*-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;
- }
-}
-
[4/6] airavata git commit: Removed gsissh module from tools
Posted by sh...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/edu/illinois/ncsa/BCGSS/GlobusTlsClient.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/edu/illinois/ncsa/BCGSS/GlobusTlsClient.java b/tools/gsissh/src/main/java/edu/illinois/ncsa/BCGSS/GlobusTlsClient.java
deleted file mode 100644
index 0b91af8..0000000
--- a/tools/gsissh/src/main/java/edu/illinois/ncsa/BCGSS/GlobusTlsClient.java
+++ /dev/null
@@ -1,247 +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 edu.illinois.ncsa.BCGSS;
-//
-////import edu.illinois.ncsa.bouncycastle.crypto.tls.*;
-////import edu.illinois.ncsa.bouncycastle.asn1.*;
-////import edu.illinois.ncsa.bouncycastle.asn1.x509.*;
-//import org.globus.common.CoGProperties;
-//import org.globus.gsi.CredentialException;
-//import org.globus.gsi.X509Credential;
-//import org.globus.gsi.X509ProxyCertPathParameters;
-//import org.globus.gsi.provider.GlobusProvider;
-//import org.globus.gsi.provider.KeyStoreParametersFactory;
-//import org.globus.gsi.stores.ResourceCertStoreParameters;
-//import org.globus.gsi.stores.ResourceSigningPolicyStore;
-//import org.globus.gsi.stores.ResourceSigningPolicyStoreParameters;
-//import org.globus.gsi.trustmanager.X509ProxyCertPathValidator;
-//import org.globus.gsi.util.CertificateUtil;
-//import org.slf4j.Logger;
-//import org.slf4j.LoggerFactory;
-//
-//import javax.crypto.Cipher;
-//import java.io.ByteArrayInputStream;
-//import java.io.IOException;
-//import java.io.InputStream;
-//import java.security.KeyStore;
-//import java.security.PrivateKey;
-//import java.security.cert.CertStore;
-//import java.security.cert.CertificateException;
-//import java.security.cert.CertificateFactory;
-//import java.security.cert.X509Certificate;
-//
-//public class GlobusTlsClient extends DefaultTlsClient
-//{
-// private Certificate clientCert = new Certificate(new X509CertificateStructure[0]);
-// private PrivateKey clientPrivateKey = null;
-// private X509Certificate[] peerCerts = null;
-// private static final Logger logger = LoggerFactory.getLogger(GlobusTlsClient.class);
-//
-// public X509Certificate[] getPeerCerts() {
-// return peerCerts;
-// }
-//
-// public GlobusTlsClient(X509Credential cred, GlobusTlsCipherFactory factory)
-// throws IOException, CertificateException, CredentialException {
-// super(factory);
-// if (cred == null) {
-// throw new IllegalArgumentException("'cred' cannot be null");
-// }
-//
-// clientCert = new Certificate(
-// X509CertArrayToStructArray(cred.getCertificateChain()));
-// clientPrivateKey = cred.getPrivateKey();
-//
-// if (clientCert.getCerts().length == 0) {
-// throw new IllegalArgumentException(
-// "'cred' contains no certificates");
-// }
-//
-// if (clientPrivateKey == null) {
-// throw new IllegalArgumentException("'clientPrivateKey' cannot be null");
-// }
-// }
-//
-// public TlsAuthentication getAuthentication() throws IOException {
-// return new GlobusTlsAuth();
-// }
-//
-// public int[] getCipherSuites() {
-// return new int[] {
-// CipherSuite.TLS_RSA_WITH_AES_256_CBC_SHA,
-// CipherSuite.TLS_RSA_WITH_AES_128_CBC_SHA,
-// CipherSuite.TLS_RSA_WITH_3DES_EDE_CBC_SHA,
-// };
-// }
-//
-// public class GlobusTlsAuth implements TlsAuthentication {
-//
-// /**
-// * Validates the server's certificate
-// * @param certificate received from server
-// * @throws IOException
-// */
-// public void notifyServerCertificate(Certificate certificate)
-// throws IOException {
-// try {
-// peerCerts = X509CertStructArrayToCertArray(certificate.getCerts());
-//
-// String caCertsLocation =
-// "file:" + CoGProperties.getDefault().getCaCertLocations();
-// String crlPattern = caCertsLocation + "/*.r*";
-// String sigPolPattern = caCertsLocation + "/*.signing_policy";
-//
-// KeyStore keyStore = KeyStore.getInstance(
-// GlobusProvider.KEYSTORE_TYPE, GlobusProvider.PROVIDER_NAME);
-// CertStore crlStore = CertStore.getInstance(
-// GlobusProvider.CERTSTORE_TYPE,
-// new ResourceCertStoreParameters(null, crlPattern));
-// ResourceSigningPolicyStore sigPolStore =
-// new ResourceSigningPolicyStore(
-// new ResourceSigningPolicyStoreParameters(
-// sigPolPattern));
-// keyStore.load(
-// KeyStoreParametersFactory.createTrustStoreParameters(
-// caCertsLocation));
-// X509ProxyCertPathParameters parameters =
-// new X509ProxyCertPathParameters(keyStore, crlStore,
-// sigPolStore, false);
-// X509ProxyCertPathValidator validator =
-// new X509ProxyCertPathValidator();
-// if (validator.engineValidate(CertificateUtil.getCertPath(peerCerts),
-// parameters) == null) {
-// throw new Exception("X509ProxyCertPathValidator did not return a result");
-// }
-// } catch (Exception e) {
-// logger.error(e.getMessage(), e);
-// throw new TlsFatalAlert(AlertDescription.user_canceled);
-// }
-// }
-//
-// /**
-// * Returns an object representing the client's credentials
-// * @param request
-// * @return the client's credentials
-// * @throws IOException
-// */
-// public TlsCredentials getClientCredentials(CertificateRequest request)
-// throws IOException {
-// return new GlobusTlsCred();
-// }
-// }
-//
-// public class GlobusTlsCred implements TlsSignerCredentials {
-// /**
-// * Encrypts a hash with the client's private key, producing a signature
-// * @param md5andsha1 the hash to encrypt
-// * @return an array of bytes containing the signature
-// * @throws IOException
-// */
-// public byte[] generateCertificateSignature(byte[] md5andsha1)
-// throws IOException {
-// // encrypt the input hash with the private key to produce signature
-// try {
-// Cipher cipher = Cipher.getInstance(clientPrivateKey.getAlgorithm());
-// cipher.init(Cipher.ENCRYPT_MODE, clientPrivateKey);
-// return cipher.doFinal(md5andsha1);
-// } catch (Exception e) {
-// logger.error(e.getMessage(), e);
-// throw new IOException(e);
-// }
-// }
-//
-// public Certificate getCertificate() {
-// return clientCert;
-// }
-// }
-//
-// /**
-// *
-// * @param struct
-// * @return
-// * @throws CertificateException
-// * @throws IOException
-// */
-// public static X509Certificate X509CertStructToCert(
-// X509CertificateStructure struct) throws CertificateException,
-// IOException {
-// CertificateFactory cf = CertificateFactory.getInstance("X.509");
-// InputStream is = new ByteArrayInputStream(struct.getEncoded());
-// X509Certificate cert = (X509Certificate) cf.generateCertificate(is);
-// is.close();
-// return cert;
-// }
-//
-// /**
-// *
-// * @param structs
-// * @return
-// * @throws java.io.IOException
-// * @throws java.security.cert.CertificateException
-// */
-// public static X509Certificate[] X509CertStructArrayToCertArray(
-// X509CertificateStructure[] structs) throws IOException,
-// CertificateException {
-// X509Certificate[] certChain = new X509Certificate[structs.length];
-//
-// for (int i = 0; i < structs.length; ++i) {
-// certChain[i] = X509CertStructToCert(structs[i]);
-// }
-//
-// return certChain;
-// }
-//
-// /**
-// *
-// * @param c
-// * @return
-// * @throws CertificateException
-// * @throws IOException
-// */
-// public static X509CertificateStructure X509CertToStruct(X509Certificate c)
-// throws CertificateException, IOException {
-// ASN1InputStream is = new ASN1InputStream(c.getEncoded());
-// DERObject o = is.readObject();
-// return X509CertificateStructure.getInstance(o);
-// }
-//
-//
-// /**
-// *
-// * @param certs
-// * @return
-// * @throws CertificateException
-// * @throws IOException
-// */
-// public static X509CertificateStructure[] X509CertArrayToStructArray(
-// X509Certificate[] certs) throws CertificateException, IOException {
-// X509CertificateStructure[] structs =
-// new X509CertificateStructure[certs.length];
-//
-// for (int i = 0; i < certs.length; ++i) {
-// structs[i] = X509CertToStruct(certs[i]);
-// }
-//
-// return structs;
-// }
-//}
-//
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/edu/illinois/ncsa/BCGSS/TlsHandlerUtil.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/edu/illinois/ncsa/BCGSS/TlsHandlerUtil.java b/tools/gsissh/src/main/java/edu/illinois/ncsa/BCGSS/TlsHandlerUtil.java
deleted file mode 100644
index 36eec77..0000000
--- a/tools/gsissh/src/main/java/edu/illinois/ncsa/BCGSS/TlsHandlerUtil.java
+++ /dev/null
@@ -1,282 +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 edu.illinois.ncsa.BCGSS;
-////import edu.illinois.ncsa.bouncycastle.crypto.tls.*;
-//
-//import java.io.*;
-//
-//public class TlsHandlerUtil {
-// private TlsProtocolHandler tlsHandler;
-// private TlsClient tlsClient;
-// private CircularByteBuffer netInStream;
-// private ByteArrayOutputStream netOutStream;
-// private boolean connectionThreadStarted = false;
-// private IOException connectionThreadException = null;
-//
-// /*
-// public TlsHandlerUtil(TlsClient client) {
-// this(client, new TlsProtocolVersion[] {TlsProtocolVersion.TLSv10,
-// TlsProtocolVersion.SSLv3});
-// }
-// */
-//
-// //public TlsHandlerUtil(TlsClient client, TlsProtocolVersion[] protocols) {
-// public TlsHandlerUtil(TlsClient client) {
-// this.tlsClient = client;
-//
-// this.netInStream = new CircularByteBuffer(
-// CircularByteBuffer.INFINITE_SIZE);
-//
-// //TODO: set a good initial size of buffer?
-// this.netOutStream = new ByteArrayOutputStream();
-//
-// this.tlsHandler = new TlsProtocolHandler(
-// netInStream.getInputStream(), netOutStream);
-// //this.tlsHandler.setEnabledProtocols(protocols);
-// }
-//
-// /**
-// *
-// * @param inNetBuf
-// * @return
-// */
-// public byte[] nextHandshakeToken(byte[] inNetBuf) throws IOException {
-// return nextHandshakeToken(inNetBuf, 0, inNetBuf.length);
-// }
-//
-// /**
-// *
-// * @param inNetBuf
-// * @param off
-// * @param len
-// * @return
-// * @throws java.io.IOException
-// */
-// public byte[] nextHandshakeToken(byte[] inNetBuf, int off, int len)
-// throws IOException {
-// if (isHandshakeFinished()) {
-// return null;
-// }
-//
-// if (! isConnectionThreadStarted()) {
-// (new ConnectionThread()).start();
-// }
-//
-//
-// if (tlsHandler.getHandshakeBlocking() > 0) {
-// tlsHandler.decHandshakeBlocking(inNetBuf.length);
-// }
-//
-// netInStream.getOutputStream().write(inNetBuf, off, len);
-//
-// // block until the TlsProtocolHandler's record stream blocks
-// // or until the handshake is finished. After either, a handshake
-// // token may have been produced
-// while (tlsHandler.getHandshakeBlocking() == 0 &&
-// ! isHandshakeFinished()) {
-//
-// IOException e = getConnectionThreadException();
-// if (e != null) {
-// throw new IOException("TLS connection thread exception", e);
-// }
-//
-// try {
-// Thread.sleep(25);
-// } catch (InterruptedException e1) {
-// throw new IOException("Handshake interrupted while waiting " +
-// "for new network data to be processed", e1);
-// }
-// }
-//
-// byte[] token = drainNetOutStream();
-//
-// if (token.length > 0) {
-// return token;
-// }
-//
-// if (tlsHandler.getHandshakeBlocking() > 0) {
-// // no token produced; need more data
-// return null;
-// }
-//
-// if (isHandshakeFinished()) {
-// return null;
-// } else {
-// throw new IOException("No handshake data available, but the " +
-// "record stream is not blocking and wasn't interrupted");
-// }
-// }
-//
-// /**
-// *
-// * @param appData
-// * @return
-// * @throws IOException
-// */
-// public byte[] wrap(byte[] appData) throws IOException {
-// return wrap(appData, 0, appData.length);
-// }
-//
-// /**
-// *
-// * @param appData
-// * @param off
-// * @param len
-// * @return
-// * @throws IOException
-// */
-// public byte[] wrap(byte[] appData, int off, int len) throws IOException {
-// if (! isHandshakeFinished()) {
-// return null;
-// }
-//
-// tlsHandler.getOutputStream().write(appData, off, len);
-// return drainNetOutStream();
-// }
-//
-// /**
-// *
-// * @param netData
-// * @return
-// * @throws IOException
-// */
-// public byte[] unwrap(byte[] netData) throws IOException {
-// return unwrap(netData, 0, netData.length);
-// }
-//
-// /**
-// *
-// * @param netData
-// * @param off
-// * @param len
-// * @return
-// * @throws IOException
-// */
-// public byte[] unwrap(byte[] netData, int off, int len) throws IOException {
-// if (! isHandshakeFinished()) {
-// return null;
-// }
-//
-// if (netData.length == 0) {
-// return null;
-// }
-//
-// netInStream.getOutputStream().write(netData, off, len);
-//
-// // Force the record to be processed in order to put an unknown
-// // amount of data in the application queue. It's assumed that
-// // the netData parameter is a full SSL record; if it's not, then
-// // this method will block indefinitely
-// byte[] tmp = new byte[1];
-// tlsHandler.getInputStream().read(tmp, 0, 1);
-//
-// int avail = tlsHandler.getApplicationDataQueueSize();
-//
-// if (avail == 0) {
-// return tmp;
-// }
-//
-// byte[] appBuf = new byte[avail + 1];
-// appBuf[0] = tmp[0];
-// tlsHandler.getInputStream().read(appBuf, 1, avail);
-//
-// return appBuf;
-// }
-//
-// /**
-// *
-// * @return
-// * @throws java.io.IOException
-// */
-// public byte[] close() throws IOException {
-// tlsHandler.close();
-// return drainNetOutStream();
-// }
-//
-// /**
-// *
-// * @return
-// */
-// public boolean isHandshakeFinished() {
-// return this.tlsHandler.isHandshakeFinished();
-// }
-//
-// /**
-// *
-// * @return
-// */
-// private byte[] drainNetOutStream() {
-// byte[] rval = netOutStream.toByteArray();
-// netOutStream.reset();
-// return rval;
-// }
-//
-// /**
-// *
-// * @param b
-// */
-// private synchronized void setConnectionThreadStarted(boolean b) {
-// connectionThreadStarted = b;
-// }
-//
-// /**
-// *
-// * @return
-// */
-// private synchronized boolean isConnectionThreadStarted() {
-// return connectionThreadStarted;
-// }
-//
-// /**
-// *
-// * @return
-// */
-// private IOException getConnectionThreadException() {
-// return connectionThreadException;
-// }
-//
-// /**
-// *
-// * @param e
-// */
-// private void setConnectionThreadException(IOException e) {
-// this.connectionThreadException = e;
-// }
-//
-// /**
-// *
-// */
-// private class ConnectionThread extends Thread {
-// /**
-// *
-// */
-// public void run() {
-// setConnectionThreadStarted(true);
-// try {
-// tlsHandler.connect(tlsClient);
-// } catch (IOException e) {
-// setConnectionThreadException(e);
-// }
-// //System.out.println("TLS connection thread done");
-// }
-// }
-//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/GSSContextX509.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/GSSContextX509.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/GSSContextX509.java
deleted file mode 100644
index 1c07a39..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/GSSContextX509.java
+++ /dev/null
@@ -1,210 +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;
-
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-import org.globus.common.CoGProperties;
-import org.globus.gsi.gssapi.auth.HostAuthorization;
-import org.gridforum.jgss.ExtendedGSSCredential;
-import org.gridforum.jgss.ExtendedGSSManager;
-import org.ietf.jgss.GSSContext;
-import org.ietf.jgss.GSSCredential;
-import org.ietf.jgss.GSSException;
-import org.ietf.jgss.GSSName;
-import org.ietf.jgss.MessageProp;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.jcraft.jsch.JSchException;
-
-/**
- * This class is based on GSSContextKrb5; it substitutes the globus
- * ExtendedGSSManager and uses the SecurityUtils method to get the credential if
- * one is not passed in from memory.
- *
- */
-public class GSSContextX509 implements com.jcraft.jsch.GSSContext {
-
- private GSSContext context = null;
- private GSSCredential credential;
- private static final Logger logger = LoggerFactory.getLogger(GSSContextX509.class);
-
- public void create(String user, String host) throws JSchException {
- try {
-// ExtendedGSSManager manager = (ExtendedGSSManager) ExtendedGSSManager.getInstance();
-
- if (credential == null) {
- try {
- credential = getCredential();
- } catch (SecurityException t) {
- System.out.printf("Could not get proxy: %s: %s\n", t.getClass().getSimpleName(), t.getMessage());
- throw new JSchException(t.toString());
- }
- }
-
- String cname = host;
-
- try {
- cname = InetAddress.getByName(cname).getCanonicalHostName();
- } catch (UnknownHostException e) {
- }
-
- GSSName name = HostAuthorization.getInstance().getExpectedName(credential, cname);
-
-// context = manager.createContext(name, null, credential, GSSContext.DEFAULT_LIFETIME);
-//
-// // RFC4462 3.4. GSS-API Session
-// //
-// // When calling GSS_Init_sec_context(), the client MUST set
-// // integ_req_flag to "true" to request that per-message integrity
-// // protection be supported for this context. In addition,
-// // deleg_req_flag MAY be set to "true" to request access delegation,
-// // if
-// // requested by the user.
-// //
-// // Since the user authentication process by its nature authenticates
-// // only the client, the setting of mutual_req_flag is not needed for
-// // this process. This flag SHOULD be set to "false".
-//
-// // TODO: OpenSSH's sshd does accept 'false' for mutual_req_flag
-// // context.requestMutualAuth(false);
-// context.requestMutualAuth(true);
-// context.requestConf(true);
-// context.requestInteg(true); // for MIC
-// context.requestCredDeleg(true);
-// context.requestAnonymity(false);
-
-// context = new BCGSSContextImpl(name, (GlobusGSSCredentialImpl) credential);
-// context.requestLifetime(GSSCredential.DEFAULT_LIFETIME);
-// context.requestCredDeleg(true);
-// context.requestMutualAuth(true);
-// context.requestReplayDet(true);
-// context.requestSequenceDet(true);
-// context.requestConf(false);
-// context.requestInteg(true);
-// ((ExtendedGSSContext)context).setOption(GSSConstants.DELEGATION_TYPE, GSIConstants.DELEGATION_TYPE_FULL);
-
- return;
- } catch (GSSException ex) {
- throw new JSchException(ex.toString());
- }
- }
-
- private static GSSCredential getProxy() {
- return getProxy(null, GSSCredential.DEFAULT_LIFETIME);
- }
-
- /**
- * @param x509_USER_PROXY
- * path to the proxy.
- * @param credentialLifetime
- * in seconds.
- * @return valid credential.
- * if proxy task throws exception (or if proxy cannot be found).
- */
- private static GSSCredential getProxy(String x509_USER_PROXY, int credentialLifetime) throws SecurityException {
- if (x509_USER_PROXY == null)
- x509_USER_PROXY = System.getProperty("x509.user.proxy");
-
-// if (x509_USER_PROXY == null) {
-// SystemUtils.envToProperties();
-// x509_USER_PROXY = System.getProperty("x509.user.proxy");
-// }
-
- if (x509_USER_PROXY == null || "".equals(x509_USER_PROXY))
- x509_USER_PROXY = CoGProperties.getDefault().getProxyFile();
-
- if (x509_USER_PROXY == null)
- throw new SecurityException("could not get credential; no location defined");
-
- ExtendedGSSManager manager = (ExtendedGSSManager) ExtendedGSSManager.getInstance();
-
- // file...load file into a buffer
- try {
- File f = new File(x509_USER_PROXY);
- byte[] data = new byte[(int) f.length()];
- FileInputStream in = new FileInputStream(f);
- // read in the credential data
- in.read(data);
- in.close();
- return manager.createCredential(data, ExtendedGSSCredential.IMPEXP_OPAQUE, credentialLifetime, null, // use
- // default
- // mechanism
- // -
- // GSI
- GSSCredential.INITIATE_AND_ACCEPT);
- } catch (Throwable t) {
- throw new SecurityException("could not get credential from " + x509_USER_PROXY, t);
- }
- }
-
- public boolean isEstablished() {
- // this must check to see if the call returned GSS_S_COMPLETE
- if (context != null){
- return context.isEstablished();
- }
- return false;
- }
-
- public byte[] init(byte[] token, int s, int l) throws JSchException {
- try {
- if (context != null){
- return context.initSecContext(token, s, l);
- }else {
- throw new JSchException("Context is null..");
- }
- } catch (GSSException ex) {
- throw new JSchException(ex.toString());
- }
- }
-
- public byte[] getMIC(byte[] message, int s, int l) {
- try {
- MessageProp prop = new MessageProp(0, false);
- return context.getMIC(message, s, l, prop);
- } catch (GSSException ex) {
- logger.error(ex.getMessage(), ex);
- return null;
- }
- }
-
- public void dispose() {
- try {
- context.dispose();
- } catch (GSSException ex) {
- }
- }
-
- public void setCredential(GSSCredential credential) {
- this.credential = credential;
- }
-
- public GSSCredential getCredential() {
- return credential;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Cluster.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Cluster.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Cluster.java
deleted file mode 100644
index beb5b37..0000000
--- a/tools/gsissh/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/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/CommandExecutor.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/CommandExecutor.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/CommandExecutor.java
deleted file mode 100644
index 024c53d..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/CommandExecutor.java
+++ /dev/null
@@ -1,278 +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 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;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This is a generic class which take care of command execution
- * in a shell, this is used through out the other places of the API.
- */
-public class CommandExecutor {
- static {
- JSch.setConfig("gssapi-with-mic.x509", "org.apache.airavata.gfac.ssh.GSSContextX509");
- JSch.setConfig("userauth.gssapi-with-mic", "com.jcraft.jsch.UserAuthGSSAPIWithMICGSSCredentials");
- JSch jSch = new JSch();
- }
-
- private static final Logger log = LoggerFactory.getLogger(CommandExecutor.class);
- public static final String X509_CERT_DIR = "X509_CERT_DIR";
-
- /**
- * This will execute the given command with given session and session is not closed at the end.
- *
- * @param commandInfo
- * @param session
- * @param commandOutput
- * @throws SSHApiException
- */
- public static Session executeCommand(CommandInfo commandInfo, Session session,
- CommandOutput commandOutput) throws SSHApiException {
-
- String command = commandInfo.getCommand();
-
- Channel channel = null;
- try {
- if (!session.isConnected()) {
- session.connect();
- }
- channel = session.openChannel("exec");
- ((ChannelExec) channel).setCommand(command);
- } catch (JSchException e) {
-// session.disconnect();
-
- throw new SSHApiException("Unable to execute command - ", e);
- }
-
- channel.setInputStream(null);
- ((ChannelExec) channel).setErrStream(commandOutput.getStandardError());
- try {
- channel.connect();
- } catch (JSchException e) {
-
- channel.disconnect();
-// session.disconnect();
- throw new SSHApiException("Unable to retrieve command output. Command - " + command, e);
- }
-
-
- commandOutput.onOutput(channel);
- //Only disconnecting the channel, session can be reused
- channel.disconnect();
- return session;
- }
-
- /**
- * This will not reuse any session, it will create the session and close it at the end
- *
- * @param commandInfo Encapsulated information about command. E.g :- executable name
- * parameters etc ...
- * @param serverInfo The SSHing server information.
- * @param authenticationInfo Security data needs to be communicated with remote server.
- * @param commandOutput The output of the command.
- * @param configReader configuration required for ssh/gshissh connection
- * @throws SSHApiException throw exception when error occurs
- */
- public static void executeCommand(CommandInfo commandInfo, ServerInfo serverInfo,
- AuthenticationInfo authenticationInfo,
- CommandOutput commandOutput, ConfigReader configReader) throws SSHApiException {
-
- if (authenticationInfo instanceof GSIAuthenticationInfo) {
- System.setProperty(X509_CERT_DIR, (String) ((GSIAuthenticationInfo)authenticationInfo).getProperties().
- get("X509_CERT_DIR"));
- }
-
-
- JSch jsch = new ExtendedJSch();
-
- log.debug("Connecting to server - " + serverInfo.getHost() + ":" + serverInfo.getPort() + " with user name - "
- + serverInfo.getUserName());
-
- Session session;
-
- try {
- session = jsch.getSession(serverInfo.getUserName(), serverInfo.getHost(), serverInfo.getPort());
- } catch (JSchException e) {
- throw new SSHApiException("An exception occurred while creating SSH session." +
- "Connecting server - " + serverInfo.getHost() + ":" + serverInfo.getPort() +
- " connecting user name - "
- + serverInfo.getUserName(), e);
- }
-
- java.util.Properties config = configReader.getProperties();
- session.setConfig(config);
-
- //=============================================================
- // Handling vanilla SSH pieces
- //=============================================================
- if (authenticationInfo instanceof SSHPasswordAuthentication) {
- String password = ((SSHPasswordAuthentication) authenticationInfo).
- getPassword(serverInfo.getUserName(), serverInfo.getHost());
-
- session.setUserInfo(new SSHAPIUIKeyboardInteractive(password));
-
- // TODO figure out why we need to set password to session
- session.setPassword(password);
-
- } else if (authenticationInfo instanceof SSHPublicKeyFileAuthentication) {
- SSHPublicKeyFileAuthentication sshPublicKeyFileAuthentication
- = (SSHPublicKeyFileAuthentication)authenticationInfo;
-
- String privateKeyFile = sshPublicKeyFileAuthentication.
- getPrivateKeyFile(serverInfo.getUserName(), serverInfo.getHost());
-
- logDebug("The private key file for vanilla SSH " + privateKeyFile);
-
- String publicKeyFile = sshPublicKeyFileAuthentication.
- getPrivateKeyFile(serverInfo.getUserName(), serverInfo.getHost());
-
- logDebug("The public key file for vanilla SSH " + publicKeyFile);
-
- Identity identityFile;
-
- try {
- identityFile = GSISSHIdentityFile.newInstance(privateKeyFile, null, jsch);
- } catch (JSchException e) {
- throw new SSHApiException("An exception occurred while initializing keys using files. " +
- "(private key and public key)." +
- "Connecting server - " + serverInfo.getHost() + ":" + serverInfo.getPort() +
- " connecting user name - "
- + serverInfo.getUserName() + " private key file - " + privateKeyFile + ", public key file - " +
- publicKeyFile, e);
- }
-
- // Add identity to identity repository
- GSISSHIdentityRepository identityRepository = new GSISSHIdentityRepository(jsch);
- identityRepository.add(identityFile);
-
- // Set repository to session
- session.setIdentityRepository(identityRepository);
-
- // Set the user info
- SSHKeyPasswordHandler sshKeyPasswordHandler
- = new SSHKeyPasswordHandler((SSHKeyAuthentication)authenticationInfo);
-
- session.setUserInfo(sshKeyPasswordHandler);
-
- } else if (authenticationInfo instanceof SSHPublicKeyAuthentication) {
-
- SSHPublicKeyAuthentication sshPublicKeyAuthentication
- = (SSHPublicKeyAuthentication)authenticationInfo;
-
- Identity identityFile;
-
- try {
- String name = serverInfo.getUserName() + "_" + serverInfo.getHost();
- identityFile = GSISSHIdentityFile.newInstance(name,
- sshPublicKeyAuthentication.getPrivateKey(serverInfo.getUserName(), serverInfo.getHost()),
- sshPublicKeyAuthentication.getPublicKey(serverInfo.getUserName(), serverInfo.getHost()), jsch);
- } catch (JSchException e) {
- throw new SSHApiException("An exception occurred while initializing keys using byte arrays. " +
- "(private key and public key)." +
- "Connecting server - " + serverInfo.getHost() + ":" + serverInfo.getPort() +
- " connecting user name - "
- + serverInfo.getUserName(), e);
- }
-
- // Add identity to identity repository
- GSISSHIdentityRepository identityRepository = new GSISSHIdentityRepository(jsch);
- identityRepository.add(identityFile);
-
- // Set repository to session
- session.setIdentityRepository(identityRepository);
-
- // Set the user info
- SSHKeyPasswordHandler sshKeyPasswordHandler
- = new SSHKeyPasswordHandler((SSHKeyAuthentication)authenticationInfo);
-
- session.setUserInfo(sshKeyPasswordHandler);
-
- }
-
- // Not a good way, but we dont have any choice
- if (session instanceof ExtendedSession) {
- if (authenticationInfo instanceof GSIAuthenticationInfo) {
- ((ExtendedSession) session).setAuthenticationInfo((GSIAuthenticationInfo)authenticationInfo);
- }
- }
-
- try {
- session.connect();
- } catch (JSchException e) {
- throw new SSHApiException("An exception occurred while connecting to server." +
- "Connecting server - " + serverInfo.getHost() + ":" + serverInfo.getPort() +
- " connecting user name - "
- + serverInfo.getUserName(), e);
- }
-
- String command = commandInfo.getCommand();
-
- Channel channel;
- try {
- channel = session.openChannel("exec");
- ((ChannelExec) channel).setCommand(command);
- } catch (JSchException e) {
-// session.disconnect();
-
- throw new SSHApiException("Unable to execute command - " + command +
- " on server - " + serverInfo.getHost() + ":" + serverInfo.getPort() +
- " connecting user name - "
- + serverInfo.getUserName(), e);
- }
-
-
- channel.setInputStream(null);
- ((ChannelExec) channel).setErrStream(commandOutput.getStandardError());
-
- try {
- channel.connect();
- } catch (JSchException e) {
-
- channel.disconnect();
-// session.disconnect();
-
- throw new SSHApiException("Unable to retrieve command output. Command - " + command +
- " on server - " + serverInfo.getHost() + ":" + serverInfo.getPort() +
- " connecting user name - "
- + serverInfo.getUserName(), e);
- }
-
- commandOutput.onOutput(channel);
-
- channel.disconnect();
-// session.disconnect();
- }
-
- private static void logDebug(String message) {
- if (log.isDebugEnabled()) {
- log.debug(message);
- }
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/CommandInfo.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/CommandInfo.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/CommandInfo.java
deleted file mode 100644
index e6797ce..0000000
--- a/tools/gsissh/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/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/CommandOutput.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/CommandOutput.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/CommandOutput.java
deleted file mode 100644
index f275ff0..0000000
--- a/tools/gsissh/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/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Core.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Core.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Core.java
deleted file mode 100644
index 67dd043..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Core.java
+++ /dev/null
@@ -1,59 +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 org.apache.airavata.gfac.ssh.api.job.JobDescriptor;
-
-/**
- * This represents a CPU core of a machine in the cluster
- */
-public class Core {
- private JobDescriptor job;
- private String id;
-
- public Core(String id) {
- this.id = id;
- this.job = null;
- }
-
- /**
- * @return core's id
- */
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * @return job running on the core
- */
- public JobDescriptor getJob() {
- return job;
- }
-
- public void setJob(JobDescriptor job) {
- this.job = job;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Node.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Node.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Node.java
deleted file mode 100644
index 1515f39..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/Node.java
+++ /dev/null
@@ -1,104 +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.HashMap;
-
-public class Node {
- private String Name;
- private Core[] Cores;
- private String state;
- private HashMap<String, String> status;
- private String np;
- private String ntype;
-
- /**
- * @return the machine's name
- */
- public String getName() {
- return Name;
- }
-
- public void setName(String Name) {
- this.Name = Name;
- }
-
- /**
- * @return machine cores as an array
- */
- public Core[] getCores() {
- return Cores;
- }
-
- public void setCores(Core[] Cores) {
- this.Cores = Cores;
- }
-
-
- /**
- * @return the machine state
- */
- public String getState() {
- return state;
- }
-
- public void setState(String state) {
- this.state = state;
- }
-
- /**
- * @return the status
- */
- public HashMap<String, String> getStatus() {
- return status;
- }
-
- public void setStatus(HashMap<String, String> status) {
- this.setStatus(status);
- }
-
-
- /**
- * @return the number of cores in the machine
- */
- public String getNp() {
- return np;
- }
-
-
- public void setNp(String np) {
- this.np = np;
- }
-
- /**
- * @return the ntype of the machine
- */
- public String getNtype() {
- return ntype;
- }
-
-
- public void setNtype(String ntype) {
- this.ntype = ntype;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/SSHApiException.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/SSHApiException.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/SSHApiException.java
deleted file mode 100644
index f78825b..0000000
--- a/tools/gsissh/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/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/ServerInfo.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/ServerInfo.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/ServerInfo.java
deleted file mode 100644
index d3c2160..0000000
--- a/tools/gsissh/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/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/authentication/AuthenticationInfo.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/authentication/AuthenticationInfo.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/authentication/AuthenticationInfo.java
deleted file mode 100644
index 6b4e913..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/authentication/AuthenticationInfo.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.apache.airavata.gfac.ssh.api.authentication;/*
- *
- * 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.
- *
- */
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 10/4/13
- * Time: 11:25 AM
- */
-
-/**
- * An empty interface that represents authentication data to the API.
- */
-public interface AuthenticationInfo {
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/authentication/GSIAuthenticationInfo.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/authentication/GSIAuthenticationInfo.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/authentication/GSIAuthenticationInfo.java
deleted file mode 100644
index 1f327f0..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/authentication/GSIAuthenticationInfo.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.apache.airavata.gfac.ssh.api.authentication;/*
- *
- * 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 org.ietf.jgss.GSSCredential;
-
-import java.util.Properties;
-
-/**
- * Authentication data. Could be MyProxy user name, password, could be GSSCredentials
- * or could be SSH keys.
- */
-public abstract class GSIAuthenticationInfo implements AuthenticationInfo {
-
- public Properties properties = new Properties();
-
- public abstract GSSCredential getCredentials() throws SecurityException;
-
- public Properties getProperties() {
- return properties;
- }
-
- public void setProperties(Properties properties) {
- this.properties = properties;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/authentication/SSHKeyAuthentication.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/authentication/SSHKeyAuthentication.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/authentication/SSHKeyAuthentication.java
deleted file mode 100644
index ebd79f2..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/authentication/SSHKeyAuthentication.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.apache.airavata.gfac.ssh.api.authentication;/*
- *
- * 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.
- *
- */
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 10/4/13
- * Time: 2:39 PM
- */
-
-/**
- * Abstracts out common methods for SSH key authentication.
- */
-public interface SSHKeyAuthentication extends AuthenticationInfo {
-
- /**
- * This is needed only if private key and public keys are encrypted.
- * If they are not encrypted we can just return null.
- * @return User should return pass phrase if keys are encrypted. If not null.
- */
- String getPassPhrase();
-
- /**
- * Callback with the banner message. API user can get hold of banner message
- * by implementing this method.
- * @param message The banner message.
- */
- void bannerMessage(String message);
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/authentication/SSHPasswordAuthentication.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/authentication/SSHPasswordAuthentication.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/authentication/SSHPasswordAuthentication.java
deleted file mode 100644
index fd884f8..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/authentication/SSHPasswordAuthentication.java
+++ /dev/null
@@ -1,43 +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.authentication;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 10/4/13
- * Time: 11:22 AM
- */
-
-/**
- * Password authentication for vanilla SSH.
- */
-public interface SSHPasswordAuthentication extends AuthenticationInfo {
-
- /**
- * Gets the password for given host name and given user name.
- * @param userName The connecting user name name.
- * @param hostName The connecting host.
- * @return Password for the given user.
- */
- String getPassword(String userName, String hostName);
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/authentication/SSHPublicKeyAuthentication.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/authentication/SSHPublicKeyAuthentication.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/authentication/SSHPublicKeyAuthentication.java
deleted file mode 100644
index dcedfec..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/authentication/SSHPublicKeyAuthentication.java
+++ /dev/null
@@ -1,54 +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.authentication;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 10/4/13
- * Time: 9:48 AM
- */
-
-
-/**
- * Public key authentication for vanilla SSH.
- * The public key and private key are returned as byte arrays. Useful when we store private key/public key
- * in a secure storage such as credential store. API user should implement this.
- */
-public interface SSHPublicKeyAuthentication extends SSHKeyAuthentication {
-
- /**
- * Gets the public key as byte array.
- * @param userName The user who is trying to SSH
- * @param hostName The host which user wants to connect to.
- * @return The public key as a byte array.
- */
- byte[] getPrivateKey(String userName, String hostName);
-
- /**
- * Gets the private key as byte array.
- * @param userName The user who is trying to SSH
- * @param hostName The host which user wants to connect to.
- * @return The private key as a byte array.
- */
- byte[] getPublicKey(String userName, String hostName);
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/13c2e79e/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/authentication/SSHPublicKeyFileAuthentication.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/authentication/SSHPublicKeyFileAuthentication.java b/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/authentication/SSHPublicKeyFileAuthentication.java
deleted file mode 100644
index e22b9af..0000000
--- a/tools/gsissh/src/main/java/org/apache/airavata/gfac/gsi/ssh/api/authentication/SSHPublicKeyFileAuthentication.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.apache.airavata.gfac.ssh.api.authentication;/*
- *
- * 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.
- *
- */
-
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 10/4/13
- * Time: 9:52 AM
- */
-
-/**
- * Public key authentication for vanilla SSH.
- * The public key and private key stored files are returned. API user should implement this.
- */
-public interface SSHPublicKeyFileAuthentication extends SSHKeyAuthentication {
-
- /**
- * The file which contains the public key.
- * @param userName The user who is trying to SSH
- * @param hostName The host which user wants to connect to.
- * @return The name of the file which contains the public key.
- */
- String getPublicKeyFile(String userName, String hostName);
-
- /**
- * The file which contains the public key.
- * @param userName The user who is trying to SSH
- * @param hostName The host which user wants to connect to.
- * @return The name of the file which contains the private key.
- */
- String getPrivateKeyFile(String userName, String hostName);
-
-
-}