- Alle implementierten Schnittstellen:
Closeable
,AutoCloseable
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.
-
Feldübersicht
Von Klasse geerbte Felder org.freedesktop.dbus.connections.AbstractConnection
DOLLAR_PATTERN, FLOAT_SUPPORT, MAX_ARRAY_LENGTH, MAX_NAME_LENGTH
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprotected AutoCloseable
addGenericSigHandler
(DBusMatchRule _rule, DBusSigHandler<DBusSignal> _handler) Adds aDBusMatchRule
to with a generic signal handler.protected <T extends DBusSignal>
AutoCloseableaddSigHandler
(DBusMatchRule _rule, DBusSigHandler<T> _handler) Add a signal handler with the givenDBusMatchRule
to DBus.getExportedObject
(String _source, String _path) Retrieves an remote object using source and path.<T extends DBusInterface>
TgetExportedObject
(String _source, String _path, Class<T> _type) Retrieves an remote object using source and path.The generated UUID of this machine.getRemoteObject
(String _objectPath) Return a reference to a remote object.<T extends DBusInterface>
TgetRemoteObject
(String _objectPath, Class<T> _type) Return a reference to a remote object.void
listen()
Use this method when running on server side.protected void
removeGenericSigHandler
(DBusMatchRule _rule, DBusSigHandler<DBusSignal> _handler) Remove a generic signal handler with the givenDBusMatchRule
.protected <T extends DBusSignal>
voidremoveSigHandler
(DBusMatchRule _rule, DBusSigHandler<T> _handler) Remove a match rule with the givenDBusSigHandler
.Von Klasse geerbte Methoden org.freedesktop.dbus.connections.AbstractConnection
addFallback, addSigHandler, addSigHandler, addSigHandlerWithoutMatch, callMethodAsync, callWithCallback, createReaderThread, exportObject, exportObject, findMatchingTypes, isFileDescriptorSupported, queueCallback, removeFallback, removeSigHandler, removeSigHandler, setWeakReferences
Von Klasse geerbte Methoden org.freedesktop.dbus.connections.base.ConnectionMessageHandler
handleException, handleMessage, handleMessage
Von Klasse geerbte Methoden org.freedesktop.dbus.connections.base.DBusBoundPropertyHandler
handleDBusBoundProperties, handleGet, handleGetAll, handleSet
Von Klasse geerbte Methoden org.freedesktop.dbus.connections.base.ConnectionMethodInvocation
invokedMethodReply, invokeMethod, invokeMethodAndReply, queueInvokeMethod, setupAndInvoke
Von Klasse geerbte Methoden org.freedesktop.dbus.connections.base.AbstractConnectionBase
close, connect, disconnect, disconnect, getAddress, getBusAddress, getCallbackManager, getCallInfo, getDisconnectCallback, getError, getExportedObject, getExportedObjects, getFallbackContainer, getGenericHandledSignals, getHandledSignals, getImportedObjects, getInfoMap, getLogger, getMessageFactory, getObjectTree, getPendingCalls, getPendingErrorQueue, getReceivingService, getTransport, getTransportConfig, internalDisconnect, isConnected, rejectUnknownProperty, sendMessage, setDisconnectCallback, toString, unExportObject
-
Methodendetails
-
listen
Use this method when running on server side.Call will block.
- Setzt außer Kraft:
listen
in KlasseAbstractConnectionBase
- Löst aus:
IOException
- when connection fails
-
getRemoteObject
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.- Parameter:
_objectPath
- The path on which the process is exporting the object.- Gibt zurück:
- A reference to a remote object.
- Löst aus:
ClassCastException
- If type is not a sub-type of DBusInterfaceDBusException
- If busname or objectpath are incorrectly formatted.
-
getRemoteObject
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.- Typparameter:
T
- class which extends DBusInterface- Parameter:
_objectPath
- The path on which the process is exporting the object._type
- 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.- Gibt zurück:
- A reference to a remote object.
- Löst aus:
ClassCastException
- If type is not a sub-type of DBusInterfaceDBusException
- If busname or objectpath are incorrectly formatted or type is not in a package.
-
removeSigHandler
protected <T extends DBusSignal> void removeSigHandler(DBusMatchRule _rule, DBusSigHandler<T> _handler) throws DBusException Beschreibung aus Klasse kopiert:AbstractConnection
Remove a match rule with the givenDBusSigHandler
. The rule will only be removed from DBus if no other additional handlers are registered to the same rule.- Angegeben von:
removeSigHandler
in KlasseAbstractConnection
- Typparameter:
T
- signal type- Parameter:
_rule
- rule to remove_handler
- handler to remove- Löst aus:
DBusException
- on error
-
addSigHandler
protected <T extends DBusSignal> AutoCloseable addSigHandler(DBusMatchRule _rule, DBusSigHandler<T> _handler) throws DBusException Beschreibung aus Klasse kopiert:AbstractConnection
Add a signal handler with the givenDBusMatchRule
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.- Angegeben von:
addSigHandler
in KlasseAbstractConnection
- Typparameter:
T
- signal type- Parameter:
_rule
- rule to add_handler
- handler to use- Gibt zurück:
- closeable that removes signal handler
- Löst aus:
DBusException
- on error
-
removeGenericSigHandler
protected void removeGenericSigHandler(DBusMatchRule _rule, DBusSigHandler<DBusSignal> _handler) throws DBusException Beschreibung aus Klasse kopiert:AbstractConnection
Remove a generic signal handler with the givenDBusMatchRule
. The rule will only be removed from DBus if no other additional handlers are registered to the same rule.- Angegeben von:
removeGenericSigHandler
in KlasseAbstractConnection
- Parameter:
_rule
- rule to remove_handler
- handler to remove- Löst aus:
DBusException
- on error
-
addGenericSigHandler
protected AutoCloseable addGenericSigHandler(DBusMatchRule _rule, DBusSigHandler<DBusSignal> _handler) throws DBusException Beschreibung aus Klasse kopiert:AbstractConnection
Adds aDBusMatchRule
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.- Angegeben von:
addGenericSigHandler
in KlasseAbstractConnection
- Parameter:
_rule
- rule to add_handler
- handler to use- Gibt zurück:
- closeable that removes signal handler
- Löst aus:
DBusException
- on error
-
getExportedObject
public <T extends DBusInterface> T getExportedObject(String _source, String _path, Class<T> _type) throws DBusException Beschreibung aus Klasse kopiert:AbstractConnectionBase
Retrieves an remote object using source and path. Will use the given type as object class.- Angegeben von:
getExportedObject
in KlasseAbstractConnectionBase
- Parameter:
_source
- source_path
- path_type
- class of remote object- Gibt zurück:
DBusInterface
compatible object- Löst aus:
DBusException
-
getMachineId
Beschreibung aus Klasse kopiert:AbstractConnectionBase
The generated UUID of this machine.- Angegeben von:
getMachineId
in KlasseAbstractConnectionBase
- Gibt zurück:
- String
-
getExportedObject
Beschreibung aus Klasse kopiert:AbstractConnectionBase
Retrieves an remote object using source and path. Will try to find suitable exported DBusInterface automatically.- Angegeben von:
getExportedObject
in KlasseAbstractConnectionBase
- Parameter:
_source
- source_path
- path- Gibt zurück:
DBusInterface
compatible object- Löst aus:
DBusException
-