use of org.apache.aries.subsystem.core.archive.AriesProvisionDependenciesDirective in project aries by apache.
the class SubsystemManifestValidator method validateAriesProvisionDependenciesDirective.
private static void validateAriesProvisionDependenciesDirective(BasicSubsystem subsystem) {
AriesProvisionDependenciesDirective directive = subsystem.getAriesProvisionDependenciesDirective();
BasicSubsystem parent = subsystem.getResource().getParents().iterator().next();
AriesProvisionDependenciesDirective parentDirective = parent.getAriesProvisionDependenciesDirective();
if (!directive.equals(parentDirective) && (subsystem.isFeature() || State.INSTALLING.equals(parent.getState()))) {
throw new SubsystemException("The value of the " + AriesProvisionDependenciesDirective.NAME + " directive must be the same as the parent subsystem for features and implicitly installed subsystems.");
}
}
use of org.apache.aries.subsystem.core.archive.AriesProvisionDependenciesDirective in project aries by apache.
the class Aries1383Test method test13.
/*
* (13) The root subsystem has apache-aries-provision-dependencies:=install.
*/
@Test
public void test13() throws Exception {
Subsystem root = getRootSubsystem();
Map<String, String> headers = root.getSubsystemHeaders(null);
String headerStr = headers.get(SubsystemConstants.SUBSYSTEM_TYPE);
SubsystemTypeHeader header = new SubsystemTypeHeader(headerStr);
AriesProvisionDependenciesDirective directive = header.getAriesProvisionDependenciesDirective();
assertEquals("Wrong directive", AriesProvisionDependenciesDirective.INSTALL, directive);
}
use of org.apache.aries.subsystem.core.archive.AriesProvisionDependenciesDirective in project aries by apache.
the class BasicSubsystem method wasInstalledWithChildrenHavingProvisionDependenciesResolve.
private static boolean wasInstalledWithChildrenHavingProvisionDependenciesResolve(Subsystem child) {
BasicSubsystem bs = (BasicSubsystem) child;
SubsystemManifest manifest = bs.getSubsystemManifest();
SubsystemTypeHeader header = manifest.getSubsystemTypeHeader();
AriesProvisionDependenciesDirective directive = header.getAriesProvisionDependenciesDirective();
if (directive.isResolve()) {
return true;
}
return wasInstalledWithChildrenHavingProvisionDependenciesResolve(child.getChildren());
}
use of org.apache.aries.subsystem.core.archive.AriesProvisionDependenciesDirective in project aries by apache.
the class RawSubsystemResource method computeSubsystemTypeHeader.
private SubsystemTypeHeader computeSubsystemTypeHeader(SubsystemManifest manifest) {
SubsystemTypeHeader header = manifest.getSubsystemTypeHeader();
AriesProvisionDependenciesDirective directive = header.getAriesProvisionDependenciesDirective();
if (directive != null) {
// manifest. Validation of the value occurs later.
return header;
}
// The directive was not specified in the original manifest. The value
// of the parent directive becomes the default.
SubsystemManifest parentManifest = ((BasicSubsystem) parentSubsystem).getSubsystemManifest();
SubsystemTypeHeader parentHeader = parentManifest.getSubsystemTypeHeader();
directive = parentHeader.getAriesProvisionDependenciesDirective();
header = new SubsystemTypeHeader(header.getValue() + ';' + directive);
return header;
}
use of org.apache.aries.subsystem.core.archive.AriesProvisionDependenciesDirective in project aries by apache.
the class SubsystemTest method uninstallSubsystem.
protected void uninstallSubsystem(Subsystem subsystem, boolean quietly) throws Exception {
BasicSubsystem basicSubsystem = (BasicSubsystem) subsystem;
AriesProvisionDependenciesDirective directive = basicSubsystem.getAriesProvisionDependenciesDirective();
Bundle b = null;
Region region = null;
RegionDigraph digraph = context().getService(RegionDigraph.class);
if (!quietly) {
if (directive.isResolve()) {
assertState(EnumSet.of(State.INSTALLING, State.INSTALLED, State.RESOLVED), subsystem);
} else {
assertState(EnumSet.of(State.INSTALLED, State.RESOLVED), subsystem);
}
subsystemEvents.clear();
if (subsystem.getType().equals(SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION) || subsystem.getType().equals(SubsystemConstants.SUBSYSTEM_TYPE_COMPOSITE)) {
b = getRegionContextBundle(subsystem);
region = digraph.getRegion(b);
}
}
State state = subsystem.getState();
subsystem.uninstall();
if (quietly) {
return;
}
Collection<Subsystem> parents = subsystem.getParents();
if (!EnumSet.of(State.INSTALL_FAILED, State.INSTALLED, State.INSTALLING).contains(state)) {
assertEvent(subsystem, State.INSTALLED, 5000);
}
assertEvent(subsystem, State.UNINSTALLING, 5000);
assertEvent(subsystem, State.UNINSTALLED, 5000);
assertState(State.UNINSTALLED, subsystem);
for (Subsystem parent : parents) {
assertNotChild(parent, subsystem);
}
if (subsystem.getType().equals(SubsystemConstants.SUBSYSTEM_TYPE_APPLICATION) || subsystem.getType().equals(SubsystemConstants.SUBSYSTEM_TYPE_COMPOSITE)) {
assertEquals("Region context bundle not uninstalled", Bundle.UNINSTALLED, b.getState());
assertNull("Region not removed", digraph.getRegion(region.getName()));
}
}
Aggregations