use of org.osgi.service.component.runtime.dto.SatisfiedReferenceDTO in project felix by apache.
the class WebConsolePlugin method listReferences.
private void listReferences(JSONWriter jw, ComponentDescriptionDTO desc, ComponentConfigurationDTO config) throws IOException {
for (final ReferenceDTO dto : desc.references) {
jw.object();
jw.key("key");
jw.value("Reference " + dto.name);
jw.key("value");
jw.array();
final SatisfiedReferenceDTO satisfiedRef;
if (config != null) {
satisfiedRef = findReference(config, dto.name);
jw.value(satisfiedRef != null ? "Satisfied" : "Unsatisfied");
} else {
satisfiedRef = null;
}
jw.value("Service Name: " + dto.interfaceName);
if (dto.target != null) {
jw.value("Target Filter: " + dto.target);
}
jw.value("Cardinality: " + dto.cardinality);
jw.value("Policy: " + dto.policy);
jw.value("Policy Option: " + dto.policyOption);
// list bound services
if (satisfiedRef != null) {
for (int j = 0; j < satisfiedRef.boundServices.length; j++) {
final StringBuffer b = new StringBuffer();
b.append("Bound Service ID ");
b.append(satisfiedRef.boundServices[j].id);
String name = (String) satisfiedRef.boundServices[j].properties.get(ComponentConstants.COMPONENT_NAME);
if (name == null) {
name = (String) satisfiedRef.boundServices[j].properties.get(Constants.SERVICE_PID);
if (name == null) {
name = (String) satisfiedRef.boundServices[j].properties.get(Constants.SERVICE_DESCRIPTION);
}
}
if (name != null) {
b.append(" (");
b.append(name);
b.append(")");
}
jw.value(b.toString());
}
} else if (config != null) {
jw.value("No Services bound");
}
jw.endArray();
jw.endObject();
}
}
Aggregations