use of org.apache.aries.subsystem.core.archive.SubsystemTypeHeader in project aries by apache.
the class SubsystemTest method assertProvisionPolicy.
protected void assertProvisionPolicy(Subsystem subsystem, boolean acceptsDependencies) {
String headerStr = subsystem.getSubsystemHeaders(null).get(SubsystemConstants.SUBSYSTEM_TYPE);
assertNotNull("Missing subsystem type header", headerStr);
SubsystemTypeHeader header = new SubsystemTypeHeader(headerStr);
ProvisionPolicyDirective directive = header.getProvisionPolicyDirective();
if (acceptsDependencies)
assertTrue("Subsystem does not accept dependencies", directive.isAcceptDependencies());
else
assertTrue("Subsystem accepts dependencies", directive.isRejectDependencies());
}
use of org.apache.aries.subsystem.core.archive.SubsystemTypeHeader 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.SubsystemTypeHeader in project aries by apache.
the class ResolveContext method isAcceptDependencies.
private boolean isAcceptDependencies() {
SubsystemManifest manifest = resource.getSubsystemManifest();
SubsystemTypeHeader header = manifest.getSubsystemTypeHeader();
ProvisionPolicyDirective directive = header.getProvisionPolicyDirective();
return directive.isAcceptDependencies();
}
use of org.apache.aries.subsystem.core.archive.SubsystemTypeHeader in project aries by apache.
the class SubsystemManifestValidator method validate.
public static void validate(BasicSubsystem subsystem, SubsystemManifest manifest) {
if (subsystem.getResource().getId() == 0) {
return;
}
validatePreferredProviderHeader(manifest.getPreferredProviderHeader());
validateAriesProvisionDependenciesDirective(subsystem);
if (subsystem.isComposite()) {
SubsystemContentHeader header = manifest.getSubsystemContentHeader();
if (header == null) {
return;
}
for (SubsystemContentHeader.Clause clause : header.getClauses()) {
if (!clause.getVersionRange().isExact()) {
throw new SubsystemException("Composite subsystem using version range for content: " + clause);
}
}
} else if (subsystem.isFeature()) {
SubsystemTypeHeader subsystemTypeHeader = manifest.getSubsystemTypeHeader();
ProvisionPolicyDirective provisionPolicyDirective = subsystemTypeHeader.getProvisionPolicyDirective();
if (provisionPolicyDirective.isAcceptDependencies()) {
throw new SubsystemException("Feature subsystems may not declare a provision-policy of acceptDependencies");
}
if (manifest.getHeaders().get(SubsystemConstants.PREFERRED_PROVIDER) != null) {
throw new SubsystemException("Feature subsystems may not declare a " + SubsystemConstants.PREFERRED_PROVIDER + " header");
}
}
}
use of org.apache.aries.subsystem.core.archive.SubsystemTypeHeader 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());
}
Aggregations