Search in sources :

Example 1 with AriesSubsystemParentsHeader

use of org.apache.aries.subsystem.core.archive.AriesSubsystemParentsHeader in project aries by apache.

the class BasicSubsystem method getParents.

@Override
public Collection<Subsystem> getParents() {
    AriesSubsystemParentsHeader header = getDeploymentManifest().getAriesSubsystemParentsHeader();
    if (header == null)
        return Collections.emptyList();
    Collection<Subsystem> result = new ArrayList<Subsystem>(header.getClauses().size());
    for (AriesSubsystemParentsHeader.Clause clause : header.getClauses()) {
        BasicSubsystem subsystem = Activator.getInstance().getSubsystems().getSubsystemById(clause.getId());
        if (subsystem == null)
            continue;
        result.add(subsystem);
    }
    return result;
}
Also used : AriesSubsystem(org.apache.aries.subsystem.AriesSubsystem) Subsystem(org.osgi.service.subsystem.Subsystem) ArrayList(java.util.ArrayList) AriesSubsystemParentsHeader(org.apache.aries.subsystem.core.archive.AriesSubsystemParentsHeader)

Example 2 with AriesSubsystemParentsHeader

use of org.apache.aries.subsystem.core.archive.AriesSubsystemParentsHeader in project aries by apache.

the class SubsystemResource method getParents.

public Collection<BasicSubsystem> getParents() {
    if (parent == null) {
        AriesSubsystemParentsHeader header = getDeploymentManifest().getAriesSubsystemParentsHeader();
        if (header == null)
            return Collections.emptyList();
        Collection<AriesSubsystemParentsHeader.Clause> clauses = header.getClauses();
        Collection<BasicSubsystem> result = new ArrayList<BasicSubsystem>(clauses.size());
        Subsystems subsystems = Activator.getInstance().getSubsystems();
        for (AriesSubsystemParentsHeader.Clause clause : clauses) {
            result.add(subsystems.getSubsystemById(clause.getId()));
        }
        return result;
    }
    return Collections.singleton(parent);
}
Also used : ArrayList(java.util.ArrayList) AriesSubsystemParentsHeader(org.apache.aries.subsystem.core.archive.AriesSubsystemParentsHeader)

Aggregations

ArrayList (java.util.ArrayList)2 AriesSubsystemParentsHeader (org.apache.aries.subsystem.core.archive.AriesSubsystemParentsHeader)2 AriesSubsystem (org.apache.aries.subsystem.AriesSubsystem)1 Subsystem (org.osgi.service.subsystem.Subsystem)1