|
|
|
|||||
|
Adapter Factories
Hi,
I have used the Ice Object factories to instantiate different concrete implementations of Ice Objects and it is an elegant way to do so. I'm just wondering if there is an equivalent one for adapters? Does Ice come with an "Adapter factory". I have two different implementations of an adapter and I would like to instantiate a different one based on certain conditionals. Could you show me how to do this?
__________________
Zhi Quan Lee University of Auckland Department of Electrical and Computer Engineering http://se.auckland.ac.nz Project: An Integrated Automated Framework for Managing Dynamic Reconfiguration Supervised by Dr. Ian Warren and Dr. Jing Sun. With respect to their paper: http://csdl2.computer.org/persagen/D...09/ASE.2006.12 Homepage: http://zhi-lee.com |
|
|||||
|
Hi benoit,
Sorry, I may have got the terminology incorrect. The idea is add a "AlloySubAnalyserI" or a "KKSubAnalyserI" depending on a condition. I want these to have the same identity. Code:
String subAnalyserType = "AlloySubAnalyser"
Ice.ObjectAdapter adapter = communicator().createObjectAdapter("SubAnalyser");
Ice.Properties properties = communicator().getProperties();
Ice.Identity id = communicator().stringToIdentity(properties.getProperty("Identity"));
if (subAnalyserType.equals("AlloySubAnalyser")) {
adapter.add(new AlloySubAnalyserI(), id);
} else if (subAnalyserType.equals("KKSubAnalyser")) {
adapter.add(new KKSubAnalyserI(), id);
adapter.activate();
__________________
Zhi Quan Lee University of Auckland Department of Electrical and Computer Engineering http://se.auckland.ac.nz Project: An Integrated Automated Framework for Managing Dynamic Reconfiguration Supervised by Dr. Ian Warren and Dr. Jing Sun. With respect to their paper: http://csdl2.computer.org/persagen/D...09/ASE.2006.12 Homepage: http://zhi-lee.com |
|
||||||
|
Do you want this to have effect on a per-request basis or at server startup? If you want to do it on server startup then what is wrong with the approach that you have taken below? If you want it to be on a per-request basis then you could use a servant locator to do what you want...
|
|
|||||
|
Thank you. Servant locators are exactly what I need. Cheers.
__________________
Zhi Quan Lee University of Auckland Department of Electrical and Computer Engineering http://se.auckland.ac.nz Project: An Integrated Automated Framework for Managing Dynamic Reconfiguration Supervised by Dr. Ian Warren and Dr. Jing Sun. With respect to their paper: http://csdl2.computer.org/persagen/D...09/ASE.2006.12 Homepage: http://zhi-lee.com |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to know which port the adapter is using? | nyingchi | Help Center | 7 | 07-07-2008 04:29 PM |
| one adapter or many | shimrod | Help Center | 2 | 11-07-2005 07:56 AM |
| object factories in slice | japanman | Help Center | 2 | 03-13-2005 06:30 PM |
| Object Factories and object initialisation | Nis Baggesen | Help Center | 1 | 09-30-2004 08:40 AM |
| Adapter Reactivation | Mr.Freeze | Help Center | 3 | 01-26-2004 09:34 AM |