package edu.usc.glidein.client;

import org.apache.axis.message.addressing.Address;
import org.apache.axis.message.addressing.EndpointReferenceType;

import edu.usc.glidein.stubs.*;
import edu.usc.glidein.stubs.service.*;
import edu.usc.glidein.stubs.types.*;

public class GlideinClient 
{
	public static void main(String[] args) 
	{
		GlideinFactoryServiceAddressingLocator glideinFactoryLocator = new GlideinFactoryServiceAddressingLocator();
		GlideinServiceAddressingLocator glideinInstanceLocator = new GlideinServiceAddressingLocator();
		
		try {
			String glideinFactoryURI = "http://juve.usc.edu:8080/wsrf/services/glidein/GlideinFactoryService";
			
			// Look up the factory
			EndpointReferenceType factoryEPR = new EndpointReferenceType();
			factoryEPR.setAddress(new Address(glideinFactoryURI));
			System.out.println(factoryEPR.toString());
			GlideinFactoryPortType glideinFactory = glideinFactoryLocator.getGlideinFactoryPortTypePort(factoryEPR);
			
			EnvironmentVariable[] env = new EnvironmentVariable[3];
			env[0] = new EnvironmentVariable("/bin","PATH");
			env[1] = new EnvironmentVariable("/home","HOME");
			env[2] = new EnvironmentVariable("shell","SHELL");
			
			Glidein glidein = new Glidein();
			glidein.setSiteId(11);
			glidein.setCount(1);
			glidein.setHostCount(1);
			glidein.setWallTime(30);
			glidein.setNumCpus(2);
			glidein.setGcbBroker("192.168.0.1");
			glidein.setIdleTime(30);
			glidein.setDebug(null);
			glidein.setEnvironment(env);
			
			EndpointReferenceType glideinRef = glideinFactory.createGlidein(glidein);
			System.out.println(glideinRef.toString());
			
			GlideinPortType instanceService = glideinInstanceLocator.getGlideinPortTypePort(glideinRef);
			
			GlideinStatus status = instanceService.getStatus(new EmptyObject());
			if (status==null) {
				System.out.println("Glidein status null");
			} else {
				System.out.printf("Glidein status: %s (%s)\n",status.getCode().toString(),status.getMessage());
			}
			
			glidein = instanceService.getGlidein(new EmptyObject());
			if (glidein==null) {
				System.out.println("Glidein null");
			} else {
				System.out.printf("Glidein: %s (%d)\n",glidein.getCondorHost(),glidein.getId());
			}
			
			//instanceService.delete(new EmptyObject());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
@@ -1435,16 +1435,22 @@
 dein.set
+Condor
 Debug(nu
@@ -1458,40 +1458,8 @@
 l);%0A
-%09%09%09glidein.setEnvironment(env);%0A
 %09%09%09%0A
@@ -1689,271 +1689,8 @@
 %09%09%09%0A
-%09%09%09GlideinStatus status = instanceService.getStatus(new EmptyObject());%0A%09%09%09if (status==null) %7B%0A%09%09%09%09System.out.println(%22Glidein status null%22);%0A%09%09%09%7D else %7B%0A%09%09%09%09System.out.printf(%22Glidein status: %25s (%25s)%5Cn%22,status.getCode().toString(),status.getMessage());%0A%09%09%09%7D%0A%09%09%09%0A
 %09%09%09g
@@ -1915,21 +1915,19 @@
 %09%09%7D%0A%09%09%09%0A
+
 %09%09%09
-//
 instance

Remove environment Rename debug Remove getStatus