Search in sources :

Example 1 with NodeDTO

use of org.osgi.framework.wiring.dto.BundleWiringDTO.NodeDTO 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));
    }
}
Also used : Requirement(org.osgi.resource.Requirement) CapabilityRefDTO(org.osgi.resource.dto.CapabilityRefDTO) Capability(org.osgi.resource.Capability) RequirementRefDTO(org.osgi.resource.dto.RequirementRefDTO) BundleWireDTO(org.osgi.framework.wiring.dto.BundleWireDTO) WireDTO(org.osgi.resource.dto.WireDTO) Wire(org.osgi.resource.Wire) BundleWire(org.osgi.framework.wiring.BundleWire) NodeDTO(org.osgi.framework.wiring.dto.BundleWiringDTO.NodeDTO)

Example 2 with NodeDTO

use of org.osgi.framework.wiring.dto.BundleWiringDTO.NodeDTO in project felix by apache.

the class DTOFactory method createFrameworkWiringDTO.

private static FrameworkWiringDTO createFrameworkWiringDTO(Felix framework) {
    FrameworkWiringDTO dto = new FrameworkWiringDTO();
    dto.resources = new HashSet<BundleRevisionDTO>();
    dto.wirings = new HashSet<NodeDTO>();
    Set<Bundle> bundles = new LinkedHashSet<Bundle>(Arrays.asList(framework.getBundles()));
    bundles.addAll(framework.getRemovalPendingBundles());
    for (Bundle bundle : bundles) {
        addBundleWiring(bundle, dto.resources, dto.wirings);
    }
    return dto;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) BundleRevisionDTO(org.osgi.framework.wiring.dto.BundleRevisionDTO) Bundle(org.osgi.framework.Bundle) NodeDTO(org.osgi.framework.wiring.dto.BundleWiringDTO.NodeDTO) FrameworkWiringDTO(org.osgi.framework.wiring.dto.FrameworkWiringDTO)

Example 3 with NodeDTO

use of org.osgi.framework.wiring.dto.BundleWiringDTO.NodeDTO in project felix by apache.

the class DTOFactory method addWiringNodeIfNotPresent.

private static void addWiringNodeIfNotPresent(BundleWiring bw, Set<BundleRevisionDTO> resources, Set<NodeDTO> nodes) {
    int wiringID = getWiringID(bw);
    for (NodeDTO n : nodes) {
        if (n.id == wiringID)
            return;
    }
    createBundleWiringNodeDTO(bw, resources, nodes);
}
Also used : NodeDTO(org.osgi.framework.wiring.dto.BundleWiringDTO.NodeDTO)

Aggregations

NodeDTO (org.osgi.framework.wiring.dto.BundleWiringDTO.NodeDTO)3 LinkedHashSet (java.util.LinkedHashSet)1 Bundle (org.osgi.framework.Bundle)1 BundleWire (org.osgi.framework.wiring.BundleWire)1 BundleRevisionDTO (org.osgi.framework.wiring.dto.BundleRevisionDTO)1 BundleWireDTO (org.osgi.framework.wiring.dto.BundleWireDTO)1 FrameworkWiringDTO (org.osgi.framework.wiring.dto.FrameworkWiringDTO)1 Capability (org.osgi.resource.Capability)1 Requirement (org.osgi.resource.Requirement)1 Wire (org.osgi.resource.Wire)1 CapabilityRefDTO (org.osgi.resource.dto.CapabilityRefDTO)1 RequirementRefDTO (org.osgi.resource.dto.RequirementRefDTO)1 WireDTO (org.osgi.resource.dto.WireDTO)1