incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From timothyjw...@apache.org
Subject svn commit: r1026007 - in /incubator/aries/trunk/application: application-api/src/main/java/org/apache/aries/application/management/spi/resolve/ application-deployment-management/src/main/java/org/apache/aries/application/deployment/management/impl/ ap...
Date Thu, 21 Oct 2010 14:13:31 GMT
Author: timothyjward
Date: Thu Oct 21 14:13:31 2010
New Revision: 1026007

URL: http://svn.apache.org/viewvc?rev=1026007&view=rev
Log:
ARIES-464 : Pass an ApplicationMetadata to the PostResolveTransformer

Modified:
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/resolve/DeploymentManifestManager.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/resolve/PostResolveTransformer.java
    incubator/aries/trunk/application/application-deployment-management/src/main/java/org/apache/aries/application/deployment/management/impl/DeploymentManifestManagerImpl.java
    incubator/aries/trunk/application/application-deployment-management/src/test/java/org/apache/aries/application/deployment/management/DeploymentGeneratorTest.java
    incubator/aries/trunk/application/application-management/src/test/java/org/apache/aries/application/management/impl/AriesApplicationManagerImplTest.java
    incubator/aries/trunk/application/application-noop-postresolve-process/src/main/java/org/apache/aries/application/noop/postresolve/process/impl/DefaultPostResolveTransformer.java

Modified: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/resolve/DeploymentManifestManager.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/resolve/DeploymentManifestManager.java?rev=1026007&r1=1026006&r2=1026007&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/resolve/DeploymentManifestManager.java
(original)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/resolve/DeploymentManifestManager.java
Thu Oct 21 14:13:31 2010
@@ -21,6 +21,7 @@ package org.apache.aries.application.man
 import java.util.Collection;
 import java.util.jar.Manifest;
 
+import org.apache.aries.application.ApplicationMetadata;
 import org.apache.aries.application.Content;
 import org.apache.aries.application.ServiceDeclaration;
 import org.apache.aries.application.management.AriesApplication;
@@ -52,13 +53,9 @@ public interface DeploymentManifestManag
    * @throws ResolverException
    */
   DeployedBundles generateDeployedBundles( 
-      String appName, 
-      String appVersion, 
-      Collection<Content> appContent, 
+      ApplicationMetadata appMetadata, 
       Collection<ModelledResource> byValueBundles, 
-      Collection<Content> useBundleSet, 
-      Collection<Content> otherBundles, 
-      Collection<ServiceDeclaration> appImportServices) throws ResolverException;
+      Collection<Content> otherBundles) throws ResolverException;
 
   /**
    * Generate a Manifest representation of a DEPLOYMENT.MF, 

Modified: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/resolve/PostResolveTransformer.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/resolve/PostResolveTransformer.java?rev=1026007&r1=1026006&r2=1026007&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/resolve/PostResolveTransformer.java
(original)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/spi/resolve/PostResolveTransformer.java
Thu Oct 21 14:13:31 2010
@@ -18,6 +18,7 @@
  */
 package org.apache.aries.application.management.spi.resolve;
 
+import org.apache.aries.application.ApplicationMetadata;
 import org.apache.aries.application.management.ResolverException;
 import org.apache.aries.application.modelling.DeployedBundles;
 
@@ -25,10 +26,11 @@ public interface PostResolveTransformer
 {
 /**
  *  This method is to perform any post process after the resolver returns back a collection
of bundles. It returns the updated manifest map.
+ * @param appMetaData The application that was resolved
  * @param bundles A collection of bundles required by this application. 
  * @return Modified collection of bundles
  * @throws ResolverException
  */
-  DeployedBundles postResolveProcess(DeployedBundles deployedBundles) throws ResolverException;
+  DeployedBundles postResolveProcess(ApplicationMetadata appMetaData, DeployedBundles deployedBundles)
throws ResolverException;
 
 }

Modified: incubator/aries/trunk/application/application-deployment-management/src/main/java/org/apache/aries/application/deployment/management/impl/DeploymentManifestManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-deployment-management/src/main/java/org/apache/aries/application/deployment/management/impl/DeploymentManifestManagerImpl.java?rev=1026007&r1=1026006&r2=1026007&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-deployment-management/src/main/java/org/apache/aries/application/deployment/management/impl/DeploymentManifestManagerImpl.java
(original)
+++ incubator/aries/trunk/application/application-deployment-management/src/main/java/org/apache/aries/application/deployment/management/impl/DeploymentManifestManagerImpl.java
Thu Oct 21 14:13:31 2010
@@ -143,11 +143,10 @@ public class DeploymentManifestManagerIm
     } catch (Exception e) {
       throw new ResolverException (e);
     }
-    Collection<Content> useBundles = app.getApplicationMetadata().getUseBundles();
 
     Collection<Content> bundlesToResolve = new ArrayList<Content>();
     bundlesToResolve.addAll(appMetadata.getApplicationContents());    
-    bundlesToResolve.addAll(useBundles);
+    bundlesToResolve.addAll(app.getApplicationMetadata().getUseBundles());
 
     //If we pass in provision bundles (e.g. import deployment manifest sanity check), we
add them into our bundlesToResolve set.
     // This is because we want to make sure all bundles we passed into resolver the same
as what we are going to get from resolver. 
@@ -157,9 +156,8 @@ public class DeploymentManifestManagerIm
       restrictedReqs.add(content);
     }
     
-    DeployedBundles deployedBundles = generateDeployedBundles (appMetadata.getApplicationSymbolicName(),
-        appMetadata.getApplicationVersion().toString(), appMetadata.getApplicationContents(),

-        byValueBundles, useBundles, restrictedReqs, appMetadata.getApplicationImportServices());
+    DeployedBundles deployedBundles = generateDeployedBundles (appMetadata, 
+        byValueBundles, restrictedReqs);
     
     Manifest man = generateDeploymentManifest(appMetadata.getApplicationSymbolicName(),
         appMetadata.getApplicationVersion().toString(), deployedBundles);
@@ -178,21 +176,20 @@ public class DeploymentManifestManagerIm
   @Override
   public DeployedBundles generateDeployedBundles
   ( 
-      String appSymbolicName, 
-      String appVersion,
-      Collection<Content> appContent, 
+      ApplicationMetadata appMetadata, 
       Collection<ModelledResource> provideByValueBundles, 
-      Collection<Content> useBundleSet, 
-      Collection<Content> otherBundles, 
-      Collection<ServiceDeclaration> applicationImportService) throws ResolverException
{  
+      Collection<Content> otherBundles) throws ResolverException {  
+    
+    _logger.debug(LOG_ENTRY, "generateDeployedBundles", new Object[]{appMetadata,
+        provideByValueBundles,otherBundles });
+    
+    Collection<Content> useBundleSet = appMetadata.getUseBundles();
+    Collection<Content> appContent = appMetadata.getApplicationContents();
     
-    _logger.debug(LOG_ENTRY, "generateDeployedBundles", new Object[]{appSymbolicName, appVersion,

-        appContent, provideByValueBundles,useBundleSet,otherBundles });
     Collection<Content> bundlesToResolve = new ArrayList<Content>();
-    Set<ImportedBundle> appContentIB = null;
-    Set<ImportedBundle> useBundleIB = null;
-    useBundleIB = new HashSet<ImportedBundle> (toImportedBundle(useBundleSet));
-    appContentIB = new HashSet<ImportedBundle>(toImportedBundle(appContent));
+    Set<ImportedBundle> appContentIB = toImportedBundle(appContent);
+    Set<ImportedBundle> useBundleIB = toImportedBundle(useBundleSet);
+
 
     bundlesToResolve.addAll(useBundleSet);
 
@@ -201,7 +198,7 @@ public class DeploymentManifestManagerIm
     Collection<ModelledResource> byValueBundles = new ArrayList<ModelledResource>(provideByValueBundles);
     ModelledResource fakeBundleResource;
     try { 
-      fakeBundleResource = createFakeBundle(applicationImportService);
+      fakeBundleResource = createFakeBundle(appMetadata.getApplicationImportServices());
     } catch (InvalidAttributeException iax) { 
       ResolverException rx = new ResolverException (iax);
       _logger.debug(LOG_EXIT, "generateDeploymentManifest", new Object[] {rx});
@@ -209,6 +206,9 @@ public class DeploymentManifestManagerIm
       throw rx;
     }
     byValueBundles.add(fakeBundleResource);
+    
+    String appSymbolicName = appMetadata.getApplicationSymbolicName();
+    String appVersion = appMetadata.getApplicationVersion().toString();
     String uniqueName = appSymbolicName + "_" + appVersion;
     
     DeployedBundles deployedBundles = modellingHelper.createDeployedBundles(appSymbolicName,
appContentIB, useBundleIB, Arrays.asList(fakeBundleResource));
@@ -330,7 +330,7 @@ public class DeploymentManifestManagerIm
     }
       
     if (postResolveTransformer != null) try {  
-      deployedBundles = postResolveTransformer.postResolveProcess (deployedBundles);
+      deployedBundles = postResolveTransformer.postResolveProcess (appMetadata, deployedBundles);
     } catch (ServiceUnavailableException e) { 
       _logger.debug(MessageUtil.getMessage("POST_RESOLVE_TRANSFORMER_UNAVAILABLE",e));
     }
@@ -523,12 +523,12 @@ public class DeploymentManifestManagerIm
    * @return a collection of ImportedBundle objects
    * @throws ResolverException
    */
-  private Collection<ImportedBundle> toImportedBundle(Collection<Content> content)
throws ResolverException
+  private Set<ImportedBundle> toImportedBundle(Collection<Content> content) throws
ResolverException
   {
 
     _logger.debug(LOG_ENTRY, "toImportedBundle", new Object[]{content});
 
-    List<ImportedBundle> result = new ArrayList<ImportedBundle>();
+    Set<ImportedBundle> result = new HashSet<ImportedBundle>();
     for (Content c : content) {
       try {
         result.add(modellingManager.getImportedBundle(c.getContentName(), c.getVersion().toString()));

Modified: incubator/aries/trunk/application/application-deployment-management/src/test/java/org/apache/aries/application/deployment/management/DeploymentGeneratorTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-deployment-management/src/test/java/org/apache/aries/application/deployment/management/DeploymentGeneratorTest.java?rev=1026007&r1=1026006&r2=1026007&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-deployment-management/src/test/java/org/apache/aries/application/deployment/management/DeploymentGeneratorTest.java
(original)
+++ incubator/aries/trunk/application/application-deployment-management/src/test/java/org/apache/aries/application/deployment/management/DeploymentGeneratorTest.java
Thu Oct 21 14:13:31 2010
@@ -181,6 +181,8 @@ public class DeploymentGeneratorTest
         new MethodCall(ApplicationMetadata.class, "getApplicationSymbolicName"), "aries.test");
     Skeleton.getSkeleton(appMetadata).setReturnValue(
         new MethodCall(ApplicationMetadata.class, "getApplicationVersion"), new Version("1.0.0"));
+    Skeleton.getSkeleton(appMetadata).setReturnValue(
+        new MethodCall(ApplicationMetadata.class, "getUseBundles"), Collections.EMPTY_LIST);
   
     
     app = Skeleton.newMock(AriesApplication.class);
     Skeleton.getSkeleton(app).setReturnValue(new MethodCall(AriesApplication.class, "getApplicationMetadata"),
appMetadata);
@@ -240,12 +242,10 @@ public class DeploymentGeneratorTest
   {
     
     Skeleton.getSkeleton(appMetadata).setReturnValue(new MethodCall(ApplicationMetadata.class,
"getApplicationContents"), Arrays.asList(mockContent("aries.test.a", "1.0.0"), mockContent("aries.test.b",
"[1.0.0, 2.0.0)" )));
+    Skeleton.getSkeleton(appMetadata).setReturnValue(new MethodCall(ApplicationMetadata.class,
"getUseBundles"), Arrays.asList(BUNDLE_C, BUNDLE_D));
     
-    
-    DeployedBundles deployedBundles = deplMFMgr.generateDeployedBundles (appMetadata.getApplicationSymbolicName(),
-        appMetadata.getApplicationVersion().toString(), appMetadata.getApplicationContents(),

-        new ArrayList<ModelledResource>(), 
-        Arrays.asList(BUNDLE_C, BUNDLE_D), Collections.<Content>emptyList(), appMetadata.getApplicationImportServices());
+    DeployedBundles deployedBundles = deplMFMgr.generateDeployedBundles (appMetadata, 
+        new ArrayList<ModelledResource>(), Collections.<Content>emptyList());

     Manifest man = deplMFMgr.generateDeploymentManifest(appMetadata.getApplicationSymbolicName(),
         appMetadata.getApplicationVersion().toString(), deployedBundles);
     
@@ -290,10 +290,8 @@ public class DeploymentGeneratorTest
     
     
     try { 
-      DeployedBundles deployedBundles = deplMFMgr.generateDeployedBundles (appMetadata.getApplicationSymbolicName(),
-          appMetadata.getApplicationVersion().toString(), appMetadata.getApplicationContents(),

-          new ArrayList<ModelledResource>(), 
-          new ArrayList<Content>(), Collections.<Content>emptyList(), appMetadata.getApplicationImportServices());
+      DeployedBundles deployedBundles = deplMFMgr.generateDeployedBundles (appMetadata, 
+          new ArrayList<ModelledResource>(), new ArrayList<Content>());
       deplMFMgr.generateDeploymentManifest(appMetadata.getApplicationSymbolicName(),
           appMetadata.getApplicationVersion().toString(), deployedBundles);
     } catch (ResolverException rx) { 
@@ -343,10 +341,9 @@ public class DeploymentGeneratorTest
     Skeleton.getSkeleton(app).setReturnValue(new MethodCall(AriesApplication.class, "getApplicationMetadata"),
appMetadata);
     
     try {
-      DeployedBundles deployedBundles = deplMFMgr.generateDeployedBundles (appMetadata.getApplicationSymbolicName(),
-          appMetadata.getApplicationVersion().toString(), appMetadata.getApplicationContents(),

+      DeployedBundles deployedBundles = deplMFMgr.generateDeployedBundles (appMetadata, 
           Arrays.asList(new ModelledResource[] {testIsolated1.getBundle(), testIsolated2.getBundle()}),

-          new ArrayList<Content>(), Collections.<Content>emptyList(), appMetadata.getApplicationImportServices());
+          new ArrayList<Content>());
       deplMFMgr.generateDeploymentManifest(appMetadata.getApplicationSymbolicName(),
           appMetadata.getApplicationVersion().toString(), deployedBundles);
     } catch (ResolverException rx) { 

Modified: incubator/aries/trunk/application/application-management/src/test/java/org/apache/aries/application/management/impl/AriesApplicationManagerImplTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-management/src/test/java/org/apache/aries/application/management/impl/AriesApplicationManagerImplTest.java?rev=1026007&r1=1026006&r2=1026007&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-management/src/test/java/org/apache/aries/application/management/impl/AriesApplicationManagerImplTest.java
(original)
+++ incubator/aries/trunk/application/application-management/src/test/java/org/apache/aries/application/management/impl/AriesApplicationManagerImplTest.java
Thu Oct 21 14:13:31 2010
@@ -147,11 +147,8 @@ public class AriesApplicationManagerImpl
       return null;
     }
 
-    public DeployedBundles generateDeployedBundles(String appName,
-        String appVersion, Collection<Content> appContent,
-        Collection<ModelledResource> byValueBundles,
-        Collection<Content> useBundleSet, Collection<Content> otherBundles,
-        Collection<ServiceDeclaration> appImportServices)
+    public DeployedBundles generateDeployedBundles(ApplicationMetadata appMetadata,
+        Collection<ModelledResource> byValueBundles, Collection<Content> otherBundles)
         throws ResolverException {
       // Not required or used in this test
       return null;

Modified: incubator/aries/trunk/application/application-noop-postresolve-process/src/main/java/org/apache/aries/application/noop/postresolve/process/impl/DefaultPostResolveTransformer.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-noop-postresolve-process/src/main/java/org/apache/aries/application/noop/postresolve/process/impl/DefaultPostResolveTransformer.java?rev=1026007&r1=1026006&r2=1026007&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-noop-postresolve-process/src/main/java/org/apache/aries/application/noop/postresolve/process/impl/DefaultPostResolveTransformer.java
(original)
+++ incubator/aries/trunk/application/application-noop-postresolve-process/src/main/java/org/apache/aries/application/noop/postresolve/process/impl/DefaultPostResolveTransformer.java
Thu Oct 21 14:13:31 2010
@@ -18,6 +18,8 @@
  */
 
 package org.apache.aries.application.noop.postresolve.process.impl;
+
+import org.apache.aries.application.ApplicationMetadata;
 import org.apache.aries.application.management.ResolverException;
 import org.apache.aries.application.management.spi.resolve.PostResolveTransformer;
 import org.apache.aries.application.modelling.DeployedBundles;
@@ -28,7 +30,7 @@ public class DefaultPostResolveTransform
 {
 
   @Override
-  public DeployedBundles postResolveProcess(DeployedBundles deployedBundles)
+  public DeployedBundles postResolveProcess(ApplicationMetadata appMetadata, DeployedBundles
deployedBundles)
       throws ResolverException
   {
     



Mime
View raw message