All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.freedesktop.dbus.connections.base.GlobalHandler Maven / Gradle / Ivy

Go to download

Improved version of the DBus-Java library provided by freedesktop.org (https://dbus.freedesktop.org/doc/dbus-java/). This is the OSGi compliant bundle of all required libraries in one bundle.

The newest version!
package org.freedesktop.dbus.connections.base;

import org.freedesktop.dbus.errors.UnknownObject;
import org.freedesktop.dbus.messages.ExportedObject;

public class GlobalHandler implements org.freedesktop.dbus.interfaces.Peer, org.freedesktop.dbus.interfaces.Introspectable {
    /**
     *
     */
    private final AbstractConnectionBase connection;
    private final String             objectpath;

    GlobalHandler(AbstractConnectionBase _abstractConnection) {
        connection = _abstractConnection;
        this.objectpath = null;
    }

    GlobalHandler(AbstractConnectionBase _abstractConnection, String _objectpath) {
        connection = _abstractConnection;
        this.objectpath = _objectpath;
    }

    @Override
    public boolean isRemote() {
        return false;
    }

    @Override
    public void Ping() {
        // nothing to do
    }

    @Override
    public String Introspect() {
        String intro = connection.getObjectTree().Introspect(objectpath);
        if (null == intro) {
            ExportedObject eo = connection.getFallbackContainer().get(objectpath);
            if (null != eo) {
                intro = eo.getIntrospectiondata();
            }
        }
        if (null == intro) {
            throw new UnknownObject("Introspecting on non-existant object");
        } else {
            return "\n" + intro;
        }
    }

    @Override
    public String getObjectPath() {
        return objectpath;
    }

    @Override
    public String GetMachineId() {
        return connection.getMachineId();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy