Difference between revisions of "Template:Java D-Bus snippet"

From Apertium
Jump to navigation Jump to search
(New page: <pre> import org.freedesktop.DBus; import org.freedesktop.dbus.DBusConnection; import org.freedesktop.dbus.exceptions.DBusException; import org.apertium.Info; // The interface we use to a...)
 
m (Java D-Bus snippet moved to Template:Java D-Bus snippet: To make {{}} syntax work)
 
(No difference)

Latest revision as of 12:54, 19 December 2007

import org.freedesktop.DBus;
import org.freedesktop.dbus.DBusConnection;
import org.freedesktop.dbus.exceptions.DBusException;

import org.apertium.Info; // The interface we use to access org.apertium.info/

class TestDBus {

        public static void main(String[] args) throws org.freedesktop.dbus.exceptions.DBusException {
                DBusConnection bus = null;
                Info info = null;

                bus = DBusConnection.getConnection(DBusConnection.SESSION);
                info = bus.getRemoteObject("org.apertium.info", "/", Info.class);

                for (String s : info.modes()) {
                        System.out.println(s);
                }

                bus.disconnect();
        }
}