|
|
|
|||||
|
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 |
|
|||||
|
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)
Thank you very much. /gp Last edited by japanman : 03-13-2005 at 05:33 PM. |
![]() |
| 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 |
| 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 |