1context-provide(1) General Commands Manual context-provide(1)
2
3
4
6 context-provide - A tool to provide ContextKit properties to debug and
7 inspect applications
8
9
11 context-provide [--session | --system] [BUSNAME] [TYPE NAME INIT‐
12 VALUE]...
13
14
16 context-provide is an interactive tool to set (provide) properties of
17 the ContextKit. It can be used to simulate an actual provider to debug
18 applications using the ContextKit. When launched, the tool presents a
19 simple console where commands can be issued to provide new keys and set
20 their values.
21
22 Properties can also be provided on the command line with TYPE NAME
23 INITVALUE triplets.
24
25 When ran, the tool automatically claims the specified BUSNAME and if
26 there were properties specified on the command line, it will provide
27 them right away. To add new properties, use the `add' command.
28
29 If no BUSNAME is given the tool acts as a Commander, taking control of
30 all subscribers in the system. This mode by default proxies the real
31 values of all properties. To control a property you have to `add' the
32 property, which stops forwarding the corresponding property. You can
33 undo this via the `del' command.
34
35 Values are input using JSon notation (http://json.org/) relaxed to
36 allow other top-level elements than objects (ie. you can write `"some
37 text"' or `23.1' directly). As an executive summary, the allowed data
38 types are strings ("soylent green"), numbers (2, 6.9), heterogeneous
39 lists ([1, 1.5, 3, "foo"]) and dictionaries with string keys ({"foo":
40 1, "bar": 2}).
41
42
44 --system
45 Use the system bus.
46
47 --session
48 Use the session bus (the default).
49
50
52 add TYPE KEY [INITVALUE]
53
54 Adds a key named KEY with the given TYPE to the list of provided
55 properties. The initial value will be INITVALUE if specified,
56 otherwise unset (null). This has to be called before an attempt
57 is made to set a key value. TYPE can be any type described in
58 the type registry (located in /usr/share/contextkit/core.types,
59 overridden by the CONTEXT_CORE_TYPES environment variable).
60 Some examples are: value, bool, number, integer, string, list,
61 map. For backward compatibility, INT, BOOL, and DOUBLE may also
62 be used as type.
63
64 Example: "add integer Battery.Status 20".
65
66 In Commander mode it also stops proxying the real property.
67
68 settype KEY TYPE FRAGMENT
69
70 Sets the type of KEY to the NanoXML fragment. For convenience,
71 "type" is interpreted as "<type/>". See /usr/share/doc/contex‐
72 tkit-doc/html/context-types.html for more information.
73
74 del KEY
75
76 Makes context-provide forget KEY. In Commander mode, restores
77 proxying of the real property.
78
79 KEY=VALUE
80
81 Sets the given KEY value to the new VALUE, which has to be in
82 JSon format (see above). For backward compatibility, if the
83 type of the property is string, the value is accepted without
84 quotes.
85
86 Example: "Battery.Status=99".
87
88
89 unset KEY
90
91 Sets the given KEY to non specified (null).
92
93 info KEY
94
95 Prints the type, name and current value of KEY. In Commander
96 mode the real value (from the original provider) is printed as
97 well.
98
99 list
100
101 Same as calling `info' for all known keys (both proxied and
102 added ones).
103
104 sleep INTERVAL
105
106 Sleeps and blocks the main loop for the given amount of seconds.
107 Used mainly for internal testing purposes. Example: "sleep 10".
108
109 dump [FILENAME]
110
111 Dumps the currently added properties to an XML .context file
112 defined by the FILENAME (the default is 'context-provide.con‐
113 text' in the current directory).
114
115 restart
116
117 Tries to republish the BUSNAME of the provider on D-Bus, exit if
118 it fails.
119
120 exit
121
122 Exits the program.
123
124
126 Starts up a provider, initially having a single integer property named
127 an.example with the default value of 42.
128
129 ./context-provide dbus.service.name integer an.example 42
130
131 Starts up the provider on the system bus without any properties, then
132 add some through the command line interface.
133
134 ./context-provide --system org.bottomdrawer.kit2000
135 add integer example.int 33
136 add string example.string
137 example.string = value1
138 example.string = value2
139 unset example.int
140
141
143 context-listen(1) context-ls(1) /usr/share/doc/contextkit-
144 doc/html/*.html
145
146
147
148 Nov-18-2009 context-provide(1)