Java API

Matthew Johnson dbus at matthew.ath.cx
Fri Nov 25 15:53:09 PST 2005


I have written Java bindings for DBus, they are mostly pure Java, but
with some JNI to call the the C dbus API. Since java can't read unix
sockets there has to be some JNI, so I thought wrapping the C API would
be the simplest. There is lots of reflection and so on done by the java
to make things easy and map DBus calls onto Java objects and interfaces.

currently you can:
    - send a signal
    - receive signals
    - register a service
    - call methods
    - export methods to be called

things it doesn't yet have:
    - documentation
    - compound types
    - UINTs

It also depends on my dbus_connection_read_write patch, so most people
may find it hardish to test.

Javadoc is here:

http://javadoc.matthew.ath.cx/cx/ath/matthew/dbus/package-summary.html

Tarball here:

http://www.matthew.ath.cx/projects/DBus.tar.gz

Source online here:

http://www.matthew.ath.cx/projects/java

Test/example files:

http://www.matthew.ath.cx/projects/hilight/projects/cx/ath/matthew/dbus/test.java
http://www.matthew.ath.cx/projects/hilight/projects/cx/ath/matthew/bluemon/Client.java

Things to note: if you want to listen on / export an interface, you just
create a java interface of the same name with the appropriate methods,
and it figures it all out. Local and remote objects are inter-changable.
Errors are handled by exceptions. If you have a class definition for a
singal type, the DBusSignal is actually an instance of the correct
object.

Matt

-- 
Matthew Johnson
http://www.matthew.ath.cx/


More information about the dbus mailing list