Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 01-09-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
Automatically Generating an ObjectFactory

Before I dive into the post proper, I'd just like to extend my appreciation for all the support I've got from these forums so far. Benoit and marc, I have taken your advice and stipped down my application to the bare minimum.

I'm still stuck on streaming and am examining the demoj\Ice\invoke example.

One thing I do not understand is how the ObjectFactory methods were generated in the C.java class:
Code:
private static class __F extends Ice.LocalObjectImpl implements Ice.ObjectFactory
    {
	public Ice.Object
	create(String type)
	{
	    assert(type.equals(ice_staticId()));
	    return new C();
	}

    }
    private static Ice.ObjectFactory _factory = new __F();

    public static Ice.ObjectFactory
    ice_factory()
    {
	return _factory;
    }
My Slice definition is very simple:
Code:
module Streaming {
	class KodkodModel {
		void solve();
	};

	interface KodkodModelReceiver {
		void receiveKodkodModel(KodkodModel k);
	};
};
However my generated class does not have those ObjectFactory methods and it is the cause of this exception:
Code:
identity: kodkodmodelreceiverobject
facet:
operation: receiveKodkodModel
Ice.NoObjectFactoryException
    reason = "class sliced to Ice.Object, which is abstract"
    type = "::Streaming::KodkodModel"
Thanks!
__________________
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-09-2007
mes's Avatar
mes mes is online now
ZeroC Staff
 
Name: Mark Spruiell
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Feb 2003
Location: California
Posts: 976
Hi,

The Slice compilers can only generate object factories for concrete classes. Since your class defines an operation, it is considered abstract. The application is responsible for defining a concrete subclass that implements the operations. Since the Slice compiler has no way of knowing what the name of that subclass might be, it's impossible for the compiler to generate a factory. Therefore, you must also define a subclass of ObjectFactory and register it with the communicator. Take a look at the example in demo/Ice/value for more details.

Take care,
- Mark
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
automatically run icepatch2server incubator Help Center 3 12-08-2006 11:56 PM
About ObjectFactory Anhur Help Center 1 10-16-2006 12:40 PM
How to publish the topic dynamicly and automatically in icestorm? Jason Gao Help Center 4 08-24-2006 06:32 AM
Question about ObjectFactory kongchoy Help Center 4 02-14-2006 03:07 AM
Generating code(.dll), Ice integration problem Kruppy Comments 6 08-11-2005 10:24 PM


All times are GMT -4. The time now is 12:15 AM.


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