Class MatchRuleMatcher

java.lang.Object
org.freedesktop.dbus.matchrules.MatchRuleMatcher

final class MatchRuleMatcher extends Object
  • Constructor Details

    • MatchRuleMatcher

      private MatchRuleMatcher()
  • Method Details

    • matchArg0123

      static boolean matchArg0123(Message _msg, Map<Integer,String> _compare)
      Matcher for arg0...argX matcher of DBus rules.

      DBus Specification Quote:

      Arg matches are special and are used for further restricting the match based on the arguments in the body of a message. Only arguments of type STRING can be matched in this way. An example of an argument match would be arg3='Foo'. Only argument indexes from 0 to 63 should be accepted.

      Parameters:
      _msg - message to match on
      _compare - compare values where map key is argument index
      Returns:
      true if matching false otherwise
      See Also:
    • matchArg0123Path

      static boolean matchArg0123Path(Message _msg, Map<Integer,String> _compare)
      Matcher for arg0Path...argXPath matcher of DBus rules.

      DBus Specification Quote:

      Argument path matches provide a specialised form of wildcard matching for path-like namespaces. They can match arguments whose type is either STRING or OBJECT_PATH. As with normal argument matches, if the argument is exactly equal to the string given in the match rule then the rule is satisfied. Additionally, there is also a match when either the string given in the match rule or the appropriate message argument ends with '/' and is a prefix of the other. An example argument path match is arg0path='/aa/bb/'. This would match messages with first arguments of '/', '/aa/', '/aa/bb/', '/aa/bb/cc/' and '/aa/bb/cc'. It would not match messages with first arguments of '/aa/b', '/aa' or even '/aa/bb'.

      This is intended for monitoring “directories” in file system-like hierarchies, as used in the dconf configuration system. An application interested in all nodes in a particular hierarchy would monitor arg0path='/ca/example/foo/'. Then the service could emit a signal with zeroth argument "/ca/example/foo/bar" to represent a modification to the “bar” property, or a signal with zeroth argument "/ca/example/" to represent atomic modification of many properties within that directory, and the interested application would be notified in both cases.

      Parameters:
      _msg - message to match on
      _compare - compare values where map key is argument index
      Returns:
      true if matching false otherwise
      See Also:
    • matchesArg0Path

      private static boolean matchesArg0Path(String _matchVal, String _compareVal)
    • matchPathNamespace

      static boolean matchPathNamespace(String _input, String _compare)
      Matcher for path_namespace match rule.
      DBus Specification Quote:

      Matches messages which are sent from or to an object for which the object path is either the given value, or that value followed by one or more path components.

      For example, path_namespace='/com/example/foo' would match signals sent by /com/example/foo or by /com/example/foo/bar, but not by /com/example/foobar.

      Using both path and path_namespace in the same match rule is not allowed.

      Parameters:
      _input - signal sender input
      _compare - compare value
      Returns:
      true if matching
      See Also:
    • matchArg0Namespace

      static boolean matchArg0Namespace(Message _msg, String _compare)
      Matcher for arg0Namespace match rule.
      DBus Specification Quote:

      Match messages whose first argument is of type STRING, and is a bus name or interface name within the specified namespace. This is primarily intended for watching name owner changes for a group of related bus names, rather than for a single name or all name changes.

      Because every valid interface name is also a valid bus name, this can also be used for messages whose first argument is an interface name.

      For example, the match rule member='NameOwnerChanged',arg0namespace='com.example.backend1' matches name owner changes for bus names such as com.example.backend1.foo, com.example.backend1.foo.bar, and com.example.backend1 itself.

      Parameters:
      _compare - compare value
      _input - signal sender input
      Returns:
      true if matching
      See Also: