Changing the server address ECF uses when it looks up remote services?

314 Views Asked by At

In my rich client application there is a setting to change the server address. When the server address changes I want to be able to change where ECF looks for remote services (R-OSGI). It looks like ECF supports two mechanisms for finding an ECF server over a WAN: edef or zookeeper. I could care less which one I use as long as it works and lets me change servers without shutting down the application.

How do change the server address ECF uses when it looks up remote services?

1

There are 1 best solutions below

2
Pablo García On BEST ANSWER

Take a look to OSGi Configuration Admin, you can modify component properties in execution time (that is, you can modify the properties of the services present in the DS.xml for example):

Configuration conf = configAdmin.getConfiguration("YourComponentName");

Dictionary dict = conf.getProperties();
//check things or whatever
dict = new Hashtable();
dict.put("service.exported.interfaces", "*");
dict.put("service.exported.configs", "ecf.generic.server");
dict.put("ecf.exported.containerfactoryargs", "ecftcp://localhost:3789/server");

conf.update(dict);

After that, I have to restart the component from the command line to let ECF the creation of the container:

disable yourComponentID
enable yourComponentID

I still don't know how to do this part automatically. I am still investigating in Configuration Admin and Remote Services Admin. If you, or other, can help, it would be nice ;)

I am also interested in your question. I think there are no much docummentation about distributed services in WANs.