Top Description Fields Constructors Methods
org.freedesktop.dbus.connections.impl

public Class DirectConnection

extends AbstractConnection
Class Inheritance
Static Imports
org.freedesktop.dbus.utils.CommonRegexPattern.IFACE_PATTERN, .CommonRegexPattern.PROXY_SPLIT_PATTERN

Handles a peer to peer connection between two applications without a bus daemon.

Signal Handlers and method calls from remote objects are run in their own threads, you MUST handle the concurrency issues.

Field Summary

Modifier and TypeField and Description
private static final Class<T>[]
private final Logger
private final String
Inherited from org.freedesktop.dbus.connections.AbstractConnection:
DOLLAR_PATTERNFLOAT_SUPPORTMAX_ARRAY_LENGTHMAX_NAME_LENGTH

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected AutoCloseable
addGenericSigHandler(DBusMatchRule
rule to add
_rule
,
DBusSigHandler<DBusSignal>
handler to use
_handler
)

Implements abstract org.freedesktop.dbus.connections.AbstractConnection.addGenericSigHandler.

Adds a DBusMatchRule to with a generic signal handler.

protected <T extends DBusSignal> AutoCloseable
addSigHandler(DBusMatchRule
rule to add
_rule
,
DBusSigHandler<T>
handler to use
_handler
)

Implements abstract org.freedesktop.dbus.connections.AbstractConnection.addSigHandler.

Add a signal handler with the given DBusMatchRule to DBus.

pack-priv <T extends DBusInterface> T
dynamicProxy(String _path, Class<T> _type)

pack-priv <T extends DBusInterface> T
getExportedObject(String _path, Class<T> _type)

public <T extends DBusInterface> T
getExportedObject(String
source
_source
,
String
path
_path
,
Class<T>
class of remote object
_type
)

Implements abstract org.freedesktop.dbus.connections.base.AbstractConnectionBase.getExportedObject.

Retrieves an remote object using source and path.

public DBusInterface
getExportedObject(String
source
_source
,
String
path
_path
)

Implements abstract org.freedesktop.dbus.connections.base.AbstractConnectionBase.getExportedObject.

Retrieves an remote object using source and path.

public String
getMachineId()

Implements abstract org.freedesktop.dbus.connections.base.AbstractConnectionBase.getMachineId.

The generated UUID of this machine.

public DBusInterface

Returns:

A reference to a remote object.
getRemoteObject
(String
The path on which the process is exporting the object.
_objectPath
)

Return a reference to a remote object.

public <
class which extends DBusInterface
T extends DBusInterface
>
T

Returns:

A reference to a remote object.
getRemoteObject
(String
The path on which the process is exporting the object.
_objectPath
,
Class<T>
The interface they are exporting it on. This type must have the same full class name and exposed method signatures as the interface the remote object is exporting.
_type
)

Return a reference to a remote object.

public void
listen()

Overrides org.freedesktop.dbus.connections.base.AbstractConnectionBase.listen.

Use this method when running on server side.

protected void
removeGenericSigHandler(DBusMatchRule
rule to remove
_rule
,
DBusSigHandler<DBusSignal>
handler to remove
_handler
)

Implements abstract org.freedesktop.dbus.connections.AbstractConnection.removeGenericSigHandler.

Remove a generic signal handler with the given DBusMatchRule.

protected <T extends DBusSignal> void
removeSigHandler(DBusMatchRule
rule to remove
_rule
,
DBusSigHandler<T>
handler to remove
_handler
)

Implements abstract org.freedesktop.dbus.connections.AbstractConnection.removeSigHandler.

Remove a match rule with the given DBusSigHandler.

Inherited from org.freedesktop.dbus.connections.AbstractConnection:
addFallbackaddSigHandleraddSigHandleraddSigHandlerWithoutMatchcallMethodAsynccallWithCallbackcreateReaderThreadexportObjectexportObjectfindMatchingTypesisFileDescriptorSupportedqueueCallbackremoveFallbackremoveSigHandlerremoveSigHandlersetWeakReferences

Field Detail

EMPTY_CLASS_ARRAYback to summary
private static final Class<T>[] EMPTY_CLASS_ARRAY
loggerback to summary
private final Logger logger

Hides org.freedesktop.dbus.connections.base.AbstractConnectionBase.logger.

machineIdback to summary
private final String machineId

Constructor Detail

DirectConnectionback to summary
pack-priv DirectConnection(ConnectionConfig _conCfg, TransportConfig _transportCfg, ReceivingServiceConfig _rsCfg) throws DBusException

Method Detail

addGenericSigHandlerback to summary
protected AutoCloseable addGenericSigHandler(DBusMatchRule _rule, DBusSigHandler<DBusSignal> _handler) throws DBusException

Implements abstract org.freedesktop.dbus.connections.AbstractConnection.addGenericSigHandler.

Doc from org.freedesktop.dbus.connections.AbstractConnection.addGenericSigHandler.

Adds a DBusMatchRule to with a generic signal handler. Generic signal handlers allow receiving different signals with the same handler. If the rule was already added, the signal handler is added to the internal map receiving the same signal as the first (and additional) handlers for this rule.

Parameters
_rule:DBusMatchRule

rule to add

_handler:DBusSigHandler<DBusSignal>

handler to use

Returns:AutoCloseable

closeable that removes signal handler

Annotations
@Override
Exceptions
DBusException:
on error
addSigHandlerback to summary
protected <T extends DBusSignal> AutoCloseable addSigHandler(DBusMatchRule _rule, DBusSigHandler<T> _handler) throws DBusException

Implements abstract org.freedesktop.dbus.connections.AbstractConnection.addSigHandler.

Doc from org.freedesktop.dbus.connections.AbstractConnection.addSigHandler.

Add a signal handler with the given DBusMatchRule to DBus. The rule will be added to DBus if it was not added before. If the rule was already added, the signal handler is added to the internal map receiving the same signal as the first (and additional) handlers for this rule.

Parameters
<T>
signal type
_rule:DBusMatchRule

rule to add

_handler:DBusSigHandler<T>

handler to use

Returns:AutoCloseable

closeable that removes signal handler

Annotations
@Override
Exceptions
DBusException:
on error
dynamicProxyback to summary
pack-priv <T extends DBusInterface> T dynamicProxy(String _path, Class<T> _type) throws DBusException
Annotations
@SuppressWarnings:unchecked
getExportedObjectback to summary
pack-priv <T extends DBusInterface> T getExportedObject(String _path, Class<T> _type) throws DBusException
Annotations
@SuppressWarnings:unchecked
getExportedObjectback to summary
public <T extends DBusInterface> T getExportedObject(String _source, String _path, Class<T> _type) throws DBusException

Implements abstract org.freedesktop.dbus.connections.base.AbstractConnectionBase.getExportedObject.

Doc from org.freedesktop.dbus.connections.base.AbstractConnectionBase.getExportedObject.

Retrieves an remote object using source and path. Will use the given type as object class.

Parameters
_source:String

source

_path:String

path

_type:Class<T>

class of remote object

Returns:T

DBusInterface compatible object

Annotations
@Override
getExportedObjectback to summary
public DBusInterface getExportedObject(String _source, String _path) throws DBusException

Implements abstract org.freedesktop.dbus.connections.base.AbstractConnectionBase.getExportedObject.

Doc from org.freedesktop.dbus.connections.base.AbstractConnectionBase.getExportedObject.

Retrieves an remote object using source and path. Will try to find suitable exported DBusInterface automatically.

Parameters
_source:String

source

_path:String

path

Returns:DBusInterface

DBusInterface compatible object

Annotations
@Override
getMachineIdback to summary
public String getMachineId()

Implements abstract org.freedesktop.dbus.connections.base.AbstractConnectionBase.getMachineId.

Doc from org.freedesktop.dbus.connections.base.AbstractConnectionBase.getMachineId.

The generated UUID of this machine.

Returns:String

String

Annotations
@Override
getRemoteObjectback to summary
public DBusInterface getRemoteObject(String _objectPath) throws DBusException

Return a reference to a remote object. This method will always refer to the well known name (if given) rather than resolving it to a unique bus name. In particular this means that if a process providing the well known name disappears and is taken over by another process proxy objects gained by this method will make calls on the new proccess. This method will use bus introspection to determine the interfaces on a remote object and so may block and may fail. The resulting proxy object will, however, be castable to any interface it implements. It will also autostart the process if applicable. Also note that the resulting proxy may fail to execute the correct method with overloaded methods and that complex types may fail in interesting ways. Basically, if something odd happens, try specifying the interface explicitly.

Parameters
_objectPath:String

The path on which the process is exporting the object.

Returns:DBusInterface

A reference to a remote object.

Exceptions
DBusException:
If busname or objectpath are incorrectly formatted.
ClassCastException:
If type is not a sub-type of DBusInterface
getRemoteObjectback to summary
public <T extends DBusInterface> T getRemoteObject(String _objectPath, Class<T> _type) throws DBusException

Return a reference to a remote object. This method will always refer to the well known name (if given) rather than resolving it to a unique bus name. In particular this means that if a process providing the well known name disappears and is taken over by another process proxy objects gained by this method will make calls on the new proccess.

Parameters
<T>
class which extends DBusInterface
_objectPath:String

The path on which the process is exporting the object.

_type:Class<T>

The interface they are exporting it on. This type must have the same full class name and exposed method signatures as the interface the remote object is exporting.

Returns:T

A reference to a remote object.

Exceptions
MissingInterfaceImplementationException:
If type is not a sub-type of DBusInterface
InvalidObjectPathException:
If busname or objectpath are invalid
listenback to summary
public void listen() throws IOException

Overrides org.freedesktop.dbus.connections.base.AbstractConnectionBase.listen.

Use this method when running on server side.

Call will block.

Annotations
@Override
Exceptions
IOException:
when connection fails
removeGenericSigHandlerback to summary
protected void removeGenericSigHandler(DBusMatchRule _rule, DBusSigHandler<DBusSignal> _handler) throws DBusException

Implements abstract org.freedesktop.dbus.connections.AbstractConnection.removeGenericSigHandler.

Doc from org.freedesktop.dbus.connections.AbstractConnection.removeGenericSigHandler.

Remove a generic signal handler with the given DBusMatchRule. The rule will only be removed from DBus if no other additional handlers are registered to the same rule.

Parameters
_rule:DBusMatchRule

rule to remove

_handler:DBusSigHandler<DBusSignal>

handler to remove

Annotations
@Override
Exceptions
DBusException:
on error
removeSigHandlerback to summary
protected <T extends DBusSignal> void removeSigHandler(DBusMatchRule _rule, DBusSigHandler<T> _handler) throws DBusException

Implements abstract org.freedesktop.dbus.connections.AbstractConnection.removeSigHandler.

Doc from org.freedesktop.dbus.connections.AbstractConnection.removeSigHandler.

Remove a match rule with the given DBusSigHandler. The rule will only be removed from DBus if no other additional handlers are registered to the same rule.

Parameters
<T>
signal type
_rule:DBusMatchRule

rule to remove

_handler:DBusSigHandler<T>

handler to remove

Annotations
@Override
Exceptions
DBusException:
on error