Hi guys,
I'm home too. I've started on a small dummy xesam service for testing
the new api before doing the full on strigi implementation.
The attached python file is quite useless since I do not have
preliminary spec here, but it does show how do pass the humungous
argument list in such a way that introspection leads to the proper
results.
Can you give me a pointer to the upcoming spec?
Cheers,
Jos
PS: suuasa(ssb)aayaay!
Maybe before going to the canary islands we should come up with at
least one function with signature ayayayay!
#!/usr/bin/env python
import dbus
import dbus.service
from dbus.mainloop.glib import DBusGMainLoop
import gobject
class Documents:
def __init__(self):
# 3 tiny documents with no common fields
self.documents = [{'name':'hello'},{'name':'world'},{'hello':'world'}]
def get(self, fields):
docs = []
for d in self.documents:
doc = []
for f in fields:
if d.has_key(f):
doc.append(d[f])
else:
doc.append('')
docs.append(doc)
return docs
class ServerObject(dbus.service.Object):
def __init__(self):
# Here the service name
bus_name = dbus.service.BusName('org.xesam.ServiceName',bus=dbus.SessionBus())
# Here the object path
dbus.service.Object.__init__(self, bus_name, '/org/xesam/ServiceName')
self.documents = Documents()
self.documents.get(['name'])
# Here the interface name, and the method is named same as on dbus.
# in s query
# in u offset
# in u count
# in as fields (array of fieldnames)
# in a(ssb) sortdefinition (array of (field, collationtype, descending))
# in aay firstsortvalue (array of bytearrays)
# in aay lastsortvalue (array of bytearrays)
@dbus.service.method('org.xesam.SearchBySortKey',
in_signature='suuasa(ssb)aayaay',
out_signature='uaav')
def Search(self, query, fields, offset, count, sortdefinition,
firstsortvalue, lastsortvalue):
print sortdefinition
docs = self.documents.get(fields)
print docs
return (0, docs)
DBusGMainLoop(set_as_default=True)
server = ServerObject()
loop = gobject.MainLoop()
loop.run()
_______________________________________________
Xesam mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/xesam