diff options
| author | slewis | 2005-01-02 05:42:55 +0000 |
|---|---|---|
| committer | slewis | 2005-01-02 05:42:55 +0000 |
| commit | 4e9e8071e63d22a6df7c266a8024065688367055 (patch) | |
| tree | 87f44e05b955181f50a8fcaef30c7148d02da630 | |
| parent | d35d61431126d8bcb5719eab661f559dc556cd81 (diff) | |
| download | org.eclipse.ecf-4e9e8071e63d22a6df7c266a8024065688367055.tar.gz org.eclipse.ecf-4e9e8071e63d22a6df7c266a8024065688367055.tar.xz org.eclipse.ecf-4e9e8071e63d22a6df7c266a8024065688367055.zip | |
Added support in provider classes for container listener notification for join/leave group member change events. Added supporting event interface and classes (in org.eclipse.ecf.core.events). Added test case to test.
23 files changed, 871 insertions, 739 deletions
diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/ClientSOContainer.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/ClientSOContainer.java index ec5430d2b..0e2d5b17e 100644 --- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/ClientSOContainer.java +++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/ClientSOContainer.java @@ -25,6 +25,10 @@ import org.eclipse.ecf.core.comm.IAsynchConnection; import org.eclipse.ecf.core.comm.IConnection; import org.eclipse.ecf.core.comm.ISynchAsynchConnection; import org.eclipse.ecf.core.comm.SynchConnectionEvent; +import org.eclipse.ecf.core.events.SharedObjectContainerDepartedEvent; +import org.eclipse.ecf.core.events.SharedObjectContainerJoinGroupEvent; +import org.eclipse.ecf.core.events.SharedObjectContainerJoinedEvent; +import org.eclipse.ecf.core.events.SharedObjectContainerLeaveGroupEvent; import org.eclipse.ecf.core.identity.ID; import org.eclipse.ecf.provider.generic.gmm.Member; @@ -75,6 +79,8 @@ public abstract class ClientSOContainer extends SOContainer { public void joinGroup(ID remote, Object data) throws SharedObjectContainerJoinException { + // first notify synchonously + fireContainerEvent(new SharedObjectContainerJoinGroupEvent(this.getID(),remote,data)); try { if (isClosing) throw new IllegalStateException("container is closing"); @@ -175,8 +181,12 @@ public abstract class ClientSOContainer extends SOContainer { for (int i = 0; i < changeIDs.length; i++) { if (vc.isAdd()) { groupManager.addMember(new Member(changeIDs[i])); + // Notify listeners + fireContainerEvent(new SharedObjectContainerJoinedEvent(getID(),changeIDs[i])); } else { groupManager.removeMember(changeIDs[i]); + // Notify listeners + fireContainerEvent(new SharedObjectContainerDepartedEvent(getID(),changeIDs[i])); } } } @@ -198,21 +208,23 @@ public abstract class ClientSOContainer extends SOContainer { public void leaveGroup() { debug("leaveGroup"); + ID groupID = getGroupID(); + fireContainerEvent(new SharedObjectContainerLeaveGroupEvent(this.getID(),groupID)); synchronized (connectLock) { // If we are currently connected if (isConnected()) { synchronized (connection) { try { - connection.sendSynch(remoteServerID, + connection.sendSynch(groupID, getBytesForObject(ContainerMessage .makeLeaveGroupMessage(getID(), - remoteServerID, + groupID, getNextSequenceNumber(), - getLeaveData(remoteServerID)))); + getLeaveData(groupID)))); } catch (Exception e) { } synchronized (getGroupMembershipLock()) { - memberLeave(remoteServerID, connection); + memberLeave(groupID, connection); } } } @@ -220,39 +232,13 @@ public abstract class ClientSOContainer extends SOContainer { connection = null; remoteServerID = null; } + // notify listeners + fireContainerEvent(new SharedObjectContainerDepartedEvent(this.getID(),groupID)); } protected abstract ISynchAsynchConnection getClientConnection( ID remoteSpace, Object data) throws ConnectionInstantiationException; - - protected void handleChangeMsg(ID fromID, ID toID, long seqNum, - Serializable data) throws IOException { - ContainerMessage.ViewChangeMessage c = null; - // Check data in packge for validity - ID ids[] = null; - try { - c = (ContainerMessage.ViewChangeMessage) data; - if (fromID == null || c == null) - throw new Exception(); - ids = c.changeIDs; - if (ids == null || ids[0] == null || !fromID.equals(remoteServerID)) - throw new IOException(); - } catch (Exception e) { - InvalidObjectException t = new InvalidObjectException("bad data" - + ":" + fromID + ":" + toID + ":" + seqNum); - throw t; - } - // Now actually add/remove member - Member m = new Member(ids[0]); - synchronized (getGroupMembershipLock()) { - if (c.add) { - groupManager.addMember(m); - } else - groupManager.removeMember(m); - } - } - protected void queueContainerMessage(ContainerMessage message) throws IOException { // Do it @@ -352,8 +338,11 @@ public abstract class ClientSOContainer extends SOContainer { throw new java.io.InvalidObjectException("id array null"); for (int i = 0; i < ids.length; i++) { ID id = ids[i]; - if (id != null && !id.equals(getID())) + if (id != null && !id.equals(getID())) { addNewRemoteMember(id, null); + // notify listeners + fireContainerEvent(new SharedObjectContainerJoinedEvent(this.getID(),id)); + } } return fromID; } diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContainer.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContainer.java index 94c5bdbdd..553cdbd0f 100644 --- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContainer.java +++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/SOContainer.java @@ -48,121 +48,219 @@ import org.eclipse.ecf.provider.Trace; import org.eclipse.ecf.provider.generic.gmm.Member; public abstract class SOContainer implements ISharedObjectContainer { - static Trace debug = Trace.create("container"); - public static final String DEFAULT_OBJECT_ARG_KEY = SOContainer.class - .getName() - + ".sharedobjectargs"; - public static final String DEFAULT_OBJECT_ARGTYPES_KEY = SOContainer.class - .getName() - + ".sharedobjectargs"; - private long sequenceNumber = 0L; - private Vector listeners = null; - protected ISharedObjectContainerConfig config = null; - protected SOContainerGMM groupManager = null; - protected ThreadGroup loadingThreadGroup = null; - protected ThreadGroup sharedObjectThreadGroup = null; - protected SOManager sharedObjectManager = null; - protected boolean isClosing = false; - protected MessageReceiver receiver; - protected void debug(String msg) { - if (Trace.ON && debug != null) { - debug.msg(msg + ":" + config.getID()); - } - } + class LoadingSharedObject implements ISharedObject { + Object credentials; + SharedObjectDescription description; + Thread runner = null; - protected void dumpStack(String msg, Throwable e) { - if (Trace.ON && debug != null) { - debug.dumpStack(e, msg + ":" + config.getID()); + LoadingSharedObject(SharedObjectDescription sd, Object credentials) { + this.description = sd; + this.credentials = credentials; } - } - protected byte[] getBytesForObject(Serializable obj) throws IOException { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ObjectOutputStream oos = new ObjectOutputStream(bos); - oos.writeObject(obj); - return bos.toByteArray(); - } + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.core.ISharedObject#dispose(org.eclipse.ecf.core.identity.ID) + */ + public void dispose(ID containerID) { + } - protected ContainerMessage getObjectFromBytes(byte[] bytes) - throws IOException { - ByteArrayInputStream bis = new ByteArrayInputStream(bytes); - ObjectInputStream ois = new ObjectInputStream(bis); - Object obj = null; - try { - obj = ois.readObject(); - } catch (ClassNotFoundException e) { - dumpStack("class not found for message", e); + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.core.ISharedObject#getAdapter(java.lang.Class) + */ + public Object getAdapter(Class clazz) { return null; } - if (obj instanceof ContainerMessage) { - return (ContainerMessage) obj; - } else { - debug("message received is not containermessage:"+obj); - return null; + + ID getHomeID() { + return description.getHomeID(); } - } - protected void killConnection(IConnection conn) { - debug("killconnection"); - try { - if (conn != null) - conn.disconnect(); - } catch (IOException e) { - logException("Exception in killConnection", e); + ID getID() { + return description.getID(); } - } - protected void logException(String msg, Throwable e) { - dumpStack(msg, e); - } + Thread getThread() { + return new Thread(loadingThreadGroup, new Runnable() { + public void run() { + try { + if (Thread.currentThread().isInterrupted() + || isClosing()) + throw new InterruptedException( + "Loading interrupted for object " + + getID().getName()); + // First load given object + ISharedObject obj = load(description); + // Get config info for new object + SOConfig aConfig = makeSharedObjectConfig(description, + obj); + // Call init method on new object. + obj.init(aConfig); + // Check to make sure thread has not been + // interrupted...if it has, throw + if (Thread.currentThread().isInterrupted() + || isClosing()) + throw new InterruptedException( + "Loading interrupted for object " + + getID().getName()); + // Create meta object and move from loading to active + // list. + SOContainer.this.moveFromLoadingToActive(new SOWrapper( + aConfig, obj, SOContainer.this)); + } catch (Exception e) { + SOContainer.this.removeFromLoading(getID()); + try { + sendCreateResponse(getHomeID(), getID(), e, + description.getIdentifier()); + } catch (Exception e1) { + } + } + } + }, "LRunner" + getID().getName()); + } - protected void log(String msg) { - debug(msg); - } + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.core.ISharedObject#handleEvent(org.eclipse.ecf.core.util.Event) + */ + public void handleEvent(Event event) { + } - protected void memberLeave(ID target, IConnection conn) { - debug("memberLeave:" + target + ":" + conn); - if (groupManager.removeMember(target)) { - try { - forwardExcluding(getID(),target,ContainerMessage.makeViewChangeMessage(getID(),null,getNextSequenceNumber(),new ID[] { target },false,null)); - } catch (IOException e) { - logException("Exception in memberLeave.forwardExcluding",e); + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.core.ISharedObject#handleEvents(org.eclipse.ecf.core.util.Event[]) + */ + public void handleEvents(Event[] events) { + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.core.ISharedObject#init(org.eclipse.ecf.core.ISharedObjectConfig) + */ + public void init(ISharedObjectConfig initData) + throws SharedObjectInitException { + } + + void start() { + if (runner == null) { + runner = (Thread) AccessController + .doPrivileged(new PrivilegedAction() { + public Object run() { + return getThread(); + } + }); + runner.setDaemon(true); + runner.start(); } } - if (conn != null) - killConnection(conn); } - protected void fireContainerEvent(IContainerEvent event) { - synchronized (listeners) { - for (Iterator i = listeners.iterator(); i.hasNext();) - ((ISharedObjectContainerListener) i.next()).handleEvent(event); + class MessageReceiver implements ISynchAsynchConnectionEventHandler { + + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.internal.comm.IConnectionEventHandler#getAdapter(java.lang.Class) + */ + public Object getAdapter(Class clazz) { + return null; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.internal.comm.IAsynchConnectionEventHandler#handleAsynchEvent(org.eclipse.ecf.internal.comm.AsynchConnectionEvent) + */ + public void handleAsynchEvent(AsynchConnectionEvent event) + throws IOException { + processAsynch(event); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.internal.comm.IConnectionEventHandler#handleDisconnectEvent(org.eclipse.ecf.internal.comm.ConnectionEvent) + */ + public void handleDisconnectEvent(DisconnectConnectionEvent event) { + processDisconnect(event); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.internal.comm.IConnectionEventHandler#handleSuspectEvent(org.eclipse.ecf.internal.comm.ConnectionEvent) + */ + public boolean handleSuspectEvent(ConnectionEvent event) { + return false; + } + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.internal.comm.ISynchConnectionEventHandler#handleSynchEvent(org.eclipse.ecf.internal.comm.SynchConnectionEvent) + */ + public Object handleSynchEvent(SynchConnectionEvent event) + throws IOException { + return processSynch(event); } } + static Trace debug = Trace.create("container"); + public static final String DEFAULT_OBJECT_ARG_KEY = SOContainer.class + .getName() + + ".sharedobjectargs"; + public static final String DEFAULT_OBJECT_ARGTYPES_KEY = SOContainer.class + .getName() + + ".sharedobjectargs"; + protected ISharedObjectContainerConfig config = null; + protected SOContainerGMM groupManager = null; + protected boolean isClosing = false; + private Vector listeners = null; + protected ThreadGroup loadingThreadGroup = null; + protected MessageReceiver receiver; + private long sequenceNumber = 0L; + protected SOManager sharedObjectManager = null; + protected ThreadGroup sharedObjectThreadGroup = null; - protected long getNextSequenceNumber() { - if (sequenceNumber == Long.MAX_VALUE) { - sequenceNumber = 0; - return sequenceNumber; - } else - return sequenceNumber++; + public SOContainer(ISharedObjectContainerConfig config) { + if (config == null) + throw new InstantiationError("config must not be null"); + this.config = config; + groupManager = new SOContainerGMM(this, new Member(config.getID())); + sharedObjectManager = new SOManager(this); + loadingThreadGroup = getLoadingThreadGroup(); + sharedObjectThreadGroup = getSharedObjectThreadGroup(); + listeners = new Vector(); + receiver = new MessageReceiver(); + debug("<init>"); } - protected Object getGroupMembershipLock() { - return groupManager; + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.core.ISharedObjectContainer#addListener(org.eclipse.ecf.core.ISharedObjectContainerListener, + * java.lang.String) + */ + public void addListener(ISharedObjectContainerListener l, String filter) { + synchronized (listeners) { + listeners.add(l); + } } - public ID[] getOtherMemberIDs() { - return groupManager.getOtherMemberIDs(); + protected boolean addNewRemoteMember(ID memberID, Object data) { + debug("addNewRemoteMember:" + memberID); + return groupManager.addMember(new Member(memberID, data)); } - protected ISharedObject getSharedObject(ID id) { - SOWrapper wrap = getSharedObjectWrapper(id); - if (wrap == null) - return null; - else - return wrap.getSharedObject(); + protected ISharedObject addSharedObject0(SharedObjectDescription sd, + ISharedObject s) throws Exception { + addSharedObjectWrapper(makeNewSharedObjectWrapper(sd, s)); + return s; } protected ISharedObject addSharedObjectAndWait(SharedObjectDescription sd, @@ -177,30 +275,6 @@ public abstract class SOContainer implements ISharedObjectContainer { return s; } - protected ISharedObject addSharedObject0(SharedObjectDescription sd, - ISharedObject s) throws Exception { - addSharedObjectWrapper(makeNewSharedObjectWrapper(sd, s)); - return s; - } - - protected SOWrapper makeNewSharedObjectWrapper(SharedObjectDescription sd, - ISharedObject s) { - SOConfig newConfig = makeNewSharedObjectConfig(sd, this); - return new SOWrapper(newConfig, s, this); - } - - protected SOConfig makeNewSharedObjectConfig(SharedObjectDescription sd, - SOContainer cont) { - ID homeID = sd.getHomeID(); - if (homeID == null) - homeID = getID(); - return new SOConfig(sd.getID(), homeID, this, sd.getProperties()); - } - - protected SOWrapper getSharedObjectWrapper(ID id) { - return groupManager.getFromActive(id); - } - protected void addSharedObjectWrapper(SOWrapper wrapper) throws Exception { if (wrapper == null) return; @@ -218,29 +292,73 @@ public abstract class SOContainer implements ISharedObjectContainer { } } - protected ISharedObject removeSharedObject(ID id) { - synchronized (getGroupMembershipLock()) { - SOWrapper wrap = groupManager.getFromActive(id); - if (wrap == null) - return null; - groupManager.removeSharedObject(id); - return wrap.getSharedObject(); + protected boolean addToLoading(LoadingSharedObject lso) { + return groupManager.addLoadingSharedObject(lso); + } + + protected Object checkCreate(ID fromID, ID toID, long seq, + SharedObjectDescription desc) { + debug("checkCreate(" + fromID + "," + toID + "," + seq + "," + desc + + ")"); + // XXX TODO + return desc; + } + + protected void debug(String msg) { + if (Trace.ON && debug != null) { + debug.msg(msg + ":" + config.getID()); } } - protected boolean addNewRemoteMember(ID memberID, Object data) { - debug("addNewRemoteMember:" + memberID); - return groupManager.addMember(new Member(memberID, data)); + protected boolean destroySharedObject(ID sharedObjectID) { + return groupManager.removeSharedObject(sharedObjectID); } - abstract protected void queueContainerMessage(ContainerMessage mess) - throws IOException; + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.core.ISharedObjectContainer#dispose(long) + */ + public void dispose(long waittime) { + debug("dispose:" + waittime); + isClosing = true; + // XXX Notify listeners that we're going away + // Clear group manager + if (groupManager != null) { + groupManager.removeAllMembers(); + groupManager = null; + } + // Clear shared object manager + if (sharedObjectManager != null) { + sharedObjectManager.dispose(); + sharedObjectManager = null; + } + if (sharedObjectThreadGroup != null) { + sharedObjectThreadGroup.interrupt(); + sharedObjectThreadGroup = null; + } + if (loadingThreadGroup != null) { + loadingThreadGroup.interrupt(); + loadingThreadGroup = null; + } + if (listeners != null) { + listeners.clear(); + listeners = null; + } + } - abstract protected void forwardToRemote(ID from, ID to, - ContainerMessage data) throws IOException; + protected void dumpStack(String msg, Throwable e) { + if (Trace.ON && debug != null) { + debug.dumpStack(e, msg + ":" + config.getID()); + } + } - abstract protected void forwardExcluding(ID from, ID excluding, - ContainerMessage data) throws IOException; + protected void fireContainerEvent(IContainerEvent event) { + synchronized (listeners) { + for (Iterator i = listeners.iterator(); i.hasNext();) + ((ISharedObjectContainerListener) i.next()).handleEvent(event); + } + } protected final void forward(ID fromID, ID toID, ContainerMessage data) throws IOException { @@ -251,197 +369,209 @@ public abstract class SOContainer implements ISharedObjectContainer { } } - protected boolean removeRemoteMember(ID remoteMember) { - return groupManager.removeMember(remoteMember); - } + abstract protected void forwardExcluding(ID from, ID excluding, + ContainerMessage data) throws IOException; - protected void sendMessage(ContainerMessage data) throws IOException { - debug("sendcontainermessage:" + data); - synchronized (getGroupMembershipLock()) { - ID ourID = getID(); - // We don't send to ourselves - if (!ourID.equals(data.getToContainerID())) - queueContainerMessage(data); - } - } + abstract protected void forwardToRemote(ID from, ID to, + ContainerMessage data) throws IOException; - protected ID[] sendCreateSharedObjectMessage(ID toContainerID, - SharedObjectDescription sd) throws IOException { - ID[] returnIDs = null; - if (toContainerID == null) { - synchronized (getGroupMembershipLock()) { - // Send message to all - sendMessage(ContainerMessage.makeSharedObjectCreateMessage( - getID(), toContainerID, getNextSequenceNumber(), sd)); - returnIDs = getOtherMemberIDs(); - } - } else { - // If the create msg is directed to this space, no msg will be sent - if (getID().equals(toContainerID)) { - returnIDs = new ID[0]; - } else { - sendMessage(ContainerMessage.makeSharedObjectCreateMessage( - getID(), toContainerID, getNextSequenceNumber(), sd)); - returnIDs = new ID[1]; - returnIDs[0] = toContainerID; - } - } - return returnIDs; + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.core.ISharedObjectContainer#getAdapter(java.lang.Class) + */ + public Object getAdapter(Class adapter) { + return null; } - protected void sendCreateResponseSharedObjectMessage(ID toContainerID, - ID fromSharedObject, Throwable t, long ident) throws IOException { - sendMessage(ContainerMessage.makeSharedObjectCreateResponseMessage( - getID(), toContainerID, getNextSequenceNumber(), - fromSharedObject, t, ident)); + /** + * @param sd + * @return + */ + public Object[] getArgsFromProperties(SharedObjectDescription sd) { + if (sd == null) + return null; + Map aMap = sd.getProperties(); + if (aMap == null) + return null; + Object obj = aMap.get(DEFAULT_OBJECT_ARG_KEY); + if (obj == null) + return null; + if (obj instanceof Object[]) { + Object[] ret = (Object[]) obj; + aMap.remove(DEFAULT_OBJECT_ARG_KEY); + return ret; + } else + return null; } - protected void sendSharedObjectMessage(ID toContainerID, - ID fromSharedObject, Serializable data) throws IOException { - sendMessage(ContainerMessage.makeSharedObjectMessage(getID(), - toContainerID, getNextSequenceNumber(), fromSharedObject, data)); + /** + * @param sd + * @return + */ + public String[] getArgTypesFromProperties(SharedObjectDescription sd) { + if (sd == null) + return null; + Map aMap = sd.getProperties(); + if (aMap == null) + return null; + Object obj = aMap.get(DEFAULT_OBJECT_ARGTYPES_KEY); + if (obj == null) + return null; + if (obj instanceof String[]) { + String[] ret = (String[]) obj; + aMap.remove(DEFAULT_OBJECT_ARGTYPES_KEY); + return ret; + } else + return null; } - protected void sendDisposeSharedObjectMessage(ID toContainerID, - ID fromSharedObject) throws IOException { - sendMessage(ContainerMessage.makeSharedObjectDisposeMessage(getID(), - toContainerID, getNextSequenceNumber(), fromSharedObject)); + protected byte[] getBytesForObject(Serializable obj) throws IOException { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(bos); + oos.writeObject(obj); + return bos.toByteArray(); } - public SOContainer(ISharedObjectContainerConfig config) { - if (config == null) - throw new InstantiationError("config must not be null"); - this.config = config; - groupManager = new SOContainerGMM(this, new Member(config.getID())); - sharedObjectManager = new SOManager(this); - loadingThreadGroup = getLoadingThreadGroup(); - sharedObjectThreadGroup = getSharedObjectThreadGroup(); - listeners = new Vector(); - receiver = new MessageReceiver(); - debug("<init>"); + protected ClassLoader getClassLoaderForContainer() { + return this.getClass().getClassLoader(); } - protected ISynchAsynchConnectionEventHandler getReceiver() { - return receiver; + /** + * @param sd + * @return + */ + protected ClassLoader getClassLoaderForSharedObject( + SharedObjectDescription sd) { + if (sd != null) { + ClassLoader cl = sd.getClassLoader(); + if (cl != null) + return cl; + else + return getClassLoaderForContainer(); + } else + return getClassLoaderForContainer(); } - protected boolean isClosing() { - return isClosing; + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.core.ISharedObjectContainer#getConfig() + */ + public ISharedObjectContainerConfig getConfig() { + return config; } - protected void setIsClosing() { - isClosing = true; - } + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.core.ISharedObjectContainer#getGroupID() + */ + public abstract ID getGroupID(); - protected ThreadGroup getLoadingThreadGroup() { - return new ThreadGroup(getID() + ":Loading"); + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.core.ISharedObjectContainer#getGroupMemberIDs() + */ + public ID[] getGroupMemberIDs() { + return groupManager.getMemberIDs(); } - protected ThreadGroup getSharedObjectThreadGroup() { - return new ThreadGroup(getID() + ":SOs"); + protected Object getGroupMembershipLock() { + return groupManager; } public ID getID() { return config.getID(); } - protected int getMaxGroupMembers() { - return groupManager.getMaxMembers(); + protected ThreadGroup getLoadingThreadGroup() { + return new ThreadGroup(getID() + ":Loading"); } - protected void setMaxGroupMembers(int max) { - groupManager.setMaxMembers(max); + protected int getMaxGroupMembers() { + return groupManager.getMaxMembers(); } - protected void notifySharedObjectActivated(ID sharedObjectID) { - groupManager.notifyOthersActivated(sharedObjectID); + protected Thread getNewSharedObjectThread(ID sharedObjectID, + Runnable runnable) { + return new Thread(sharedObjectThreadGroup, runnable, getID().getName() + + ";" + sharedObjectID.getName()); } - protected void notifySharedObjectDeactivated(ID sharedObjectID) { - groupManager.notifyOthersDeactivated(sharedObjectID); + protected long getNextSequenceNumber() { + if (sequenceNumber == Long.MAX_VALUE) { + sequenceNumber = 0; + return sequenceNumber; + } else + return sequenceNumber++; } - protected boolean destroySharedObject(ID sharedObjectID) { - return groupManager.removeSharedObject(sharedObjectID); + protected ContainerMessage getObjectFromBytes(byte[] bytes) + throws IOException { + ByteArrayInputStream bis = new ByteArrayInputStream(bytes); + ObjectInputStream ois = new ObjectInputStream(bis); + Object obj = null; + try { + obj = ois.readObject(); + } catch (ClassNotFoundException e) { + dumpStack("class not found for message", e); + return null; + } + if (obj instanceof ContainerMessage) { + return (ContainerMessage) obj; + } else { + debug("message received is not containermessage:"+obj); + return null; + } } protected IOSGIService getOSGIServiceInterface() { return null; } - protected void sendCreate(ID sharedObjectID, ID toContainerID, - SharedObjectDescription sd) throws IOException { - sendCreateSharedObjectMessage(toContainerID, sd); - } - - protected void sendDispose(ID toContainerID, ID sharedObjectID) - throws IOException { - sendDisposeSharedObjectMessage(toContainerID, sharedObjectID); - } - - protected void sendMessage(ID toContainerID, ID sharedObjectID, - Object message) throws IOException { - if (message == null) - return; - if (message instanceof Serializable) - throw new NotSerializableException(message.getClass().getName()); - sendSharedObjectMessage(toContainerID, sharedObjectID, - (Serializable) message); - } - - protected void sendCreateResponse(ID homeID, ID sharedObjectID, - Throwable t, long identifier) throws IOException { - sendCreateResponseSharedObjectMessage(homeID, sharedObjectID, t, - identifier); + public ID[] getOtherMemberIDs() { + return groupManager.getOtherMemberIDs(); } - protected Thread getNewSharedObjectThread(ID sharedObjectID, - Runnable runnable) { - return new Thread(sharedObjectThreadGroup, runnable, getID().getName() - + ";" + sharedObjectID.getName()); + protected ISynchAsynchConnectionEventHandler getReceiver() { + return receiver; } - protected ISharedObject load(SharedObjectDescription sd) throws Exception { - return sharedObjectManager.loadSharedObject(sd); + protected ISharedObject getSharedObject(ID id) { + SOWrapper wrap = getSharedObjectWrapper(id); + if (wrap == null) + return null; + else + return wrap.getSharedObject(); } protected ID[] getSharedObjectIDs() { return groupManager.getSharedObjectIDs(); } - protected SOConfig makeSharedObjectConfig(SharedObjectDescription sd, - ISharedObject obj) { - return new SOConfig(sd.getID(), sd.getHomeID(), this, sd - .getProperties()); - } - - protected void moveFromLoadingToActive(SOWrapper wrap) { - groupManager.moveSharedObjectFromLoadingToActive(wrap); - } - - protected void removeFromLoading(ID id) { - groupManager.removeSharedObjectFromLoading(id); + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.core.ISharedObjectContainer#getSharedObjectManager() + */ + public ISharedObjectManager getSharedObjectManager() { + return sharedObjectManager; } - protected void processDisconnect(DisconnectConnectionEvent e) { - debug("processDisconnect:" + e); - try { - ContainerMessage mess = getObjectFromBytes((byte[]) e.getData()); - } catch (IOException except) { - logException("Exception in processDisconnect ", except); - } + protected ThreadGroup getSharedObjectThreadGroup() { + return new ThreadGroup(getID() + ":SOs"); } - protected Object checkCreate(ID fromID, ID toID, long seq, - SharedObjectDescription desc) { - debug("checkCreate(" + fromID + "," + toID + "," + seq + "," + desc - + ")"); - // XXX TODO - return desc; + protected SOWrapper getSharedObjectWrapper(ID id) { + return groupManager.getFromActive(id); } - protected boolean addToLoading(LoadingSharedObject lso) { - return groupManager.addLoadingSharedObject(lso); + protected void handleAsynchIOException(IOException except, + AsynchConnectionEvent e) { + // If we get IO Exception, we'll disconnect...if we can + killConnection(e.getConnection()); } protected void handleCreateMessage(ContainerMessage mess) @@ -535,18 +665,118 @@ public abstract class SOContainer implements ISharedObjectContainer { } } - protected abstract void handleViewChangeMessage(ContainerMessage mess) - throws IOException; - protected void handleUnidentifiedMessage(ContainerMessage mess) throws IOException { // do nothing } - protected void handleAsynchIOException(IOException except, - AsynchConnectionEvent e) { - // If we get IO Exception, we'll disconnect...if we can - killConnection(e.getConnection()); + protected abstract void handleViewChangeMessage(ContainerMessage mess) + throws IOException; + + protected boolean isClosing() { + return isClosing; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.core.ISharedObjectContainer#isGroupManager() + */ + public abstract boolean isGroupManager(); + + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.core.ISharedObjectContainer#isGroupServer() + */ + public abstract boolean isGroupServer(); + + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.core.ISharedObjectContainer#joinGroup(org.eclipse.ecf.core.identity.ID, + * java.lang.Object) + */ + public abstract void joinGroup(ID groupID, Object loginData) + throws SharedObjectContainerJoinException; + + protected void killConnection(IConnection conn) { + debug("killconnection"); + try { + if (conn != null) + conn.disconnect(); + } catch (IOException e) { + logException("Exception in killConnection", e); + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.core.ISharedObjectContainer#leaveGroup() + */ + public abstract void leaveGroup(); + + protected ISharedObject load(SharedObjectDescription sd) throws Exception { + return sharedObjectManager.loadSharedObject(sd); + } + + protected void log(String msg) { + debug(msg); + } + + protected void logException(String msg, Throwable e) { + dumpStack(msg, e); + } + + protected SOConfig makeNewSharedObjectConfig(SharedObjectDescription sd, + SOContainer cont) { + ID homeID = sd.getHomeID(); + if (homeID == null) + homeID = getID(); + return new SOConfig(sd.getID(), homeID, this, sd.getProperties()); + } + + protected SOWrapper makeNewSharedObjectWrapper(SharedObjectDescription sd, + ISharedObject s) { + SOConfig newConfig = makeNewSharedObjectConfig(sd, this); + return new SOWrapper(newConfig, s, this); + } + + protected SOConfig makeSharedObjectConfig(SharedObjectDescription sd, + ISharedObject obj) { + return new SOConfig(sd.getID(), sd.getHomeID(), this, sd + .getProperties()); + } + + protected void memberLeave(ID target, IConnection conn) { + debug("memberLeave:" + target + ":" + conn); + if (groupManager.removeMember(target)) { + try { + forwardExcluding(getID(),target,ContainerMessage.makeViewChangeMessage(getID(),null,getNextSequenceNumber(),new ID[] { target },false,null)); + } catch (IOException e) { + logException("Exception in memberLeave.forwardExcluding",e); + } + } + if (conn != null) + killConnection(conn); + } + + protected void moveFromLoadingToActive(SOWrapper wrap) { + groupManager.moveSharedObjectFromLoadingToActive(wrap); + } + + protected void notifyGroupLeave(ContainerMessage mess) { + // XXX todo + debug("notifyGroupLeave(" + mess + ")"); + } + + protected void notifySharedObjectActivated(ID sharedObjectID) { + groupManager.notifyOthersActivated(sharedObjectID); + } + + protected void notifySharedObjectDeactivated(ID sharedObjectID) { + groupManager.notifyOthersDeactivated(sharedObjectID); } protected void processAsynch(AsynchConnectionEvent e) { @@ -576,6 +806,15 @@ public abstract class SOContainer implements ISharedObjectContainer { } } + protected void processDisconnect(DisconnectConnectionEvent e) { + debug("processDisconnect:" + e); + try { + ContainerMessage mess = getObjectFromBytes((byte[]) e.getData()); + } catch (IOException except) { + logException("Exception in processDisconnect ", except); + } + } + protected Serializable processSynch(SynchConnectionEvent e) throws IOException { debug("processSynch:" + e); @@ -588,143 +827,11 @@ public abstract class SOContainer implements ISharedObjectContainer { return null; } - protected void notifyGroupLeave(ContainerMessage mess) { - // XXX todo - debug("notifyGroupLeave(" + mess + ")"); - } - - class LoadingSharedObject implements ISharedObject { - SharedObjectDescription description; - Object credentials; - Thread runner = null; - - LoadingSharedObject(SharedObjectDescription sd, Object credentials) { - this.description = sd; - this.credentials = credentials; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ecf.core.ISharedObject#init(org.eclipse.ecf.core.ISharedObjectConfig) - */ - public void init(ISharedObjectConfig initData) - throws SharedObjectInitException { - } - - ID getID() { - return description.getID(); - } - - ID getHomeID() { - return description.getHomeID(); - } - - void start() { - if (runner == null) { - runner = (Thread) AccessController - .doPrivileged(new PrivilegedAction() { - public Object run() { - return getThread(); - } - }); - runner.setDaemon(true); - runner.start(); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ecf.core.ISharedObject#handleEvent(org.eclipse.ecf.core.util.Event) - */ - public void handleEvent(Event event) { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ecf.core.ISharedObject#handleEvents(org.eclipse.ecf.core.util.Event[]) - */ - public void handleEvents(Event[] events) { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ecf.core.ISharedObject#dispose(org.eclipse.ecf.core.identity.ID) - */ - public void dispose(ID containerID) { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ecf.core.ISharedObject#getAdapter(java.lang.Class) - */ - public Object getAdapter(Class clazz) { - return null; - } - - Thread getThread() { - return new Thread(loadingThreadGroup, new Runnable() { - public void run() { - try { - if (Thread.currentThread().isInterrupted() - || isClosing()) - throw new InterruptedException( - "Loading interrupted for object " - + getID().getName()); - // First load given object - ISharedObject obj = load(description); - // Get config info for new object - SOConfig aConfig = makeSharedObjectConfig(description, - obj); - // Call init method on new object. - obj.init(aConfig); - // Check to make sure thread has not been - // interrupted...if it has, throw - if (Thread.currentThread().isInterrupted() - || isClosing()) - throw new InterruptedException( - "Loading interrupted for object " - + getID().getName()); - // Create meta object and move from loading to active - // list. - SOContainer.this.moveFromLoadingToActive(new SOWrapper( - aConfig, obj, SOContainer.this)); - } catch (Exception e) { - SOContainer.this.removeFromLoading(getID()); - try { - sendCreateResponse(getHomeID(), getID(), e, - description.getIdentifier()); - } catch (Exception e1) { - } - } - } - }, "LRunner" + getID().getName()); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ecf.core.ISharedObjectContainer#getConfig() - */ - public ISharedObjectContainerConfig getConfig() { - return config; - } + abstract protected void queueContainerMessage(ContainerMessage mess) + throws IOException; - /* - * (non-Javadoc) - * - * @see org.eclipse.ecf.core.ISharedObjectContainer#addListener(org.eclipse.ecf.core.ISharedObjectContainerListener, - * java.lang.String) - */ - public void addListener(ISharedObjectContainerListener l, String filter) { - synchronized (listeners) { - listeners.add(l); - } + protected void removeFromLoading(ID id) { + groupManager.removeSharedObjectFromLoading(id); } /* @@ -738,211 +845,104 @@ public abstract class SOContainer implements ISharedObjectContainer { } } - /* - * (non-Javadoc) - * - * @see org.eclipse.ecf.core.ISharedObjectContainer#dispose(long) - */ - public void dispose(long waittime) { - debug("dispose:" + waittime); - isClosing = true; - // XXX Notify listeners that we're going away - // Clear group manager - if (groupManager != null) { - groupManager.removeAllMembers(); - groupManager = null; - } - // Clear shared object manager - if (sharedObjectManager != null) { - sharedObjectManager.dispose(); - sharedObjectManager = null; - } - if (sharedObjectThreadGroup != null) { - sharedObjectThreadGroup.interrupt(); - sharedObjectThreadGroup = null; - } - if (loadingThreadGroup != null) { - loadingThreadGroup.interrupt(); - loadingThreadGroup = null; - } - if (listeners != null) { - listeners.clear(); - listeners = null; - } + protected boolean removeRemoteMember(ID remoteMember) { + return groupManager.removeMember(remoteMember); } - /* - * (non-Javadoc) - * - * @see org.eclipse.ecf.core.ISharedObjectContainer#joinGroup(org.eclipse.ecf.core.identity.ID, - * java.lang.Object) - */ - public abstract void joinGroup(ID groupID, Object loginData) - throws SharedObjectContainerJoinException; - - /* - * (non-Javadoc) - * - * @see org.eclipse.ecf.core.ISharedObjectContainer#leaveGroup() - */ - public abstract void leaveGroup(); - - /* - * (non-Javadoc) - * - * @see org.eclipse.ecf.core.ISharedObjectContainer#getGroupID() - */ - public abstract ID getGroupID(); - - /* - * (non-Javadoc) - * - * @see org.eclipse.ecf.core.ISharedObjectContainer#getGroupMemberIDs() - */ - public ID[] getGroupMemberIDs() { - return groupManager.getMemberIDs(); + protected ISharedObject removeSharedObject(ID id) { + synchronized (getGroupMembershipLock()) { + SOWrapper wrap = groupManager.getFromActive(id); + if (wrap == null) + return null; + groupManager.removeSharedObject(id); + return wrap.getSharedObject(); + } } - /* - * (non-Javadoc) - * - * @see org.eclipse.ecf.core.ISharedObjectContainer#isGroupManager() - */ - public abstract boolean isGroupManager(); - - /* - * (non-Javadoc) - * - * @see org.eclipse.ecf.core.ISharedObjectContainer#isGroupServer() - */ - public abstract boolean isGroupServer(); - - /* - * (non-Javadoc) - * - * @see org.eclipse.ecf.core.ISharedObjectContainer#getSharedObjectManager() - */ - public ISharedObjectManager getSharedObjectManager() { - return sharedObjectManager; + protected void sendCreate(ID sharedObjectID, ID toContainerID, + SharedObjectDescription sd) throws IOException { + sendCreateSharedObjectMessage(toContainerID, sd); } - /* - * (non-Javadoc) - * - * @see org.eclipse.ecf.core.ISharedObjectContainer#getAdapter(java.lang.Class) - */ - public Object getAdapter(Class adapter) { - return null; + protected void sendCreateResponse(ID homeID, ID sharedObjectID, + Throwable t, long identifier) throws IOException { + sendCreateResponseSharedObjectMessage(homeID, sharedObjectID, t, + identifier); } - protected ClassLoader getClassLoaderForContainer() { - return this.getClass().getClassLoader(); + protected void sendCreateResponseSharedObjectMessage(ID toContainerID, + ID fromSharedObject, Throwable t, long ident) throws IOException { + sendMessage(ContainerMessage.makeSharedObjectCreateResponseMessage( + getID(), toContainerID, getNextSequenceNumber(), + fromSharedObject, t, ident)); } - /** - * @param sd - * @return - */ - protected ClassLoader getClassLoaderForSharedObject( - SharedObjectDescription sd) { - if (sd != null) { - ClassLoader cl = sd.getClassLoader(); - if (cl != null) - return cl; - else - return getClassLoaderForContainer(); - } else - return getClassLoaderForContainer(); + protected ID[] sendCreateSharedObjectMessage(ID toContainerID, + SharedObjectDescription sd) throws IOException { + ID[] returnIDs = null; + if (toContainerID == null) { + synchronized (getGroupMembershipLock()) { + // Send message to all + sendMessage(ContainerMessage.makeSharedObjectCreateMessage( + getID(), toContainerID, getNextSequenceNumber(), sd)); + returnIDs = getOtherMemberIDs(); + } + } else { + // If the create msg is directed to this space, no msg will be sent + if (getID().equals(toContainerID)) { + returnIDs = new ID[0]; + } else { + sendMessage(ContainerMessage.makeSharedObjectCreateMessage( + getID(), toContainerID, getNextSequenceNumber(), sd)); + returnIDs = new ID[1]; + returnIDs[0] = toContainerID; + } + } + return returnIDs; } - /** - * @param sd - * @return - */ - public Object[] getArgsFromProperties(SharedObjectDescription sd) { - if (sd == null) - return null; - Map aMap = sd.getProperties(); - if (aMap == null) - return null; - Object obj = aMap.get(DEFAULT_OBJECT_ARG_KEY); - if (obj == null) - return null; - if (obj instanceof Object[]) { - Object[] ret = (Object[]) obj; - aMap.remove(DEFAULT_OBJECT_ARG_KEY); - return ret; - } else - return null; + protected void sendDispose(ID toContainerID, ID sharedObjectID) + throws IOException { + sendDisposeSharedObjectMessage(toContainerID, sharedObjectID); } - /** - * @param sd - * @return - */ - public String[] getArgTypesFromProperties(SharedObjectDescription sd) { - if (sd == null) - return null; - Map aMap = sd.getProperties(); - if (aMap == null) - return null; - Object obj = aMap.get(DEFAULT_OBJECT_ARGTYPES_KEY); - if (obj == null) - return null; - if (obj instanceof String[]) { - String[] ret = (String[]) obj; - aMap.remove(DEFAULT_OBJECT_ARGTYPES_KEY); - return ret; - } else - return null; + protected void sendDisposeSharedObjectMessage(ID toContainerID, + ID fromSharedObject) throws IOException { + sendMessage(ContainerMessage.makeSharedObjectDisposeMessage(getID(), + toContainerID, getNextSequenceNumber(), fromSharedObject)); } - class MessageReceiver implements ISynchAsynchConnectionEventHandler { - /* - * (non-Javadoc) - * - * @see org.eclipse.ecf.internal.comm.ISynchConnectionEventHandler#handleSynchEvent(org.eclipse.ecf.internal.comm.SynchConnectionEvent) - */ - public Object handleSynchEvent(SynchConnectionEvent event) - throws IOException { - return processSynch(event); + protected void sendMessage(ContainerMessage data) throws IOException { + debug("sendcontainermessage:" + data); + synchronized (getGroupMembershipLock()) { + ID ourID = getID(); + // We don't send to ourselves + if (!ourID.equals(data.getToContainerID())) + queueContainerMessage(data); } + } - /* - * (non-Javadoc) - * - * @see org.eclipse.ecf.internal.comm.IConnectionEventHandler#handleSuspectEvent(org.eclipse.ecf.internal.comm.ConnectionEvent) - */ - public boolean handleSuspectEvent(ConnectionEvent event) { - return false; - } + protected void sendMessage(ID toContainerID, ID sharedObjectID, + Object message) throws IOException { + if (message == null) + return; + if (message instanceof Serializable) + throw new NotSerializableException(message.getClass().getName()); + sendSharedObjectMessage(toContainerID, sharedObjectID, + (Serializable) message); + } - /* - * (non-Javadoc) - * - * @see org.eclipse.ecf.internal.comm.IConnectionEventHandler#handleDisconnectEvent(org.eclipse.ecf.internal.comm.ConnectionEvent) - */ - public void handleDisconnectEvent(DisconnectConnectionEvent event) { - processDisconnect(event); - } + protected void sendSharedObjectMessage(ID toContainerID, + ID fromSharedObject, Serializable data) throws IOException { + sendMessage(ContainerMessage.makeSharedObjectMessage(getID(), + toContainerID, getNextSequenceNumber(), fromSharedObject, data)); + } - /* - * (non-Javadoc) - * - * @see org.eclipse.ecf.internal.comm.IConnectionEventHandler#getAdapter(java.lang.Class) - */ - public Object getAdapter(Class clazz) { - return null; - } + protected void setIsClosing() { + isClosing = true; + } - /* - * (non-Javadoc) - * - * @see org.eclipse.ecf.internal.comm.IAsynchConnectionEventHandler#handleAsynchEvent(org.eclipse.ecf.internal.comm.AsynchConnectionEvent) - */ - public void handleAsynchEvent(AsynchConnectionEvent event) - throws IOException { - processAsynch(event); - } + protected void setMaxGroupMembers(int max) { + groupManager.setMaxMembers(max); } }
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/ServerSOContainer.java b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/ServerSOContainer.java index 26345a1c9..70f973dcd 100644 --- a/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/ServerSOContainer.java +++ b/framework/bundles/org.eclipse.ecf.provider/src/org/eclipse/ecf/provider/generic/ServerSOContainer.java @@ -19,7 +19,10 @@ import java.net.Socket; import org.eclipse.ecf.core.ISharedObjectContainerConfig; import org.eclipse.ecf.core.SharedObjectContainerJoinException; import org.eclipse.ecf.core.comm.IAsynchConnection; +import org.eclipse.ecf.core.comm.IConnection; import org.eclipse.ecf.core.comm.ISynchAsynchConnection; +import org.eclipse.ecf.core.events.SharedObjectContainerDepartedEvent; +import org.eclipse.ecf.core.events.SharedObjectContainerJoinedEvent; import org.eclipse.ecf.core.identity.ID; import org.eclipse.ecf.provider.generic.gmm.Member; @@ -143,6 +146,9 @@ public class ServerSOContainer extends SOContainer { throw e; } } + // notify listeners + fireContainerEvent(new SharedObjectContainerJoinedEvent(this.getID(),remoteID)); + return ContainerMessage.makeViewChangeMessage(getID(), remoteID, getNextSequenceNumber(), memberIDs, true, null); } catch (Exception e) { @@ -163,17 +169,10 @@ public class ServerSOContainer extends SOContainer { return null; } - protected void memberLeave(ID leaveID, IAsynchConnection conn) { - if (removeRemoteMember(leaveID)) { - try { - forwardExcluding(getID(), leaveID, ContainerMessage - .makeViewChangeMessage(getID(), leaveID, - getNextSequenceNumber(), new ID[] { leaveID }, - false, null)); - } catch (IOException e) { - } - } - killConnection(conn); + protected void memberLeave(ID leaveID, IConnection conn) { + super.memberLeave(leaveID,conn); + // Notify listeners + fireContainerEvent(new SharedObjectContainerDepartedEvent(getID(),leaveID)); } public void ejectGroupMember(ID memberID) { @@ -187,6 +186,7 @@ public class ServerSOContainer extends SOContainer { .makeLeaveGroupMessage(getID(), memberID, getNextSequenceNumber(), null))); } catch (Exception e) { + logException("Exception in ejectGroupMember.sendAsynch()",e); } memberLeave(memberID, conn); } diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/IContainerEvent.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/IContainerEvent.java index 8bfa0efa8..a595fe9d6 100644 --- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/IContainerEvent.java +++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/IContainerEvent.java @@ -6,13 +6,11 @@ * * Contributors: Composent, Inc. - initial API and implementation ******************************************************************************/ - package org.eclipse.ecf.core.events; import org.eclipse.ecf.core.identity.ID; import org.eclipse.ecf.core.util.Event; public interface IContainerEvent extends Event { - public ID getLocalContainerID(); }
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectActivatedEvent.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectActivatedEvent.java index fbd49a619..82bc9a83f 100644 --- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectActivatedEvent.java +++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectActivatedEvent.java @@ -6,12 +6,12 @@ * * Contributors: Composent, Inc. - initial API and implementation ******************************************************************************/ - package org.eclipse.ecf.core.events; import org.eclipse.ecf.core.identity.ID; public interface ISharedObjectActivatedEvent extends IContainerEvent { public ID getActivatedID(); + public ID[] getGroupMemberIDs(); -} +}
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectCallEvent.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectCallEvent.java index 6c42d8c41..3d51423f3 100644 --- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectCallEvent.java +++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectCallEvent.java @@ -6,12 +6,10 @@ * * Contributors: Composent, Inc. - initial API and implementation ******************************************************************************/ - package org.eclipse.ecf.core.events; import org.eclipse.ecf.core.util.AsynchResult; public interface ISharedObjectCallEvent extends ISharedObjectEvent { - AsynchResult getAsynchResult(); -} +}
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectContainerDepartedEvent.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectContainerDepartedEvent.java index 086fa3b85..bb11a90d6 100644 --- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectContainerDepartedEvent.java +++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectContainerDepartedEvent.java @@ -6,11 +6,10 @@ * * Contributors: Composent, Inc. - initial API and implementation ******************************************************************************/ - package org.eclipse.ecf.core.events; import org.eclipse.ecf.core.identity.ID; public interface ISharedObjectContainerDepartedEvent extends IContainerEvent { public ID getDepartedContainerID(); -} +}
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectContainerJoinGroupEvent.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectContainerJoinGroupEvent.java new file mode 100644 index 000000000..63c2183f6 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectContainerJoinGroupEvent.java @@ -0,0 +1,17 @@ +/******************************************************************************* + * Copyright (c) 2004 Composent, Inc. and others. All rights reserved. This + * program and the accompanying materials are made available under the terms of + * the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: Composent, Inc. - initial API and implementation + ******************************************************************************/ +package org.eclipse.ecf.core.events; + +import org.eclipse.ecf.core.identity.ID; + +public interface ISharedObjectContainerJoinGroupEvent extends IContainerEvent { + public ID getGroupID(); + + public Object getData(); +}
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectContainerJoinedEvent.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectContainerJoinedEvent.java index 67b4fa364..fb4763576 100644 --- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectContainerJoinedEvent.java +++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectContainerJoinedEvent.java @@ -6,11 +6,10 @@ * * Contributors: Composent, Inc. - initial API and implementation ******************************************************************************/ - package org.eclipse.ecf.core.events; import org.eclipse.ecf.core.identity.ID; public interface ISharedObjectContainerJoinedEvent extends IContainerEvent { public ID getJoinedContainerID(); -} +}
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectContainerLeaveGroupEvent.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectContainerLeaveGroupEvent.java new file mode 100644 index 000000000..f2590469d --- /dev/null +++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectContainerLeaveGroupEvent.java @@ -0,0 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2004 Composent, Inc. and others. All rights reserved. This + * program and the accompanying materials are made available under the terms of + * the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: Composent, Inc. - initial API and implementation + ******************************************************************************/ +package org.eclipse.ecf.core.events; + +import org.eclipse.ecf.core.identity.ID; + +public interface ISharedObjectContainerLeaveGroupEvent extends IContainerEvent { + public ID getGroupID(); +}
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectCreateResponseEvent.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectCreateResponseEvent.java index 31fdfdcd6..78df389ee 100644 --- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectCreateResponseEvent.java +++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectCreateResponseEvent.java @@ -6,10 +6,11 @@ * * Contributors: Composent, Inc. - initial API and implementation ******************************************************************************/ - package org.eclipse.ecf.core.events; -public interface ISharedObjectCreateResponseEvent extends ISharedObjectMessageEvent { - public long getSequence(); - public Throwable getException(); -} +public interface ISharedObjectCreateResponseEvent extends + ISharedObjectMessageEvent { + public long getSequence(); + + public Throwable getException(); +}
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectDeactivatedEvent.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectDeactivatedEvent.java index 29be7a93c..e9bc34097 100644 --- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectDeactivatedEvent.java +++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectDeactivatedEvent.java @@ -6,11 +6,10 @@ * * Contributors: Composent, Inc. - initial API and implementation ******************************************************************************/ - package org.eclipse.ecf.core.events; import org.eclipse.ecf.core.identity.ID; public interface ISharedObjectDeactivatedEvent extends IContainerEvent { public ID getDeactivatedID(); -} +}
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectEvent.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectEvent.java index 177655e89..f17b042f9 100644 --- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectEvent.java +++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectEvent.java @@ -6,15 +6,13 @@ * * Contributors: Composent, Inc. - initial API and implementation ******************************************************************************/ - package org.eclipse.ecf.core.events; import org.eclipse.ecf.core.identity.ID; import org.eclipse.ecf.core.util.Event; public interface ISharedObjectEvent extends Event { - public ID getSenderSharedObjectID(); - public Event getEvent(); + public Event getEvent(); }
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectMessageEvent.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectMessageEvent.java index 8ac0b71b6..2b922d871 100644 --- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectMessageEvent.java +++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/ISharedObjectMessageEvent.java @@ -6,13 +6,12 @@ * * Contributors: Composent, Inc. - initial API and implementation ******************************************************************************/ - package org.eclipse.ecf.core.events; import org.eclipse.ecf.core.identity.ID; public interface ISharedObjectMessageEvent extends ISharedObjectEvent { - public ID getRemoteContainerID(); + public Object getData(); -} +}
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/RemoteSharedObjectCreateResponseEvent.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/RemoteSharedObjectCreateResponseEvent.java index 7de1c8a21..b8bb1d17e 100644 --- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/RemoteSharedObjectCreateResponseEvent.java +++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/RemoteSharedObjectCreateResponseEvent.java @@ -1,28 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2004 Composent, Inc. and others. All rights reserved. This + * program and the accompanying materials are made available under the terms of + * the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: Composent, Inc. - initial API and implementation + ******************************************************************************/ package org.eclipse.ecf.core.events; import org.eclipse.ecf.core.identity.ID; -public class RemoteSharedObjectCreateResponseEvent extends RemoteSharedObjectEvent - implements ISharedObjectCreateResponseEvent { +public class RemoteSharedObjectCreateResponseEvent extends + RemoteSharedObjectEvent implements ISharedObjectCreateResponseEvent { + long sequence = 0; - long sequence = 0; - - public RemoteSharedObjectCreateResponseEvent(ID senderObj, ID remoteCont, long seq, Throwable exception) { - super(senderObj,remoteCont,exception); - this.sequence = seq; + public RemoteSharedObjectCreateResponseEvent(ID senderObj, ID remoteCont, + long seq, Throwable exception) { + super(senderObj, remoteCont, exception); + this.sequence = seq; } - /* (non-Javadoc) - * @see org.eclipse.ecf.core.events.ISharedObjectCreateResponseEvent#getSequence() - */ - public long getSequence() { - return sequence; - } - /* (non-Javadoc) - * @see org.eclipse.ecf.core.events.ISharedObjectCreateResponseEvent#getException() - */ - public Throwable getException() { - return (Throwable) getData(); - } + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.core.events.ISharedObjectCreateResponseEvent#getSequence() + */ + public long getSequence() { + return sequence; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.core.events.ISharedObjectCreateResponseEvent#getException() + */ + public Throwable getException() { + return (Throwable) getData(); + } -} + public String toString() { + StringBuffer sb = new StringBuffer( + "RemoteSharedObjectCreateResponseEvent["); + sb.append(getSenderSharedObjectID()).append(";"); + sb.append(getRemoteContainerID()).append(";"); + sb.append(getSequence()).append(";"); + sb.append(getException()).append("]"); + return sb.toString(); + } +}
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/RemoteSharedObjectEvent.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/RemoteSharedObjectEvent.java index d989b3edc..d2130ba36 100644 --- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/RemoteSharedObjectEvent.java +++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/RemoteSharedObjectEvent.java @@ -6,16 +6,14 @@ * * Contributors: Composent, Inc. - initial API and implementation ******************************************************************************/ - package org.eclipse.ecf.core.events; import java.io.Serializable; - import org.eclipse.ecf.core.identity.ID; import org.eclipse.ecf.core.util.Event; -public class RemoteSharedObjectEvent implements ISharedObjectMessageEvent, Serializable { - +public class RemoteSharedObjectEvent implements ISharedObjectMessageEvent, + Serializable { private final ID senderSharedObjectID; private final ID remoteContainerID; private final Object data; @@ -35,21 +33,24 @@ public class RemoteSharedObjectEvent implements ISharedObjectMessageEvent, Seria public ID getSenderSharedObjectID() { return senderSharedObjectID; } + public ID getRemoteContainerID() { return remoteContainerID; } + public Event getEvent() { return this; } + public Object getData() { return data; } public String toString() { - StringBuffer sb = new StringBuffer("RemoteSharedObjectEvent {"); - sb.append("senderSharedObjectID: ").append(senderSharedObjectID).append(", "); - sb.append("remoteContainerID: ").append(remoteContainerID).append(", "); - sb.append("data: ").append(data).append("}"); + StringBuffer sb = new StringBuffer("RemoteSharedObjectEvent["); + sb.append(getSenderSharedObjectID()).append(";"); + sb.append(getRemoteContainerID()).append(";"); + sb.append(getData()).append("]"); return sb.toString(); } }
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/SharedObjectActivatedEvent.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/SharedObjectActivatedEvent.java index 44d074f81..5be203642 100644 --- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/SharedObjectActivatedEvent.java +++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/SharedObjectActivatedEvent.java @@ -6,15 +6,12 @@ * * Contributors: Composent, Inc. - initial API and implementation ******************************************************************************/ - package org.eclipse.ecf.core.events; import java.util.Arrays; - import org.eclipse.ecf.core.identity.ID; public class SharedObjectActivatedEvent implements ISharedObjectActivatedEvent { - private final ID activatedID; private final ID[] groupMemberIDs; private final ID localContainerID; @@ -33,15 +30,17 @@ public class SharedObjectActivatedEvent implements ISharedObjectActivatedEvent { public ID getLocalContainerID() { return localContainerID; } + public ID[] getGroupMemberIDs() { return groupMemberIDs; } public String toString() { - StringBuffer sb = new StringBuffer("SharedObjectActivatedEvent {"); - sb.append("activatedID: ").append(activatedID).append(", "); - sb.append("groupMemberIDs: ").append(Arrays.asList(groupMemberIDs)).append(", "); - sb.append("localContainerID: ").append(localContainerID).append("}"); + StringBuffer sb = new StringBuffer("SharedObjectActivatedEvent["); + sb.append(getActivatedID()).append(";"); + sb.append(Arrays.asList(getGroupMemberIDs())) + .append(";"); + sb.append(getLocalContainerID()).append("]"); return sb.toString(); } }
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/SharedObjectContainerDepartedEvent.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/SharedObjectContainerDepartedEvent.java index c5820d42e..495b815a3 100644 --- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/SharedObjectContainerDepartedEvent.java +++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/SharedObjectContainerDepartedEvent.java @@ -6,13 +6,12 @@ * * Contributors: Composent, Inc. - initial API and implementation ******************************************************************************/ - package org.eclipse.ecf.core.events; import org.eclipse.ecf.core.identity.ID; -public class SharedObjectContainerDepartedEvent implements ISharedObjectContainerDepartedEvent { - +public class SharedObjectContainerDepartedEvent implements + ISharedObjectContainerDepartedEvent { private final ID departedContainerID; private final ID localContainerID; @@ -25,17 +24,21 @@ public class SharedObjectContainerDepartedEvent implements ISharedObjectContaine public ID getDepartedContainerID() { return departedContainerID; } + public ID getLocalContainerID() { return localContainerID; } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - public String toString() { - StringBuffer buf = new StringBuffer("SharedObjectContainerDepartedEvent {"); - buf.append("departedContainerID: ").append(departedContainerID).append(", "); - buf.append("localContainerID: ").append(localContainerID).append("}"); - return buf.toString(); - } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + public String toString() { + StringBuffer buf = new StringBuffer( + "SharedObjectContainerDepartedEvent["); + buf.append(getDepartedContainerID()).append(";"); + buf.append(getLocalContainerID()).append("]"); + return buf.toString(); + } }
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/SharedObjectContainerJoinGroupEvent.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/SharedObjectContainerJoinGroupEvent.java new file mode 100644 index 000000000..1537933b4 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/SharedObjectContainerJoinGroupEvent.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2004 Composent, Inc. and others. All rights reserved. This + * program and the accompanying materials are made available under the terms of + * the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: Composent, Inc. - initial API and implementation + ******************************************************************************/ +package org.eclipse.ecf.core.events; + +import org.eclipse.ecf.core.identity.ID; + +public class SharedObjectContainerJoinGroupEvent implements + ISharedObjectContainerJoinGroupEvent { + ID localContainerID; + ID groupID; + Object data; + + public SharedObjectContainerJoinGroupEvent(ID localContainerID, ID groupID, + Object data) { + this.localContainerID = localContainerID; + this.groupID = groupID; + this.data = data; + } + + public ID getGroupID() { + return groupID; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.core.events.ISharedObjectContainerJoinGroupEvent#getData() + */ + public Object getData() { + return data; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.core.events.IContainerEvent#getLocalContainerID() + */ + public ID getLocalContainerID() { + return localContainerID; + } + + public String toString() { + StringBuffer buf = new StringBuffer("SharedObjectContainerJoinGroupEvent["); + buf.append(getLocalContainerID()).append(";"); + buf.append(getGroupID()).append(";"); + buf.append(getData()).append("]"); + return buf.toString(); + } +}
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/SharedObjectContainerJoinedEvent.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/SharedObjectContainerJoinedEvent.java index b0dce3de1..d008f0fae 100644 --- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/SharedObjectContainerJoinedEvent.java +++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/SharedObjectContainerJoinedEvent.java @@ -6,20 +6,19 @@ * * Contributors: Composent, Inc. - initial API and implementation ******************************************************************************/ - package org.eclipse.ecf.core.events; import org.eclipse.ecf.core.identity.ID; -public class SharedObjectContainerJoinedEvent implements ISharedObjectContainerJoinedEvent { - +public class SharedObjectContainerJoinedEvent implements + ISharedObjectContainerJoinedEvent { private final ID joinedContainerID; private final ID localContainerID; - public SharedObjectContainerJoinedEvent(ID container, ID o) { + public SharedObjectContainerJoinedEvent(ID local, ID joinContainerID) { super(); - this.localContainerID = container; - this.joinedContainerID = o; + this.localContainerID = local; + this.joinedContainerID = joinContainerID; } public ID getJoinedContainerID() { @@ -29,14 +28,18 @@ public class SharedObjectContainerJoinedEvent implements ISharedObjectContainerJ public ID getLocalContainerID() { return localContainerID; } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - public String toString() { - StringBuffer buf = new StringBuffer("SharedObjectContainerJoinedEvent {"); - buf.append("joinedContainerID: ").append(joinedContainerID).append(", "); - buf.append("localContainerID: ").append(localContainerID).append("}"); - return buf.toString(); - } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + public String toString() { + StringBuffer buf = new StringBuffer( + "SharedObjectContainerJoinedEvent["); + buf.append(getJoinedContainerID()) + .append(";"); + buf.append(getLocalContainerID()).append("]"); + return buf.toString(); + } }
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/SharedObjectContainerLeaveGroupEvent.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/SharedObjectContainerLeaveGroupEvent.java new file mode 100644 index 000000000..0457abde3 --- /dev/null +++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/SharedObjectContainerLeaveGroupEvent.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2004 Composent, Inc. and others. All rights reserved. This + * program and the accompanying materials are made available under the terms of + * the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: Composent, Inc. - initial API and implementation + ******************************************************************************/ +package org.eclipse.ecf.core.events; + +import org.eclipse.ecf.core.identity.ID; + +public class SharedObjectContainerLeaveGroupEvent implements + ISharedObjectContainerLeaveGroupEvent { + ID localContainerID; + ID groupID; + + public SharedObjectContainerLeaveGroupEvent(ID localContainerID, ID groupID) { + this.localContainerID = localContainerID; + this.groupID = groupID; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ecf.core.events.IContainerEvent#getLocalContainerID() + */ + public ID getLocalContainerID() { + return localContainerID; + } + + public ID getGroupID() { + return groupID; + } + public String toString() { + StringBuffer buf = new StringBuffer("SharedObjectContainerLeaveGroupEvent["); + buf.append(getLocalContainerID()).append(";"); + buf.append(getGroupID()).append("]"); + return buf.toString(); + } +}
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/SharedObjectDeactivatedEvent.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/SharedObjectDeactivatedEvent.java index 4c1c3b376..73436b61b 100644 --- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/SharedObjectDeactivatedEvent.java +++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/events/SharedObjectDeactivatedEvent.java @@ -6,13 +6,12 @@ * * Contributors: Composent, Inc. - initial API and implementation ******************************************************************************/ - package org.eclipse.ecf.core.events; import org.eclipse.ecf.core.identity.ID; -public class SharedObjectDeactivatedEvent implements ISharedObjectDeactivatedEvent { - +public class SharedObjectDeactivatedEvent implements + ISharedObjectDeactivatedEvent { private final ID deactivatedID; private final ID localContainerID; @@ -21,16 +20,19 @@ public class SharedObjectDeactivatedEvent implements ISharedObjectDeactivatedEve this.localContainerID = container; this.deactivatedID = deact; } + public ID getDeactivatedID() { return deactivatedID; } + public ID getLocalContainerID() { return localContainerID; } + public String toString() { - StringBuffer sb = new StringBuffer("SharedObjectDeactivatedEvent {"); - sb.append("deactivatedID: ").append(deactivatedID).append(", "); - sb.append("localContainerID: ").append(localContainerID).append("}"); + StringBuffer sb = new StringBuffer("SharedObjectDeactivatedEvent["); + sb.append(getLocalContainerID()).append(";"); + sb.append(getDeactivatedID()).append("]"); return sb.toString(); } }
\ No newline at end of file diff --git a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/identity/GUID.java b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/identity/GUID.java index 491aef93e..964a47dcf 100644 --- a/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/identity/GUID.java +++ b/framework/bundles/org.eclipse.ecf/src/org/eclipse/ecf/core/identity/GUID.java @@ -108,14 +108,8 @@ public class GUID extends StringID { } public String toString() { - if (value == null) - return ""; - int strlen = value.length(); - StringBuffer sb = new StringBuffer(strlen + 10); - String packname = this.getClass().getPackage().getName(); - int pnLength = packname.length(); - sb.insert(0, packname + ".GUID[").insert(pnLength + 6, value).insert( - strlen + pnLength + 6, ']'); + StringBuffer sb = new StringBuffer("GUID["); + sb.append(value).append("]"); return sb.toString(); } |
