Re: [ecf-dev] Problem with SharedObject API
-----BEGIN PGP SIGNED MESSAGE-----
Tests works fine, my code works too. But I do not understand why this
code is in TestSharedObject (in method initialize()):
// This is a replica, so initialize the name from property
name = (String) getConfig().getProperties().get(NAME_PROPERTY);
Is this code a deserialization from Config to SharedObject? Why name do
not replicate with SharedObject automaticaly?
And another question: Does SharedObject API have any listeners that
calls when shared object has been added?
Scott Lewis пишет:
> Hi Pavel,
> Samolisov Pavel wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>> Hello folks,
>> I'm playing with SharedObject API and Generic Server/Client. I'm tring
>> to create shared object in one bundle and to get it in another bundle.
>> In the first bundle, I get SharedObjectManager and call
>> public static final String DEMO_SHARED_OBJECT_ID = "foo";
>> _server = createServer();
>> ISharedObjectManager manager = getServerSOManager();
>> ID id = manager.addSharedObject(createNewID(DEMO_SHARED_OBJECT_ID), new
>> MySharedObject(), null);
>> System.out.println("Added new SharedObject with ID = " + id.getName());
>> It works, I get "Added new SharedObject with ID = foo" in the OSGi
>> In another bundle activator:
>> System.out.println("Clients created and connected");
>> ISharedObjectManager manager = getClientSOManager(0);
>> ISharedObject sharedObject =
>> and I get
>> "Clients created and connected
>> in the OSGi Console :-(
>> May be I make mistake? Any ideas?
> The shared object instance is responsible for replicating itself to
> remotes, and your MySharedObject class has to have code to do this
> replication. The default (in BaseSharedObject...which I assume
> MySharedObject extends), is to *not* automatically replicate the object
> to remote containers.
> There's an example of code for replicating a shared object (and
> replicating the state of the primary copy...i.e. the one created via
> addSharedObject) onto a remote container in this test class:
> This class is in the test bundle: org.eclipse.ecf.tests.sharedobject
> Note that since the replication is done asynchronously (BaseSharedObject
> subclasses...see ) that you might want to put some delay into your
> test code after connection (to allow the replication to complete).
>  Note there is also the TransactionSharedObject super class, which
> has logic built in for replicating transactionally/all or
> nothing...which will block on addSharedObject until replication is
> complete...if desired.
Meet me at:
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----