FileDocCategorySizeDatePackage
SchedulerClient.javaAPI DocExample5285Sat Jun 03 14:29:42 BST 2000None

SchedulerClient

public class SchedulerClient extends Object
SchedulerClient is an XML-RPC client that makes XML-RPC requests to Scheduler.
version
1.0

Fields Summary
Constructors Summary
Methods Summary
public static voidaddEvents(helma.xmlrpc.XmlRpcClient client)

Add events to the Scheduler.

param
client XmlRpcClient to connect to

          
        System.out.println("\nAdding events...\n");          
          
        // Parameters for events
        Vector params = new Vector();
        
        // Add an event for next month
        params.addElement("Proofread final draft");
            
        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.MONTH, 1);
        params.addElement(cal.getTime());
            
        // Add the event
        if (((Boolean)client.execute("scheduler.addEvent", params))
                            .booleanValue()) {
            System.out.println("Event added.");
        } else {
            System.out.println("Could not add event.");
        }        
            
        // Add an event for tomorrow
        params.clear();
        params.addElement("Submit final draft");
            
        cal = Calendar.getInstance();
        cal.add(Calendar.DAY_OF_MONTH, 1);
        params.addElement(cal.getTime());
        
        // Add the event
        if (((Boolean)client.execute("scheduler.addEvent", params))
                            .booleanValue()) {
            System.out.println("Event added.");
        } else {
            System.out.println("Could not add event.");
        }        
            
    
public static voidlistEvents(helma.xmlrpc.XmlRpcClient client)

List the events currently in the Scheduler.

param
client XmlRpcClient to connect to

  
          
        System.out.println("\nListing events...\n");                

        // Get the events in the scheduler
        Vector params = new Vector();
        Vector events = 
            (Vector)client.execute("scheduler.getListOfEvents", params);
        for (int i=0; i<events.size(); i++) {
            System.out.println((String)events.elementAt(i));
        }
    
public static voidmain(java.lang.String[] args)

Static entry point for the demo.

        
        try {
            // Use the Apache Xerces SAX Parser Implementation
            XmlRpc.setDriver("org.apache.xerces.parsers.SAXParser");
          
            // Connect to server
            XmlRpcClient client = 
                new XmlRpcClient("http://localhost:8585/");                                         
              
            // Add some events
            addEvents(client);                        
            
            // List events
            listEvents(client);            
        
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }