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

偶尔善良 提交于 2019-12-23 02:38:27

问题


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:


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.



来源:https://stackoverflow.com/questions/5723910/changing-the-server-address-ecf-uses-when-it-looks-up-remote-services

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!