Search in sources :

Example 1 with RequirementDTO

use of org.osgi.resource.dto.RequirementDTO in project bnd by bndtools.

the class AgentServer method toDTO.

/*
	 * Turn a bundle in a Bundle Revision dto. On a r6 framework we could do
	 * this with adapt but on earlier frameworks we're on our own
	 */
private BundleRevisionDTO toDTO(BundleRevision resource) {
    BundleRevisionDTO brd = new BundleRevisionDTO();
    brd.bundle = resource.getBundle().getBundleId();
    brd.id = sequence.getAndIncrement();
    brd.symbolicName = resource.getSymbolicName();
    brd.type = resource.getTypes();
    brd.version = resource.getVersion().toString();
    brd.requirements = new ArrayList<RequirementDTO>();
    for (Requirement r : resource.getRequirements(null)) {
        brd.requirements.add(toDTO(brd.id, r));
    }
    brd.capabilities = new ArrayList<CapabilityDTO>();
    for (Capability c : resource.getCapabilities(null)) {
        brd.capabilities.add(toDTO(brd.id, c));
    }
    return brd;
}
Also used : Requirement(org.osgi.resource.Requirement) RequirementDTO(org.osgi.resource.dto.RequirementDTO) Capability(org.osgi.resource.Capability) BundleRevisionDTO(org.osgi.framework.wiring.dto.BundleRevisionDTO) CapabilityDTO(org.osgi.resource.dto.CapabilityDTO)

Example 2 with RequirementDTO

use of org.osgi.resource.dto.RequirementDTO in project bnd by bndtools.

the class AgentServer method toDTO.

private RequirementDTO toDTO(int resource, Requirement r) {
    RequirementDTO rd = new RequirementDTO();
    rd.id = sequence.getAndIncrement();
    rd.resource = resource;
    rd.namespace = r.getNamespace();
    rd.directives = r.getDirectives();
    rd.attributes = r.getAttributes();
    return rd;
}
Also used : RequirementDTO(org.osgi.resource.dto.RequirementDTO)

Aggregations

RequirementDTO (org.osgi.resource.dto.RequirementDTO)2 BundleRevisionDTO (org.osgi.framework.wiring.dto.BundleRevisionDTO)1 Capability (org.osgi.resource.Capability)1 Requirement (org.osgi.resource.Requirement)1 CapabilityDTO (org.osgi.resource.dto.CapabilityDTO)1