Search in sources :

Example 11 with ISharedObjectContainer

use of org.eclipse.ecf.core.sharedobject.ISharedObjectContainer in project ecf by eclipse.

the class ClientApplication method createSharedObjects.

public void createSharedObjects() throws Exception {
    if (sharedObjectClassNames != null) {
        for (int j = 0; j < clientCount; j++) {
            ISharedObjectContainer scg = sm[j];
            sharedObjects = new ID[sharedObjectClassNames.length];
            for (int i = 0; i < sharedObjectClassNames.length; i++) {
                // $NON-NLS-1$ //$NON-NLS-2$
                System.out.println("Creating sharedObject: " + sharedObjectClassNames[i] + " for client " + scg.getID().getName());
                ISharedObject so = (ISharedObject) Class.forName(sharedObjectClassNames[i]).newInstance();
                // $NON-NLS-1$
                sharedObjects[i] = IDFactory.getDefault().createStringID(sharedObjectClassNames[i] + "_" + i);
                scg.getSharedObjectManager().addSharedObject(sharedObjects[i], so, new HashMap());
                // $NON-NLS-1$
                System.out.println("Created sharedObject for client " + scg.getID().getName());
            }
        }
    }
}
Also used : HashMap(java.util.HashMap) ISharedObjectContainer(org.eclipse.ecf.core.sharedobject.ISharedObjectContainer) ISharedObject(org.eclipse.ecf.core.sharedobject.ISharedObject)

Example 12 with ISharedObjectContainer

use of org.eclipse.ecf.core.sharedobject.ISharedObjectContainer in project ecf by eclipse.

the class SSLGenericServerContainerGroup method createContainer.

public ISharedObjectContainer createContainer(String path, int keepAlive, Map properties) throws ContainerCreateException {
    if (path == null)
        // $NON-NLS-1$
        throw new ContainerCreateException("Path for new container cannot be null");
    Map lock = serverGroup.getMap();
    ISharedObjectContainer newContainer = null;
    synchronized (lock) {
        SSLServerSOContainer existing = (SSLServerSOContainer) lock.get(path);
        if (existing != null)
            // $NON-NLS-1$ //$NON-NLS-2$
            throw new ContainerCreateException("Container with path=" + path + " already exists");
        // create container
        newContainer = createGenericServerContainer(path, keepAlive, properties);
        // add To container manager
        addNewContainerToContainerManager(newContainer);
    }
    return newContainer;
}
Also used : ISharedObjectContainer(org.eclipse.ecf.core.sharedobject.ISharedObjectContainer)

Aggregations

ISharedObjectContainer (org.eclipse.ecf.core.sharedobject.ISharedObjectContainer)12 ID (org.eclipse.ecf.core.identity.ID)8 IContainer (org.eclipse.ecf.core.IContainer)5 ISharedObject (org.eclipse.ecf.core.sharedobject.ISharedObject)5 ISharedObjectManager (org.eclipse.ecf.core.sharedobject.ISharedObjectManager)4 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 IContainerFactory (org.eclipse.ecf.core.IContainerFactory)1 ISharedObjectMessageSerializer (org.eclipse.ecf.core.sharedobject.util.ISharedObjectMessageSerializer)1 XMPPChatClient (org.eclipse.ecf.example.clients.XMPPChatClient)1 EclipseCollabSharedObject (org.eclipse.ecf.example.collab.share.EclipseCollabSharedObject)1 SharedObjectContainerUI (org.eclipse.ecf.internal.example.collab.ui.SharedObjectContainerUI)1 IChatID (org.eclipse.ecf.presence.im.IChatID)1