use of org.osgi.resource.dto.RequirementRefDTO in project felix by apache.
the class DTOFactory method createBundleWiringNodeDTO.
private static void createBundleWiringNodeDTO(BundleWiring bw, Set<BundleRevisionDTO> resources, Set<NodeDTO> nodes) {
NodeDTO node = new BundleWiringDTO.NodeDTO();
node.id = getWiringID(bw);
addNodeDTO(node, nodes);
node.current = bw.isCurrent();
node.inUse = bw.isInUse();
node.resource = getResourceIDAndAdd(bw.getResource(), resources);
node.capabilities = new ArrayList<CapabilityRefDTO>();
for (Capability cap : bw.getCapabilities(null)) {
CapabilityRefDTO cdto = new CapabilityRefDTO();
cdto.capability = getCapabilityID(cap);
cdto.resource = getResourceIDAndAdd(cap.getResource(), resources);
node.capabilities.add(cdto);
}
node.requirements = new ArrayList<RequirementRefDTO>();
for (Requirement req : bw.getRequirements(null)) {
RequirementRefDTO rdto = new RequirementRefDTO();
rdto.requirement = getRequirementID(req);
rdto.resource = getResourceIDAndAdd(req.getResource(), resources);
node.requirements.add(rdto);
}
node.providedWires = new ArrayList<WireDTO>();
for (Wire pw : bw.getProvidedWires(null)) {
node.providedWires.add(createBundleWireDTO(pw, resources, nodes));
}
node.requiredWires = new ArrayList<WireDTO>();
for (Wire rw : bw.getRequiredWires(null)) {
node.requiredWires.add(createBundleWireDTO(rw, resources, nodes));
}
}
use of org.osgi.resource.dto.RequirementRefDTO in project felix by apache.
the class DTOFactory method createBundleWireDTO.
private static BundleWireDTO createBundleWireDTO(Wire wire, Set<BundleRevisionDTO> resources, Set<NodeDTO> nodes) {
BundleWireDTO wdto = new BundleWireDTO();
if (wire instanceof BundleWire) {
BundleWire w = (BundleWire) wire;
BundleWiring pw = w.getProviderWiring();
addWiringNodeIfNotPresent(pw, resources, nodes);
wdto.providerWiring = getWiringID(pw);
BundleWiring rw = w.getRequirerWiring();
addWiringNodeIfNotPresent(rw, resources, nodes);
wdto.requirerWiring = getWiringID(rw);
}
wdto.provider = getResourceIDAndAdd(wire.getProvider(), resources);
wdto.requirer = getResourceIDAndAdd(wire.getRequirer(), resources);
wdto.capability = new CapabilityRefDTO();
wdto.capability.capability = getCapabilityID(wire.getCapability());
wdto.capability.resource = getResourceIDAndAdd(wire.getCapability().getResource(), resources);
wdto.requirement = new RequirementRefDTO();
wdto.requirement.requirement = getRequirementID(wire.getRequirement());
wdto.requirement.resource = getResourceIDAndAdd(wire.getRequirement().getResource(), resources);
return wdto;
}
Aggregations