%@ page import="WebFlow.*" %>
<%@ page import="WebFlow.submitJob.*" %>
<%@ page import="java.util.Hashtable" %>
<%@ page import="java.util.StringTokenizer" %>
<%!
boolean validateInput(String logit){
//int logitindex = 0;
//String logitsubstring = null;
StringTokenizer st = null;
boolean result = false;
//logitindex = logit.indexOf("STDERR:");
//logitsubstring = logit.substring(logitindex);
st = new StringTokenizer(logit);
//st.nextToken();
if(st.hasMoreTokens()) result = true;
else result = false;
return result;
}
%>
<%
String[] codenames = request.getParameterValues("codenames");
String codeName=request.getParameter("codeName");
boolean checkflag = true;
for (int l = 0; l < codenames.length; l++) {
if(codeName.equals(codenames[l])) {
checkflag = false;
break;
}
}
if(checkflag) {
String userName=storeInfo.getTableVal("userName");
submitJob sj=ServerServlet.getSubmitJob(userName);
String machinenames = request.getParameter("machineName");
String execpaths = request.getParameter("execpath");
String workspaces = request.getParameter("workspace");
String qsubpaths = request.getParameter("qsubpath");
String execpathcheck = request.getParameter("execpathverify");
String workdircheck = request.getParameter("workdirverify");
String qsubcheck= request.getParameter("qsubverify");
String logit = null;
String command = "ls -l ";
String errorcode = null;
if(execpathcheck.equals("Yes") && checkflag) {
command += execpaths;
logit=sj.execRemoteCommand(machinenames,userName,command,"rsh");
if(!validateInput(logit)) {
errorcode = "Execution Path: "+execpaths;
checkflag = false;
}
else command = "ls -l ";
}
if(workdircheck.equals("Yes") && checkflag) {
command += workspaces;
logit=sj.execRemoteCommand(machinenames,userName,command,"rsh");
if(!validateInput(logit)) {
errorcode = "Work Directory: "+workspaces;
checkflag = false;
}
else command = "ls -l ";
}
if(qsubcheck.equals("Yes") && checkflag) {
command += qsubpaths;
logit=sj.execRemoteCommand(machinenames,userName,command,"rsh");
if(!validateInput(logit)) {
errorcode = "Qsub Path: "+qsubpaths;
checkflag = false;
}
else command = "ls -l ";
}
if(checkflag) {
Hashtable applData = new Hashtable();
String xmlpath = "/a/birch.csit.fsu.edu/shared/home/cyoun/GATEWAY/apache1.3.12/WWW/GOW/WEB-INF/src/generic/ApplDesc.xml";
String NumOfInParam = request.getParameter("numofinparam");
String NumOfInFiles = request.getParameter("numofinfiles");
String NumOfOutParam = request.getParameter("numofoutparam");
String NumOfOutFiles = request.getParameter("numofoutfiles");
String Iostyle = request.getParameter("iostyle");
String queuetypes = request.getParameter("queuetype");
applData.put("applName",codeName);
applData.put("paramInNum",NumOfInParam);
applData.put("infileNum", NumOfInFiles);
applData.put("paramOutNum", NumOfOutParam);
applData.put("outfileNum",NumOfOutFiles);
applData.put("iostyle",Iostyle);
applData.put("hostName",machinenames);
applData.put("queueType",queuetypes);
applData.put("execPath",execpaths);
applData.put("workDir",workspaces);
applData.put("qsubPath",qsubpaths);
xmlGOW.addApplication(xmlpath,applData);
int nappl = xmlGOW.doParse(xmlpath);
%>
The new Application Data
code: <%= codeName %>
input param: <%= NumOfInParam %>
input files: <%= NumOfInFiles %>
output param: <%= NumOfOutParam %>
outfiles: <%= NumOfOutFiles %>
iostyle: <%= Iostyle %>
machine: <%= machinenames %>
queue: <%= queuetypes %>
exec: <%= execpaths %>
work: <%= workspaces %>
qsub: <%= qsubpaths %>
the content of the hahtable: <%= applData.toString() %>
The Number of the existing Applications: <%= nappl %>
Your application was added. if you want to do more things,
Please choose buttons as below.
<%
}
else {
%>
Error Report for adding the Application Data
<%= machinenames %> has NOT the correct path for
<%= errorcode %>
Please try it again.
<%
}
%>
<% }
else {
%>
Error Report for adding the Application Data
You used the SAME application name, <%= codeName %>.
In order to add this application, You must use the UNIQUE application name.
Please try it again.
<%
}
%>