Class DBusServer.Builder<B extends DBusServer.Builder<B>>
- Type Parameters:
B- the type of the Builder that is returned
- All Implemented Interfaces:
BuilderInterface
- Enclosing class:
DBusServer
- Since:
- 2.26
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Finish building theDBusServerobject.Emitted when a new authenticated connection has been made.setAddress(String address) The D-Bus address to listen on.setAuthenticationObserver(DBusAuthObserver authenticationObserver) AGDBusAuthObserverobject to assist in the authentication process ornull.setFlags(Set<DBusServerFlags> flags) Flags from theGDBusServerFlagsenumeration.setFlags(DBusServerFlags... flags) Flags from theGDBusServerFlagsenumeration.The GUID of the server.Methods inherited from class GObject.Builder
onNotifyMethods inherited from class Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValues
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilderobject.
-
-
Method Details
-
build
Finish building theDBusServerobject. This will callGObject.withProperties(Type, String[], Value[])to create a new GObject instance, which is then cast toDBusServer.- Overrides:
buildin classGObject.Builder<B extends DBusServer.Builder<B>>- Returns:
- a new instance of
DBusServerwith the properties that were set in the Builder object.
-
setAddress
-
setAuthenticationObserver
AGDBusAuthObserverobject to assist in the authentication process ornull.- Parameters:
authenticationObserver- the value for theauthentication-observerproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.26
-
setFlags
Flags from theGDBusServerFlagsenumeration.- Parameters:
flags- the value for theflagsproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.26
-
setGuid
-
setFlags
Flags from theGDBusServerFlagsenumeration.- Parameters:
flags- the value for theflagsproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.26
-
onNewConnection
Emitted when a new authenticated connection has been made. Use g_dbus_connection_get_peer_credentials() to figure out what identity (if any), was authenticated.
If you want to accept the connection, take a reference to the
connectionobject and returntrue. When you are done with the connection call g_dbus_connection_close() and give up your reference. Note that the other peer may disconnect at any time - a typical thing to do when accepting a connection is to listen to theGDBusConnection::closed signal.If
GDBusServer:flags containsDBusServerFlags.RUN_IN_THREADthen the signal is emitted in a new thread dedicated to the connection. Otherwise the signal is emitted in the thread-default main context (see MainContext#pushThreadDefault) of the thread thatserverwas constructed in.You are guaranteed that signal handlers for this signal runs before incoming messages on
connectionare processed. This means that it's suitable to call g_dbus_connection_register_object() or similar from the signal handler.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 2.26
- See Also:
-