incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r911409 - in /incubator/aries/trunk/application: application-api/src/main/java/org/apache/aries/application/management/ application-management/src/main/java/org/apache/aries/application/management/impl/
Date Thu, 18 Feb 2010 14:11:29 GMT
Author: gnodet
Date: Thu Feb 18 14:11:29 2010
New Revision: 911409

URL: http://svn.apache.org/viewvc?rev=911409&view=rev
Log:
The resolution process should be able to be done separatly from the AriesApplication creation

Modified:
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/AriesApplication.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationManager.java
    incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/AriesApplicationImpl.java
    incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/AriesApplicationManagerImpl.java

Modified: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/AriesApplication.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/AriesApplication.java?rev=911409&r1=911408&r2=911409&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/AriesApplication.java
(original)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/AriesApplication.java
Thu Feb 18 14:11:29 2010
@@ -54,6 +54,19 @@
    */
   public Set<BundleInfo> getBundleInfo();
 
+
+  /**
+   * Check if the application is resolved or not.
+   * An application is said to be resolved if it has a valid deployment metadata.
+   * During the installation process, an application will be automatically
+   * resolved if it is not already.
+   *
+   * @return if the appplication is resolved or not.
+   * @see org.apache.aries.application.management.AriesApplicationManager#install(AriesApplication)
 
+   * @see org.apache.aries.application.management.AriesApplicationManager#resolve(AriesApplication,
ResolveConstraint...)
+   */
+  public boolean isResolved();
+
   /** 
    * Persist this metadata. 
    * @param f The file to store this metadata to

Modified: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationManager.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationManager.java?rev=911409&r1=911408&r2=911409&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationManager.java
(original)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationManager.java
Thu Feb 18 14:11:29 2010
@@ -32,7 +32,10 @@
 public interface AriesApplicationManager
 {
   /**
-   * Create an AriesApplication from a local resource
+   * Create an AriesApplication from a local resource.
+   * The application won't be automatically resolved if the
+   * archive does not contain a deployment manifest.
+   *
    * @param source .eba file, or exploded directory
    * @return AriesApplication
    * @throws ManagementException
@@ -40,7 +43,10 @@
   public AriesApplication createApplication(IDirectory source) throws ManagementException;
   
   /**
-   * Create an AriesApplication from a remote resource
+   * Create an AriesApplication from a remote resource.
+   * The application won't be automatically resolved if the
+   * archive does not contain a deployment manifest.
+   *
    * @param url
    * @return
    * @throws ManagementException
@@ -49,13 +55,18 @@
   
   /**
    * Install an AriesApplication - i.e. load its bundles into the runtime, but do 
-   * not start them. 
+   * not start them.
+   * If the application is not resolved, a call to {@link #resolve(AriesApplication, ResolveConstraint...)}
+   * will be performed and the resolved application will be installed.  In such a case the
resolved
+   * application can be obtained by calling {@link org.apache.aries.application.management.ApplicationContext#getApplication()}
+   * on the returned ApplicationContext.
+   *
    * @param app Application to install 
    * @return ApplicationContext, a handle to an application in the runtime
    * @throws BundleException
    * @throws ManagementException 
    */
-  public ApplicationContext install(AriesApplication app) throws BundleException, ManagementException;
+  public ApplicationContext install(AriesApplication app) throws BundleException, ManagementException,
ResolverException;
   
   /**
    * Uninstall an AriesApplication - i.e. unload its bundles from the runtime. 
@@ -77,8 +88,10 @@
   public void removeApplicationListener(ApplicationListener l);
   
   /**
-   * Re-resolve an AriesApplication against a set of constraints. Each ResolveConstraint
-   * represents a single proposed change to the content of an 
+   * Resolve an AriesApplication against a set of constraints. Each ResolveConstraint
+   * represents a single proposed change to the content of an application.
+   * If no constraints are given, a default resolution will be performed.
+   *
    * @param originalApp Original application
    * @param constraints Constraints
    * @throws ResolverException

Modified: incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/AriesApplicationImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/AriesApplicationImpl.java?rev=911409&r1=911408&r2=911409&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/AriesApplicationImpl.java
(original)
+++ incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/AriesApplicationImpl.java
Thu Feb 18 14:11:29 2010
@@ -86,7 +86,11 @@
   public void setDeploymentMetadata (DeploymentMetadata dm) { 
     _deploymentMetadata = dm;
   }
-  
+
+  public Map<String, InputStream> getModifiedBundles() {
+    return _modifiedBundles;
+  }
+
   public void setModifiedBundles (Map<String, InputStream> modifiedBundles) {
     _modifiedBundles = modifiedBundles;
   }
@@ -95,6 +99,10 @@
     _localPlatform = lp;
   }
 
+  public boolean isResolved() {
+    return getDeploymentMetadata() != null;
+  }
+
   public void store(File f) throws FileNotFoundException, IOException {
     OutputStream os = new FileOutputStream (f);
     store(os);

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=911409&r1=911408&r2=911409&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
Thu Feb 18 14:11:29 2010
@@ -217,13 +217,23 @@
     return app;
   }
 
-  public AriesApplication resolve(AriesApplication originalApp,
-      ResolveConstraint... constraints) {
-    // TODO Auto-generated method stub
-    return null;
+  public AriesApplication resolve(AriesApplication originalApp, ResolveConstraint... constraints)
throws ResolverException {
+    AriesApplicationImpl application = new AriesApplicationImpl(originalApp.getApplicationMetadata(),
originalApp.getBundleInfo(), _localPlatform);
+    Set<BundleInfo> additionalBundlesRequired = _resolver.resolve(application);
+    DeploymentMetadata deploymentMetadata = _deploymentMetadataFactory.createDeploymentMetadata(application,
additionalBundlesRequired);
+    application.setDeploymentMetadata(deploymentMetadata);
+    // Store a reference to any modified bundles
+    if (originalApp instanceof AriesApplicationImpl) {
+        // TODO: are we really passing streams around ?
+        application.setModifiedBundles(((AriesApplicationImpl) originalApp).getModifiedBundles());
+    }
+    return application;
   } 
 
-  public ApplicationContext install(AriesApplication app) throws BundleException, ManagementException
{
+  public ApplicationContext install(AriesApplication app) throws BundleException, ManagementException,
ResolverException {
+    if (!app.isResolved()) {
+        app = resolve(app);
+    }
     ApplicationContext result = _applicationContextManager.getApplicationContext(app);
     return result;
   }



Mime
View raw message