1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.springframework.osgi.extender.internal.dependencies.shutdown;
17
18 import org.osgi.framework.Bundle;
19
20 /**
21 * SPI for sorting OSGi bundles based on their service dependency. Given a
22 * number of bundles, implementors of this interface will return a list
23 * referencing the bundles in the order in which they should be shutdown based
24 * on their OSGi service dependencies.
25 * <p/>
26 * It is considered that bundle A depends on bundle B if A uses a service that
27 * belongs to a bundle which depends on B or is B itself. Note that bundles can
28 * depend on each other : A -> B -> A.
29 * <p/>
30 * Thus implementations should 'sort' direct, circular graphs without any
31 * guarantee on the node used for start.
32 *
33 * @author Costin Leau
34 *
35 */
36 public interface ServiceDependencySorter {
37
38 /**
39 * Given a number of bundles, determine the dependency between each other and compute
40 * the dependency tree.
41 *
42 * @param bundles array of bundles
43 * @return an array of bundles, sorted out by their dependency.
44 */
45 Bundle[] computeServiceDependencyGraph(Bundle[] bundles);
46 }