Modul org.freedesktop.dbus
Klasse AbstractConnectionBase
java.lang.Object
org.freedesktop.dbus.connections.base.AbstractConnectionBase
- Alle implementierten Schnittstellen:
Closeable
,AutoCloseable
- Bekannte direkte Unterklassen:
ConnectionMethodInvocation
public abstract sealed class AbstractConnectionBase
extends Object
implements Closeable
permits ConnectionMethodInvocation
Class containing most parts required for a arbitrary connection.
It is not intended to be used directly, therefore it is sealed.
It is not intended to be used directly, therefore it is sealed.
- Seit:
- 5.0.0 - 2023-10-23
- Autor:
- hypfvieh
-
Konstruktorübersicht
ModifiziererKonstruktorBeschreibungprotected
AbstractConnectionBase
(TransportConfig _transportConfig, ReceivingServiceConfig _rsCfg) -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
close()
Disconnect this session (for use in try-with-resources).boolean
connect()
Connects the underlying transport if it is not already connected.protected abstract IncomingMessageThread
createReaderThread
(BusAddress _busAddress) Create the read thread for reading incoming messages.void
Disconnect from the Bus.protected void
disconnect
(IDisconnectAction _before, IDisconnectAction _after) Special disconnect method which may be used whenever some cleanup before or after disconnection to DBus is required.Returns the address this connection is connected to.protected BusAddress
protected PendingCallbackManager
static DBusCallInfo
Returns a structure with information on the current method call.Returns the currently configured disconnect callback.getError()
Return any DBus error which has been received.abstract DBusInterface
getExportedObject
(String _source, String _path) Retrieves an remote object using source and path.abstract <T extends DBusInterface>
TgetExportedObject
(String _source, String _path, Class<T> _type) Retrieves an remote object using source and path.getExportedObject
(DBusInterface _interface) protected Map
<String, ExportedObject> protected FallbackContainer
protected Map
<DBusMatchRule, Queue<DBusSigHandler<DBusSignal>>> protected Map
<DBusMatchRule, Queue<DBusSigHandler<? extends DBusSignal>>> protected Map
<DBusInterface, RemoteObject> protected Map
<Thread, DBusCallInfo> protected org.slf4j.Logger
abstract String
The generated UUID of this machine.protected Map
<Long, MethodCall> protected ReceivingService
protected AbstractTransport
The currently configured transport.Returns the transport's configuration.
Please note: changing any value will not change the transport settings!protected final void
internalDisconnect
(IOException _connectionError) Disconnects the DBus session.boolean
Whether the transport is connected.protected void
listen()
Start reading and messages.protected void
rejectUnknownProperty
(MethodCall _methodCall, Object[] _params) Sends a reply on the bus to signal a non-existing property was requested.void
sendMessage
(Message _message) Send a message or signal to the DBus daemon.void
setDisconnectCallback
(IDisconnectCallback _disconnectCallback) Set the callback which will be notified when a disconnection happens.toString()
void
unExportObject
(String _objectpath) Stop Exporting an object
-
Konstruktordetails
-
AbstractConnectionBase
protected AbstractConnectionBase(TransportConfig _transportConfig, ReceivingServiceConfig _rsCfg) throws DBusException - Löst aus:
DBusException
-
-
Methodendetails
-
getExportedObject
Retrieves an remote object using source and path. Will try to find suitable exported DBusInterface automatically.- Parameter:
_source
- source_path
- path- Gibt zurück:
DBusInterface
compatible object- Löst aus:
DBusException
-
getExportedObject
public abstract <T extends DBusInterface> T getExportedObject(String _source, String _path, Class<T> _type) throws DBusException Retrieves an remote object using source and path. Will use the given type as object class.- Parameter:
_source
- source_path
- path_type
- class of remote object- Gibt zurück:
DBusInterface
compatible object- Löst aus:
DBusException
-
createReaderThread
Create the read thread for reading incoming messages.- Parameter:
_busAddress
- current bus address- Gibt zurück:
- IncomingMessageThread, never
null
-
getMachineId
The generated UUID of this machine.- Gibt zurück:
- String
-
internalDisconnect
Disconnects the DBus session. This method is final as it should never be overwritten by subclasses, otherwise we have an endless recursion when usingdisconnect(IDisconnectAction, IDisconnectAction)
which then will cause a StackOverflowError.- Parameter:
_connectionError
- exception caused the disconnection (null if intended disconnect)
-
disconnect
Special disconnect method which may be used whenever some cleanup before or after disconnection to DBus is required.- Parameter:
_before
- action execute before actual disconnect, null if not needed_after
- action execute after disconnect, null if not needed
-
disconnect
public void disconnect()Disconnect from the Bus. -
rejectUnknownProperty
Sends a reply on the bus to signal a non-existing property was requested.- Parameter:
_methodCall
- method call_params
- params- Löst aus:
DBusException
- when sending fails
-
getExportedObjects
-
getLogger
protected org.slf4j.Logger getLogger() -
getFallbackContainer
-
getAddress
Returns the address this connection is connected to.- Gibt zurück:
- new
BusAddress
object
-
isConnected
public boolean isConnected()Whether the transport is connected.- Gibt zurück:
- true if connected
-
getTransport
The currently configured transport.- Gibt zurück:
- AbstractTransport
-
sendMessage
Send a message or signal to the DBus daemon.- Parameter:
_message
- message to send
-
getExportedObject
- Löst aus:
DBusException
-
getError
Return any DBus error which has been received.- Gibt zurück:
- A DBusExecutionException, or null if no error is pending.
-
connect
Connects the underlying transport if it is not already connected.Will work for both, client and server (listening) connections.
- Gibt zurück:
- true if connection established or already connected, false otherwise
- Löst aus:
IOException
- when connection was not already established and creating the connnection failed
-
getTransportConfig
Returns the transport's configuration.
Please note: changing any value will not change the transport settings!
This is read-only.- Gibt zurück:
- transport config
-
listen
Start reading and messages.- Löst aus:
IOException
- when listening fails
-
getMessageFactory
-
getPendingErrorQueue
-
getHandledSignals
-
getGenericHandledSignals
-
getPendingCalls
-
getImportedObjects
-
getObjectTree
-
getCallbackManager
-
getReceivingService
-
getBusAddress
-
getInfoMap
-
unExportObject
Stop Exporting an object- Parameter:
_objectpath
- The objectpath to stop exporting.
-
getCallInfo
Returns a structure with information on the current method call.- Gibt zurück:
- the DBusCallInfo for this method call, or null if we are not in a method call.
-
getDisconnectCallback
Returns the currently configured disconnect callback.- Gibt zurück:
- callback or null if no callback registered
-
setDisconnectCallback
Set the callback which will be notified when a disconnection happens. Use null to remove.- Parameter:
_disconnectCallback
- callback to execute or null to remove
-
close
Disconnect this session (for use in try-with-resources).- Angegeben von:
close
in SchnittstelleAutoCloseable
- Angegeben von:
close
in SchnittstelleCloseable
- Löst aus:
IOException
-
toString
-