Search in sources :

Example 1 with ImportedBundle

use of org.apache.aries.application.modelling.ImportedBundle in project aries by apache.

the class ModelledResourceImpl method getFragmentHost.

public ImportedBundle getFragmentHost() {
    logger.debug(LOG_ENTRY, "getFragmentHost");
    ImportedBundle result = _exportedBundle.getFragmentHost();
    logger.debug(LOG_EXIT, "getFragmentHost", result);
    return result;
}
Also used : ImportedBundle(org.apache.aries.application.modelling.ImportedBundle)

Example 2 with ImportedBundle

use of org.apache.aries.application.modelling.ImportedBundle in project aries by apache.

the class DeployedBundlesTest method getSimpleDeployedBundles.

private DeployedBundles getSimpleDeployedBundles(ternary a, ternary b, ternary c) throws InvalidAttributeException {
    Collection<ImportedBundle> content = new ArrayList<ImportedBundle>();
    Collection<ImportedBundle> uses = new ArrayList<ImportedBundle>();
    if (a == ternary.CONTENT)
        content.add(new ImportedBundleImpl("bundle.a", "1.0.0"));
    else if (a == ternary.USES)
        uses.add(new ImportedBundleImpl("bundle.a", "1.0.0"));
    if (b == ternary.CONTENT)
        content.add(new ImportedBundleImpl("bundle.b", "1.0.0"));
    else if (b == ternary.USES)
        uses.add(new ImportedBundleImpl("bundle.b", "1.0.0"));
    if (c == ternary.CONTENT)
        content.add(new ImportedBundleImpl("bundle.c", "1.0.0"));
    else if (c == ternary.USES)
        uses.add(new ImportedBundleImpl("bundle.c", "1.0.0"));
    // In a unit test we could go straight to the static method; choosing not to in this case. 
    return new ModellingHelperImpl().createDeployedBundles("test", content, uses, null);
}
Also used : ImportedBundleImpl(org.apache.aries.application.modelling.impl.ImportedBundleImpl) ArrayList(java.util.ArrayList) ImportedBundle(org.apache.aries.application.modelling.ImportedBundle) ModellingHelperImpl(org.apache.aries.application.modelling.utils.impl.ModellingHelperImpl)

Example 3 with ImportedBundle

use of org.apache.aries.application.modelling.ImportedBundle in project aries by apache.

the class DeployedBundlesTest method validDeployedBundles.

private DeployedBundles validDeployedBundles() throws Exception {
    Collection<ImportedBundle> content = new ArrayList<ImportedBundle>();
    Collection<ImportedBundle> uses = new ArrayList<ImportedBundle>();
    content.add(new ImportedBundleImpl("bundle.a", "1.0.0"));
    content.add(new ImportedBundleImpl("bundle.b", "1.0.0"));
    uses.add(new ImportedBundleImpl("bundle.c", "1.0.0"));
    uses.add(new ImportedBundleImpl("bundle.d", "1.0.0"));
    return new ModellingHelperImpl().createDeployedBundles("test", content, uses, null);
}
Also used : ImportedBundleImpl(org.apache.aries.application.modelling.impl.ImportedBundleImpl) ArrayList(java.util.ArrayList) ImportedBundle(org.apache.aries.application.modelling.ImportedBundle) ModellingHelperImpl(org.apache.aries.application.modelling.utils.impl.ModellingHelperImpl)

Example 4 with ImportedBundle

use of org.apache.aries.application.modelling.ImportedBundle in project aries by apache.

the class OBRAriesResolver method resolve.

/**
   * Resolve a list of resources from the OBR bundle repositories by OBR
   * resolver.
   * 
   * @param appName - application name
   * @param appVersion - application version
   * @param byValueBundles - by value bundles
   * @param inputs - other constraints
   * @param platformRepository - a platform repository to use instead of the one provided as a service
   * @return a collection of modelled resources required by this application
   * @throws ResolverException
   */
@Override
public Collection<ModelledResource> resolve(String appName, String appVersion, Collection<ModelledResource> byValueBundles, Collection<Content> inputs) throws ResolverException {
    log.debug(LOG_ENTRY, "resolve", new Object[] { appName, appVersion, byValueBundles, inputs });
    Collection<ImportedBundle> importedBundles = toImportedBundle(inputs);
    Resolver obrResolver = getConfiguredObrResolver(appName, appVersion, byValueBundles, false);
    // add a resource describing the requirements of the application metadata.
    obrResolver.add(createApplicationResource(appName, appVersion, importedBundles));
    log.debug(LOG_EXIT, "resolve");
    return doResolve(obrResolver, appName);
}
Also used : Resolver(org.apache.felix.bundlerepository.Resolver) AriesApplicationResolver(org.apache.aries.application.management.spi.resolve.AriesApplicationResolver) ImportedBundle(org.apache.aries.application.modelling.ImportedBundle)

Example 5 with ImportedBundle

use of org.apache.aries.application.modelling.ImportedBundle in project aries by apache.

the class OBRAriesResolver method resolveInIsolation.

@Override
public Collection<ModelledResource> resolveInIsolation(String appName, String appVersion, Collection<ModelledResource> byValueBundles, Collection<Content> inputs) throws ResolverException {
    log.debug(LOG_ENTRY, "resolve", new Object[] { appName, appVersion, byValueBundles, inputs });
    Collection<ImportedBundle> importedBundles = toImportedBundle(inputs);
    Resolver obrResolver = getConfiguredObrResolver(appName, appVersion, byValueBundles, true);
    // add a resource describing the requirements of the application metadata.
    obrResolver.add(createApplicationResource(appName, appVersion, importedBundles));
    log.debug(LOG_EXIT, "resolve");
    return doResolve(obrResolver, appName);
}
Also used : Resolver(org.apache.felix.bundlerepository.Resolver) AriesApplicationResolver(org.apache.aries.application.management.spi.resolve.AriesApplicationResolver) ImportedBundle(org.apache.aries.application.modelling.ImportedBundle)

Aggregations

ImportedBundle (org.apache.aries.application.modelling.ImportedBundle)11 ArrayList (java.util.ArrayList)4 InvalidAttributeException (org.apache.aries.application.InvalidAttributeException)4 Content (org.apache.aries.application.Content)3 ResolverException (org.apache.aries.application.management.ResolverException)3 ImportedBundleImpl (org.apache.aries.application.modelling.impl.ImportedBundleImpl)3 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 AriesApplicationResolver (org.apache.aries.application.management.spi.resolve.AriesApplicationResolver)2 ExportedPackage (org.apache.aries.application.modelling.ExportedPackage)2 ImportedPackage (org.apache.aries.application.modelling.ImportedPackage)2 ModellingHelperImpl (org.apache.aries.application.modelling.utils.impl.ModellingHelperImpl)2 Resolver (org.apache.felix.bundlerepository.Resolver)2 List (java.util.List)1 PreResolveHook (org.apache.aries.application.management.spi.resolve.PreResolveHook)1 DeployedBundles (org.apache.aries.application.modelling.DeployedBundles)1 ExportedService (org.apache.aries.application.modelling.ExportedService)1 ImportedService (org.apache.aries.application.modelling.ImportedService)1 ModelledResource (org.apache.aries.application.modelling.ModelledResource)1