Package org.eclipse.ecf.core.sharedobject

Examples of org.eclipse.ecf.core.sharedobject.ISharedObjectContainer


  public ISharedObjectContainer createContainer(String path, int keepAlive, Map properties) throws ContainerCreateException {
    if (path == null)
      throw new ContainerCreateException("Path for new container cannot be null"); //$NON-NLS-1$
    Map lock = serverGroup.getMap();
    ISharedObjectContainer newContainer = null;
    synchronized (lock) {
      SSLServerSOContainer existing = (SSLServerSOContainer) lock.get(path);
      if (existing != null)
        throw new ContainerCreateException("Container with path=" + path + " already exists"); //$NON-NLS-1$ //$NON-NLS-2$
      // create container
View Full Code Here


  }

  protected ISharedObjectContainer createClient() throws Exception {
    // Make identity instance for the new container
    ID newContainerID = IDFactory.getDefault().createGUID();
    ISharedObjectContainer result = SharedObjectContainerFactory.getDefault().createSharedObjectContainer(contd, new Object[] {newContainerID, new Integer(DEFAULT_TIMEOUT)});
    return result;
  }
View Full Code Here

  }

  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++) {
          System.out.println("Creating sharedObject: " + sharedObjectClassNames[i] + " for client " + scg.getID().getName()); //$NON-NLS-1$ //$NON-NLS-2$
          ISharedObject so = (ISharedObject) Class.forName(sharedObjectClassNames[i]).newInstance();
          sharedObjects[i] = IDFactory.getDefault().createStringID(sharedObjectClassNames[i] + "_" + i); //$NON-NLS-1$
          scg.getSharedObjectManager().addSharedObject(sharedObjects[i], so, new HashMap());
          System.out.println("Created sharedObject for client " + scg.getID().getName()); //$NON-NLS-1$
        }
      }
    }

  }
View Full Code Here

  public ISharedObjectContainer createContainer(String path, int keepAlive, Map properties) throws ContainerCreateException {
    if (path == null)
      throw new ContainerCreateException("Path for new container cannot be null"); //$NON-NLS-1$
    Map lock = serverGroup.getMap();
    ISharedObjectContainer newContainer = null;
    synchronized (lock) {
      TCPServerSOContainer existing = (TCPServerSOContainer) lock.get(path);
      if (existing != null)
        throw new ContainerCreateException("Container with path=" + path + " already exists"); //$NON-NLS-1$ //$NON-NLS-2$
      // create container
View Full Code Here

  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);
View Full Code Here

  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);
View Full Code Here

  public void testAddTwoSharedObjects() 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 objectID0 = createSharedObjectID();
    final ID id0 = manager.addSharedObject(objectID0, createSharedObject(objectID0), null);
    assertNotNull(id0);
    final ID objectID1 = createSharedObjectID();
View Full Code Here

  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();
View Full Code Here

  protected void setUp() throws Exception {
    super.setUp();
    createServerAndClients();
    connectClients();
    // Setup custom serializer
    ISharedObjectContainer soContainer = getClientSOContainer(0);
    soContainer.setSharedObjectMessageSerializer(new ISharedObjectMessageSerializer() {

      public Object deserializeMessage(byte[] data) throws IOException,
          ClassNotFoundException {
        return deserialize(data);
      }

      public byte[] serializeMessage(ID sharedObjectId, Object message)
          throws IOException {
        return serialize(message);
      }});
    ISharedObjectContainer serverContainer = getServerSOContainer();
    serverContainer.setSharedObjectMessageSerializer(new ISharedObjectMessageSerializer() {

      public Object deserializeMessage(byte[] data) throws IOException,
          ClassNotFoundException {
        return deserialize(data);
      }
View Full Code Here

    }

    public synchronized ISharedDataGraph subscribe(String path,
            IUpdateConsumer consumer) throws ECFException {
        Path p = new Path(path);
        ISharedObjectContainer container = getContainer(ResourcesPlugin
                .getWorkspace().getRoot().getProject(p.segment(0)));
        PublishedGraphTracker tracker = getTracker(container);

        ID id = IDFactory.getDefault().createStringID(path);
        WaitableSubscriptionCallback mutex = new WaitableSubscriptionCallback();
View Full Code Here

TOP

Related Classes of org.eclipse.ecf.core.sharedobject.ISharedObjectContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.