incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mnutt...@apache.org
Subject svn commit: r895710 - in /incubator/aries/trunk/application: application-api/src/main/java/org/apache/aries/application/ application-api/src/main/java/org/apache/aries/application/management/ application-management/src/main/java/org/apache/aries/applic...
Date Mon, 04 Jan 2010 17:18:35 GMT
Author: mnuttall
Date: Mon Jan  4 17:18:30 2010
New Revision: 895710

URL: http://svn.apache.org/viewvc?rev=895710&view=rev
Log:
ARIES-89: Implement application support: Create deployment metadata

Added:
    incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/ExplodedEBA.java
    incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/DeploymentContentImpl.java
Modified:
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/ApplicationMetadata.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/Content.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/DeploymentMetadata.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationResolver.java
    incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/BundleConverter.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
    incubator/aries/trunk/application/application-management/src/main/resources/OSGI-INF/blueprint/app-management.xml
    incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ApplicationMetadataImpl.java
    incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ContentImpl.java
    incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/DeploymentMetadataFactoryImpl.java
    incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/DeploymentMetadataImpl.java
    incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/utils/messages/APPUTILSmessages.properties

Modified: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/ApplicationMetadata.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/ApplicationMetadata.java?rev=895710&r1=895709&r2=895710&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/ApplicationMetadata.java
(original)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/ApplicationMetadata.java
Mon Jan  4 17:18:30 2010
@@ -18,6 +18,8 @@
  */
 package org.apache.aries.application; 
 
+import java.io.File;
+import java.io.OutputStream;
 import java.util.List;
 
 import org.osgi.framework.Version;
@@ -70,4 +72,8 @@
    * @return    the value of the AppScope
    */
   public String getApplicationScope();
+  
+  /** Stores any changes to disk using this implementation's storage form */
+  public void store(File f);
+  public void store(OutputStream out);
 }

Modified: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/Content.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/Content.java?rev=895710&r1=895709&r2=895710&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/Content.java
(original)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/Content.java
Mon Jan  4 17:18:30 2010
@@ -34,12 +34,6 @@
   public String getContentName();
   
   /**
-   * get the entire content including the content name, directives & attributes
-   * @return the entire content in String format
-   */
-  public String getContent();
-  
-  /**
    * get the attributes of the content
    * @return    the attributes of the content
    */

Modified: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/DeploymentMetadata.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/DeploymentMetadata.java?rev=895710&r1=895709&r2=895710&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/DeploymentMetadata.java
(original)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/DeploymentMetadata.java
Mon Jan  4 17:18:30 2010
@@ -19,6 +19,8 @@
 
 package org.apache.aries.application;
 
+import java.io.File;
+import java.io.OutputStream;
 import java.util.List;
 
 import org.osgi.framework.Version;
@@ -53,4 +55,8 @@
    * @return the application.
    */
   public ApplicationMetadata getApplicationMetadata();
+  
+  /** Stores any changes to disk using this implementation's storage form */
+  public void store(File f);
+  public void store(OutputStream in);
 }

Modified: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationResolver.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationResolver.java?rev=895710&r1=895709&r2=895710&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationResolver.java
(original)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/AriesApplicationResolver.java
Mon Jan  4 17:18:30 2010
@@ -26,7 +26,8 @@
   /** Resolve an AriesApplication 
    * 
    * @param app The application to resolve
-   * @return The complete set of bundles required to resolve the application
+   * @return The additional bundles required to ensure that the application resolves. This
+   *         set will not include those provided by value within the application. 
    */
   Set<BundleInfo> resolve (AriesApplication app);
 }

Modified: incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/BundleConverter.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/BundleConverter.java?rev=895710&r1=895709&r2=895710&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/BundleConverter.java
(original)
+++ incubator/aries/trunk/application/application-api/src/main/java/org/apache/aries/application/management/BundleConverter.java
Mon Jan  4 17:18:30 2010
@@ -21,6 +21,8 @@
 
 import java.io.InputStream;
 
+import org.apache.aries.application.filesystem.IDirectory;
+
 /**
  * A BundleConverter turns a .jar that is not an OSGi bundle into a well formed OSGi bundle,
  * or a .war that is not a WAB into a WAB. 
@@ -29,9 +31,11 @@
   /**
    * 
    * @param inputBundle Stream to the input bundle
-   * @param bundleFileName Used to infer which type of conversion is required. 
+   * @param artifact The root of the eba containing the artifact being converted - 
+   *                 currently a .zip file. In time we may come to support this 
+   *                 being an exploded directory.  
    * @return valid input stream or null if the bundle could not be converted. 
    */
-  public InputStream convert (InputStream inputBundle, String bundleFileName);
+  public InputStream convert (InputStream inputBundle, IDirectory parentEba);
 
 }

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=895710&r1=895709&r2=895710&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
Mon Jan  4 17:18:30 2010
@@ -20,8 +20,10 @@
 package org.apache.aries.application.management.impl;
 
 import java.io.File;
+import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import org.apache.aries.application.ApplicationMetadata;
@@ -35,6 +37,10 @@
   private ApplicationMetadata _applicationMetadata;
   private DeploymentMetadata _deploymentMetadata;
   
+  // Placeholders for information we'll need for store()
+  private boolean _applicationManifestChanged = false;
+  private Map<String, InputStream> _modifiedBundles = null;
+  
   public AriesApplicationImpl(ApplicationMetadata meta, Set<BundleInfo> bundleInfo)
{
     _applicationMetadata = meta;
     _bundleInfo = bundleInfo;
@@ -51,8 +57,7 @@
   }
 
   public DeploymentMetadata getDeploymentMetadata() {
-    // TODO Auto-generated method stub
-    return null;
+    return _deploymentMetadata;
   }
 
   public void store(File f) {
@@ -69,4 +74,14 @@
     _deploymentMetadata = dm;
   }
 
+  // When store() is called we'll need to know whether application.mf was changed, 
+  // or any constituent .wars or .jars migrated to bundles in the course of constructing
+  // the AriesApplication. 
+  void setApplicationManifestChanged (boolean changed) { 
+    _applicationManifestChanged = changed;
+  }
+  
+  void setModifiedBundles (Map<String, InputStream> modifiedBundles) { 
+    _modifiedBundles = modifiedBundles;
+  }
 }

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=895710&r1=895709&r2=895710&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
Mon Jan  4 17:18:30 2010
@@ -29,7 +29,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.jar.Attributes;
 import java.util.jar.Manifest;
 
 import org.apache.aries.application.ApplicationMetadata;
@@ -91,6 +90,7 @@
     DeploymentMetadata deploymentMetadata;
     Map<String, InputStream> modifiedBundles = new HashMap<String, InputStream>();
     AriesApplicationImpl application = null;
+    boolean manifestChanged = false;
     
     try { 
       if (!ebaFile.isFile()) { 
@@ -101,22 +101,20 @@
       // Locate META-INF/APPLICATION.MF and ensure that the 
       // manifest has the necessary fields set 
       Manifest applicationManifest = parseManifest (ebaFile, AppConstants.APPLICATION_MF);
-      boolean manifestChanged = ManifestDefaultsInjector.updateManifest(applicationManifest,
ebaFile.getName(), ebaFile); 
+      manifestChanged = ManifestDefaultsInjector.updateManifest(applicationManifest, ebaFile.getName(),
ebaFile); 
       applicationMetadata = _applicationMetadataManager.createApplicationMetadata(applicationManifest);
 
       Manifest deploymentManifest = parseManifest (ebaFile, AppConstants.DEPLOYMENT_MF);
       if (deploymentManifest != null) {
         // If there's a deployment.mf present, check it matches applicationManifest, and
if so, use it
       } else { 
-        //   -- Look for application.xml to support .war file migration
-        //   -- Process any other files in the .eba, i.e. migrate wars to wabs, plain jars
to bundles
+        //  -- Process any other files in the .eba, i.e. migrate wars to wabs, plain jars
to bundles
         IDirectory eba = FileSystem.getFSRoot(ebaFile);
-        IFile appXml = eba.getFile(AppConstants.APPLICATION_XML);
+        
         Set<BundleInfo> bundleInfo = new HashSet<BundleInfo>();
         for (IFile f : eba) { 
           BundleManifest bm = getBundleManifest (f);
           if (bm != null) {
-            Attributes bundleAttributes;
             if (bm.isValid()) {
               bundleInfo.add(new BundleInfoImpl(bm, null));
             } else { 
@@ -128,13 +126,15 @@
                 Iterator<BundleConverter> converters = _bundleConverters.iterator();
                 while (converters.hasNext() && convertedBinary == null) { 
                   try { 
-                    convertedBinary = converters.next().convert(is, f.getName());
+                    // WarToWabConverter can extract application.xml via
+                    // eba.getFile(AppConstants.APPLICATION_XML);
+                    convertedBinary = converters.next().convert(is, eba);
                   } catch (ServiceException sx) {
                     // We'll get this if our optional BundleConverter has not been injected.

                   }
                 }
                 if (convertedBinary != null) { 
-                  modifiedBundles.put (f.getName(), convertedBinary); // I expect I'll need
the filename in a bit
+                  modifiedBundles.put (f.getName(), convertedBinary); 
                   bm = BundleManifest.fromBundle(is);
                   bundleInfo.add(new BundleInfoImpl(bm, null));
                 }
@@ -144,19 +144,22 @@
                 } catch (IOException iox) {}
               }
             }
-          }
+          } 
         }
         application = new AriesApplicationImpl (applicationMetadata, bundleInfo);
-        Set<BundleInfo> resolvedBundles = _resolver.resolve(application);
-        deploymentMetadata = _deploymentMetadataFactory.createDeploymentMetadata(application,
resolvedBundles);
+        Set<BundleInfo> additionalBundlesRequired = _resolver.resolve(application);
+        deploymentMetadata = _deploymentMetadataFactory.createDeploymentMetadata(application,
additionalBundlesRequired);
         application.setDeploymentMetadata(deploymentMetadata);
+        
+        // We may have changed parts of its content. The application's store()
+        // method needs to be able to work. Do something with modifiedBundles 
+        // and manifestChanged. We'll save them in the application for now. 
+        application.setApplicationManifestChanged (manifestChanged);
+        application.setModifiedBundles (modifiedBundles);
+        
       }
-      
-      // We may have changed parts of its content. The application's store()
-      // method needs to be able to work. Do something with modifiedBundles 
-      // and manifestChanged
-      
     } catch (IOException iox) { 
+      // Log an error
       throw new ManagementException(iox);
     }
     

Added: incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/ExplodedEBA.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/ExplodedEBA.java?rev=895710&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/ExplodedEBA.java
(added)
+++ incubator/aries/trunk/application/application-management/src/main/java/org/apache/aries/application/management/impl/ExplodedEBA.java
Mon Jan  4 17:18:30 2010
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.aries.application.management.impl;
+
+/**
+ * An administrator may supply an application.eba file that will be changed before deployment.
 
+ * We may augment, or even create, META-INF/APPLICATION.MF. 
+ * We will create META-INF/DEPLOYMENT.MF if one does not exist. 
+ * We may migrate plain .war files to WABs, and may also migrate plain .jar files to become

+ * well formed bundles. Thus the .eba file that will be subsequently used to provide bundles
into 
+ * the application server's runtime may differ from that originally provided by the administrator.

+ * This class handles the creation of the modified .eba artifact. 
+ */
+public class ExplodedEBA {
+
+  // TODO
+  
+}

Modified: incubator/aries/trunk/application/application-management/src/main/resources/OSGI-INF/blueprint/app-management.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-management/src/main/resources/OSGI-INF/blueprint/app-management.xml?rev=895710&r1=895709&r2=895710&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-management/src/main/resources/OSGI-INF/blueprint/app-management.xml
(original)
+++ incubator/aries/trunk/application/application-management/src/main/resources/OSGI-INF/blueprint/app-management.xml
Mon Jan  4 17:18:30 2010
@@ -32,8 +32,6 @@
                   interface="org.apache.aries.application.management.BundleConverter"
                   availability="optional"/>
   <reference id="resolver" interface="org.apache.aries.application.management.AriesApplicationResolver"/>
-             
-  
     
   <service interface="org.apache.aries.application.management.AriesApplicationManager"
ref="manager-service" />
   

Modified: incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ApplicationMetadataImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ApplicationMetadataImpl.java?rev=895710&r1=895709&r2=895710&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ApplicationMetadataImpl.java
(original)
+++ incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ApplicationMetadataImpl.java
Mon Jan  4 17:18:30 2010
@@ -18,6 +18,8 @@
  */
 package org.apache.aries.application.impl;
 
+import java.io.File;
+import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -169,4 +171,14 @@
   {
     return appScope.hashCode();
   }
+
+  public void store(File f) {
+    // TODO when writing AriesApplication.store()
+    
+  }
+
+  public void store(OutputStream out) {
+    // TODO when writing AriesApplication.store()
+    
+  }
 }
\ No newline at end of file

Modified: incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ContentImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ContentImpl.java?rev=895710&r1=895709&r2=895710&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ContentImpl.java
(original)
+++ incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ContentImpl.java
Mon Jan  4 17:18:30 2010
@@ -24,6 +24,11 @@
 
 import org.apache.aries.application.Content;
 import org.apache.aries.application.VersionRange;
+import org.apache.aries.application.utils.internal.MessageUtil;
+import org.apache.aries.application.utils.manifest.ManifestHeaderProcessor;
+import org.apache.aries.application.utils.manifest.ManifestHeaderProcessor.NameValueMap;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Version;
 
 
 /**
@@ -32,24 +37,44 @@
  */
 public final class ContentImpl implements Content
 {
-  private String content;
   private String contentName;
   protected Map<String, String> attributes;
   private Map<String, String> directives;
+  private NameValueMap<String, String> nameValueMap;
   
   /**
    * 
    * @param content  Application-Content, Import-Package content
    */
   public ContentImpl(String content) {
-    this.content = content;
-    this.attributes = new HashMap<String, String>();
-    this.directives = new HashMap<String, String>();
-    setup(content, this.attributes, this.directives);
+    Map<String, NameValueMap<String, String>> appContentsMap = ManifestHeaderProcessor.parseImportString(content);
+    if (appContentsMap.size() != 1) {
+      throw new IllegalArgumentException(MessageUtil.getMessage("APPUTILS0004E",content));
+    }
+    for (Map.Entry<String, NameValueMap<String, String>> entry : appContentsMap.entrySet())
{
+      this.contentName = entry.getKey();
+      this.nameValueMap= entry.getValue();
+      setup();
+      break;
+    }
+  }
+  
+  public ContentImpl (String bundleSymbolicName, Version version) { 
+    this.contentName = bundleSymbolicName;
+    this.nameValueMap = new NameValueMap<String, String>();
+    nameValueMap.put("version", version.toString());
+    setup();
   }
   
-  public String getContent() {
-    return this.content;
+  /**
+   * 
+   * @param contentName  
+   * @param nameValueMap
+   */
+  public ContentImpl(String contentName, NameValueMap<String, String> nameValueMap)
{
+    this.contentName = contentName;
+    this.nameValueMap= nameValueMap;
+    setup();
   }
   
   public String getContentName() {
@@ -94,10 +119,12 @@
   
   public VersionRange getVersion() {
     VersionRange vi = null;
-    if (this.attributes.get("version") != null && this.attributes.get("version").length()
> 0) {
-      vi = new VersionRangeImpl(this.attributes.get("version"));
+    if (this.attributes.get(Constants.VERSION_ATTRIBUTE) != null 
+        && this.attributes.get(Constants.VERSION_ATTRIBUTE).length() > 0) {
+      vi = ManifestHeaderProcessor.parseVersionRange(this.attributes.get(Constants.VERSION_ATTRIBUTE));
     } else {
-      vi = new VersionRangeImpl("0.0.0");
+      // what if version is not specified?  let's interpret it as 0.0.0 
+      vi = ManifestHeaderProcessor.parseVersionRange("0.0.0");
     }
     return vi;
   }
@@ -105,7 +132,7 @@
   @Override
   public String toString()
   {
-    return content;
+    return this.contentName + ";" + this.nameValueMap.toString();
   }
   
   @Override
@@ -147,43 +174,18 @@
   }
   
   /**
-   * setup attributes and directives from the Application-Content or Import-Package
-   * @param content
-   * @param attributes
-   * @param directives
+   * set up directives and attributes
    */
-  protected void setup(String content, Map<String, String> attributes, Map<String,
String> directives)
-  {
-    String[] tokens = content.split(";");
-    if (tokens.length < 1) {
-      throw new IllegalArgumentException("Invalid content: " + content);
-    }
-    this.contentName = tokens[0].trim();
-    for (int i = 1; i < tokens.length; i++) {
-      int pos = tokens[i].indexOf('=');
-      if (pos != -1) {
-        if (pos > 0 && tokens[i].charAt(pos - 1) == ':') {
-          String name = tokens[i].substring(0, pos - 1).trim();
-          String value = tokens[i].substring(pos + 1).trim();
-          directives.put(name, trimDoubleQuotes(value));
-        } else {
-          String name = tokens[i].substring(0, pos).trim();
-          String value = tokens[i].substring(pos + 1).trim();
-          attributes.put(name, trimDoubleQuotes(value));
-        }
+  protected void setup() {
+    this.attributes = new HashMap<String, String>();
+    this.directives = new HashMap<String, String>();
+    
+    for (String key : this.nameValueMap.keySet()) {
+      if (key.endsWith(":")) {
+        this.directives.put(key.substring(0, key.length() - 1), this.nameValueMap.get(key));
+      } else {
+        this.attributes.put(key, this.nameValueMap.get(key));
       }
     }
   }
-  
-  /**
-   * this method trims the double quotes at the beginning and end, for example version="1.0.0"
-   * @param value
-   * @return
-   */
-  private String trimDoubleQuotes(String value) {
-    if (value.startsWith("\"") && value.endsWith("\"")) {
-      value = value.substring(1, value.length() -1);
-    }   
-    return value;
-  }
 }

Added: incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/DeploymentContentImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/DeploymentContentImpl.java?rev=895710&view=auto
==============================================================================
--- incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/DeploymentContentImpl.java
(added)
+++ incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/DeploymentContentImpl.java
Mon Jan  4 17:18:30 2010
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.aries.application.impl;
+
+import java.util.Map;
+
+import org.apache.aries.application.DeploymentContent;
+import org.apache.aries.application.VersionRange;
+import org.osgi.framework.Version;
+
+public class DeploymentContentImpl implements DeploymentContent {
+  
+  private ContentImpl _content;
+  
+  public DeploymentContentImpl (String content) { 
+    _content = new ContentImpl (content);
+  }
+  
+  public DeploymentContentImpl (String bundleSymbolicName, Version version) { 
+    _content = new ContentImpl (bundleSymbolicName, version);
+  }
+
+  public Version getExactVersion() {
+    return getVersion().getExactVersion();
+  }
+
+  public String getAttribute(String key) {
+    return _content.getAttribute(key);
+  }
+
+  public Map<String, String> getAttributes() {
+    return _content.getAttributes();
+  }
+
+  public String getContentName() {
+    return _content.getContentName();
+  }
+
+  public String getDirective(String key) {
+    return _content.getDirective(key);
+  }
+
+  public Map<String, String> getDirectives() {
+    return _content.getDirectives();
+  }
+
+  public VersionRange getVersion() {
+    return _content.getVersion();
+  }
+
+}

Modified: incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/DeploymentMetadataFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/DeploymentMetadataFactoryImpl.java?rev=895710&r1=895709&r2=895710&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/DeploymentMetadataFactoryImpl.java
(original)
+++ incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/DeploymentMetadataFactoryImpl.java
Mon Jan  4 17:18:30 2010
@@ -20,9 +20,7 @@
 package org.apache.aries.application.impl;
 
 import java.util.Set;
-import java.util.jar.Manifest;
 
-import org.apache.aries.application.ApplicationMetadata;
 import org.apache.aries.application.DeploymentMetadata;
 import org.apache.aries.application.DeploymentMetadataFactory;
 import org.apache.aries.application.management.AriesApplication;
@@ -31,11 +29,7 @@
 public class DeploymentMetadataFactoryImpl implements DeploymentMetadataFactory {
 
   public DeploymentMetadata createDeploymentMetadata(AriesApplication app,
-      Set<BundleInfo> bundleInfo) {
-    // TODO Auto-generated method stub
-    return null;
+      Set<BundleInfo> additionalBundlesRequired) {
+    return new DeploymentMetadataImpl (app, additionalBundlesRequired);
   }
-
-  
-
 }

Modified: incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/DeploymentMetadataImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/DeploymentMetadataImpl.java?rev=895710&r1=895709&r2=895710&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/DeploymentMetadataImpl.java
(original)
+++ incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/DeploymentMetadataImpl.java
Mon Jan  4 17:18:30 2010
@@ -19,33 +19,61 @@
 
 package org.apache.aries.application.impl;
 
+import java.io.File;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
+import java.util.Set;
 
 import org.apache.aries.application.ApplicationMetadata;
 import org.apache.aries.application.DeploymentContent;
 import org.apache.aries.application.DeploymentMetadata;
+import org.apache.aries.application.management.AriesApplication;
+import org.apache.aries.application.management.BundleInfo;
 import org.osgi.framework.Version;
 
 public class DeploymentMetadataImpl implements DeploymentMetadata {
+  
+  ApplicationMetadata _applicationMetadata;
+  List<DeploymentContent> _deploymentContent;
+  
+  public DeploymentMetadataImpl (AriesApplication app, Set<BundleInfo> additionalBundlesRequired)
{
+    _applicationMetadata = app.getApplicationMetadata();
+    _deploymentContent = new ArrayList<DeploymentContent>();
+    for (BundleInfo bundleInfo : additionalBundlesRequired) { 
+      DeploymentContentImpl dci = new DeploymentContentImpl(bundleInfo.getSymbolicName(),

+          bundleInfo.getVersion()); 
+      _deploymentContent.add(dci);
+    }
+  }
 
   public List<DeploymentContent> getApplicationDeploymentContents() {
-    // TODO Auto-generated method stub
-    return null;
+    return Collections.unmodifiableList(_deploymentContent);
   }
 
   public ApplicationMetadata getApplicationMetadata() {
-    // TODO Auto-generated method stub
-    return null;
+    return _applicationMetadata;
   }
 
   public String getApplicationSymbolicName() {
-    // TODO Auto-generated method stub
-    return null;
+    return _applicationMetadata.getApplicationSymbolicName();
   }
 
   public Version getApplicationVersion() {
-    // TODO Auto-generated method stub
-    return null;
+    return _applicationMetadata.getApplicationVersion();
+  }
+
+
+  public void store(File f) {
+    // TODO when writing AriesApplication.store()
+    
+  }
+
+
+  public void store(OutputStream in) {
+    // TODO when writing AriesApplication.store()
+    
   }
 
 }

Modified: incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/utils/messages/APPUTILSmessages.properties
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/utils/messages/APPUTILSmessages.properties?rev=895710&r1=895709&r2=895710&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/utils/messages/APPUTILSmessages.properties
(original)
+++ incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/utils/messages/APPUTILSmessages.properties
Mon Jan  4 17:18:30 2010
@@ -1,3 +1,4 @@
+APPUTILS0004E=APPUTILS0004E: Unable to create ContentImpl object based on content: {0}.
 APPUTILS0007E=APPUTILS0007E: The path {0} does not denote a valid file.
 APPUTILS0008E=APPUTILS0008E: Unable to parse the string, because one of the quotations marks
(") is missing: {0}.
 APPUTILS0009E=APPUTILS0009E: Unable to parse the version. Could not parse {0}.



Mime
View raw message