Search in sources :

Example 1 with MissingCapability

use of org.apache.aries.subsystem.core.internal.DependencyCalculator.MissingCapability in project aries by apache.

the class ResolveContext method processNewlyResolvedResource.

private void processNewlyResolvedResource(Resource resource, Requirement requirement, List<Capability> capabilities) {
    try {
        // Only check the system repository for osgi.ee and osgi.native
        if (ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE.equals(requirement.getNamespace()) || NativeNamespace.NATIVE_NAMESPACE.equals(requirement.getNamespace())) {
            addDependenciesFromSystemRepository(requirement, capabilities);
        } else {
            addDependenciesFromContentRepository(requirement, capabilities);
            addDependenciesFromPreferredProviderRepository(requirement, capabilities);
            addDependenciesFromSystemRepository(requirement, capabilities);
            addDependenciesFromLocalRepository(requirement, capabilities);
            if (capabilities.isEmpty()) {
                addDependenciesFromRepositoryServiceRepositories(requirement, capabilities);
            }
        }
        if (capabilities.isEmpty()) {
            // Is the requirement optional?
            String resolution = requirement.getDirectives().get(Namespace.REQUIREMENT_RESOLUTION_DIRECTIVE);
            if (Namespace.RESOLUTION_OPTIONAL.equals(resolution)) {
                // Yes, it's optional. Add a missing capability to ensure
                // it gets added to the sharing policy per the specification.
                capabilities.add(new MissingCapability(requirement));
            } else // Is the requirement resource already resolved? See ARIES-1538.
            if (isResolved(requirement.getResource())) {
                // Yes, the resource has already been resolved. Do not fail
                // the subsystem resolution due to a missing dependency.
                capabilities.add(new MissingCapability(requirement));
            }
        }
    } catch (Throwable t) {
        Utils.handleTrowable(t);
    }
}
Also used : MissingCapability(org.apache.aries.subsystem.core.internal.DependencyCalculator.MissingCapability)

Aggregations

MissingCapability (org.apache.aries.subsystem.core.internal.DependencyCalculator.MissingCapability)1