|
From: Venkat S. <vso...@ho...> - 2004-11-02 20:06:31
|
Hi, The subject may sound strange but please bear with me. I am trying to use Spring to isolate ICE (http://www.zeroc.com) specific depedencies. I could prototype the client side interaction (Thanks to Jurgen for pointing me in the right direction), but have come to a block when trying Server side. ICE has a kind of app server called IceBox, it loads different services from a Config file, it has a feature called UseSharedCommunicator, which means all the loaded services share the same ICE runtime instance and calls to other services located in the same instance are treated as local calls. Basically you wrap a ServiceImpl class in ServiceAdapter so that IceBox can load it, here is an example of the ServiceAdapter for a ServiceImpl class PrinterI public class IceBoxService extends Ice.LocalObjectImpl implements IceBox.Service { private Ice.ObjectAdapter adapter; public void start(String s, Communicator communicator, String[] strings) { this.adapter = communicator.createObjectAdapter(s); Ice.Object object = new PrinterI(communicator); adapter.add(object, Ice.Util.stringToIdentity("SimpleFCASearch")); adapter.activate(); } public void stop() { adapter.deactivate(); } } } I was planning on writing a generic IceBoxService which takes a parameter to context.xml file and instantiate a BeanFactory which loads the ServiceImpls and resolve the services they depend upon. But, if you observe how the PrinterI is instantiated, the communicator instance passed to it should be one that is supplied by the IceBox server (passed in as a parameter to start method). How to make a bean factory aware of this communicator? The following code explains the behaviour I am looking for: BeanFactory bf = new ClassPathXmlApplicationContext(); bf.setBean("communicator", communicator); // Setting/passing the application communicator instance to the Bean bf.load("context.xml"); // refers to the communicator bean passed in above statement. Thanks for your time and patience. --Venkat. |