Package org.freedesktop.dbus.bin
Class DBusDaemon.DBusServer
- java.lang.Object
-
- org.freedesktop.dbus.bin.DBusDaemon.DBusServer
-
- All Implemented Interfaces:
DBus,DBusInterface,Introspectable,Peer
- Enclosing class:
- DBusDaemon
public class DBusDaemon.DBusServer extends java.lang.Object implements DBus, Introspectable, Peer
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.freedesktop.dbus.interfaces.DBus
DBus.NameAcquired, DBus.NameLost, DBus.NameOwnerChanged
-
-
Field Summary
Fields Modifier and Type Field Description private DBusDaemon.ConnectionStructconnStructprivate java.lang.StringmachineId-
Fields inherited from interface org.freedesktop.dbus.interfaces.DBus
DBUS_NAME_FLAG_ALLOW_REPLACEMENT, DBUS_NAME_FLAG_DO_NOT_QUEUE, DBUS_NAME_FLAG_REPLACE_EXISTING, DBUS_RELEASE_NAME_REPLY_NON_EXISTANT, DBUS_RELEASE_NAME_REPLY_NOT_OWNER, DBUS_RELEASE_NAME_REPLY_RELEASED, DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER, DBUS_REQUEST_NAME_REPLY_EXISTS, DBUS_REQUEST_NAME_REPLY_IN_QUEUE, DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER, DBUS_START_REPLY_ALREADY_RUNNING, DBUS_START_REPLY_SUCCESS
-
-
Constructor Summary
Constructors Constructor Description DBusServer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidAddMatch(java.lang.String _matchrule)Add a match rule.java.lang.Byte[]GetAdtAuditSessionData(java.lang.String _busName)java.util.Map<java.lang.String,Variant<?>>GetConnectionCredentials(java.lang.String _busName)DBUS Specification:
Returns as many credentials as possible for the process connected to the server.java.lang.Byte[]GetConnectionSELinuxSecurityContext(java.lang.String _args)UInt32GetConnectionUnixProcessID(java.lang.String _connectionName)Returns the proccess ID associated with a connection.UInt32GetConnectionUnixUser(java.lang.String _connectionName)Get the Unix UID that owns a connection name.java.lang.StringGetId()DBUS Specification:
Gets the unique ID of the bus.java.lang.StringGetMachineId()java.lang.StringGetNameOwner(java.lang.String _name)Get the connection unique name that owns the given name.java.lang.StringgetObjectPath()Returns the path of this object.private voidhandleMessage(DBusDaemon.ConnectionStruct _connStruct, Message _msg)java.lang.StringHello()Initial message to register ourselves on the Bus.java.lang.StringIntrospect()booleanisRemote()Returns true on remote objects.java.lang.String[]ListActivatableNames()Returns a list of all names that can be activated on the bus.java.lang.String[]ListNames()Lists all connected names on the Bus.java.lang.String[]ListQueuedOwners(java.lang.String _name)List the connections currently queued for a name.booleanNameHasOwner(java.lang.String _name)Determine if a name has an owner.voidPing()UInt32ReleaseName(java.lang.String _name)Release a name on the bus.voidRemoveMatch(java.lang.String _matchrule)Remove a match rule.UInt32RequestName(java.lang.String _name, UInt32 _flags)Request a name on the bus.UInt32StartServiceByName(java.lang.String _name, UInt32 _flags)Start a service.voidUpdateActivationEnvironment(java.util.Map<java.lang.String,java.lang.String>[] _environment)DBUS Specification:
Normally, session bus activated services inherit the environment of the bus daemon.
-
-
-
Field Detail
-
machineId
private final java.lang.String machineId
-
connStruct
private DBusDaemon.ConnectionStruct connStruct
-
-
Method Detail
-
isRemote
public boolean isRemote()
Description copied from interface:DBusInterfaceReturns true on remote objects. Local objects implementing this interface MUST return false.- Specified by:
isRemotein interfaceDBusInterface- Returns:
- boolean
-
Hello
public java.lang.String Hello()
Description copied from interface:DBusInitial message to register ourselves on the Bus.
-
ListNames
public java.lang.String[] ListNames()
Description copied from interface:DBusLists all connected names on the Bus.
-
NameHasOwner
public boolean NameHasOwner(java.lang.String _name)
Description copied from interface:DBusDetermine if a name has an owner.- Specified by:
NameHasOwnerin interfaceDBus- Parameters:
_name- The name to query.- Returns:
- true if the name has an owner.
-
GetNameOwner
public java.lang.String GetNameOwner(java.lang.String _name)
Description copied from interface:DBusGet the connection unique name that owns the given name.- Specified by:
GetNameOwnerin interfaceDBus- Parameters:
_name- The name to query.- Returns:
- The connection which owns the name.
-
GetConnectionUnixUser
public UInt32 GetConnectionUnixUser(java.lang.String _connectionName)
Description copied from interface:DBusGet the Unix UID that owns a connection name.- Specified by:
GetConnectionUnixUserin interfaceDBus- Parameters:
_connectionName- The connection name.- Returns:
- The Unix UID that it.
-
StartServiceByName
public UInt32 StartServiceByName(java.lang.String _name, UInt32 _flags)
Description copied from interface:DBusStart a service. If the given service is not provided by any application, it will be started according to the .service file for that service.- Specified by:
StartServiceByNamein interfaceDBus- Parameters:
_name- The service name to start._flags- Unused.- Returns:
- DBUS_START_REPLY constants.
-
RequestName
public UInt32 RequestName(java.lang.String _name, UInt32 _flags)
Description copied from interface:DBusRequest a name on the bus.- Specified by:
RequestNamein interfaceDBus- Parameters:
_name- The name to request._flags- DBUS_NAME flags.- Returns:
- DBUS_REQUEST_NAME_REPLY constants.
-
ReleaseName
public UInt32 ReleaseName(java.lang.String _name)
Description copied from interface:DBusRelease a name on the bus.- Specified by:
ReleaseNamein interfaceDBus- Parameters:
_name- The name to release.- Returns:
- DBUS_RELEASE_NAME_REPLY constants.
-
AddMatch
public void AddMatch(java.lang.String _matchrule) throws MatchRuleInvalidDescription copied from interface:DBusAdd a match rule. Will cause you to receive messages that aren't directed to you which match this rule.- Specified by:
AddMatchin interfaceDBus- Parameters:
_matchrule- The Match rule as a string. Format Undocumented.- Throws:
MatchRuleInvalid
-
RemoveMatch
public void RemoveMatch(java.lang.String _matchrule) throws MatchRuleInvalidDescription copied from interface:DBusRemove a match rule. Will cause you to stop receiving messages that aren't directed to you which match this rule.- Specified by:
RemoveMatchin interfaceDBus- Parameters:
_matchrule- The Match rule as a string. Format Undocumented.- Throws:
MatchRuleInvalid
-
ListQueuedOwners
public java.lang.String[] ListQueuedOwners(java.lang.String _name)
Description copied from interface:DBusList the connections currently queued for a name.- Specified by:
ListQueuedOwnersin interfaceDBus- Parameters:
_name- The name to query- Returns:
- A list of unique connection IDs.
-
GetConnectionUnixProcessID
public UInt32 GetConnectionUnixProcessID(java.lang.String _connectionName)
Description copied from interface:DBusReturns the proccess ID associated with a connection.- Specified by:
GetConnectionUnixProcessIDin interfaceDBus- Parameters:
_connectionName- The name of the connection- Returns:
- The PID of the connection.
-
GetConnectionSELinuxSecurityContext
public java.lang.Byte[] GetConnectionSELinuxSecurityContext(java.lang.String _args)
Description copied from interface:DBusDBUS Specification:
Returns the security context used by SELinux, in an unspecified
format. If you know what this means, please contribute
documentation via the D-Bus bug tracking system.
This method is on the core DBus interface for historical reasons;
the same information should be made available via
the section called "org.freedesktop.DBus.GetConnectionCredentials”
in future.- Specified by:
GetConnectionSELinuxSecurityContextin interfaceDBus- Parameters:
_args- Unique or well-known bus name of the connection to query, such as :12.34 or com.example.tea- Returns:
- some sort of string of bytes, not necessarily UTF-8, not including '\0'
-
handleMessage
private void handleMessage(DBusDaemon.ConnectionStruct _connStruct, Message _msg) throws DBusException
- Throws:
DBusException
-
getObjectPath
public java.lang.String getObjectPath()
Description copied from interface:DBusInterfaceReturns the path of this object.- Specified by:
getObjectPathin interfaceDBusInterface- Returns:
- string
-
Introspect
public java.lang.String Introspect()
- Specified by:
Introspectin interfaceIntrospectable- Returns:
- The XML introspection data for this object
-
ListActivatableNames
public java.lang.String[] ListActivatableNames()
Description copied from interface:DBusReturns a list of all names that can be activated on the bus.- Specified by:
ListActivatableNamesin interfaceDBus- Returns:
- Array of strings where each string is a bus name
-
GetConnectionCredentials
public java.util.Map<java.lang.String,Variant<?>> GetConnectionCredentials(java.lang.String _busName)
Description copied from interface:DBusDBUS Specification:
Returns as many credentials as possible for the process connected to the server. If unable to determine certain credentials (for instance, because the process is not on the same machine as the bus daemon, or because this version of the bus daemon does not support a particular security framework), or if the values of those credentials cannot be represented as documented here, then those credentials are omitted.Keys in the returned dictionary not containing "." are defined by this specification. Bus daemon implementors supporting credentials frameworks not mentioned in this document should either contribute patches to this specification, or use keys containing "." and starting with a reversed domain name.
- Specified by:
GetConnectionCredentialsin interfaceDBus- Parameters:
_busName- Unique or well-known bus name of the connection to query, such as :12.34 or com.example.tea- Returns:
- Credentials
-
GetAdtAuditSessionData
public java.lang.Byte[] GetAdtAuditSessionData(java.lang.String _busName)
Description copied from interface:DBusDBUS Specification:
Returns auditing data used by Solaris ADT, in an unspecified
binary format. If you know what this means, please contribute
documentation via the D-Bus bug tracking system.
This method is on the core DBus interface for historical reasons;
the same information should be made available via
the section called "org.freedesktop.DBus.GetConnectionCredentials"
in future.- Specified by:
GetAdtAuditSessionDatain interfaceDBus- Parameters:
_busName- Unique or well-known bus name of the connection to query, such as :12.34 or com.example.tea- Returns:
- auditing data as returned by adt_export_session_data()
-
UpdateActivationEnvironment
public void UpdateActivationEnvironment(java.util.Map<java.lang.String,java.lang.String>[] _environment)
Description copied from interface:DBusDBUS Specification:
Normally, session bus activated services inherit the environment of the bus daemon. This method adds to or modifies that environment when activating services. Some bus instances, such as the standard system bus, may disable access to this method for some or all callers. Note, both the environment variable names and values must be valid UTF-8. There's no way to update the activation environment with data that is invalid UTF-8.- Specified by:
UpdateActivationEnvironmentin interfaceDBus- Parameters:
_environment- Environment to add or update
-
GetId
public java.lang.String GetId()
Description copied from interface:DBusDBUS Specification:
Gets the unique ID of the bus. The unique ID here is shared among all addresses the
bus daemon is listening on (TCP, UNIX domain socket, etc.) and its format is described in
the section called "UUIDs”.
Each address the bus is listening on also has its own unique
ID, as described in the section called "Server Addresses”. The per-bus and per-address IDs are not related.
There is also a per-machine ID, described in the section called "org.freedesktop.DBus.Peer” and returned by org.freedesktop.DBus.Peer.GetMachineId().
For a desktop session bus, the bus ID can be used as a way to uniquely identify a user's session.
-
GetMachineId
public java.lang.String GetMachineId()
- Specified by:
GetMachineIdin interfacePeer
-
-