fixing double commit in bes-client.
authorLahiru Gunathilake <lahiru@apache.org>
Tue, 22 Jan 2013 15:39:23 +0000 (15:39 +0000)
committerLahiru Gunathilake <lahiru@apache.org>
Tue, 22 Jan 2013 15:39:23 +0000 (15:39 +0000)
git-svn-id: https://svn.apache.org/repos/asf/airavata/sandbox@1436999 13f79535-47bb-0310-9956-ffa450edef68

grid-tools/bes-client/src/main/java/org/apache/airavata/sample/bes/AbstractJobCommand.java
grid-tools/bes-client/src/main/java/org/apache/airavata/sample/bes/CreateAndTerminateActivityTask.java
grid-tools/bes-client/src/main/java/org/apache/airavata/sample/bes/MonitorJobStatusTask.java
grid-tools/bes-client/src/main/java/org/apache/airavata/sample/bes/RunAndTerminateJob.java

index f4589f1..fb2a116 100644 (file)
@@ -34,39 +34,3 @@ public abstract class AbstractJobCommand {
        }
        
 }
-package org.apache.airavata.sample.bes;
-
-import de.fzj.unicore.uas.security.ClientProperties;
-import eu.unicore.security.util.client.IClientProperties;
-
-public abstract class AbstractJobCommand {
-       
-       
-       
-       public static final String factoryUrl = "https://zam1161v01.zam.kfa-juelich.de:8002/INTEROP1/services/BESFactory?res=default_bes_factory";
-       public static final String dateJsdlPath = "src/test/resources/date.xml";
-       
-       protected IClientProperties securityProperties;
-       
-       
-       public AbstractJobCommand() {
-               securityProperties = initSecurityProperties();
-       }
-       
-       protected ClientProperties initSecurityProperties() {
-
-               ClientProperties sp = new ClientProperties();
-
-               sp.setSslEnabled(true);
-               sp.setSignMessage(true);
-
-               sp.setKeystore("src/test/resources/demo-keystore.jks");
-               sp.setKeystorePassword("654321");
-               sp.setKeystoreAlias("demouser-new");
-               sp.setKeystoreType("JKS");
-
-               return sp;
-
-       }
-       
-}
index f38f800..e3460a5 100644 (file)
@@ -73,86 +73,4 @@ public class CreateAndTerminateActivityTask {
 
                
        }
-
-       
-
-}
-package org.apache.airavata.sample.bes;
-
-import java.util.Calendar;
-
-import org.ggf.schemas.bes.x2006.x08.besFactory.ActivityStateEnumeration;
-import org.ggf.schemas.bes.x2006.x08.besFactory.CreateActivityDocument;
-import org.ggf.schemas.bes.x2006.x08.besFactory.CreateActivityResponseDocument;
-import org.ggf.schemas.bes.x2006.x08.besFactory.TerminateActivitiesResponseType;
-import org.w3.x2005.x08.addressing.EndpointReferenceType;
-
-import de.fzj.unicore.bes.client.FactoryClient;
-import de.fzj.unicore.wsrflite.xmlbeans.WSUtilities;
-import eu.unicore.security.util.client.IClientProperties;
-
-public class CreateAndTerminateActivityTask {
-
-       private BESJob job;
-
-       private IClientProperties sec;
-       private String jobId;
-       
-       
-       public CreateAndTerminateActivityTask(BESJob job, IClientProperties sec) {
-               this.job = job;
-               this.sec = sec;
-               
-       }
-
-       public void startJob() throws Exception {
-               String factoryUrl = job.getFactoryUrl();
-               EndpointReferenceType eprt = EndpointReferenceType.Factory
-                               .newInstance();
-               eprt.addNewAddress().setStringValue(factoryUrl);
-               System.out.println("========================================");
-               System.out.println(String.format("Job Submitted to %s.\n", factoryUrl));
-               FactoryClient factory = new FactoryClient(eprt, sec);
-               CreateActivityDocument cad = CreateActivityDocument.Factory
-                               .newInstance();
-               cad.addNewCreateActivity().addNewActivityDocument()
-                               .setJobDefinition(job.getJobDoc().getJobDefinition());
-               CreateActivityResponseDocument response = factory.createActivity(cad);
-               EndpointReferenceType activityEpr = response
-                               .getCreateActivityResponse().getActivityIdentifier();
-               jobId = WSUtilities.extractResourceID(activityEpr);
-               if (jobId == null) {
-                       jobId = new Long(Calendar.getInstance().getTimeInMillis())
-                                       .toString();
-               }
-               
-               String status;
-               
-               status = String.format("Job %s is %s.\n", activityEpr.getAddress()
-                               .getStringValue(), factory.getActivityStatus(activityEpr)
-                               .toString()).toString();
-               
-               System.out.println(status);
-               
-               TerminateActivitiesResponseType terminateResType = factory.terminateActivity(activityEpr);
-               
-               Thread.sleep(500);
-               System.out.println(terminateResType);
-
-               if (!(factory.getActivityStatus(activityEpr) == ActivityStateEnumeration.CANCELLED)) {
-                       throw new Exception("Job "+activityEpr.getAddress().getStringValue()+" not CANCELLED");
-               }
-               
-               status = String.format("Job %s is %s.\n", activityEpr.getAddress()
-                               .getStringValue(), factory.getActivityStatus(activityEpr)
-                               .toString()).toString();
-               
-               System.out.println(status);
-               
-
-               
-       }
-
-       
-
-}
+}
\ No newline at end of file
index 311286a..2fa278a 100644 (file)
@@ -17,36 +17,4 @@ public class MonitorJobStatusTask {
                this.jobEPR = jobEPR;
                this.sec = sec; 
        }
-       
-       
-       
-       
-
-       
-}
-package org.apache.airavata.sample.bes;
-
-import org.w3.x2005.x08.addressing.EndpointReferenceType;
-
-import de.fzj.unicore.wsrflite.xmlbeans.WSUtilities;
-
-import eu.unicore.security.util.client.IClientProperties;
-
-public class MonitorJobStatusTask {
-       
-       private String factoryUrl;
-       private EndpointReferenceType jobEPR;
-       private IClientProperties sec;
-       
-       public MonitorJobStatusTask(String factoryUrl, IClientProperties sec, EndpointReferenceType jobEPR) {
-               this.factoryUrl = factoryUrl;
-               this.jobEPR = jobEPR;
-               this.sec = sec; 
-       }
-       
-       
-       
-       
-
-       
-}
+}
\ No newline at end of file
index a2e76ef..5da78f8 100644 (file)
@@ -33,40 +33,3 @@ public class RunAndTerminateJob extends AbstractJobCommand {
        
 
 }
-
-package org.apache.airavata.sample.bes;
-
-import java.io.File;
-
-import org.ggf.schemas.jsdl.x2005.x11.jsdl.JobDefinitionDocument;
-
-public class RunAndTerminateJob extends AbstractJobCommand {
-
-       public RunAndTerminateJob() {
-               super();
-       }
-
-       public void runAndTerminate(){
-               JobDefinitionDocument jobDoc = null;
-               try {
-                       jobDoc = JobDefinitionDocument.Factory.parse(new File(dateJsdlPath));
-               } catch (Exception e) {
-                       System.err.println("Error parsing JSDL instance. " + e);
-               }
-
-               BESJob job = new BESJob();
-               job.setFactory(factoryUrl);
-               job.setJobDoc(jobDoc);
-
-               CreateAndTerminateActivityTask th = new CreateAndTerminateActivityTask(job, securityProperties);
-               try {
-                       th.startJob();
-               } catch (Exception e) {
-
-                       System.err.println("Couldn't run job: " + e);
-               }
-       }
-       
-
-}
-