aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cummi...@apache.org
Subject svn commit: r1059320 - 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-manag...
Date Sat, 15 Jan 2011 12:58:13 GMT
Author: cumminsh
Date: Sat Jan 15 12:58:13 2011
New Revision: 1059320

URL: http://svn.apache.org/viewvc?rev=1059320&view=rev
Log:
ARIES-542: New API on AriesApplicationResolver which takes in a PlatformRepository.

Modified:
    aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/resolve/AriesApplicationResolver.java
    aries/trunk/application/application-deployment-management/src/test/java/org/apache/aries/application/deployment/management/DeploymentGeneratorTest.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=1059320&r1=1059319&r2=1059320&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
Sat Jan 15 12:58:13 2011
@@ -29,6 +29,7 @@ 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.modelling.ModelledResource;
 import org.osgi.framework.Version;
 
@@ -94,4 +95,20 @@ public interface AriesApplicationResolve
    */
   Collection<ModelledResource> resolve(String appName, String appVersion, Collection<ModelledResource>
byValueBundles, Collection<Content> inputs) throws ResolverException;
 
+  /**
+   * Resolve an AriesApplication against a given platform repository. 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.
+   * 
+   * 
+   * 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
+   * @param platformRepository a platform repository to resolve against instead of the default
+   * @return a collection of modelled resource required by this application.
+   * @throws ResolverException
+   */
+  Collection<ModelledResource> resolve(String appName, String appVersion, Collection<ModelledResource>
byValueBundles, Collection<Content> inputs, PlatformRepository platformRepository) throws
ResolverException;
+
 }

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=1059320&r1=1059319&r2=1059320&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
Sat Jan 15 12:58:13 2011
@@ -45,6 +45,7 @@ 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.management.spi.runtime.LocalPlatform;
 import org.apache.aries.application.modelling.DeployedBundles;
@@ -128,6 +129,15 @@ public class DeploymentGeneratorTest
       _nextResults.add(result);
     }
 
+		public Collection<ModelledResource> resolve(String appName,
+				String appVersion, Collection<ModelledResource> byValueBundles,
+				Collection<Content> inputs,
+				PlatformRepository platformRepository) throws ResolverException 
+		{
+
+			return resolve(appName, appVersion, byValueBundles, inputs);
+		}
+
     public BundleInfo getBundleInfo(String bundleSymbolicName, Version bundleVersion)
     {
       return null;

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=1059320&r1=1059319&r2=1059320&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
Sat Jan 15 12:58:13 2011
@@ -63,6 +63,7 @@ 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;
@@ -185,6 +186,15 @@ public class AriesApplicationManagerImpl
       
       return byValueBundles;
     }
+    
+	   public Collection<ModelledResource> resolve(String appName, String appVersion,
+		       Collection<ModelledResource> byValueBundles, Collection<Content> inputs,
PlatformRepository platformRepository)
+		       throws ResolverException
+		   {
+		     
+		     return byValueBundles;
+		   }
+
   }
   
   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=1059320&r1=1059319&r2=1059320&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
Sat Jan 15 12:58:13 2011
@@ -27,6 +27,7 @@ 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;
@@ -71,6 +72,14 @@ public class NoOpResolver implements Ari
 	     
 	     return byValueBundles;
 	   }
+	   
+	   public Collection<ModelledResource> resolve(String appName, String appVersion,
+		       Collection<ModelledResource> byValueBundles, Collection<Content> inputs,
PlatformRepository platformRepository)
+		       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=1059320&r1=1059319&r2=1059320&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
Sat Jan 15 12:58:13 2011
@@ -130,7 +130,14 @@ public class OBRAriesResolver implements
     return returnOptionalResources;
   }
   
-  /**
+	public Collection<ModelledResource> resolve(String appName,
+			String appVersion, Collection<ModelledResource> byValueBundles,
+			Collection<Content> inputs) throws ResolverException {
+		return resolve(appName, appVersion, byValueBundles,
+				inputs, this.platformRepository);
+	}
+
+/**
    * Resolve a list of resources from the OBR bundle repositories by OBR
    * resolver.
    * 
@@ -138,18 +145,19 @@ public class OBRAriesResolver implements
    * @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
-  {
+  public Collection<ModelledResource> resolve(String appName, String appVersion,
+			Collection<ModelledResource> byValueBundles, Collection<Content> inputs, PlatformRepository
platformRepository)
+			throws ResolverException {
      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,
platformRepository);
     // add a resource describing the requirements of the application metadata.
     obrResolver.add(createApplicationResource( appName, appVersion, importedBundles));
     
@@ -212,7 +220,14 @@ public class OBRAriesResolver implements
   }
 
   private Resolver getConfiguredObrResolver(String appName, String appVersion,
-      Collection<ModelledResource> byValueBundles) throws ResolverException
+	      Collection<ModelledResource> byValueBundles) throws ResolverException
+	      {
+	 
+	  return getConfiguredObrResolver(appName, appVersion, byValueBundles, platformRepository);
+	      }
+
+  private Resolver getConfiguredObrResolver(String appName, String appVersion,
+      Collection<ModelledResource> byValueBundles, PlatformRepository platformRepository)
throws ResolverException
   {
     log.debug(LOG_ENTRY, "getConfiguredObrResolver", new Object[]{appName, appVersion,byValueBundles
});
     DataModelHelper helper = repositoryAdmin.getHelper();
@@ -241,7 +256,7 @@ public class OBRAriesResolver implements
       resolveRepos.add(r);      
     }     
     Resolver obrResolver = repositoryAdmin.resolver(resolveRepos.toArray(new Repository[resolveRepos.size()]));
-    addPlatformRepositories (obrResolver, appName);
+    addPlatformRepositories (obrResolver, appName, platformRepository);
     log.debug(LOG_EXIT, "getConfiguredObrResolver", obrResolver);
     return obrResolver;
   }
@@ -339,7 +354,7 @@ public class OBRAriesResolver implements
    * These should be added to the resolver without being listed as coming from a particular

    * repository or bundle.  
    */
-  private void addPlatformRepositories (Resolver obrResolver, String appName)
+  private void addPlatformRepositories (Resolver obrResolver, String appName, PlatformRepository
platformRepository)
   { 
     log.debug(LOG_ENTRY, "addPlatformRepositories", new Object[]{obrResolver, appName});
     DataModelHelper helper = repositoryAdmin.getHelper();
@@ -360,7 +375,7 @@ public class OBRAriesResolver implements
               }
             }
           } catch (Exception e) {
-            // no a big problem
+            // not a big problem
             log.error(MessageUtil.getMessage("RESOLVER_UNABLE_TO_READ_REPOSITORY_EXCEPTION",
new Object[]{appName, uri}) );
           } finally { 
             IOUtils.close(is);



Mime
View raw message