public class DirectConnection extends AbstractConnection
Signal Handlers and method calls from remote objects are run in their own threads, you MUST handle the concurrency issues.
BUSNAME_REGEX, CONNID_REGEX, DOLLAR_PATTERN, FLOAT_SUPPORT, MAX_ARRAY_LENGTH, MAX_NAME_LENGTH, OBJECT_REGEX, TCP_CONNECT_TIMEOUT| Constructor and Description |
|---|
DirectConnection(String address)
Create a direct connection to another application.
|
DirectConnection(String address,
int timeout)
Create a direct connection to another application.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addGenericSigHandler(DBusMatchRule rule,
DBusSigHandler<DBusSignal> handler)
Adds a
DBusMatchRule to with a generic signal handler. |
protected <T extends DBusSignal> |
addSigHandler(DBusMatchRule rule,
DBusSigHandler<T> handler)
Add a signal handler with the given
DBusMatchRule to DBus. |
static String |
createDynamicSession()
Creates a bus address for a randomly generated abstract unix socket.
|
static String |
createDynamicTCPSession()
Creates a bus address for a randomly generated tcp port.
|
DBusInterface |
getExportedObject(String source,
String path) |
String |
getMachineId()
The generated UUID of this machine.
|
DBusInterface |
getRemoteObject(String objectpath)
Return a reference to a remote object.
|
<T extends DBusInterface> |
getRemoteObject(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 given
DBusMatchRule. |
protected <T extends DBusSignal> |
removeSigHandler(DBusMatchRule rule,
DBusSigHandler<T> handler)
Remove a match rule with the given
DBusSigHandler. |
addFallback, addSigHandler, addSigHandler, addSigHandlerWithoutMatch, callMethodAsync, callWithCallback, changeThreadCount, close, disconnect, disconnect, exportObject, getAddress, getCallInfo, getEndianness, getError, getExportedObject, getExportedObjects, getGenericHandledSignals, getHandledSignals, getImportedObjects, getObjectTree, getPendingCalls, getPendingErrorQueue, getSystemEndianness, handleException, isConnected, queueCallback, removeFallback, removeSigHandler, removeSigHandler, sendMessage, setEndianness, setWeakReferences, unExportObjectpublic DirectConnection(String address) throws DBusException
address - The address to connect to. This is a standard D-Bus address, except that the additional parameter 'listen=true' should be added in the application which is creating the socket.DBusException - on errorpublic DirectConnection(String address, int timeout) throws DBusException
address - The address to connect to. This is a standard D-Bus address, except that the additional parameter 'listen=true' should be added in the application which is creating the socket.timeout - the timeout set for the underlying socket. 0 will block forever on the underlying socket.DBusException - on errorpublic void listen()
listen in class AbstractConnectionpublic static String createDynamicTCPSession()
public static String createDynamicSession()
public DBusInterface getRemoteObject(String objectpath) throws DBusException
objectpath - The path on which the process is exporting the object.ClassCastException - If type is not a sub-type of DBusInterfaceDBusException - If busname or objectpath are incorrectly formatted.public <T extends DBusInterface> T getRemoteObject(String objectpath, Class<T> type) throws DBusException
T - class which extends DBusInterfaceobjectpath - 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.ClassCastException - If type is not a sub-type of DBusInterfaceDBusException - If busname or objectpath are incorrectly formatted or type is not in a package.protected <T extends DBusSignal> void removeSigHandler(DBusMatchRule rule, DBusSigHandler<T> handler) throws DBusException
AbstractConnectionDBusSigHandler.
The rule will only be removed from DBus if no other additional handlers are registered to the same rule.removeSigHandler in class AbstractConnectionrule - rule to removehandler - handler to removeDBusException - on errorprotected <T extends DBusSignal> void addSigHandler(DBusMatchRule rule, DBusSigHandler<T> handler) throws DBusException
AbstractConnectionDBusMatchRule 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.addSigHandler in class AbstractConnectionrule - rule to addhandler - handler to useDBusException - on errorprotected void removeGenericSigHandler(DBusMatchRule rule, DBusSigHandler<DBusSignal> handler) throws DBusException
AbstractConnectionDBusMatchRule.
The rule will only be removed from DBus if no other additional handlers are registered to the same rule.removeGenericSigHandler in class AbstractConnectionrule - rule to removehandler - handler to removeDBusException - on errorprotected void addGenericSigHandler(DBusMatchRule rule, DBusSigHandler<DBusSignal> handler) throws DBusException
AbstractConnectionDBusMatchRule 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.addGenericSigHandler in class AbstractConnectionrule - rule to addhandler - handler to useDBusException - on errorpublic DBusInterface getExportedObject(String source, String path) throws DBusException
getExportedObject in class AbstractConnectionDBusExceptionpublic String getMachineId()
AbstractConnectiongetMachineId in class AbstractConnectionCopyright © 2020. All rights reserved.