Package com.lucimber.dbus.annotation
Class StandardInterfaceHandler
java.lang.Object
com.lucimber.dbus.connection.AbstractInboundHandler
com.lucimber.dbus.annotation.StandardInterfaceHandler
- All Implemented Interfaces:
Handler
,InboundHandler
Handler that implements standard D-Bus interfaces using reflection and annotations.
This handler automatically provides server-side implementations for:
- org.freedesktop.DBus.Introspectable - generates XML from annotations
- org.freedesktop.DBus.Properties - accesses annotated properties
- org.freedesktop.DBus.Peer - standard implementation
Relationship to ServiceProxy:
StandardInterfaceHandler
- Server-side handler for implementing D-Bus servicesServiceProxy
- Client-side proxy for calling remote D-Bus services
Example usage:
@DBusInterface("com.example.MyService")
public class MyService {
@DBusProperty
private String version = "1.0.0";
@DBusMethod
public String echo(String message) {
return message;
}
}
// Register the handler
MyService service = new MyService();
StandardInterfaceHandler handler = new StandardInterfaceHandler(
"/com/example/MyService", service);
connection.getPipeline().addLast("standard", handler);
-
Constructor Summary
ConstructorsConstructorDescriptionStandardInterfaceHandler
(String objectPath, Object targetObject) Creates a handler for the given object at the specified path. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.slf4j.Logger
Returns the logger of the concrete class.void
handleInboundMessage
(Context ctx, InboundMessage msg) Default implementation that simply propagates the message through the pipeline.Methods inherited from class com.lucimber.dbus.connection.AbstractInboundHandler
handleInboundFailure, handleUserEvent, onConnectionActive, onConnectionInactive, onHandlerAdded, onHandlerRemoved
-
Constructor Details
-
StandardInterfaceHandler
Creates a handler for the given object at the specified path.- Parameters:
objectPath
- the D-Bus object pathtargetObject
- the object implementing the interfaces
-
-
Method Details
-
handleInboundMessage
Description copied from class:AbstractInboundHandler
Default implementation that simply propagates the message through the pipeline.- Specified by:
handleInboundMessage
in interfaceInboundHandler
- Overrides:
handleInboundMessage
in classAbstractInboundHandler
- Parameters:
ctx
- theContext
this handler is bound tomsg
- theInboundMessage
being processed
-
getLogger
protected org.slf4j.Logger getLogger()Description copied from class:AbstractInboundHandler
Returns the logger of the concrete class.- Specified by:
getLogger
in classAbstractInboundHandler
- Returns:
- the logger instance for this handler
-