From 68449f3271b3061cc6ed2c3f665615de1bac2246 Mon Sep 17 00:00:00 2001 From: jprocter Date: Tue, 12 Dec 2006 23:49:50 +0000 Subject: [PATCH] basic ideas for per-object update interface git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@249 be28352e-c001-0410-b1a7-c7978e42abec --- src/org/vamsas/client/IClient.java | 9 +++++++++ src/org/vamsas/client/IObjectUpdate.java | 26 ++++++++++++++++++++++++++ src/org/vamsas/client/IVorbaIdFactory.java | 7 ++++--- 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 src/org/vamsas/client/IObjectUpdate.java diff --git a/src/org/vamsas/client/IClient.java b/src/org/vamsas/client/IClient.java index c73aaa4..aaf855f 100644 --- a/src/org/vamsas/client/IClient.java +++ b/src/org/vamsas/client/IClient.java @@ -115,6 +115,15 @@ public interface IClient { */ public void addVorbaEventHandler(String EventChain, PropertyChangeListener evt); /** + * Sets the update handler that will be called when any updates occur to objects of type rootObject. + * @param rootObject + * @param handler + */ + public void setUpdateHandler(IObjectUpdate handler); + public IObjectUpdate getUpdateHandler(Class rootObject); + public void removeUpdateHandler(Class rootObject); + public IObjectUpdate[] getUpdateHandlers(); + /** * client application calls this to force the * Vorba client to check for updates immediately. * diff --git a/src/org/vamsas/client/IObjectUpdate.java b/src/org/vamsas/client/IObjectUpdate.java new file mode 100644 index 0000000..f725c3c --- /dev/null +++ b/src/org/vamsas/client/IObjectUpdate.java @@ -0,0 +1,26 @@ +package org.vamsas.client; + +/** + * Methods implemented by a Vamsas Application's Object Update handler + * @author vamsas + * Introduced November 2006 Vamsas Meeting + * TODO: verify this is sufficient for the per-object update event mechanism + */ +interface IObjectUpdate { + /** + * Called by the library to find out which vamsas document object this update handler is interested in + * @return class that extends org.vamsas.Vobject + */ + Class getRootVobject(); + /** + * Called to test if this handler is to be called for updates to any Vobjects below the Root Vobject in the vamsas document. + * @return false means IObjectUpdate.update(updated, cdoc) will only be called with instances of type getRootVobject(). + */ + boolean handlesSubtreeUpdates(); + /** + * Method called by Vamsas Client Library for all updated objects that the handler is registered for. + * @param updated + * @param cdoc + */ + void update(org.vamsas.client.Vobject updated, org.vamsas.client.IClientDocument cdoc); +} diff --git a/src/org/vamsas/client/IVorbaIdFactory.java b/src/org/vamsas/client/IVorbaIdFactory.java index 3878592..f2364f0 100644 --- a/src/org/vamsas/client/IVorbaIdFactory.java +++ b/src/org/vamsas/client/IVorbaIdFactory.java @@ -8,9 +8,10 @@ package org.vamsas.client; /** * @author jimp - * - * TODO To change the template for this generated type comment go to - * Window - Preferences - Java - Code Style - Code Templates + * middleware interface for generating new VorbaId objects + * for a particular vamsas client based on the current + * session, user and client handle. Generally implemented + * by instances of the vamsas library api only. */ public interface IVorbaIdFactory { /** -- 1.7.10.2