Hi,
I'm trying to use shared object implementation of the ECF framework 
and I'm experiencing problems. I wrote some code largely inspired by 
the test cases and from 
http://wiki.eclipse.org/Sharing_objects_over_XMPP.
This is my source code, I start to define some class variables :
   public static final String CHAT_ROOM_NAME = "chatroom";
   public IContainer[] clients = new IContainer[2];
   IChatRoomContainer[] chatRoomContainer = new IChatRoomContainer[2];;
   protected String[] usernames = {"user1@domain", "user2@domain"};
   protected String[] passwords = {"pwd", "pwd"};
And then I connect my two clients to the server and also I connect 
them to the chatroom. I can browse participants, send chat messages 
with no problems. Here is the code, I think it is OK :
       System.out.println("> Creation client 0");
       clients[0] = 
ContainerFactory.getDefault().createContainer("ecf.xmpp.smack");
       ID id0 = 
IDFactory.getDefault().createID(clients[0].getConnectNamespace(), 
usernames[0]);                   IConnectContext connectContext0 = 
ConnectContextFactory.createUsernamePasswordConnectContext(usernames[0], 
passwords[0]);
       clients[0].connect(id0, connectContext0);
       System.out.println("> Get chatRoom 0");
       final IChatRoomInfo info0 = 
((IPresenceContainerAdapter)clients[0].getAdapter(IPresenceContainerAdapter.class)).getChatRoomManager().getChatRoomInfo(CHAT_ROOM_NAME); 
       if (info0 == null)
           throw new Exception(NLS.bind("no chat room {0} avalable", 
CHAT_ROOM_NAME));
       chatRoomContainer[0] = info0.createChatRoomContainer();
       System.out.println("> Connect to chatRoomContainer 0");
       chatRoomContainer[0].connect(info0.getRoomID(), null);
       System.out.println("> Creation client 1");
       clients[1] = 
ContainerFactory.getDefault().createContainer("ecf.xmpp.smack");
       ID id1 = 
IDFactory.getDefault().createID(clients[1].getConnectNamespace(), 
usernames[1]);                   IConnectContext connectContext1 = 
ConnectContextFactory.createUsernamePasswordConnectContext(usernames[1], 
passwords[1]);
       clients[1].connect(id1, connectContext1);
       System.out.println("> Get chatRoom 1");
       final IChatRoomInfo info1 = 
((IPresenceContainerAdapter)clients[1].getAdapter(IPresenceContainerAdapter.class)).getChatRoomManager().getChatRoomInfo(CHAT_ROOM_NAME); 
       if (info1 == null)
           throw new Exception(NLS.bind("no chat room {0} avalable", 
CHAT_ROOM_NAME));
       chatRoomContainer[1] = info1.createChatRoomContainer();
       System.out.println("> Connect to chatRoomContainer 1");
       chatRoomContainer[1].connect(info1.getRoomID(), null);
At this point, I tried to share an object by the client 0. All seems 
fine, the client 0 can access the object and I can see its presence 
when I call the getSharedObjectIDs() of the ISharedObjectManager.
       final ISharedObjectContainer socontainer0 = 
(ISharedObjectContainer)chatRoomContainer[0].getAdapter(ISharedObjectContainer.class); 
       final ISharedObjectManager manager0 = 
socontainer0.getSharedObjectManager();
       System.out.println("> Creation manager");
       if (manager0 == null) throw new Exception("manager is null");
       final ID objectID = IDFactory.getDefault().createStringID("xxx");
              System.out.println("> Add shared object");
       MySharedObject shared = new MySharedObject(objectID.getName());
       final ID id = manager0.addSharedObject(objectID, shared, null);
              System.out.println("> We sleep a litle time...");
       Thread.sleep(4000);
              System.out.println("> Client 0 retrieve so");
       final MySharedObject sharedObject0 = 
(MySharedObject)manager0.getSharedObject(id);
              if (sharedObject0 == null) throw new 
Exception("sharedObject is null");
       System.out.println("OK");
Then I try to use the shared object with my client 1 which is also 
connected to the chatroom. Unfortunately the sharedObject1 is always 
'null'. When I call the getSharedObjectIDs() of the 
ISharedObjectManager, the object is not present.
       System.out.println("> Client 1 retrieve so");
       final ISharedObjectContainer socontainer1 = 
(ISharedObjectContainer)chatRoomContainer[1].getAdapter(ISharedObjectContainer.class); 
       MySharedObject sharedObject1 = 
(MySharedObject)socontainer1.getSharedObjectManager().getSharedObject(id); 
       if (sharedObject1 == null)
       {
           System.out.println("Cannot retrieve sharedObject1");
           throw new Exception("sharedObject1 is null");
       }
       System.out.println("OK");
       sharedObject1.getMyName();
I try to call explicitly 
MySharedObject.this.replicateToRemoteContainers but this does not seem 
have an effect.
I tried this source code with :
- ECF 1.2.0 on Eclipse 3.3.1.1
- ECF 2.0 on Eclipse 3.4
I also tried on server :
- ejabberd 1.1.26
- openfire 3.4.4
Is there a problem in the source code ? Does the jabber server needs a 
special configuration ? I don't know where the problem comes from. 
Could you help me ?
Thanks a lot,
Cyril
_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev