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.
Seit:
5.0.0 - 2023-10-23
Autor:
hypfvieh
  • Konstruktordetails

  • Methodendetails

    • getExportedObject

      public abstract DBusInterface getExportedObject(String _source, String _path) throws DBusException
      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

      protected abstract IncomingMessageThread createReaderThread(BusAddress _busAddress)
      Create the read thread for reading incoming messages.
      Parameter:
      _busAddress - current bus address
      Gibt zurück:
      IncomingMessageThread, never null
    • getMachineId

      public abstract String getMachineId()
      The generated UUID of this machine.
      Gibt zurück:
      String
    • internalDisconnect

      protected final void internalDisconnect(IOException _connectionError)
      Disconnects the DBus session. This method is final as it should never be overwritten by subclasses, otherwise we have an endless recursion when using disconnect(IDisconnectAction, IDisconnectAction) which then will cause a StackOverflowError.
      Parameter:
      _connectionError - exception caused the disconnection (null if intended disconnect)
    • disconnect

      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.
      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

      protected void rejectUnknownProperty(MethodCall _methodCall, Object[] _params) throws DBusException
      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

      protected Map<String,ExportedObject> getExportedObjects()
    • getLogger

      protected org.slf4j.Logger getLogger()
    • getFallbackContainer

      protected FallbackContainer getFallbackContainer()
    • getAddress

      public BusAddress 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

      protected AbstractTransport getTransport()
      The currently configured transport.
      Gibt zurück:
      AbstractTransport
    • sendMessage

      public void sendMessage(Message _message)
      Send a message or signal to the DBus daemon.
      Parameter:
      _message - message to send
    • getExportedObject

      public String getExportedObject(DBusInterface _interface) throws DBusException
      Löst aus:
      DBusException
    • getError

      public DBusExecutionException getError()
      Return any DBus error which has been received.
      Gibt zurück:
      A DBusExecutionException, or null if no error is pending.
    • connect

      public boolean connect() throws IOException
      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

      public TransportConfig 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

      protected void listen() throws IOException
      Start reading and messages.
      Löst aus:
      IOException - when listening fails
    • getMessageFactory

      public MessageFactory getMessageFactory()
    • getPendingErrorQueue

      protected Queue<Error> getPendingErrorQueue()
    • getHandledSignals

      protected Map<DBusMatchRule,Queue<DBusSigHandler<? extends DBusSignal>>> getHandledSignals()
    • getGenericHandledSignals

      protected Map<DBusMatchRule,Queue<DBusSigHandler<DBusSignal>>> getGenericHandledSignals()
    • getPendingCalls

      protected Map<Long,MethodCall> getPendingCalls()
    • getImportedObjects

      protected Map<DBusInterface,RemoteObject> getImportedObjects()
    • getObjectTree

      public ObjectTree getObjectTree()
    • getCallbackManager

      protected PendingCallbackManager getCallbackManager()
    • getReceivingService

      protected ReceivingService getReceivingService()
    • getBusAddress

      protected BusAddress getBusAddress()
    • getInfoMap

      protected Map<Thread,DBusCallInfo> getInfoMap()
    • unExportObject

      public void unExportObject(String _objectpath)
      Stop Exporting an object
      Parameter:
      _objectpath - The objectpath to stop exporting.
    • getCallInfo

      public static DBusCallInfo 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

      public IDisconnectCallback getDisconnectCallback()
      Returns the currently configured disconnect callback.
      Gibt zurück:
      callback or null if no callback registered
    • setDisconnectCallback

      public void setDisconnectCallback(IDisconnectCallback _disconnectCallback)
      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

      public void close() throws IOException
      Disconnect this session (for use in try-with-resources).
      Angegeben von:
      close in Schnittstelle AutoCloseable
      Angegeben von:
      close in Schnittstelle Closeable
      Löst aus:
      IOException
    • toString

      public String toString()
      Setzt außer Kraft:
      toString in Klasse Object