Search in sources :

Example 61 with IContainer

use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.

the class AbstractChatRoomSOAddTest method testAddSharedObject1.

public void testAddSharedObject1() throws Exception {
    if (chatRoomContainer[0] == null)
        return;
    final IContainer client0Container = chatRoomContainer[1];
    assertNotNull(client0Container);
    // 
    final ISharedObjectContainer socontainer = (ISharedObjectContainer) client0Container.getAdapter(ISharedObjectContainer.class);
    final ISharedObjectManager manager = socontainer.getSharedObjectManager();
    assertNotNull(manager);
    final ID objectID = createSharedObjectID();
    final ID id = manager.addSharedObject(objectID, createSharedObject(objectID), null);
    assertNotNull(id);
    final ISharedObject sharedObject = manager.getSharedObject(id);
    assertNotNull(sharedObject);
    sleep(5000);
}
Also used : ISharedObjectContainer(org.eclipse.ecf.core.sharedobject.ISharedObjectContainer) ISharedObjectManager(org.eclipse.ecf.core.sharedobject.ISharedObjectManager) ID(org.eclipse.ecf.core.identity.ID) ISharedObject(org.eclipse.ecf.core.sharedobject.ISharedObject) IContainer(org.eclipse.ecf.core.IContainer)

Example 62 with IContainer

use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.

the class AbstractChatRoomSOAddTest method testAddSharedObject.

public void testAddSharedObject() throws Exception {
    if (chatRoomContainer[0] == null)
        return;
    final IContainer client0Container = chatRoomContainer[0];
    assertNotNull(client0Container);
    // 
    final ISharedObjectContainer socontainer = (ISharedObjectContainer) client0Container.getAdapter(ISharedObjectContainer.class);
    final ISharedObjectManager manager = socontainer.getSharedObjectManager();
    assertNotNull(manager);
    final ID objectID = createSharedObjectID();
    final ID id = manager.addSharedObject(objectID, createSharedObject(objectID), null);
    assertNotNull(id);
    final ISharedObject sharedObject = manager.getSharedObject(id);
    assertNotNull(sharedObject);
    sleep(5000);
}
Also used : ISharedObjectContainer(org.eclipse.ecf.core.sharedobject.ISharedObjectContainer) ISharedObjectManager(org.eclipse.ecf.core.sharedobject.ISharedObjectManager) ID(org.eclipse.ecf.core.identity.ID) ISharedObject(org.eclipse.ecf.core.sharedobject.ISharedObject) IContainer(org.eclipse.ecf.core.IContainer)

Example 63 with IContainer

use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.

the class AbstractChatRoomSOAddTest method testAddTwoSharedObjects1.

public void testAddTwoSharedObjects1() throws Exception {
    if (chatRoomContainer[0] == null)
        return;
    final IContainer client0Container = chatRoomContainer[1];
    assertNotNull(client0Container);
    final ISharedObjectContainer socontainer = (ISharedObjectContainer) client0Container.getAdapter(ISharedObjectContainer.class);
    final ISharedObjectManager manager = socontainer.getSharedObjectManager();
    assertNotNull(manager);
    final ID objectID0 = createSharedObjectID();
    final ID id0 = manager.addSharedObject(objectID0, createSharedObject(objectID0), null);
    assertNotNull(id0);
    final ID objectID1 = createSharedObjectID();
    final ID id1 = manager.addSharedObject(objectID1, createSharedObject(objectID1), null);
    assertNotNull(id1);
    final ISharedObject sharedObject0 = manager.getSharedObject(id0);
    assertNotNull(sharedObject0);
    final ISharedObject sharedObject1 = manager.getSharedObject(id1);
    assertNotNull(sharedObject1);
    sleep(5000);
}
Also used : ISharedObjectContainer(org.eclipse.ecf.core.sharedobject.ISharedObjectContainer) ISharedObjectManager(org.eclipse.ecf.core.sharedobject.ISharedObjectManager) ID(org.eclipse.ecf.core.identity.ID) ISharedObject(org.eclipse.ecf.core.sharedobject.ISharedObject) IContainer(org.eclipse.ecf.core.IContainer)

Example 64 with IContainer

use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.

the class CompositeDiscoveryContainer method disconnect.

/* (non-Javadoc)
	 * @see org.eclipse.ecf.core.IContainer#disconnect()
	 */
public void disconnect() {
    fireContainerEvent(new ContainerDisconnectingEvent(this.getID(), getConnectedID()));
    targetID = null;
    synchronized (containers) {
        for (final Iterator itr = containers.iterator(); itr.hasNext(); ) {
            final IContainer container = (IContainer) itr.next();
            container.disconnect();
        }
        containers.clear();
    }
    synchronized (registeredServices) {
        registeredServices.clear();
    }
    synchronized (allServiceListeners) {
        allServiceListeners.clear();
    }
    synchronized (serviceListeners) {
        serviceListeners.clear();
    }
    synchronized (serviceTypeListeners) {
        serviceTypeListeners.clear();
    }
    fireContainerEvent(new ContainerDisconnectedEvent(this.getID(), getConnectedID()));
}
Also used : IContainer(org.eclipse.ecf.core.IContainer)

Example 65 with IContainer

use of org.eclipse.ecf.core.IContainer in project ecf by eclipse.

the class CompositeDiscoveryContainer method connect.

/* (non-Javadoc)
	 * @see org.eclipse.ecf.core.IContainer#connect(org.eclipse.ecf.core.identity.ID, org.eclipse.ecf.core.security.IConnectContext)
	 */
public void connect(final ID aTargetID, final IConnectContext connectContext) throws ContainerConnectException {
    if (targetID != null || getConfig() == null) {
        // $NON-NLS-1$
        throw new ContainerConnectException("Already connected");
    }
    targetID = (aTargetID == null) ? getConfig().getID() : aTargetID;
    fireContainerEvent(new ContainerConnectingEvent(this.getID(), targetID, connectContext));
    synchronized (containers) {
        final Collection containersFailedToConnect = new HashSet();
        for (final Iterator itr = containers.iterator(); itr.hasNext(); ) {
            final IContainer container = (IContainer) itr.next();
            if (container.getConnectedID() == null) {
                try {
                    container.connect(targetID, connectContext);
                } catch (ContainerConnectException cce) {
                    // $NON-NLS-1$
                    Trace.catching(// $NON-NLS-1$
                    Activator.PLUGIN_ID, // $NON-NLS-1$
                    METHODS_TRACING, // $NON-NLS-1$
                    this.getClass(), // $NON-NLS-1$
                    "connect", cce);
                    containersFailedToConnect.add(container);
                    continue;
                }
            }
            final IDiscoveryLocator idca = (IDiscoveryLocator) container;
            idca.addServiceListener(ccsl);
            idca.addServiceTypeListener(ccstl);
        }
        // remove all containers that failed to connect and thus are unusable subsequently
        containers.removeAll(containersFailedToConnect);
    }
    fireContainerEvent(new ContainerConnectedEvent(this.getID(), targetID));
}
Also used : ContainerConnectException(org.eclipse.ecf.core.ContainerConnectException) IContainer(org.eclipse.ecf.core.IContainer)

Aggregations

IContainer (org.eclipse.ecf.core.IContainer)121 ID (org.eclipse.ecf.core.identity.ID)29 ContainerTypeDescription (org.eclipse.ecf.core.ContainerTypeDescription)20 IRosterEntry (org.eclipse.ecf.presence.roster.IRosterEntry)9 IRoster (org.eclipse.ecf.presence.roster.IRoster)8 IChannelContainerAdapter (org.eclipse.ecf.datashare.IChannelContainerAdapter)7 IRemoteServiceContainer (org.eclipse.ecf.remoteservice.IRemoteServiceContainer)7 IRemoteServiceContainerAdapter (org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter)7 ISharedObjectContainer (org.eclipse.ecf.core.sharedobject.ISharedObjectContainer)5 IPresenceContainerAdapter (org.eclipse.ecf.presence.IPresenceContainerAdapter)5 RemoteServiceContainer (org.eclipse.ecf.remoteservice.RemoteServiceContainer)5 Action (org.eclipse.jface.action.Action)5 IAction (org.eclipse.jface.action.IAction)5 URL (java.net.URL)4 Job (org.eclipse.core.runtime.jobs.Job)4 ContainerConnectException (org.eclipse.ecf.core.ContainerConnectException)4 IContainerManager (org.eclipse.ecf.core.IContainerManager)4 ISharedObject (org.eclipse.ecf.core.sharedobject.ISharedObject)4 ISharedObjectManager (org.eclipse.ecf.core.sharedobject.ISharedObjectManager)4 RestClientContainer (org.eclipse.ecf.remoteservice.rest.client.RestClientContainer)4