incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mnutt...@apache.org
Subject svn commit: r988464 - in /incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management: impl/AriesApplicationManagerImpl.java repository/ApplicationRepository.java
Date Tue, 24 Aug 2010 10:17:02 GMT
Author: mnuttall
Date: Tue Aug 24 10:17:02 2010
New Revision: 988464

URL: http://svn.apache.org/viewvc?rev=988464&view=rev
Log:
ARIES-384: ApplicationRepository should not use resolver to find the bundleInfo contained
within itself

Modified:
    incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/AriesApplicationManagerImpl.java
    incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/repository/ApplicationRepository.java

Modified: incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/AriesApplicationManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/AriesApplicationManagerImpl.java?rev=988464&r1=988463&r2=988464&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/AriesApplicationManagerImpl.java
(original)
+++ incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/AriesApplicationManagerImpl.java
Tue Aug 24 10:17:02 2010
@@ -285,7 +285,7 @@ public class AriesApplicationManagerImpl
     Dictionary dict = new Hashtable();
     dict.put(ApplicationRepository.REPOSITORY_SCOPE, app.getApplicationMetadata().getApplicationScope());
     _bundleContext.registerService(BundleRepository.class.getName(), 
-        new ApplicationRepository(_resolver), 
+        new ApplicationRepository(app), 
         dict);
     
     AriesApplicationContext result = _applicationContextManager.getApplicationContext(app);

Modified: incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/repository/ApplicationRepository.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/repository/ApplicationRepository.java?rev=988464&r1=988463&r2=988464&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/repository/ApplicationRepository.java
(original)
+++ incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/repository/ApplicationRepository.java
Tue Aug 24 10:17:02 2010
@@ -18,9 +18,9 @@
  */
 package org.apache.aries.application.management.repository;
 
+import java.util.Collections;
 import java.util.Set;
 
-import org.apache.aries.application.ApplicationMetadata;
 import org.apache.aries.application.Content;
 import org.apache.aries.application.DeploymentContent;
 import org.apache.aries.application.management.AriesApplication;
@@ -36,12 +36,12 @@ public class ApplicationRepository imple
 {
   private static final int REPOSITORY_COST = 0;
   public static final String REPOSITORY_SCOPE = "repositoryScope";
-  
+  private AriesApplication app;
   AriesApplicationResolver resolver;
 
-  public ApplicationRepository(AriesApplicationResolver resolver)
+  public ApplicationRepository(AriesApplication app)
   {
-    this.resolver = resolver;
+    this.app = app;
   }
   
   public int getCost()
@@ -56,13 +56,20 @@ public class ApplicationRepository imple
 
   private class BundleSuggestionImpl implements BundleSuggestion
   {
-    private BundleInfo bundleInfo;
+    private BundleInfo bundleInfo = null;
     
     BundleSuggestionImpl(DeploymentContent content)
     {
-      this.bundleInfo = resolver.getBundleInfo(content.getContentName(), content.getExactVersion());
+      if ((app.getBundleInfo() != null) && (!app.getBundleInfo().isEmpty())) {
+        for (BundleInfo bi : app.getBundleInfo()) {
+          if (bi.getSymbolicName().equals(content.getContentName()) && (bi.getVersion().equals(content.getVersion().getExactVersion())))
{
+            bundleInfo = bi;
+            break;
+          }
+        }
+      }
     }
-    
+
     public int getCost()
     {
       return REPOSITORY_COST;
@@ -70,22 +77,40 @@ public class ApplicationRepository imple
 
     public Set<Content> getExportPackage()
     {
+      if (bundleInfo != null) {
       return bundleInfo.getExportPackage();
+      } else {
+        return null;
+      }
     }
 
     public Set<Content> getImportPackage()
     {
-      return bundleInfo.getImportPackage();
-    }
-
-    public Version getVersion()
-    {
-      return bundleInfo.getVersion();
+      if (bundleInfo != null) {
+        return bundleInfo.getImportPackage();
+        } else {
+          return null;
+        }
+      
+    }
+
+    public Version getVersion() 
+    {
+      if (bundleInfo != null) {
+        return bundleInfo.getVersion();
+        } else {        	
+          return null;
+        }
+      
     }
 
     public Bundle install(BundleContext ctx, AriesApplication app) throws BundleException
     {
-      return ctx.installBundle(bundleInfo.getLocation());
+      if (bundleInfo != null ) {
+        return ctx.installBundle(bundleInfo.getLocation());
+      } else {
+        throw new BundleException("Unable to install the bundle, as the BundleInfo is null.");
+      }
     }
     
   }



Mime
View raw message