1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.springframework.osgi.extender.event;
17
18 import java.util.ArrayList;
19 import java.util.Collection;
20 import java.util.Collections;
21 import java.util.List;
22
23 import org.osgi.framework.Bundle;
24 import org.osgi.framework.Filter;
25 import org.springframework.context.ApplicationContext;
26 import org.springframework.osgi.context.event.OsgiBundleApplicationContextEvent;
27 import org.springframework.osgi.service.importer.event.OsgiServiceDependencyEvent;
28 import org.springframework.util.Assert;
29
30
31
32
33
34
35
36
37
38
39
40
41
42 public class BootstrappingDependenciesEvent extends OsgiBundleApplicationContextEvent {
43
44 private final Collection<OsgiServiceDependencyEvent> dependencyEvents;
45 private final Collection<String> dependencyFilters;
46 private final Filter dependenciesFilter;
47 private final long timeLeft;
48
49
50
51
52
53
54 public BootstrappingDependenciesEvent(ApplicationContext source, Bundle bundle,
55 Collection<OsgiServiceDependencyEvent> nestedEvents, Filter filter, long timeLeft) {
56 super(source, bundle);
57 Assert.notNull(nestedEvents);
58 this.dependencyEvents = nestedEvents;
59 this.dependenciesFilter = filter;
60 this.timeLeft = timeLeft;
61
62 List<String> depFilters = new ArrayList<String>(dependencyEvents.size());
63
64 for (OsgiServiceDependencyEvent dependency : nestedEvents) {
65 depFilters.add(dependency.getServiceDependency().getServiceFilter().toString());
66 }
67
68 dependencyFilters = Collections.unmodifiableCollection(depFilters);
69 }
70
71
72
73
74
75
76 public Collection<OsgiServiceDependencyEvent> getDependencyEvents() {
77 return dependencyEvents;
78 }
79
80 public Filter getDependenciesAsFilter() {
81 return dependenciesFilter;
82 }
83
84 public Collection<String> getDependencyFilters() {
85 return dependencyFilters;
86 }
87
88 public long getTimeToWait() {
89 return timeLeft;
90 }
91 }