Search in sources :

Example 16 with ID

use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.

the class PubSubAdapterFactory method getDirectory.

protected IPublishedServiceDirectory getDirectory(ISharedObjectContainer container) {
    ID directoryID;
    try {
        directoryID = IDFactory.getDefault().createStringID(PublishedServiceDirectory.SHARED_OBJECT_ID);
    } catch (IDCreateException e) {
        throw new RuntimeException(e);
    }
    final ISharedObjectManager mgr = container.getSharedObjectManager();
    IPublishedServiceDirectory directory = (IPublishedServiceDirectory) mgr.getSharedObject(directoryID);
    if (directory != null)
        return directory;
    try {
        SharedObjectDescription desc = createDirectoryDescription(directoryID);
        mgr.createSharedObject(desc);
        return (IPublishedServiceDirectory) mgr.getSharedObject(directoryID);
    } catch (SharedObjectCreateException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        return null;
    }
}
Also used : IPublishedServiceDirectory(org.eclipse.ecf.pubsub.IPublishedServiceDirectory) SharedObjectDescription(org.eclipse.ecf.core.sharedobject.SharedObjectDescription) IDCreateException(org.eclipse.ecf.core.identity.IDCreateException) SharedObjectCreateException(org.eclipse.ecf.core.sharedobject.SharedObjectCreateException) ISharedObjectManager(org.eclipse.ecf.core.sharedobject.ISharedObjectManager) ID(org.eclipse.ecf.core.identity.ID)

Example 17 with ID

use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.

the class PublishedServiceDirectory method disconnected.

protected void disconnected(IContainerDisconnectedEvent event) {
    ID containerID = event.getTargetID();
    if (!containerID.equals(event.getLocalContainerID())) {
        synchronized (this) {
            Collection values = (Collection) services.remove(event.getTargetID());
            if (values != null) {
                PublishedServiceDescriptor[] buf = new PublishedServiceDescriptor[values.size()];
                values.toArray(buf);
                fireServiceChangedEvent(new PublishedServiceDirectoryChangeEvent(this, PublishedServiceDirectoryChangeEvent.REMOVED, buf));
            }
        }
    }
}
Also used : PublishedServiceDescriptor(org.eclipse.ecf.pubsub.PublishedServiceDescriptor) PublishedServiceDirectoryChangeEvent(org.eclipse.ecf.pubsub.PublishedServiceDirectoryChangeEvent) Collection(java.util.Collection) ID(org.eclipse.ecf.core.identity.ID)

Example 18 with ID

use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.

the class SharedObjectContainerUI method createAndAddSharedObject.

protected void createAndAddSharedObject(final ISharedObjectContainer soContainer, final ClientEntry client, final IResource proj, IUser user, String fileDir) throws Exception {
    final EclipseCollabSharedObject sharedObject = new EclipseCollabSharedObject(soContainer, proj, user, fileDir);
    sharedObject.setListener(new SharedObjectEventListener() {

        public void memberRemoved(ID member) {
            final ID groupID = client.getContainer().getConnectedID();
            if (member.equals(groupID)) {
                if (!client.isDisposed()) {
                    collabclient.disposeClient(proj, client);
                }
            }
        }

        public void memberAdded(ID member) {
        }

        public void otherActivated(ID other) {
        }

        public void otherDeactivated(ID other) {
        }

        public void windowClosing() {
            final ID groupID = client.getContainer().getConnectedID();
            CollabClient.removeClientForResource(proj, groupID);
        }
    });
    final ID newID = IDFactory.getDefault().createStringID(COLLAB_SHARED_OBJECT_ID);
    soContainer.getSharedObjectManager().addSharedObject(newID, sharedObject, new HashMap());
    client.setSharedObject(sharedObject);
}
Also used : EclipseCollabSharedObject(org.eclipse.ecf.example.collab.share.EclipseCollabSharedObject) SharedObjectEventListener(org.eclipse.ecf.example.collab.share.SharedObjectEventListener) ID(org.eclipse.ecf.core.identity.ID)

Example 19 with ID

use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.

the class CollabClient method getClientEntry.

protected static ClientEntry getClientEntry(IResource proj, String containerType) {
    synchronized (clients) {
        Vector v = getClientEntries(proj);
        if (v == null)
            return null;
        for (Iterator i = v.iterator(); i.hasNext(); ) {
            ClientEntry e = (ClientEntry) i.next();
            ID connectedID = e.getContainer().getConnectedID();
            if (connectedID == null)
                continue;
            else {
                String contType = e.getContainerType();
                if (contType.equals(containerType)) {
                    return e;
                }
            }
        }
    }
    return null;
}
Also used : ID(org.eclipse.ecf.core.identity.ID)

Example 20 with ID

use of org.eclipse.ecf.core.identity.ID in project ecf by eclipse.

the class CollabClient method getClientEntry.

protected static ClientEntry getClientEntry(IResource proj, ID targetID) {
    synchronized (clients) {
        Vector v = getClientEntries(proj);
        if (v == null)
            return null;
        for (Iterator i = v.iterator(); i.hasNext(); ) {
            ClientEntry e = (ClientEntry) i.next();
            ID connectedID = e.getContainer().getConnectedID();
            if (connectedID == null)
                continue;
            else if (connectedID.equals(targetID)) {
                return e;
            }
        }
    }
    return null;
}
Also used : ID(org.eclipse.ecf.core.identity.ID)

Aggregations

ID (org.eclipse.ecf.core.identity.ID)256 IContainer (org.eclipse.ecf.core.IContainer)29 IOException (java.io.IOException)19 IDCreateException (org.eclipse.ecf.core.identity.IDCreateException)18 UUID (java.util.UUID)17 HashMap (java.util.HashMap)12 ArrayList (java.util.ArrayList)11 ContainerConnectException (org.eclipse.ecf.core.ContainerConnectException)11 GUID (org.eclipse.ecf.core.identity.GUID)11 ISharedObjectManager (org.eclipse.ecf.core.sharedobject.ISharedObjectManager)11 XMPPRoomID (org.eclipse.ecf.provider.xmpp.identity.XMPPRoomID)11 Namespace (org.eclipse.ecf.core.identity.Namespace)10 XMPPID (org.eclipse.ecf.provider.xmpp.identity.XMPPID)10 Map (java.util.Map)9 Matcher (java.util.regex.Matcher)9 ECFException (org.eclipse.ecf.core.util.ECFException)9 List (java.util.List)8 ISharedObject (org.eclipse.ecf.core.sharedobject.ISharedObject)8 IChannel (org.eclipse.ecf.datashare.IChannel)8 Iterator (java.util.Iterator)7