I'm trying to implement the observer pattern using Agnos and am running into some difficulty. Here is a small snippet from my IDL:
<record name="LogRecord">
<doc>Stores all of the information for a log message.</doc>
<attr name="timestamp" type="date" />
<attr name="type" type="LogType" />
<attr name="message" type="str" />
</record>
<class name="LogListener">
<doc>Stores all of the information for a log update</doc>
<method name="logUpdate" type="void">
<arg name="record" type="LogRecord"/>
</method>
</class>
<func name="registerLogUpdate" type="void">
<doc>Register to be notified of log messages</doc>
<arg name="listener" type="LogListener" />
</func>
Basically, I want to register a callback with the server. My server is implemented in Java and the client is Python. My naive approach was to simply create a class on the client side and pass it in, but I was met with the following error:
File "C:\TEMP\wspace2\SimService\build\gen_src\GroundService_bindings.py", line 523, in sync_900023
LogListenerObjRef.pack(listener, _self.utils.transport)
File "c:\Python26\lib\contextlib.py", line 34, in __exit__
self.gen.throw(type, value, traceback)
File "c:\Python26\lib\site-packages\agnos-1.0.2-py2.6.egg\agnos\protocol.py", line 381, in invocation
yield seq
File "C:\TEMP\wspace2\SimService\build\gen_src\GroundService_bindings.py", line 523, in sync_900023
LogListenerObjRef.pack(listener, _self.utils.transport)
File "c:\Python26\lib\site-packages\agnos-1.0.2-py2.6.egg\agnos\packers.py", line 90, in pack
Int64.pack(self.storer(obj), stream)
File "C:\TEMP\wspace2\SimService\build\gen_src\GroundService_bindings.py", line 488, in <lambda>
storer = lambda proxy: -1 if proxy is None else proxy._objref
AttributeError: 'LogListener' object has no attribute '_objref'
Clearly, it's expecting me to do something special to create this object. In my generated bindings module, I see the classes for the Proxy objects, but not abstract class for me to implement. Is what I'm trying to do even possible?