use of org.apache.aries.subsystem.core.archive.SubsystemManifest in project aries by apache.
the class ResolveContext method isValid.
private boolean isValid(Capability capability, Requirement requirement) throws BundleException, IOException, InvalidSyntaxException, URISyntaxException {
if (IdentityNamespace.IDENTITY_NAMESPACE.equals(capability.getNamespace()))
return true;
Resource provider = capability.getResource();
Resource requirer = requirement.getResource();
SubsystemManifest manifest = resource.getSubsystemManifest();
SubsystemContentHeader header = manifest.getSubsystemContentHeader();
if (header.contains(provider) && header.contains(requirer)) {
// are in the same region and the capability will be visible.
return true;
}
Region from = findRegionForCapabilityValidation(provider);
Region to = findRegionForCapabilityValidation(requirer);
return new SharingPolicyValidator(from, to).isValid(capability);
}
use of org.apache.aries.subsystem.core.archive.SubsystemManifest in project aries by apache.
the class RawSubsystemResource method computeTranslations.
private Collection<TranslationFile> computeTranslations(IDirectory directory) throws IOException {
SubsystemManifest manifest = getSubsystemManifest();
SubsystemLocalizationHeader header = manifest.getSubsystemLocalizationHeader();
String directoryName = header.getDirectoryName();
// TODO Assumes the ZIP file includes directory entries. Issues?
IFile file = directoryName == null ? directory : directory.getFile(directoryName);
if (file == null || !file.isDirectory())
return Collections.emptyList();
List<IFile> files = file.convert().listFiles();
if (files == null || files.isEmpty())
return Collections.emptyList();
ArrayList<TranslationFile> result = new ArrayList<TranslationFile>(files.size());
for (IFile f : files) {
Properties properties = new Properties();
InputStream is = f.open();
try {
properties.load(is);
result.add(new TranslationFile(f.getName(), properties));
} finally {
is.close();
}
}
result.trimToSize();
return result;
}
use of org.apache.aries.subsystem.core.archive.SubsystemManifest 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.SubsystemManifest in project aries by apache.
the class Utils method isContent.
/*
* The Deployed-Content header in the deployment manifest is used to store
* information about explicitly installed resources and provisioned
* dependencies in addition to content for persistence purposes. This method
* returns true only if the resource is "true" content of the subsystem and,
* therefore, uses the Subsystem-Content header from the subsystem manifest.
*/
public static boolean isContent(BasicSubsystem subsystem, Resource resource) {
SubsystemManifest subsystemManifest = subsystem.getSubsystemManifest();
if (subsystemManifest == null)
return false;
SubsystemContentHeader subsystemContentHeader = subsystemManifest.getSubsystemContentHeader();
if (subsystemContentHeader == null)
return false;
return subsystemContentHeader.contains(resource);
}
Aggregations