You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by ga...@apache.org on 2010/01/15 03:17:41 UTC

svn commit: r899518 [3/7] - in /incubator/aries/trunk/application: ./ application-api/ application-api/src/main/java/org/apache/aries/application/ application-api/src/main/java/org/apache/aries/application/filesystem/ application-api/src/main/java/org/...

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=899518&r1=899517&r2=899518&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 Fri Jan 15 02:17:38 2010
@@ -1,42 +1,42 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    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 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
-            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0">
-  
-  <bean id="app-manager" class="org.apache.aries.application.management.impl.AriesApplicationManagerImpl" scope="singleton" activation="lazy">
-    <property name="applicationMetadataManager" ref="app-metadata-manager"/>
-    <property name="deploymentMetadataFactory" ref="deployment-metadata-factory"/>
-    <property name="bundleConverters" ref="bundle-converters"/>
-    <property name="resolver" ref="resolver"/>
-    <property name="localPlatform" ref="localPlatform"/>
-    <property name="applicationContextManager" ref="application-context-manager"/>
-  </bean>
-  
-  <reference id="app-metadata-manager" interface="org.apache.aries.application.ApplicationMetadataManager"/>
-  <reference id="deployment-metadata-factory" interface="org.apache.aries.application.DeploymentMetadataFactory"/>
-  <reference-list id="bundle-converters" 
-                  interface="org.apache.aries.application.management.BundleConverter"
-                  availability="optional"/>
-  <reference id="resolver" interface="org.apache.aries.application.management.AriesApplicationResolver"/>
-  <reference id="localPlatform" interface="org.apache.aries.application.management.LocalPlatform"/>
-  <reference id="application-context-manager" interface="org.apache.aries.application.management.ApplicationContextManager"/>
-    
-  <service interface="org.apache.aries.application.management.AriesApplicationManager" ref="manager-service" />
-  
-</blueprint>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+  
+  <bean id="app-manager" class="org.apache.aries.application.management.impl.AriesApplicationManagerImpl" scope="singleton" activation="lazy">
+    <property name="applicationMetadataManager" ref="app-metadata-manager"/>
+    <property name="deploymentMetadataFactory" ref="deployment-metadata-factory"/>
+    <property name="bundleConverters" ref="bundle-converters"/>
+    <property name="resolver" ref="resolver"/>
+    <property name="localPlatform" ref="localPlatform"/>
+    <property name="applicationContextManager" ref="application-context-manager"/>
+  </bean>
+  
+  <reference id="app-metadata-manager" interface="org.apache.aries.application.ApplicationMetadataManager"/>
+  <reference id="deployment-metadata-factory" interface="org.apache.aries.application.DeploymentMetadataFactory"/>
+  <reference-list id="bundle-converters" 
+                  interface="org.apache.aries.application.management.BundleConverter"
+                  availability="optional"/>
+  <reference id="resolver" interface="org.apache.aries.application.management.AriesApplicationResolver"/>
+  <reference id="localPlatform" interface="org.apache.aries.application.management.LocalPlatform"/>
+  <reference id="application-context-manager" interface="org.apache.aries.application.management.ApplicationContextManager"/>
+    
+  <service interface="org.apache.aries.application.management.AriesApplicationManager" ref="manager-service" />
+  
+</blueprint>

Propchange: incubator/aries/trunk/application/application-management/src/main/resources/OSGI-INF/blueprint/app-management.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/trunk/application/application-management/src/main/resources/OSGI-INF/blueprint/app-management.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/application/application-management/src/main/resources/OSGI-INF/blueprint/app-management.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

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=899518&r1=899517&r2=899518&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 Fri Jan 15 02:17:38 2010
@@ -1,203 +1,203 @@
-/*
- * 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;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.aries.application.ApplicationMetadata;
-import org.apache.aries.application.ApplicationMetadataManager;
-import org.apache.aries.application.Content;
-import org.apache.aries.application.DeploymentContent;
-import org.apache.aries.application.DeploymentMetadata;
-import org.apache.aries.application.DeploymentMetadataFactory;
-import org.apache.aries.application.filesystem.IDirectory;
-import org.apache.aries.application.filesystem.IFile;
-import org.apache.aries.application.impl.ApplicationMetadataManagerImpl;
-import org.apache.aries.application.impl.ContentImpl;
-import org.apache.aries.application.impl.DeploymentContentImpl;
-import org.apache.aries.application.impl.DeploymentMetadataFactoryImpl;
-import org.apache.aries.application.management.AriesApplication;
-import org.apache.aries.application.management.AriesApplicationResolver;
-import org.apache.aries.application.management.BundleConverter;
-import org.apache.aries.application.management.BundleInfo;
-import org.apache.aries.application.management.LocalPlatform;
-import org.apache.aries.application.management.ManagementException;
-import org.apache.aries.application.management.impl.AriesApplicationManagerImpl;
-import org.apache.aries.application.management.impl.BundleInfoImpl;
-import org.apache.aries.application.utils.filesystem.FileSystem;
-import org.apache.aries.application.utils.filesystem.IOUtils;
-import org.apache.aries.application.utils.manifest.BundleManifest;
-import org.apache.aries.unittest.utils.EbaUnitTestUtils;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.osgi.framework.Version;
-
-/**
- * Initial, simple test that creates and stores an AriesApplication. No
- * BundleConverters are used in this test. 
- */
-public class AriesApplicationManagerImplTest {
-  
-  static class DummyResolver implements AriesApplicationResolver {
-    Set<BundleInfo> nextResult;
-    public Set<BundleInfo> resolve(AriesApplication app) {
-      return nextResult;
-    } 
-    void setNextResult (Set<BundleInfo> r) { 
-      nextResult = r;
-    }
-  }
-  
-  static class DummyLocalPlatform implements LocalPlatform {
-    public File getTemporaryDirectory() throws IOException {
-      File f = File.createTempFile("ebaTmp", null);
-      f.delete();
-      f.mkdir();
-      return f;
-    } 
-    public File getTemporaryFile () throws IOException { 
-      // Not used
-      return File.createTempFile("ebaTmp", null);
-    }
-  }
-
-  static final String TEST_EBA = "./ariesApplicationManagerImplTest/test.eba";
-  
-  @BeforeClass 
-  public static void preTest() throws Exception { 
-    new File("ariesApplicationManagerImplTest").mkdir();
-    EbaUnitTestUtils.createEba("../src/test/resources/bundles/test.eba", TEST_EBA);
-    File src = new File ("../src/test/resources/bundles/repository/a.handy.persistence.library.jar");
-    File dest = new File ("ariesApplicationManagerImplTest/a.handy.persistence.library.jar");
-    IOUtils.zipUp(src, dest);
-  }
-  
-  AriesApplicationManagerImpl _appMgr;
-  ApplicationMetadataManager _appMetaMgr;
-  DummyResolver _resolver;
-  
-  @Before
-  public void setup() { 
-    _appMgr = new AriesApplicationManagerImpl ();
-    _appMetaMgr = new ApplicationMetadataManagerImpl ();
-
-    DeploymentMetadataFactory dmf = new DeploymentMetadataFactoryImpl();
-    List<BundleConverter> bundleConverters = new ArrayList<BundleConverter>();
-    _resolver = new DummyResolver();
-    
-    _appMgr.setApplicationMetadataManager(_appMetaMgr);
-    _appMgr.setDeploymentMetadataFactory(dmf);
-    _appMgr.setBundleConverters(bundleConverters);
-    _appMgr.setResolver(_resolver);
-    _appMgr.setLocalPlatform(new DummyLocalPlatform());
-  }
-  
-  @Test
-  public void testCreate() throws Exception { 
-    AriesApplication app = createApplication (TEST_EBA);
-    
-    ApplicationMetadata appMeta = app.getApplicationMetadata();
-    assertEquals (appMeta.getApplicationName(), "Test application");
-    assertEquals (appMeta.getApplicationSymbolicName(), "org.apache.aries.application.management.test");
-    assertEquals (appMeta.getApplicationVersion(), new Version("1.0"));
-    List<Content> appContent = appMeta.getApplicationContents();
-    assertEquals (appContent.size(), 2);
-    Content fbw = new ContentImpl("foo.bar.widgets;version=1.0.0");
-    Content mbl = new ContentImpl("my.business.logic;version=1.0.0");
-    assertTrue (appContent.contains(fbw));
-    assertTrue (appContent.contains(mbl));
-    
-    DeploymentMetadata dm = app.getDeploymentMetadata();
-    List<DeploymentContent> dcList = dm.getApplicationDeploymentContents();
-    
-    assertEquals (dcList.size(), 3);
-    DeploymentContent dc1 = new DeploymentContentImpl ("foo.bar.widgets;deployed-version=1.0.0");
-    DeploymentContent dc2 = new DeploymentContentImpl ("my.business.logic;deployed-version=1.0.0");
-    DeploymentContent dc3 = new DeploymentContentImpl ("a.handy.persistence.library;deployed-version=1.1.0");
-    assertTrue (dcList.contains(dc1));
-    assertTrue (dcList.contains(dc2));
-    assertTrue (dcList.contains(dc3));
-  
-  }
-  
-  @Test
-  public void testStoreAndReload() throws Exception { 
-    AriesApplication app = createApplication (TEST_EBA);
-    File dest = new File ("ariesApplicationManagerImplTest/stored.eba");
-    app.store(dest);
-    
-    /* Dest should be a zip file with four entries:
-     *  /foo.bar.widgets.jar
-     *  /my.business.logic.jar
-     *  /META-INF/APPLICATION.MF
-     *  /META-INF/DEPLOYMENT.MF
-     */
-    
-    IDirectory storedEba = FileSystem.getFSRoot(dest);
-    assertNotNull (storedEba);
-    assertEquals (storedEba.listFiles().size(), 3);
-    IFile ifile = storedEba.getFile("META-INF/APPLICATION.MF");
-    assertNotNull (ifile);
-    ifile = storedEba.getFile ("META-INF/DEPLOYMENT.MF");
-    assertNotNull (ifile);
-    ifile = storedEba.getFile ("foo.bar.widgets.jar");
-    assertNotNull (ifile);
-    ifile = storedEba.getFile ("my.business.logic.jar");
-    assertNotNull (ifile);
-    
-    AriesApplication newApp = _appMgr.createApplication(storedEba);
-    DeploymentMetadata dm = newApp.getDeploymentMetadata();
-    assertEquals (dm.getApplicationDeploymentContents().size(), 3);
-    assertEquals (dm.getApplicationSymbolicName(), app.getApplicationMetadata().getApplicationSymbolicName());
-    assertEquals (dm.getApplicationVersion(), app.getApplicationMetadata().getApplicationVersion());
-  }
-  
-  private AriesApplication createApplication (String fileName) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException, ManagementException  { 
-    // This next block is a very long winded way of constructing a BundleInfoImpl
-    // against the existing (BundleManifest bm, String location) constructor. If we 
-    // find we need a String-based BundleInfoImpl constructor for other reasons, 
-    // we could change to using it here. 
-    Set<BundleInfo> nextResolverResult = new HashSet<BundleInfo>();
-    String persistenceLibraryLocation = "../src/test/resources/bundles/repository/a.handy.persistence.library.jar";
-    File persistenceLibrary = new File (persistenceLibraryLocation);
-    BundleManifest mf = BundleManifest.fromBundle(persistenceLibrary);
-    BundleInfo resolvedPersistenceLibrary = new BundleInfoImpl(mf, persistenceLibraryLocation); 
-    Field v = BundleInfoImpl.class.getDeclaredField("_version");
-    v.setAccessible(true);
-    v.set(resolvedPersistenceLibrary, new Version("1.1.0"));
-    nextResolverResult.add(resolvedPersistenceLibrary);
-    _resolver.setNextResult(nextResolverResult);
-    
-    IDirectory testEba = FileSystem.getFSRoot(new File(TEST_EBA));
-    AriesApplication app = _appMgr.createApplication(testEba);
-    return app;
-  }
-}
+/*
+ * 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;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.aries.application.ApplicationMetadata;
+import org.apache.aries.application.ApplicationMetadataManager;
+import org.apache.aries.application.Content;
+import org.apache.aries.application.DeploymentContent;
+import org.apache.aries.application.DeploymentMetadata;
+import org.apache.aries.application.DeploymentMetadataFactory;
+import org.apache.aries.application.filesystem.IDirectory;
+import org.apache.aries.application.filesystem.IFile;
+import org.apache.aries.application.impl.ApplicationMetadataManagerImpl;
+import org.apache.aries.application.impl.ContentImpl;
+import org.apache.aries.application.impl.DeploymentContentImpl;
+import org.apache.aries.application.impl.DeploymentMetadataFactoryImpl;
+import org.apache.aries.application.management.AriesApplication;
+import org.apache.aries.application.management.AriesApplicationResolver;
+import org.apache.aries.application.management.BundleConverter;
+import org.apache.aries.application.management.BundleInfo;
+import org.apache.aries.application.management.LocalPlatform;
+import org.apache.aries.application.management.ManagementException;
+import org.apache.aries.application.management.impl.AriesApplicationManagerImpl;
+import org.apache.aries.application.management.impl.BundleInfoImpl;
+import org.apache.aries.application.utils.filesystem.FileSystem;
+import org.apache.aries.application.utils.filesystem.IOUtils;
+import org.apache.aries.application.utils.manifest.BundleManifest;
+import org.apache.aries.unittest.utils.EbaUnitTestUtils;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.osgi.framework.Version;
+
+/**
+ * Initial, simple test that creates and stores an AriesApplication. No
+ * BundleConverters are used in this test. 
+ */
+public class AriesApplicationManagerImplTest {
+  
+  static class DummyResolver implements AriesApplicationResolver {
+    Set<BundleInfo> nextResult;
+    public Set<BundleInfo> resolve(AriesApplication app) {
+      return nextResult;
+    } 
+    void setNextResult (Set<BundleInfo> r) { 
+      nextResult = r;
+    }
+  }
+  
+  static class DummyLocalPlatform implements LocalPlatform {
+    public File getTemporaryDirectory() throws IOException {
+      File f = File.createTempFile("ebaTmp", null);
+      f.delete();
+      f.mkdir();
+      return f;
+    } 
+    public File getTemporaryFile () throws IOException { 
+      // Not used
+      return File.createTempFile("ebaTmp", null);
+    }
+  }
+
+  static final String TEST_EBA = "./ariesApplicationManagerImplTest/test.eba";
+  
+  @BeforeClass 
+  public static void preTest() throws Exception { 
+    new File("ariesApplicationManagerImplTest").mkdir();
+    EbaUnitTestUtils.createEba("../src/test/resources/bundles/test.eba", TEST_EBA);
+    File src = new File ("../src/test/resources/bundles/repository/a.handy.persistence.library.jar");
+    File dest = new File ("ariesApplicationManagerImplTest/a.handy.persistence.library.jar");
+    IOUtils.zipUp(src, dest);
+  }
+  
+  AriesApplicationManagerImpl _appMgr;
+  ApplicationMetadataManager _appMetaMgr;
+  DummyResolver _resolver;
+  
+  @Before
+  public void setup() { 
+    _appMgr = new AriesApplicationManagerImpl ();
+    _appMetaMgr = new ApplicationMetadataManagerImpl ();
+
+    DeploymentMetadataFactory dmf = new DeploymentMetadataFactoryImpl();
+    List<BundleConverter> bundleConverters = new ArrayList<BundleConverter>();
+    _resolver = new DummyResolver();
+    
+    _appMgr.setApplicationMetadataManager(_appMetaMgr);
+    _appMgr.setDeploymentMetadataFactory(dmf);
+    _appMgr.setBundleConverters(bundleConverters);
+    _appMgr.setResolver(_resolver);
+    _appMgr.setLocalPlatform(new DummyLocalPlatform());
+  }
+  
+  @Test
+  public void testCreate() throws Exception { 
+    AriesApplication app = createApplication (TEST_EBA);
+    
+    ApplicationMetadata appMeta = app.getApplicationMetadata();
+    assertEquals (appMeta.getApplicationName(), "Test application");
+    assertEquals (appMeta.getApplicationSymbolicName(), "org.apache.aries.application.management.test");
+    assertEquals (appMeta.getApplicationVersion(), new Version("1.0"));
+    List<Content> appContent = appMeta.getApplicationContents();
+    assertEquals (appContent.size(), 2);
+    Content fbw = new ContentImpl("foo.bar.widgets;version=1.0.0");
+    Content mbl = new ContentImpl("my.business.logic;version=1.0.0");
+    assertTrue (appContent.contains(fbw));
+    assertTrue (appContent.contains(mbl));
+    
+    DeploymentMetadata dm = app.getDeploymentMetadata();
+    List<DeploymentContent> dcList = dm.getApplicationDeploymentContents();
+    
+    assertEquals (dcList.size(), 3);
+    DeploymentContent dc1 = new DeploymentContentImpl ("foo.bar.widgets;deployed-version=1.0.0");
+    DeploymentContent dc2 = new DeploymentContentImpl ("my.business.logic;deployed-version=1.0.0");
+    DeploymentContent dc3 = new DeploymentContentImpl ("a.handy.persistence.library;deployed-version=1.1.0");
+    assertTrue (dcList.contains(dc1));
+    assertTrue (dcList.contains(dc2));
+    assertTrue (dcList.contains(dc3));
+  
+  }
+  
+  @Test
+  public void testStoreAndReload() throws Exception { 
+    AriesApplication app = createApplication (TEST_EBA);
+    File dest = new File ("ariesApplicationManagerImplTest/stored.eba");
+    app.store(dest);
+    
+    /* Dest should be a zip file with four entries:
+     *  /foo.bar.widgets.jar
+     *  /my.business.logic.jar
+     *  /META-INF/APPLICATION.MF
+     *  /META-INF/DEPLOYMENT.MF
+     */
+    
+    IDirectory storedEba = FileSystem.getFSRoot(dest);
+    assertNotNull (storedEba);
+    assertEquals (storedEba.listFiles().size(), 3);
+    IFile ifile = storedEba.getFile("META-INF/APPLICATION.MF");
+    assertNotNull (ifile);
+    ifile = storedEba.getFile ("META-INF/DEPLOYMENT.MF");
+    assertNotNull (ifile);
+    ifile = storedEba.getFile ("foo.bar.widgets.jar");
+    assertNotNull (ifile);
+    ifile = storedEba.getFile ("my.business.logic.jar");
+    assertNotNull (ifile);
+    
+    AriesApplication newApp = _appMgr.createApplication(storedEba);
+    DeploymentMetadata dm = newApp.getDeploymentMetadata();
+    assertEquals (dm.getApplicationDeploymentContents().size(), 3);
+    assertEquals (dm.getApplicationSymbolicName(), app.getApplicationMetadata().getApplicationSymbolicName());
+    assertEquals (dm.getApplicationVersion(), app.getApplicationMetadata().getApplicationVersion());
+  }
+  
+  private AriesApplication createApplication (String fileName) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException, ManagementException  { 
+    // This next block is a very long winded way of constructing a BundleInfoImpl
+    // against the existing (BundleManifest bm, String location) constructor. If we 
+    // find we need a String-based BundleInfoImpl constructor for other reasons, 
+    // we could change to using it here. 
+    Set<BundleInfo> nextResolverResult = new HashSet<BundleInfo>();
+    String persistenceLibraryLocation = "../src/test/resources/bundles/repository/a.handy.persistence.library.jar";
+    File persistenceLibrary = new File (persistenceLibraryLocation);
+    BundleManifest mf = BundleManifest.fromBundle(persistenceLibrary);
+    BundleInfo resolvedPersistenceLibrary = new BundleInfoImpl(mf, persistenceLibraryLocation); 
+    Field v = BundleInfoImpl.class.getDeclaredField("_version");
+    v.setAccessible(true);
+    v.set(resolvedPersistenceLibrary, new Version("1.1.0"));
+    nextResolverResult.add(resolvedPersistenceLibrary);
+    _resolver.setNextResult(nextResolverResult);
+    
+    IDirectory testEba = FileSystem.getFSRoot(new File(TEST_EBA));
+    AriesApplication app = _appMgr.createApplication(testEba);
+    return app;
+  }
+}

Propchange: incubator/aries/trunk/application/application-management/src/test/java/org/apache/aries/application/management/impl/AriesApplicationManagerImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/trunk/application/application-management/src/test/java/org/apache/aries/application/management/impl/AriesApplicationManagerImplTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/application/application-management/src/test/java/org/apache/aries/application/management/impl/AriesApplicationManagerImplTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/aries/trunk/application/application-management/src/test/java/org/apache/aries/unittest/utils/EbaUnitTestUtils.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-management/src/test/java/org/apache/aries/unittest/utils/EbaUnitTestUtils.java?rev=899518&r1=899517&r2=899518&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-management/src/test/java/org/apache/aries/unittest/utils/EbaUnitTestUtils.java (original)
+++ incubator/aries/trunk/application/application-management/src/test/java/org/apache/aries/unittest/utils/EbaUnitTestUtils.java Fri Jan 15 02:17:38 2010
@@ -1,81 +1,81 @@
-/*
- * 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.unittest.utils;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.jar.Attributes;
-import java.util.jar.Manifest;
-
-import org.apache.aries.application.utils.filesystem.IOUtils;
-
-public class EbaUnitTestUtils {
-
-private static final String TEMP_DIR = "unittest/tmpEbaContent";
-  
-  public static void createEba(String rootFolder, String outputFile) throws IOException
-  {
-    File tempDir = new File(TEMP_DIR);
-    tempDir.mkdirs();
-    
-    createEbaRecursive(new File(rootFolder), tempDir, "");
-    IOUtils.zipUp(tempDir, new File(outputFile));
-    IOUtils.deleteRecursive(tempDir);
-  }
-  
-  private static void createEbaRecursive(File folder, File tempDir, String prefix) throws IOException
-  {
-    for (File f : folder.listFiles())
-    {
-      if ((f.getName().endsWith(".jar") || f.getName().endsWith(".war")) && f.isDirectory())
-      {
-        File manifestFile = new File(f, "META-INF/MANIFEST.MF");
-        Manifest m;
-        
-        if (manifestFile.isFile())
-          m = new Manifest(new FileInputStream(manifestFile));
-        else
-        {
-          m = new Manifest();
-          m.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
-        }
-          
-        File jarFile = new File(tempDir, prefix + f.getName());
-        jarFile.getParentFile().mkdirs();
-        
-        IOUtils.jarUp(f, jarFile, m); 
-      }
-      else if (f.isFile())
-      {
-        IOUtils.writeOut(tempDir, prefix + f.getName(), new FileInputStream(f));
-      }
-      else if (f.isDirectory())
-      {
-        createEbaRecursive(f, tempDir, prefix + f.getName() + File.separator);
-      }
-    }
-  }
-  
-  public static void cleanupEba(String outputFile)
-  {
-    new File(outputFile).delete();
-  }
-}
+/*
+ * 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.unittest.utils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+
+import org.apache.aries.application.utils.filesystem.IOUtils;
+
+public class EbaUnitTestUtils {
+
+private static final String TEMP_DIR = "unittest/tmpEbaContent";
+  
+  public static void createEba(String rootFolder, String outputFile) throws IOException
+  {
+    File tempDir = new File(TEMP_DIR);
+    tempDir.mkdirs();
+    
+    createEbaRecursive(new File(rootFolder), tempDir, "");
+    IOUtils.zipUp(tempDir, new File(outputFile));
+    IOUtils.deleteRecursive(tempDir);
+  }
+  
+  private static void createEbaRecursive(File folder, File tempDir, String prefix) throws IOException
+  {
+    for (File f : folder.listFiles())
+    {
+      if ((f.getName().endsWith(".jar") || f.getName().endsWith(".war")) && f.isDirectory())
+      {
+        File manifestFile = new File(f, "META-INF/MANIFEST.MF");
+        Manifest m;
+        
+        if (manifestFile.isFile())
+          m = new Manifest(new FileInputStream(manifestFile));
+        else
+        {
+          m = new Manifest();
+          m.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
+        }
+          
+        File jarFile = new File(tempDir, prefix + f.getName());
+        jarFile.getParentFile().mkdirs();
+        
+        IOUtils.jarUp(f, jarFile, m); 
+      }
+      else if (f.isFile())
+      {
+        IOUtils.writeOut(tempDir, prefix + f.getName(), new FileInputStream(f));
+      }
+      else if (f.isDirectory())
+      {
+        createEbaRecursive(f, tempDir, prefix + f.getName() + File.separator);
+      }
+    }
+  }
+  
+  public static void cleanupEba(String outputFile)
+  {
+    new File(outputFile).delete();
+  }
+}

Propchange: incubator/aries/trunk/application/application-management/src/test/java/org/apache/aries/unittest/utils/EbaUnitTestUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/trunk/application/application-management/src/test/java/org/apache/aries/unittest/utils/EbaUnitTestUtils.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/application/application-management/src/test/java/org/apache/aries/unittest/utils/EbaUnitTestUtils.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: incubator/aries/trunk/application/application-runtime/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/trunk/application/application-runtime/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/application/application-runtime/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/aries/trunk/application/application-runtime/src/main/java/org/apache/aries/application/runtime/impl/ApplicationContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-runtime/src/main/java/org/apache/aries/application/runtime/impl/ApplicationContextImpl.java?rev=899518&r1=899517&r2=899518&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-runtime/src/main/java/org/apache/aries/application/runtime/impl/ApplicationContextImpl.java (original)
+++ incubator/aries/trunk/application/application-runtime/src/main/java/org/apache/aries/application/runtime/impl/ApplicationContextImpl.java Fri Jan 15 02:17:38 2010
@@ -1,88 +1,88 @@
-/*
- * 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.runtime.impl;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.aries.application.management.ApplicationContext;
-import org.apache.aries.application.management.AriesApplication;
-import org.apache.aries.application.management.BundleInfo;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-
-public class ApplicationContextImpl implements ApplicationContext {
-  
-  private AriesApplication _application;
-  private Map<BundleInfo, Bundle> _bundles;
-  private ApplicationState _state;
-  private BundleContext _bundleContext;
-  
-  public ApplicationContextImpl (BundleContext b, AriesApplication app) { 
-    _application = app;
-    _bundles = new HashMap<BundleInfo, Bundle>();
-    _state = ApplicationState.INSTALLED;
-  }
-
-  public AriesApplication getApplication() {
-    return _application;
-  }
-  
-  public Set<Bundle> getApplicationContent() {
-    Set<Bundle> result = new HashSet<Bundle>();
-    for (Map.Entry<BundleInfo, Bundle> entry : _bundles.entrySet()) { 
-      result.add (entry.getValue());
-    }
-    return result;
-  } 
-
-  public ApplicationState getApplicationState() {
-    return _state;
-  }
-
-  public void start() throws BundleException {
-    Set<BundleInfo> bundleInfo = _application.getBundleInfo();
-    for (BundleInfo bi : bundleInfo) { 
-      // TODO: proper synchronisation!
-      if (_bundles.containsKey(bi)) { 
-        Bundle b = _bundles.get(bi);
-        if (b.getState() != Bundle.ACTIVE) { 
-          b.start();
-        }
-      } else { 
-        Bundle b = _bundleContext.installBundle(bi.getLocation()); 
-        b.start();
-        _bundles.put(bi, b);
-      }
-    }
-    _state = ApplicationState.ACTIVE;
-  }
-
-  public void stop() throws BundleException {
-    for (Map.Entry<BundleInfo, Bundle> entry : _bundles.entrySet()) { 
-      Bundle b = entry.getValue();
-      b.stop();
-    }
-    _state = ApplicationState.RESOLVED;
-  }
-}
+/*
+ * 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.runtime.impl;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.aries.application.management.ApplicationContext;
+import org.apache.aries.application.management.AriesApplication;
+import org.apache.aries.application.management.BundleInfo;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+public class ApplicationContextImpl implements ApplicationContext {
+  
+  private AriesApplication _application;
+  private Map<BundleInfo, Bundle> _bundles;
+  private ApplicationState _state;
+  private BundleContext _bundleContext;
+  
+  public ApplicationContextImpl (BundleContext b, AriesApplication app) { 
+    _application = app;
+    _bundles = new HashMap<BundleInfo, Bundle>();
+    _state = ApplicationState.INSTALLED;
+  }
+
+  public AriesApplication getApplication() {
+    return _application;
+  }
+  
+  public Set<Bundle> getApplicationContent() {
+    Set<Bundle> result = new HashSet<Bundle>();
+    for (Map.Entry<BundleInfo, Bundle> entry : _bundles.entrySet()) { 
+      result.add (entry.getValue());
+    }
+    return result;
+  } 
+
+  public ApplicationState getApplicationState() {
+    return _state;
+  }
+
+  public void start() throws BundleException {
+    Set<BundleInfo> bundleInfo = _application.getBundleInfo();
+    for (BundleInfo bi : bundleInfo) { 
+      // TODO: proper synchronisation!
+      if (_bundles.containsKey(bi)) { 
+        Bundle b = _bundles.get(bi);
+        if (b.getState() != Bundle.ACTIVE) { 
+          b.start();
+        }
+      } else { 
+        Bundle b = _bundleContext.installBundle(bi.getLocation()); 
+        b.start();
+        _bundles.put(bi, b);
+      }
+    }
+    _state = ApplicationState.ACTIVE;
+  }
+
+  public void stop() throws BundleException {
+    for (Map.Entry<BundleInfo, Bundle> entry : _bundles.entrySet()) { 
+      Bundle b = entry.getValue();
+      b.stop();
+    }
+    _state = ApplicationState.RESOLVED;
+  }
+}

Propchange: incubator/aries/trunk/application/application-runtime/src/main/java/org/apache/aries/application/runtime/impl/ApplicationContextImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/trunk/application/application-runtime/src/main/java/org/apache/aries/application/runtime/impl/ApplicationContextImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/application/application-runtime/src/main/java/org/apache/aries/application/runtime/impl/ApplicationContextImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/aries/trunk/application/application-runtime/src/main/java/org/apache/aries/application/runtime/impl/ApplicationContextManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-runtime/src/main/java/org/apache/aries/application/runtime/impl/ApplicationContextManagerImpl.java?rev=899518&r1=899517&r2=899518&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-runtime/src/main/java/org/apache/aries/application/runtime/impl/ApplicationContextManagerImpl.java (original)
+++ incubator/aries/trunk/application/application-runtime/src/main/java/org/apache/aries/application/runtime/impl/ApplicationContextManagerImpl.java Fri Jan 15 02:17:38 2010
@@ -1,68 +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.runtime.impl;
-
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import org.apache.aries.application.management.ApplicationContext;
-import org.apache.aries.application.management.ApplicationContextManager;
-import org.apache.aries.application.management.AriesApplication;
-import org.osgi.framework.BundleContext;
-
-public class ApplicationContextManagerImpl implements ApplicationContextManager {
-
-  ConcurrentMap<AriesApplication, ApplicationContext> _appToContextMap;
-  BundleContext _bundleContext;
-  
-  public ApplicationContextManagerImpl () { 
-    _appToContextMap = new ConcurrentHashMap<AriesApplication, ApplicationContext>();
-  }
-  
-  public void setBundleContext (BundleContext b) { 
-    _bundleContext = b;
-  }
-  
-  public ApplicationContext getApplicationContext(AriesApplication app) {
-    ApplicationContext result;
-    if (_appToContextMap.containsKey(app)) { 
-      result = _appToContextMap.get(app);
-    } else { 
-      result = new ApplicationContextImpl (_bundleContext, app);
-      ApplicationContext previous = _appToContextMap.putIfAbsent(app, result);
-      if (previous != null) { 
-        result = previous;
-      }
-    }
-    return result;
-  }
-
-  public Set<ApplicationContext> getApplicationContexts() {
-    Set<ApplicationContext> result = new HashSet<ApplicationContext>();
-    for (Map.Entry<AriesApplication, ApplicationContext> entry: _appToContextMap.entrySet()) {
-      result.add (entry.getValue());
-    }
-    return result;
-  }
-
-}
+/*
+ * 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.runtime.impl;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import org.apache.aries.application.management.ApplicationContext;
+import org.apache.aries.application.management.ApplicationContextManager;
+import org.apache.aries.application.management.AriesApplication;
+import org.osgi.framework.BundleContext;
+
+public class ApplicationContextManagerImpl implements ApplicationContextManager {
+
+  ConcurrentMap<AriesApplication, ApplicationContext> _appToContextMap;
+  BundleContext _bundleContext;
+  
+  public ApplicationContextManagerImpl () { 
+    _appToContextMap = new ConcurrentHashMap<AriesApplication, ApplicationContext>();
+  }
+  
+  public void setBundleContext (BundleContext b) { 
+    _bundleContext = b;
+  }
+  
+  public ApplicationContext getApplicationContext(AriesApplication app) {
+    ApplicationContext result;
+    if (_appToContextMap.containsKey(app)) { 
+      result = _appToContextMap.get(app);
+    } else { 
+      result = new ApplicationContextImpl (_bundleContext, app);
+      ApplicationContext previous = _appToContextMap.putIfAbsent(app, result);
+      if (previous != null) { 
+        result = previous;
+      }
+    }
+    return result;
+  }
+
+  public Set<ApplicationContext> getApplicationContexts() {
+    Set<ApplicationContext> result = new HashSet<ApplicationContext>();
+    for (Map.Entry<AriesApplication, ApplicationContext> entry: _appToContextMap.entrySet()) {
+      result.add (entry.getValue());
+    }
+    return result;
+  }
+
+}

Propchange: incubator/aries/trunk/application/application-runtime/src/main/java/org/apache/aries/application/runtime/impl/ApplicationContextManagerImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/trunk/application/application-runtime/src/main/java/org/apache/aries/application/runtime/impl/ApplicationContextManagerImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/application/application-runtime/src/main/java/org/apache/aries/application/runtime/impl/ApplicationContextManagerImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/aries/trunk/application/application-runtime/src/main/resources/OSGI-INF/blueprint/app-context-management.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-runtime/src/main/resources/OSGI-INF/blueprint/app-context-management.xml?rev=899518&r1=899517&r2=899518&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-runtime/src/main/resources/OSGI-INF/blueprint/app-context-management.xml (original)
+++ incubator/aries/trunk/application/application-runtime/src/main/resources/OSGI-INF/blueprint/app-context-management.xml Fri Jan 15 02:17:38 2010
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    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 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
-            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0">
-  
-  <bean id="app-context-manager" class="org.apache.aries.application.runtime.impl.ApplicationContextManagerImpl" scope="singleton" activation="lazy">
-    <property name="bundleContext" ref="blueprintBundleContext"/>
-  </bean>
-   
-  <service interface="org.apache.aries.application.management.pplicationContextManager" ref="app-context-manager" />
-  
-</blueprint>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0">
+  
+  <bean id="app-context-manager" class="org.apache.aries.application.runtime.impl.ApplicationContextManagerImpl" scope="singleton" activation="lazy">
+    <property name="bundleContext" ref="blueprintBundleContext"/>
+  </bean>
+   
+  <service interface="org.apache.aries.application.management.pplicationContextManager" ref="app-context-manager" />
+  
+</blueprint>

Propchange: incubator/aries/trunk/application/application-runtime/src/main/resources/OSGI-INF/blueprint/app-context-management.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/trunk/application/application-runtime/src/main/resources/OSGI-INF/blueprint/app-context-management.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/application/application-runtime/src/main/resources/OSGI-INF/blueprint/app-context-management.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Propchange: incubator/aries/trunk/application/application-utils/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/trunk/application/application-utils/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/application/application-utils/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

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=899518&r1=899517&r2=899518&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 Fri Jan 15 02:17:38 2010
@@ -1,196 +1,196 @@
-/*
- * 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.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-import java.util.jar.Attributes;
-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.utils.AppConstants;
-import org.apache.aries.application.utils.manifest.ManifestProcessor;
-import org.osgi.framework.Version;
-
-/**
- * Implementation of ApplicationMetadata and DeploymentMetadata
- *
- */
-public final class ApplicationMetadataImpl implements ApplicationMetadata
-{
-  private String appSymbolicName;
-  private Version appVersion;
-  private String appName;
-  private String appScope;
-  private List<Content> appContents;
-  private List<ServiceDeclaration> importServices;
-  private List<ServiceDeclaration> exportServices;
-  private Manifest manifest;
-  
-  /**
-   * create the applicationMetadata from appManifest
-   * @param appManifest   the Application.mf manifest
-   */
-  public ApplicationMetadataImpl(Manifest appManifest) {
-
-    this.appContents = new ArrayList<Content>();
-    this.importServices = new ArrayList<ServiceDeclaration>();
-    this.exportServices = new ArrayList<ServiceDeclaration>();
-    setup(appManifest);
-    
-    // As of 7 Jan 2010 we have no setter methods. Hence it's currently 
-    // fine to keep a copy of appManifest, and to use it in the store()
-    // method.
-    manifest = appManifest;
-  }
-  
-  /**
-   * setup the application metadata from the appManifest
-   * @param appManifest     application.mf manifest
-   */
-  private void setup(Manifest appManifest) 
-  {
-    Map<String, String> appMap = readManifestIntoMap(appManifest);
-    
-    // configure the appSymbolicName and appVersion
-    this.appSymbolicName = appMap.get(AppConstants.APPLICATION_SYMBOLIC_NAME);
-    this.appVersion = new Version(appMap.get(AppConstants.APPLICATION_VERSION));
-    this.appName = appMap.get(AppConstants.APPLICATION_NAME);
-    this.appScope = this.appSymbolicName + "_" + this.appVersion.toString();
-    
-    if (this.appSymbolicName == null || this.appVersion == null) {
-      throw new IllegalArgumentException("Failed to create ApplicationMetadataImpl object from Manifest " + appManifest);
-    }
-    
-    // configure appContents
-    String applicationContents = appMap.get(AppConstants.APPLICATION_CONTENT);
-    List<String> appContentsArray = ManifestProcessor.split(applicationContents, ",");
-    for (String content : appContentsArray) {
-      this.appContents.add(new ContentImpl(content));
-    }
-    
-    // TODO: configure importServices + exportServices
-    
-  }
-  
-  /**
-   * Reads a manifest's main attributes into a String->String map.
-   * <p>
-   * Will always return a map, empty if the manifest had no attributes.
-   * 
-   * @param mf The manifest to read.
-   * @return Map of manifest main attributes.
-   */
-  private Map<String, String> readManifestIntoMap(Manifest mf){   
-    HashMap<String, String> props = new HashMap<String, String>();
-    
-    Attributes mainAttrs = mf.getMainAttributes();
-    if (mainAttrs!=null){
-      Set<Entry<Object, Object>> attributeSet =  mainAttrs.entrySet(); 
-      if (attributeSet != null){
-        // Copy all the manifest headers across. The entry set should be a set of
-        // Name to String mappings, by calling String.valueOf we do the conversion
-        // to a string and we do not NPE.
-        for (Map.Entry<Object, Object> entry : attributeSet) {
-          props.put(String.valueOf(entry.getKey()), String.valueOf(entry.getValue()));
-        }
-      }    
-    }
-       
-    return props;
-  }  
-    
-  public List<Content> getApplicationContents()
-  {
-    return Collections.unmodifiableList(this.appContents);
-  }
-
-  public List<ServiceDeclaration> getApplicationExportServices()
-  {
-    return Collections.unmodifiableList(this.exportServices);
-  }
-
-  public List<ServiceDeclaration> getApplicationImportServices()
-  {
-    return Collections.unmodifiableList(this.importServices);
-  }
-
-  public String getApplicationSymbolicName()
-  {
-    return this.appSymbolicName;
-  }
-
-  public Version getApplicationVersion()
-  {
-    return this.appVersion;
-  }
-
-  public String getApplicationName() 
-  {
-    return this.appName;
-  }
-  
-  public String getApplicationScope() 
-  {
-    return appScope;
-  }
-  
-  public boolean equals(Object other)
-  {
-    if (other == this) return true;
-    if (other == null) return false;
-    if (other instanceof ApplicationMetadataImpl) {
-      return appScope.equals(((ApplicationMetadataImpl)other).appScope);
-    }
-    
-    return false;
-  }
-  
-  public int hashCode()
-  {
-    return appScope.hashCode();
-  }
-
-  public void store(File f) throws IOException {
-    FileOutputStream fos = new FileOutputStream (f);
-    store(fos);
-    fos.close();
-  }
-
-  public void store(OutputStream out) throws IOException {
-    if (manifest != null) {
-      Attributes att = manifest.getMainAttributes();
-      if ((att.getValue(Attributes.Name.MANIFEST_VERSION.toString())) == null) {
-        att.putValue(Attributes.Name.MANIFEST_VERSION.toString(), AppConstants.MANIFEST_VERSION);
-      }
-      manifest.write(out);
-    }
-  }
+/*
+ * 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.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+import java.util.jar.Attributes;
+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.utils.AppConstants;
+import org.apache.aries.application.utils.manifest.ManifestProcessor;
+import org.osgi.framework.Version;
+
+/**
+ * Implementation of ApplicationMetadata and DeploymentMetadata
+ *
+ */
+public final class ApplicationMetadataImpl implements ApplicationMetadata
+{
+  private String appSymbolicName;
+  private Version appVersion;
+  private String appName;
+  private String appScope;
+  private List<Content> appContents;
+  private List<ServiceDeclaration> importServices;
+  private List<ServiceDeclaration> exportServices;
+  private Manifest manifest;
+  
+  /**
+   * create the applicationMetadata from appManifest
+   * @param appManifest   the Application.mf manifest
+   */
+  public ApplicationMetadataImpl(Manifest appManifest) {
+
+    this.appContents = new ArrayList<Content>();
+    this.importServices = new ArrayList<ServiceDeclaration>();
+    this.exportServices = new ArrayList<ServiceDeclaration>();
+    setup(appManifest);
+    
+    // As of 7 Jan 2010 we have no setter methods. Hence it's currently 
+    // fine to keep a copy of appManifest, and to use it in the store()
+    // method.
+    manifest = appManifest;
+  }
+  
+  /**
+   * setup the application metadata from the appManifest
+   * @param appManifest     application.mf manifest
+   */
+  private void setup(Manifest appManifest) 
+  {
+    Map<String, String> appMap = readManifestIntoMap(appManifest);
+    
+    // configure the appSymbolicName and appVersion
+    this.appSymbolicName = appMap.get(AppConstants.APPLICATION_SYMBOLIC_NAME);
+    this.appVersion = new Version(appMap.get(AppConstants.APPLICATION_VERSION));
+    this.appName = appMap.get(AppConstants.APPLICATION_NAME);
+    this.appScope = this.appSymbolicName + "_" + this.appVersion.toString();
+    
+    if (this.appSymbolicName == null || this.appVersion == null) {
+      throw new IllegalArgumentException("Failed to create ApplicationMetadataImpl object from Manifest " + appManifest);
+    }
+    
+    // configure appContents
+    String applicationContents = appMap.get(AppConstants.APPLICATION_CONTENT);
+    List<String> appContentsArray = ManifestProcessor.split(applicationContents, ",");
+    for (String content : appContentsArray) {
+      this.appContents.add(new ContentImpl(content));
+    }
+    
+    // TODO: configure importServices + exportServices
+    
+  }
+  
+  /**
+   * Reads a manifest's main attributes into a String->String map.
+   * <p>
+   * Will always return a map, empty if the manifest had no attributes.
+   * 
+   * @param mf The manifest to read.
+   * @return Map of manifest main attributes.
+   */
+  private Map<String, String> readManifestIntoMap(Manifest mf){   
+    HashMap<String, String> props = new HashMap<String, String>();
+    
+    Attributes mainAttrs = mf.getMainAttributes();
+    if (mainAttrs!=null){
+      Set<Entry<Object, Object>> attributeSet =  mainAttrs.entrySet(); 
+      if (attributeSet != null){
+        // Copy all the manifest headers across. The entry set should be a set of
+        // Name to String mappings, by calling String.valueOf we do the conversion
+        // to a string and we do not NPE.
+        for (Map.Entry<Object, Object> entry : attributeSet) {
+          props.put(String.valueOf(entry.getKey()), String.valueOf(entry.getValue()));
+        }
+      }    
+    }
+       
+    return props;
+  }  
+    
+  public List<Content> getApplicationContents()
+  {
+    return Collections.unmodifiableList(this.appContents);
+  }
+
+  public List<ServiceDeclaration> getApplicationExportServices()
+  {
+    return Collections.unmodifiableList(this.exportServices);
+  }
+
+  public List<ServiceDeclaration> getApplicationImportServices()
+  {
+    return Collections.unmodifiableList(this.importServices);
+  }
+
+  public String getApplicationSymbolicName()
+  {
+    return this.appSymbolicName;
+  }
+
+  public Version getApplicationVersion()
+  {
+    return this.appVersion;
+  }
+
+  public String getApplicationName() 
+  {
+    return this.appName;
+  }
+  
+  public String getApplicationScope() 
+  {
+    return appScope;
+  }
+  
+  public boolean equals(Object other)
+  {
+    if (other == this) return true;
+    if (other == null) return false;
+    if (other instanceof ApplicationMetadataImpl) {
+      return appScope.equals(((ApplicationMetadataImpl)other).appScope);
+    }
+    
+    return false;
+  }
+  
+  public int hashCode()
+  {
+    return appScope.hashCode();
+  }
+
+  public void store(File f) throws IOException {
+    FileOutputStream fos = new FileOutputStream (f);
+    store(fos);
+    fos.close();
+  }
+
+  public void store(OutputStream out) throws IOException {
+    if (manifest != null) {
+      Attributes att = manifest.getMainAttributes();
+      if ((att.getValue(Attributes.Name.MANIFEST_VERSION.toString())) == null) {
+        att.putValue(Attributes.Name.MANIFEST_VERSION.toString(), AppConstants.MANIFEST_VERSION);
+      }
+      manifest.write(out);
+    }
+  }
 }
\ No newline at end of file

Propchange: incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ApplicationMetadataImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ApplicationMetadataImpl.java
            ('svn:executable' removed)

Propchange: incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ApplicationMetadataImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ApplicationMetadataImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ApplicationMetadataManagerImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ApplicationMetadataManagerImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ApplicationMetadataManagerImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ApplicationMetadataManagerServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ApplicationMetadataManagerServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ApplicationMetadataManagerServiceImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

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=899518&r1=899517&r2=899518&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 Fri Jan 15 02:17:38 2010
@@ -1,199 +1,199 @@
-/*
- * 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.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-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;
-
-
-/**
- * Implementation of Content 
- *
- */
-public final class ContentImpl implements 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) {
-    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();
-  }
-  
-  /**
-   * 
-   * @param contentName  
-   * @param nameValueMap
-   */
-  public ContentImpl(String contentName, NameValueMap<String, String> nameValueMap) {
-    this.contentName = contentName;
-    this.nameValueMap= nameValueMap;
-    setup();
-  }
-  
-  public String getContentName() {
-    return this.contentName;
-  }
-  
-  public Map<String, String> getAttributes() {
-    return Collections.unmodifiableMap(this.attributes);
-  }
-  
-  public Map<String, String> getDirectives() {
-    return Collections.unmodifiableMap(this.directives);
-  }
-  
-  public String getAttribute(String key) {
-    String toReturn = this.attributes.get(key);
-    return toReturn;
-  }
-  
-  /**
-   * add key value to the attributes map
-   * @param key
-   * @param value
-   */
-  public void addAttribute(String key, String value) {
-    this.attributes.put(key, value);
-  }
-  
-  public String getDirective(String key) {
-    String toReturn = this.directives.get(key);
-    return toReturn;
-  }
-  
-  public NameValueMap<String, String> getNameValueMap() {
-    NameValueMap<String, String> nvm = new NameValueMap<String, String>();
-    for (String key : this.nameValueMap.keySet()) {
-      nvm.addToCollection(key, this.nameValueMap.get(key));
-    }
-    return nvm;
-  }
-  
-  /**
-   * add key value to the directives map
-   * @param key
-   * @param value
-   */
-  public void addDirective(String key, String value) {
-    this.directives.put(key, value);
-  }
-  
-  public VersionRange getVersion() {
-    VersionRange vi = null;
-    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 {
-      // what if version is not specified?  let's interpret it as 0.0.0 
-      vi = ManifestHeaderProcessor.parseVersionRange("0.0.0");
-    }
-    return vi;
-  }
-  
-  @Override
-  public String toString()
-  {
-    return this.contentName + ";" + this.nameValueMap.toString();
-  }
-  
-  @Override
-  public boolean equals(Object other)
-  {
-    if (other == this) return true;
-    if (other == null) return false;
-    
-    if (other instanceof ContentImpl) {
-      ContentImpl otherContent = (ContentImpl)other;
-      
-      Map<String,String> attributesWithoutVersion = attributes;
-      
-      if (attributes.containsKey("version")) {
-        attributesWithoutVersion = new HashMap<String, String>(attributes);
-        attributesWithoutVersion.remove("version");
-      }
-      
-      Map<String, String> otherAttributesWithoutVersion = otherContent.attributes;
-      
-      if (otherContent.attributes.containsKey("version")) {
-        otherAttributesWithoutVersion = new HashMap<String, String>(otherContent.attributes);
-        otherAttributesWithoutVersion.remove("version");
-      }
-      
-      return contentName.equals(otherContent.contentName) && 
-             attributesWithoutVersion.equals(otherAttributesWithoutVersion) &&
-             directives.equals(otherContent.directives) &&
-             getVersion().equals(otherContent.getVersion());
-    }
-    
-    return false;
-  }
-  
-  @Override
-  public int hashCode()
-  {
-    return contentName.hashCode();
-  }
-  
-  /**
-   * set up directives and attributes
-   */
-  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));
-      }
-    }
-  }
-}
+/*
+ * 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.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+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;
+
+
+/**
+ * Implementation of Content 
+ *
+ */
+public final class ContentImpl implements 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) {
+    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();
+  }
+  
+  /**
+   * 
+   * @param contentName  
+   * @param nameValueMap
+   */
+  public ContentImpl(String contentName, NameValueMap<String, String> nameValueMap) {
+    this.contentName = contentName;
+    this.nameValueMap= nameValueMap;
+    setup();
+  }
+  
+  public String getContentName() {
+    return this.contentName;
+  }
+  
+  public Map<String, String> getAttributes() {
+    return Collections.unmodifiableMap(this.attributes);
+  }
+  
+  public Map<String, String> getDirectives() {
+    return Collections.unmodifiableMap(this.directives);
+  }
+  
+  public String getAttribute(String key) {
+    String toReturn = this.attributes.get(key);
+    return toReturn;
+  }
+  
+  /**
+   * add key value to the attributes map
+   * @param key
+   * @param value
+   */
+  public void addAttribute(String key, String value) {
+    this.attributes.put(key, value);
+  }
+  
+  public String getDirective(String key) {
+    String toReturn = this.directives.get(key);
+    return toReturn;
+  }
+  
+  public NameValueMap<String, String> getNameValueMap() {
+    NameValueMap<String, String> nvm = new NameValueMap<String, String>();
+    for (String key : this.nameValueMap.keySet()) {
+      nvm.addToCollection(key, this.nameValueMap.get(key));
+    }
+    return nvm;
+  }
+  
+  /**
+   * add key value to the directives map
+   * @param key
+   * @param value
+   */
+  public void addDirective(String key, String value) {
+    this.directives.put(key, value);
+  }
+  
+  public VersionRange getVersion() {
+    VersionRange vi = null;
+    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 {
+      // what if version is not specified?  let's interpret it as 0.0.0 
+      vi = ManifestHeaderProcessor.parseVersionRange("0.0.0");
+    }
+    return vi;
+  }
+  
+  @Override
+  public String toString()
+  {
+    return this.contentName + ";" + this.nameValueMap.toString();
+  }
+  
+  @Override
+  public boolean equals(Object other)
+  {
+    if (other == this) return true;
+    if (other == null) return false;
+    
+    if (other instanceof ContentImpl) {
+      ContentImpl otherContent = (ContentImpl)other;
+      
+      Map<String,String> attributesWithoutVersion = attributes;
+      
+      if (attributes.containsKey("version")) {
+        attributesWithoutVersion = new HashMap<String, String>(attributes);
+        attributesWithoutVersion.remove("version");
+      }
+      
+      Map<String, String> otherAttributesWithoutVersion = otherContent.attributes;
+      
+      if (otherContent.attributes.containsKey("version")) {
+        otherAttributesWithoutVersion = new HashMap<String, String>(otherContent.attributes);
+        otherAttributesWithoutVersion.remove("version");
+      }
+      
+      return contentName.equals(otherContent.contentName) && 
+             attributesWithoutVersion.equals(otherAttributesWithoutVersion) &&
+             directives.equals(otherContent.directives) &&
+             getVersion().equals(otherContent.getVersion());
+    }
+    
+    return false;
+  }
+  
+  @Override
+  public int hashCode()
+  {
+    return contentName.hashCode();
+  }
+  
+  /**
+   * set up directives and attributes
+   */
+  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));
+      }
+    }
+  }
+}

Propchange: incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ContentImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ContentImpl.java
            ('svn:executable' removed)

Propchange: incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ContentImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ContentImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain