if (resource == null) {
try {
resource = new SubsystemResource(directory);
}
catch (Exception e) {
throw new SubsystemException(e);
}
Collection<DeployedContentHeader.Clause> missingResources = resource.getMissingResources();
if (!missingResources.isEmpty()) {
if (isRoot())
// We don't care if the root subsystem has missing resources
// because they are either (1) extraneous bundles outside of
// the subsystems API or (2) provisioned dependencies of
// other subsystems. Those that fall in the latter category
// will be detected by the dependent subsystems.
removedContent(missingResources);
else
// If a non-root subsystem has missing dependencies, let's
// fail fast for now.
throw new SubsystemException("Missing resources: " + missingResources);
}
}
return resource;
}