1 package org
.argeo
.osgi
.boot
.a2
;
3 import java
.util
.Collections
;
5 import java
.util
.TreeMap
;
7 class A2Contribution
implements Comparable
<A2Contribution
> {
8 final static String BOOT
= "boot";
9 final static String RUNTIME
= "runtime";
11 private final ProvisioningSource source
;
12 private final String id
;
14 final Map
<String
, A2Component
> components
= Collections
.synchronizedSortedMap(new TreeMap
<>());
16 public A2Contribution(ProvisioningSource context
, String id
) {
17 this.source
= context
;
20 context
.contributions
.put(id
, this);
23 A2Component
getOrAddComponent(String componentId
) {
24 if (components
.containsKey(componentId
))
25 return components
.get(componentId
);
27 return new A2Component(this, componentId
);
30 public ProvisioningSource
getSource() {
34 public String
getId() {
39 public int compareTo(A2Contribution o
) {
40 return id
.compareTo(o
.id
);
44 public int hashCode() {
49 public boolean equals(Object obj
) {
50 if (obj
instanceof A2Contribution
) {
51 A2Contribution o
= (A2Contribution
) obj
;
52 return id
.equals(o
.id
);
58 public String
toString() {
62 void asTree(String prefix
, StringBuffer buf
) {
65 for (String componentId
: components
.keySet()) {
67 buf
.append(componentId
);
68 A2Component component
= components
.get(componentId
);
69 component
.asTree(prefix
, buf
);