Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 03-13-2005
japanman japanman is offline
Registered User
 
 
Join Date: Nov 2004
Posts: 2
object factories in slice

Hello all,
I've found in the overview web pages an interesting way to play with objects factories
----
interface Invoice {
void addItems(ItemSeq items);
void submit();
};
interface InvoiceFactory {
Invoice* create();
};
----

that makes the usage of factories very simple (this is the python sample)
----
# Create a proxy for the invoice factory object.
proxy = communicator.stringToProxy("InvoiceFactory:tcp -p 9000")

# Narrow the proxy to the proper type.
factory = Biz.InvoiceFactoryPrx.checkedCast(proxy)

# Use the factory to obtain a proxy for a new invoice object.
invoice = factory.create()
----

Unfortunately, I'm not able to find in the documentation and in the samples other usages of this technique: is it possible to have more details (perhaps a working server implementation) ?

Thanks in advance
/gp
Reply With Quote
  #2 (permalink)  
Old 03-13-2005
marc's Avatar
marc marc is offline
ZeroC Staff
 
Name: Marc Laukien
Organization: ZeroC, Inc.
Project: The Internet Communications Engine
 
Join Date: Feb 2003
Location: Florida
Posts: 1,780
For an example that also involves the use of Freeze, have a look at demo/Freeze/phonebook or demo/Freeze/library. Another example is demo/IcePack/hello, which also demonstrates the use of IcePack.
Reply With Quote
  #3 (permalink)  
Old 03-13-2005
japanman japanman is offline
Registered User
 
 
Join Date: Nov 2004
Posts: 2
Thanks for your quick reply,
I've borrowed from demo/IcePack/hello: here's my minimalist InvoiceFactoryI python implementation

Code:
class InvoiceFactoryI(Biz.InvoiceFactory):

    def create(self, current=None):
        adapter = current.adapter    
        obj = adapter.addWithUUID(InvoiceI())   
        return Biz.InvoicePrx.uncheckedCast(obj)
And it seems to work.
Thank you very much.
/gp

Last edited by japanman : 03-13-2005 at 05:33 PM.
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
Adapter Factories zhi Help Center 4 01-22-2007 07:46 PM
How to release object. laotee Help Center 12 08-29-2005 11:48 PM
Object Factories and object initialisation Nis Baggesen Help Center 1 09-30-2004 07:40 AM
Object Factory enzo Help Center 2 03-17-2004 01:29 PM
Object serialization in ICE shantanu_k06 Help Center 4 02-17-2004 01:00 PM


All times are GMT -4. The time now is 08:04 PM.


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.