blob: f2bf6c7cf399c4f21cd0af443e1e9ac24722588c [file] [log] [blame]
Pierre De Rop3a00a212015-03-01 09:27:46 +00001# Introduction
2
3The shell bundle for the dependency manager extends the gogo shell with one new command called "dm". This command can be used to get insight in the actual components and services in a running OSGi framework.
4
5Typing help ```help dm``` in the gogo shell gives an overview of the available command options.
6
7```
8dm - List dependency manager components
9 scope: dependencymanager
10 flags:
11 compact, cp Displays components using a compact form
12 nodeps, nd Hides component dependencies
13 notavail, na Only displays unavailable components
14 stats, stat, st Displays components statistics
15 wtf Detects where are the root failures
16 options:
17 bundleIds, bid, bi, b <List of bundle ids or bundle symbolic names to display (comma separated)> [optional]
18 componentIds, cid, ci <List of component identifiers to display (comma separated)> [optional]
19 components, c <Regex(s) used to filter on component implementation class names (comma separated), can be negated using "!" prefix> [optional]
20 services, s <OSGi filter used to filter some service properties> [optional]
21 top <Max number of top components to display (0=all)> This command displays components callbacks (init/start) times> [optional]
22 parameters:
23 CommandSession
24```
25
26
27# Usage examples
28Below are some examples for typical usage of the dependency manager shell commands. The examples are based on a simple component model with a dashboard which has a required dependency on four probes (temperature, humidity, radiation, pressure). The radiation probe requires a Sensor service but this sensor is not available.
29
30__List all dependency manager components__
31
32```dm```
33
34Sample output
35
36```
37[9] dm.demo
38 [6] dm.demo.Probe(type=radiation) unregistered
39 dm.demo.Sensor service required unavailable
40 [7] dm.demo.Probe(type=humidity) registered
41 [9] dm.demo.impl.Dashboard unregistered
42 dm.demo.Probe (type=temperature) service required available
43 dm.demo.Probe (type=radiation) service required unavailable
44 dm.demo.Probe (type=humidity) service required available
45 dm.demo.Probe (type=pressure) service required available
46 [5] dm.demo.Probe(type=temperature) registered
47 [8] dm.demo.Probe(type=pressure) registered
48```
49All components are listed including the dependencies and the availability of these dependencies. The top level element is the bundle and below are the components registered with that bundle's bundle context. The lowest level is that of the component's dependencies.
50
51```
52[bundleid] bundle
53 [component id] component interfaces (service properties)
54 dependency <availability>
55```
56
57The following flags can be used to tailor the output.
58
59```compact, cp``` shortens package names and dependencies and therefore gives a more compressed output.
60
61```nodeps, nd``` omits the dependencies from the output.
62
63```notavail, na``` filters out all components that are registered wich results in the output only containing those components that are in the unregistered state due to one or more unsatisfied required dependencies. This is the command option most used when using the dependency manager shell commands.
64
65Sample output for ```dm na```:
66
67```
68[9] dm.demo
69 [14] dm.demo.impl.Dashboard unregistered
70 dm.demo.Probe (type=radiation) service required unavailable
71 [11] dm.demo.Probe(type=radiation) unregistered
72 dm.demo.Sensor service required unavailable
73```
74
75The flags can be used in conjunction with the other command options.
76
77__Find all components for a given classname__
78
79```dm c .*ProbeImpl```
80
81dm c or components finds all components for which the classname of the implementation matches the regular expression.
82
83__Find all services matching a service filter__
84
85```dm s "(type=temperature)"```
86
87dm s allows finding components based on the service properties of their registered services in the service registry using a standard OSGi service filter.
88
89__Find out why components are not registered__
90
91```dm wtf```
92
93Sample output
94
95```
962 missing dependencies found.
97-----------------------------
98The following service(s) are missing:
99 * dm.demo.Sensor is not found in the service registry
100```
101
102wtf gives the root cause for components not being registered and therefore their services not being available. In a typical application components have dependencies on services implemented by components that have dependencies on services etcetera. This transitivity means that an entire chain of components could be unregistered due to a (few) root dependencies not being satisified. wtf is about discovering those dependencies.