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);
}
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);
}
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);
}
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()));
}
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));
}
Aggregations