Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 01-22-2007
zhi zhi is offline
Registered User
 
Name: Zhi Quan Lee
Organization: University of Auckland
Project: Dynamic Reconfiguration with Correctness Assurance
 
Join Date: Nov 2006
Location: Auckland
Posts: 32
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
Reply With Quote
  #2 (permalink)  
Old 01-22-2007
benoit's Avatar
benoit benoit is online now
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,542
Hi,

Sorry, I'm not sure I understand your question. By "adapter", are you refering to Ice object adapters? Object adapters are created through the communicator. Perhaps you could describe a little more what you're trying to do or what you're looking for with an example?

Cheers,
Benoit.
Reply With Quote
  #3 (permalink)  
Old 01-22-2007
zhi zhi is offline
Registered User
 
Name: Zhi Quan Lee
Organization: University of Auckland
Project: Dynamic Reconfiguration with Correctness Assurance
 
Join Date: Nov 2006
Location: Auckland
Posts: 32
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
Reply With Quote
  #4 (permalink)  
Old 01-22-2007
matthew's Avatar
matthew matthew is online now
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,061
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...
Reply With Quote
  #5 (permalink)  
Old 01-22-2007
zhi zhi is offline
Registered User
 
Name: Zhi Quan Lee
Organization: University of Auckland
Project: Dynamic Reconfiguration with Correctness Assurance
 
Join Date: Nov 2006
Location: Auckland
Posts: 32
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
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT -4. The time now is 09:36 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.