import com.sqribe.rm.*;
import java.util.Properties;
/*** example class for triggering an External event */
public class TriggerExternalEvent
{
public TriggerExternalEvent(String [] args)
{
try
{
Session session;
//--------------------------------------------------------------------
// obtain a session connection
//--------------------------------------------------------------------
if (args.length < 5) { throw new IndexOutOfBoundsException(); } else { session = SessionFactory.getInstance(args[0], args[1], args[2], new Integer(args[3]).intValue()); } System.out.println("connection established"); //---------------------------------------------------------------- // trigger external event //---------------------------------------------------------------- try { String EventName = args[4]; Scheduler sch = session.getScheduler(); ExternallyTriggeredEvent MyEvent = null; MyEvent = (ExternallyTriggeredEvent) .getExternallyTriggeredEvent(EventName); System.out.println("Event found..."); MyEvent.triggerETE(); System.out.println("Triggerred Event :: " + EventName); } catch (ReportMartException e) { System.out.println("Event not found"); e.printStackTrace(); } //---------------------------------------------------------------- // close the session when you no longer need it //---------------------------------------------------------------- session.close(); System.out.println("connection closed"); } catch (ReportMartException e) { System.out.println("connection could not be established"); e.printStackTrace(); } } /** * program entry point *
* @param String [] args - command line arguments
*/
public static void main(String [] args)
{
try
{
new TriggerExternalEvent(args);
}
catch (IndexOutOfBoundsException e)
{
System.err.println("usage: TriggerExternalEvent
}
}
}