You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by ma...@apache.org on 2011/09/07 10:20:46 UTC
svn commit: r1166046 - in /aries/trunk/application:
application-api/src/main/java/org/apache/aries/application/management/spi/resolve/
application-deployment-management/src/test/java/org/apache/aries/application/deployment/management/
application-itest...
Author: mahrwald
Date: Wed Sep 7 08:20:45 2011
New Revision: 1166046
URL: http://svn.apache.org/viewvc?rev=1166046&view=rev
Log:
ARIES-740: Isolated resolving of application
Modified:
aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/resolve/AriesApplicationResolver.java
aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/resolve/packageinfo
aries/trunk/application/application-deployment-management/src/test/java/org/apache/aries/application/deployment/management/DeploymentGeneratorTest.java
aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRResolverTest.java
aries/trunk/application/application-management/src/test/java/org/apache/aries/application/management/impl/AriesApplicationManagerImplTest.java
aries/trunk/application/application-noop-resolver/src/main/java/org/apache/aries/application/resolver/noop/impl/NoOpResolver.java
aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/OBRAriesResolver.java
Modified: aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/resolve/AriesApplicationResolver.java
URL: http://svn.apache.org/viewvc/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/resolve/AriesApplicationResolver.java?rev=1166046&r1=1166045&r2=1166046&view=diff
==============================================================================
--- aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/resolve/AriesApplicationResolver.java (original)
+++ aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/resolve/AriesApplicationResolver.java Wed Sep 7 08:20:45 2011
@@ -76,6 +76,7 @@ public interface AriesApplicationResolve
* @return the BundleInfo for the requested bundle, or null if none could be found.
*/
BundleInfo getBundleInfo(String bundleSymbolicName, Version bundleVersion);
+
/**
* Resolve an AriesApplication. The resolving process will build a repository from by-value bundles.
* It then scans all the required bundles and pull the dependencies required to resolve the bundles.
@@ -90,5 +91,18 @@ public interface AriesApplicationResolve
* @throws ResolverException
*/
Collection<ModelledResource> resolve(String appName, String appVersion, Collection<ModelledResource> byValueBundles, Collection<Content> inputs) throws ResolverException;
+
+ /**
+ * Resolve an AriesApplication in isolation i.e. without consulting any bundle repositories other than the system repository. This can be used for checking that the application is completely self-contained.
+ *
+ * Return a collect of modelled resources. This method is called when installing an application
+ * @param appName Application name
+ * @param appVersion application version
+ * @param byValueBundles by value bundles
+ * @param inputs bundle requirement
+ * @return a collection of modelled resource required by this application.
+ * @throws ResolverException
+ */
+ Collection<ModelledResource> resolveInIsolation(String appName, String appVersion, Collection<ModelledResource> byValueBundles, Collection<Content> inputs) throws ResolverException;
}
Modified: aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/resolve/packageinfo
URL: http://svn.apache.org/viewvc/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/resolve/packageinfo?rev=1166046&r1=1166045&r2=1166046&view=diff
==============================================================================
--- aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/resolve/packageinfo (original)
+++ aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/resolve/packageinfo Wed Sep 7 08:20:45 2011
@@ -16,4 +16,4 @@
# specific language governing permissions and limitations
# under the License.
#
-version 0.3.0
+version 0.4.0
Modified: aries/trunk/application/application-deployment-management/src/test/java/org/apache/aries/application/deployment/management/DeploymentGeneratorTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/application/application-deployment-management/src/test/java/org/apache/aries/application/deployment/management/DeploymentGeneratorTest.java?rev=1166046&r1=1166045&r2=1166046&view=diff
==============================================================================
--- aries/trunk/application/application-deployment-management/src/test/java/org/apache/aries/application/deployment/management/DeploymentGeneratorTest.java (original)
+++ aries/trunk/application/application-deployment-management/src/test/java/org/apache/aries/application/deployment/management/DeploymentGeneratorTest.java Wed Sep 7 08:20:45 2011
@@ -59,7 +59,6 @@ import org.apache.aries.mocks.BundleCont
import org.apache.aries.unittest.mocks.MethodCall;
import org.apache.aries.unittest.mocks.Skeleton;
import org.apache.aries.util.VersionRange;
-import org.apache.aries.util.manifest.ManifestHeaderProcessor;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -140,6 +139,14 @@ public class DeploymentGeneratorTest
return null;
}
+ @Override
+ public Collection<ModelledResource> resolveInIsolation(String appName,
+ String appVersion, Collection<ModelledResource> byValueBundles,
+ Collection<Content> inputs) throws ResolverException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Modified: aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRResolverTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRResolverTest.java?rev=1166046&r1=1166045&r2=1166046&view=diff
==============================================================================
--- aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRResolverTest.java (original)
+++ aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRResolverTest.java Wed Sep 7 08:20:45 2011
@@ -27,10 +27,13 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import org.apache.aries.application.Content;
import org.apache.aries.application.DeploymentContent;
import org.apache.aries.application.DeploymentMetadata;
import org.apache.aries.application.management.AriesApplication;
@@ -38,9 +41,11 @@ import org.apache.aries.application.mana
import org.apache.aries.application.management.AriesApplicationManager;
import org.apache.aries.application.management.ResolverException;
import org.apache.aries.application.management.spi.repository.RepositoryGenerator;
+import org.apache.aries.application.management.spi.resolve.AriesApplicationResolver;
import org.apache.aries.application.modelling.ModelledResource;
import org.apache.aries.application.modelling.ModelledResourceManager;
import org.apache.aries.application.utils.AppConstants;
+import org.apache.aries.application.utils.manifest.ContentFactory;
import org.apache.aries.itest.AbstractIntegrationTest;
import org.apache.aries.unittest.fixture.ArchiveFixture;
import org.apache.aries.unittest.fixture.ArchiveFixture.ZipFixture;
@@ -55,8 +60,11 @@ import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
-
+import static org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME;
+import static org.osgi.framework.Constants.BUNDLE_MANIFESTVERSION;
+import static org.osgi.framework.Constants.IMPORT_PACKAGE;
+import static org.osgi.framework.Constants.EXPORT_PACKAGE;
+import static org.osgi.framework.Constants.BUNDLE_VERSION;
@RunWith(JUnit4TestRunner.class)
public class OBRResolverTest extends AbstractIntegrationTest
@@ -75,10 +83,10 @@ public class OBRResolverTest extends Abs
public static void createApplications() throws Exception
{
ZipFixture bundle = ArchiveFixture.newJar().manifest()
- .attribute(Constants.BUNDLE_SYMBOLICNAME, CORE_BUNDLE_BY_VALUE)
- .attribute(Constants.BUNDLE_MANIFESTVERSION, "2")
- .attribute(Constants.IMPORT_PACKAGE, "p.q.r, x.y.z, javax.naming, " + BUNDLE_IN_FRAMEWORK)
- .attribute(Constants.BUNDLE_VERSION, "1.0.0").end();
+ .attribute(BUNDLE_SYMBOLICNAME, CORE_BUNDLE_BY_VALUE)
+ .attribute(BUNDLE_MANIFESTVERSION, "2")
+ .attribute(IMPORT_PACKAGE, "p.q.r, x.y.z, javax.naming, " + BUNDLE_IN_FRAMEWORK)
+ .attribute(BUNDLE_VERSION, "1.0.0").end();
FileOutputStream fout = new FileOutputStream(CORE_BUNDLE_BY_VALUE + ".jar");
@@ -86,39 +94,39 @@ public class OBRResolverTest extends Abs
fout.close();
bundle = ArchiveFixture.newJar().manifest()
- .attribute(Constants.BUNDLE_SYMBOLICNAME, TRANSITIVE_BUNDLE_BY_VALUE)
- .attribute(Constants.BUNDLE_MANIFESTVERSION, "2")
- .attribute(Constants.EXPORT_PACKAGE, "p.q.r")
- .attribute(Constants.BUNDLE_VERSION, "1.0.0").end();
+ .attribute(BUNDLE_SYMBOLICNAME, TRANSITIVE_BUNDLE_BY_VALUE)
+ .attribute(BUNDLE_MANIFESTVERSION, "2")
+ .attribute(EXPORT_PACKAGE, "p.q.r")
+ .attribute(BUNDLE_VERSION, "1.0.0").end();
fout = new FileOutputStream(TRANSITIVE_BUNDLE_BY_VALUE + ".jar");
bundle.writeOut(fout);
fout.close();
bundle = ArchiveFixture.newJar().manifest()
- .attribute(Constants.BUNDLE_SYMBOLICNAME, TRANSITIVE_BUNDLE_BY_REFERENCE)
- .attribute(Constants.BUNDLE_MANIFESTVERSION, "2")
- .attribute(Constants.EXPORT_PACKAGE, "x.y.z")
- .attribute(Constants.BUNDLE_VERSION, "1.0.0").end();
+ .attribute(BUNDLE_SYMBOLICNAME, TRANSITIVE_BUNDLE_BY_REFERENCE)
+ .attribute(BUNDLE_MANIFESTVERSION, "2")
+ .attribute(EXPORT_PACKAGE, "x.y.z")
+ .attribute(BUNDLE_VERSION, "1.0.0").end();
fout = new FileOutputStream(TRANSITIVE_BUNDLE_BY_REFERENCE + ".jar");
bundle.writeOut(fout);
fout.close();
bundle = ArchiveFixture.newJar().manifest()
- .attribute(Constants.BUNDLE_SYMBOLICNAME, CORE_BUNDLE_BY_REFERENCE)
- .attribute(Constants.BUNDLE_MANIFESTVERSION, "2")
- .attribute(Constants.EXPORT_PACKAGE, "d.e.f")
- .attribute(Constants.BUNDLE_VERSION, "1.0.0").end();
+ .attribute(BUNDLE_SYMBOLICNAME, CORE_BUNDLE_BY_REFERENCE)
+ .attribute(BUNDLE_MANIFESTVERSION, "2")
+ .attribute(EXPORT_PACKAGE, "d.e.f")
+ .attribute(BUNDLE_VERSION, "1.0.0").end();
fout = new FileOutputStream(CORE_BUNDLE_BY_REFERENCE + ".jar");
bundle.writeOut(fout);
fout.close();
bundle = ArchiveFixture.newJar().manifest()
- .attribute(Constants.BUNDLE_SYMBOLICNAME, CORE_BUNDLE_BY_REFERENCE)
- .attribute(Constants.BUNDLE_MANIFESTVERSION, "2")
- .attribute(Constants.EXPORT_PACKAGE, "d.e.f").end();
+ .attribute(BUNDLE_SYMBOLICNAME, CORE_BUNDLE_BY_REFERENCE)
+ .attribute(BUNDLE_MANIFESTVERSION, "2")
+ .attribute(EXPORT_PACKAGE, "d.e.f").end();
fout = new FileOutputStream(CORE_BUNDLE_BY_REFERENCE + "_0.0.0.jar");
bundle.writeOut(fout);
@@ -194,10 +202,50 @@ public class OBRResolverTest extends Abs
//installing requires a valid url for the bundle in repository.xml.
app = manager.resolve(app);
-
-
+ }
+ @Test
+ public void test_resolve_self_contained_app_in_isolation() throws Exception {
+ assertEquals(2, createAndResolveSelfContainedApp("org.osgi.framework").size());
}
+
+ @Test(expected=ResolverException.class)
+ public void test_resolve_non_self_contained_app_in_isolation() throws Exception {
+ createAndResolveSelfContainedApp("org.osgi.service.blueprint");
+ }
+
+ private Collection<ModelledResource> createAndResolveSelfContainedApp(String extraImport) throws Exception {
+ FileOutputStream fout = new FileOutputStream(new File("a.bundle.jar"));
+ ArchiveFixture.newJar()
+ .manifest()
+ .attribute(BUNDLE_SYMBOLICNAME, "a.bundle")
+ .attribute(BUNDLE_VERSION, "1.0.0")
+ .attribute(BUNDLE_MANIFESTVERSION, "2")
+ .attribute(IMPORT_PACKAGE, "a.pack.age")
+ .end().writeOut(fout);
+ fout.close();
+
+ fout = new FileOutputStream(new File("b.bundle.jar"));
+ ArchiveFixture.newJar()
+ .manifest()
+ .attribute(BUNDLE_SYMBOLICNAME, "b.bundle")
+ .attribute(BUNDLE_VERSION, "1.0.0")
+ .attribute(BUNDLE_MANIFESTVERSION, "2")
+ .attribute(IMPORT_PACKAGE, extraImport)
+ .attribute(EXPORT_PACKAGE, "a.pack.age")
+ .end().writeOut(fout);
+ fout.close();
+
+ ModelledResourceManager mrm = context().getService(ModelledResourceManager.class);
+ ModelledResource aBundle = mrm.getModelledResource(FileSystem.getFSRoot(new File("a.bundle.jar")));
+ ModelledResource bBundle = mrm.getModelledResource(FileSystem.getFSRoot(new File("b.bundle.jar")));
+
+ AriesApplicationResolver resolver = context().getService(AriesApplicationResolver.class);
+ return resolver.resolveInIsolation("test.app", "1.0.0",
+ Arrays.asList(aBundle, bBundle),
+ Arrays.<Content>asList(ContentFactory.parseContent("a.bundle", "1.0.0"), ContentFactory.parseContent("b.bundle", "1.0.0")));
+ }
+
@Test
public void testBlogApp() throws Exception
{
Modified: aries/trunk/application/application-management/src/test/java/org/apache/aries/application/management/impl/AriesApplicationManagerImplTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/application/application-management/src/test/java/org/apache/aries/application/management/impl/AriesApplicationManagerImplTest.java?rev=1166046&r1=1166045&r2=1166046&view=diff
==============================================================================
--- aries/trunk/application/application-management/src/test/java/org/apache/aries/application/management/impl/AriesApplicationManagerImplTest.java (original)
+++ aries/trunk/application/application-management/src/test/java/org/apache/aries/application/management/impl/AriesApplicationManagerImplTest.java Wed Sep 7 08:20:45 2011
@@ -61,7 +61,6 @@ import org.apache.aries.application.mana
import org.apache.aries.application.management.spi.convert.BundleConversion;
import org.apache.aries.application.management.spi.convert.BundleConverter;
import org.apache.aries.application.management.spi.convert.ConversionException;
-import org.apache.aries.application.management.spi.repository.PlatformRepository;
import org.apache.aries.application.management.spi.resolve.AriesApplicationResolver;
import org.apache.aries.application.management.spi.resolve.DeploymentManifestManager;
import org.apache.aries.application.management.spi.runtime.AriesApplicationContextManager;
@@ -186,6 +185,12 @@ public class AriesApplicationManagerImpl
return byValueBundles;
}
+ @Override
+ public Collection<ModelledResource> resolveInIsolation(String appName,
+ String appVersion, Collection<ModelledResource> byValueBundles,
+ Collection<Content> inputs) throws ResolverException {
+ return null;
+ }
}
static class DummyLocalPlatform implements LocalPlatform {
Modified: aries/trunk/application/application-noop-resolver/src/main/java/org/apache/aries/application/resolver/noop/impl/NoOpResolver.java
URL: http://svn.apache.org/viewvc/aries/trunk/application/application-noop-resolver/src/main/java/org/apache/aries/application/resolver/noop/impl/NoOpResolver.java?rev=1166046&r1=1166045&r2=1166046&view=diff
==============================================================================
--- aries/trunk/application/application-noop-resolver/src/main/java/org/apache/aries/application/resolver/noop/impl/NoOpResolver.java (original)
+++ aries/trunk/application/application-noop-resolver/src/main/java/org/apache/aries/application/resolver/noop/impl/NoOpResolver.java Wed Sep 7 08:20:45 2011
@@ -27,52 +27,53 @@ import org.apache.aries.application.mana
import org.apache.aries.application.management.BundleInfo;
import org.apache.aries.application.management.ResolveConstraint;
import org.apache.aries.application.management.ResolverException;
-import org.apache.aries.application.management.spi.repository.PlatformRepository;
import org.apache.aries.application.management.spi.resolve.AriesApplicationResolver;
import org.apache.aries.application.modelling.ModelledResource;
import org.osgi.framework.Version;
+
/**
- * AriesApplicationManager requires that there be at least one
- * AriesApplicationResolver service present. This class provides a null
- * implementation: it simply returns the bundles that it was provided with -
- * enough to permit the testing of Aries applications that have no external
- * dependencies.
- * It is not intended to be used in a production environment, as the implementation
- * of the AriesApplicationResolver just returns the bundles included in the application irrespective of
- * what is specified in application.mf.
+ * AriesApplicationManager requires that there be at least one
+ * AriesApplicationResolver service present. This class provides a null
+ * implementation: it simply returns the bundles that it was provided with -
+ * enough to permit the testing of Aries applications that have no external
+ * dependencies. It is not intended to be used in a production environment, as
+ * the implementation of the AriesApplicationResolver just returns the bundles
+ * included in the application irrespective of what is specified in
+ * application.mf.
*/
public class NoOpResolver implements AriesApplicationResolver {
- Set<BundleInfo> resolvedBundles = new HashSet<BundleInfo>();
-
- public Set<BundleInfo> resolve(AriesApplication app, ResolveConstraint... constraints) {
- resolvedBundles.addAll(app.getBundleInfo());
- return app.getBundleInfo();
- }
-
- public BundleInfo getBundleInfo(String bundleSymbolicName, Version bundleVersion)
- {
- BundleInfo result = null;
- for (BundleInfo info : resolvedBundles)
- {
- if (info.getSymbolicName().equals(bundleSymbolicName) &&
- info.getVersion().equals(bundleVersion))
- {
- result = info;
- }
- }
- return result;
- }
-
- public Collection<ModelledResource> resolve(String appName, String appVersion,
- Collection<ModelledResource> byValueBundles, Collection<Content> inputs)
- throws ResolverException
- {
-
- return byValueBundles;
- }
+ Set<BundleInfo> resolvedBundles = new HashSet<BundleInfo>();
-}
+ public Set<BundleInfo> resolve(AriesApplication app, ResolveConstraint... constraints) {
+ resolvedBundles.addAll(app.getBundleInfo());
+ return app.getBundleInfo();
+ }
+
+ public BundleInfo getBundleInfo(String bundleSymbolicName, Version bundleVersion) {
+ BundleInfo result = null;
+ for (BundleInfo info : resolvedBundles) {
+ if (info.getSymbolicName().equals(bundleSymbolicName)
+ && info.getVersion().equals(bundleVersion)) {
+ result = info;
+ }
+ }
+ return result;
+ }
+ public Collection<ModelledResource> resolve(String appName,
+ String appVersion, Collection<ModelledResource> byValueBundles,
+ Collection<Content> inputs) throws ResolverException {
+ return byValueBundles;
+ }
+
+ @Override
+ public Collection<ModelledResource> resolveInIsolation(String appName,
+ String appVersion, Collection<ModelledResource> byValueBundles,
+ Collection<Content> inputs) throws ResolverException {
+ return byValueBundles;
+ }
+
+}
Modified: aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/OBRAriesResolver.java
URL: http://svn.apache.org/viewvc/aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/OBRAriesResolver.java?rev=1166046&r1=1166045&r2=1166046&view=diff
==============================================================================
--- aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/OBRAriesResolver.java (original)
+++ aries/trunk/application/application-obr-resolver/src/main/java/org/apache/aries/application/resolver/obr/OBRAriesResolver.java Wed Sep 7 08:20:45 2011
@@ -145,69 +145,90 @@ public class OBRAriesResolver implements
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});
+
+ log.debug(LOG_ENTRY, "resolve", new Object[]{appName, appVersion,byValueBundles, inputs});
Collection<ImportedBundle> importedBundles = toImportedBundle(inputs);
- Collection<ModelledResource> toReturn = new ArrayList<ModelledResource>();
- Resolver obrResolver = getConfiguredObrResolver(appName, appVersion, byValueBundles);
+ Resolver obrResolver = getConfiguredObrResolver(appName, appVersion, byValueBundles, false);
// add a resource describing the requirements of the application metadata.
obrResolver.add(createApplicationResource( appName, appVersion, importedBundles));
- if (obrResolver.resolve()) {
-
- List<Resource> requiredResources = retrieveRequiredResources(obrResolver);
-
- if (requiredResources == null) {
- log.debug("resolver.getRequiredResources() returned null");
- } else {
+ log.debug(LOG_EXIT, "resolve");
+ return doResolve(obrResolver, appName);
+ }
+
+ private Collection<ModelledResource> doResolve(Resolver obrResolver, String appName) throws ResolverException
+ {
+ log.debug(LOG_ENTRY, "doResolve");
+ Collection<ModelledResource> toReturn = new ArrayList<ModelledResource>();
- for (Resource r : requiredResources) {
- Map<String, String> attribs = new HashMap<String, String>();
- attribs.put(Constants.VERSION_ATTRIBUTE, "[" + r.getVersion() + ',' + r.getVersion()
- + "]");
- ModelledResource modelledResourceForThisMatch = null;
- // OBR may give us back the global capabilities. Typically these do not have a bundle symbolic name - they're a
- // list of packages available in the target runtime environment. If the resource has no symbolic name, we can ignore it
- if (r.getSymbolicName() != null) {
- try {
- modelledResourceForThisMatch = new ModelledBundleResource (r, modellingManager, modellingHelper);
- } catch (InvalidAttributeException iax) {
-
- ResolverException re = new ResolverException("Internal error occurred: " + iax.toString());
- log.debug(LOG_EXIT, "resolve", re);
-
- throw re;
+ if (obrResolver.resolve()) {
+
+ List<Resource> requiredResources = retrieveRequiredResources(obrResolver);
+
+ if (requiredResources == null) {
+ log.debug("resolver.getRequiredResources() returned null");
+ } else {
+
+ for (Resource r : requiredResources) {
+ Map<String, String> attribs = new HashMap<String, String>();
+ attribs.put(Constants.VERSION_ATTRIBUTE, "[" + r.getVersion() + ',' + r.getVersion() + "]");
+ ModelledResource modelledResourceForThisMatch = null;
+ // OBR may give us back the global capabilities. Typically these do not have a bundle symbolic name - they're a
+ // list of packages available in the target runtime environment. If the resource has no symbolic name, we can ignore it
+ if (r.getSymbolicName() != null) {
+ try {
+ modelledResourceForThisMatch = new ModelledBundleResource (r, modellingManager, modellingHelper);
+ } catch (InvalidAttributeException iax) {
+ ResolverException re = new ResolverException("Internal error occurred: " + iax);
+ log.debug(LOG_EXIT, "doResolve", re);
+ throw re;
+ }
+ toReturn.add(modelledResourceForThisMatch);
+ }
}
- toReturn.add(modelledResourceForThisMatch);
}
- }
- }
- log.debug(LOG_EXIT, "resolve", toReturn);
- return toReturn;
- } else {
- Reason[] reasons = obrResolver.getUnsatisfiedRequirements();
- // let's refine the list by removing the indirect unsatisfied bundles that are caused by unsatisfied packages or other bundles
- Map<String,Set<String>> refinedReqs = refineUnsatisfiedRequirements(obrResolver, reasons);
- StringBuffer reqList = new StringBuffer();
- Map<String, String> unsatisfiedRequirements = extractConsumableMessageInfo(refinedReqs);
+ log.debug(LOG_EXIT, toReturn);
+ return toReturn;
+ } else {
+ Reason[] reasons = obrResolver.getUnsatisfiedRequirements();
+ // let's refine the list by removing the indirect unsatisfied bundles that are caused by unsatisfied packages or other bundles
+ Map<String,Set<String>> refinedReqs = refineUnsatisfiedRequirements(obrResolver, reasons);
+ StringBuffer reqList = new StringBuffer();
+ Map<String, String> unsatisfiedRequirements = extractConsumableMessageInfo(refinedReqs);
+
+ for (String reason : unsatisfiedRequirements.keySet()) {
+ reqList.append('\n');
+ reqList.append(reason);
+ }
- for (String reason : unsatisfiedRequirements.keySet()) {
- reqList.append('\n');
- reqList.append(reason);
- }
+ ResolverException re = new ResolverException(MessageUtil.getMessage("RESOLVER_UNABLE_TO_RESOLVE", new Object[] { appName, reqList }));
+ re.setUnsatisfiedRequirementsAndReasons(unsatisfiedRequirements);
- ResolverException re = new ResolverException(MessageUtil.getMessage("RESOLVER_UNABLE_TO_RESOLVE",
- new Object[] { appName, reqList }));
- re.setUnsatisfiedRequirementsAndReasons(unsatisfiedRequirements);
- log.debug(LOG_EXIT, "resolve", re);
-
- throw re;
- }
-
+ log.debug(LOG_EXIT, "doResolve", re);
+ throw re;
+ }
}
+
+ @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);
+ }
+
private Resolver getConfiguredObrResolver(String appName, String appVersion,
- Collection<ModelledResource> byValueBundles) throws ResolverException
+ Collection<ModelledResource> byValueBundles, boolean noExtraRepositories) throws ResolverException
{
log.debug(LOG_ENTRY, "getConfiguredObrResolver", new Object[]{appName, appVersion,byValueBundles });
DataModelHelper helper = repositoryAdmin.getHelper();
@@ -223,18 +244,22 @@ public class OBRAriesResolver implements
List<Repository> resolveRepos = new ArrayList<Repository>();
// add system repository
resolveRepos.add(repositoryAdmin.getSystemRepository());
- // add local repository if configured
- if (!(excludeLocalRuntime())) {
- resolveRepos.add(getLocalRepository(repositoryAdmin));
- }
+
// add application repository
resolveRepos.add(appRepo);
- // Need to refresh the repositories added to repository admin
- // add user-defined repositories
- Repository[] repos = repositoryAdmin.listRepositories();
- for (Repository r : repos) {
- resolveRepos.add(r);
- }
+
+ if (!!!noExtraRepositories) {
+ // add local repository if configured
+ if (!(excludeLocalRuntime())) {
+ resolveRepos.add(getLocalRepository(repositoryAdmin));
+ }
+ // Need to refresh the repositories added to repository admin
+ // add user-defined repositories
+ Repository[] repos = repositoryAdmin.listRepositories();
+ for (Repository r : repos) {
+ resolveRepos.add(r);
+ }
+ }
Resolver obrResolver = repositoryAdmin.resolver(resolveRepos.toArray(new Repository[resolveRepos.size()]));
addPlatformRepositories (obrResolver, appName, platformRepository);
@@ -264,7 +289,7 @@ public class OBRAriesResolver implements
}
}
- Resolver obrResolver = getConfiguredObrResolver(appName, appVersion.toString(), toModelledResource(app.getBundleInfo()));
+ Resolver obrResolver = getConfiguredObrResolver(appName, appVersion.toString(), toModelledResource(app.getBundleInfo()), false);
// add a resource describing the requirements of the application metadata.
obrResolver.add(createApplicationResource( appName, appVersion, contents));
if (obrResolver.resolve()) {
@@ -653,7 +678,7 @@ public class OBRAriesResolver implements
log.debug(LOG_EXIT, "refineUnsatisfiedRequirements", new Object[]{result});
return result;
- }
+ }