X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Forg%2Fvamsas%2Ftest%2FExampleApplication.java;h=37e1498988933caff4f7538e97e271d33253e3a6;hb=875f9cdaa8fbc8716534ef7cb491a0803e580c43;hp=3c520546ec0f2c88f66ac3f14b1f805333b6eefb;hpb=4f90ed0584b74a10f19f9bbf69642a51c41c9062;p=vamsas.git diff --git a/src/org/vamsas/test/ExampleApplication.java b/src/org/vamsas/test/ExampleApplication.java index 3c52054..37e1498 100644 --- a/src/org/vamsas/test/ExampleApplication.java +++ b/src/org/vamsas/test/ExampleApplication.java @@ -81,7 +81,15 @@ public class ExampleApplication { System.out.println("Session "+evt.getPropertyName()+" is shutting down."); // tell app to finalize its session data before shutdown. } - }); + }); + vorbaclient.addVorbaEventHandler(Events.DOCUMENT_FINALIZEAPPDATA, + new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent evt) { + System.out.println("Application received a DOCUMENT_FINALIZEAPPDATA event."); + // tell app to finalize its session data prior to the storage of the current session as an archive. + } + }); + } public static String Usage="ExampleApplication [+]\n" @@ -91,13 +99,13 @@ public class ExampleApplication { return true; // incorrect arguments. } public static void main(String[] args) { - if ((args.length<=2) || parseArgs(args)) { + if ((args.length<=2) || !parseArgs(args)) { System.err.print(Usage); } // get IClientFactory try { - clientfactory = new org.vamsas.client.SimpleClientFactory(args[0]); + clientfactory = new org.vamsas.client.simpleclient.SimpleClientFactory(args[0]); } catch (IOException e) { System.err.println(e+"\n"+Usage); System.exit(1); @@ -106,11 +114,34 @@ public class ExampleApplication { // get an Iclient with session data app = new ClientHandle("org.vamsas.test.ExampleApplication","0.1"); user = new UserHandle("arnolduser","deathsdoor"); - vorbaclient = clientfactory.getIClient(app, user); + try { + vorbaclient = clientfactory.getIClient(app, user); + } catch (NoDefaultSessionException e) { + System.err.println("There appear to be several sessions to choose from :"); + String[] sessions = clientfactory.getCurrentSessions(); + for (int s=0;s