You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by zo...@apache.org on 2011/02/27 21:20:30 UTC

svn commit: r1075132 [4/18] - in /aries/tags/application-0.3: ./ application-api/ application-api/src/ application-api/src/main/ application-api/src/main/java/ application-api/src/main/java/org/ application-api/src/main/java/org/apache/ application-api...

Added: aries/tags/application-0.3/application-bundle/pom.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-bundle/pom.xml?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-bundle/pom.xml (added)
+++ aries/tags/application-0.3/application-bundle/pom.xml Sun Feb 27 20:20:13 2011
@@ -0,0 +1,236 @@
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.aries.application</groupId>
+        <artifactId>application</artifactId>
+        <version>0.3</version>
+    </parent>
+
+    <artifactId>org.apache.aries.application</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Aries Application Bundle</name>
+    <description>
+      This bundle is a standalone bundle to support
+      Aries applications.
+    </description>
+
+    <properties>
+        <aries.osgi.symbolic.name>
+            ${project.artifactId};blueprint.graceperiod:=false
+        </aries.osgi.symbolic.name>
+        <aries.osgi.import>
+            org.osgi.framework;version="[1.5,2)",
+            org.slf4j;version="[1.5,2)",
+            org.apache.aries.application*;version="[0.1,0.2)",
+            *
+        </aries.osgi.import>
+        <aries.osgi.export.pkg>
+            org.apache.aries.application;
+            org.apache.aries.application.filesystem;
+            org.apache.aries.application.management;
+            org.apache.aries.application.utils;
+            org.apache.aries.application.utils.filesystem;
+            org.apache.aries.application.utils.manifest;
+            org.apache.aries.application.utils.management;
+        </aries.osgi.export.pkg>
+        <aries.osgi.private.pkg>
+            org.apache.aries.application*,
+            META-INF*,
+            OSGI-INF*
+        </aries.osgi.private.pkg>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.aries.application</groupId>
+            <artifactId>org.apache.aries.application.api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.application</groupId>
+            <artifactId>org.apache.aries.application.management</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.application</groupId>
+            <artifactId>org.apache.aries.application.runtime</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.application</groupId>
+            <artifactId>org.apache.aries.application.utils</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+    
+    <build>
+        <plugins>
+            <!-- Use the shade plugin with the dependency plugin to unjar the three jars (api, core and cm)
+                 so that the associated sources and javadocs jars are complete.
+                 To build the main jar, the maven-bundle-plugin is used, that's why everything is exluded -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                        <configuration>
+                            <artifactSet>
+                                <includes>
+                                    <include>org.apache.aries.application:org.apache.aries.application.api</include>
+                                    <include>org.apache.aries.application:org.apache.aries.application.management</include>
+                                    <include>org.apache.aries.application:org.apache.aries.application.runtime</include>
+                                    <include>org.apache.aries.application:org.apache.aries.application.utils</include>
+                                </includes>
+                            </artifactSet>
+                            <filters>
+                                 <filter>
+                                    <artifact>org.apache.aries.application:org.apache.aries.application.api</artifact>
+                                    <excludes>
+                                        <exclude>org/**</exclude>
+                                    </excludes>
+                                </filter>
+                                <filter>
+                                    <artifact>org.apache.aries.application:org.apache.aries.application.management</artifact>
+                                    <excludes>
+                                        <exclude>org/**</exclude>
+                                    </excludes>
+                                </filter>
+                                <filter>
+                                    <artifact>org.apache.aries.application:org.apache.aries.application.runtime</artifact>
+                                    <excludes>
+                                        <exclude>org/**</exclude>
+                                    </excludes>
+                                </filter>
+                                <filter>
+                                    <artifact>org.apache.aries.application:org.apache.aries.application.utils</artifact>
+                                    <excludes>
+                                        <exclude>org/**</exclude>
+                                    </excludes>
+                                </filter>
+                            </filters>
+                            <createSourcesJar>${createSourcesJar}</createSourcesJar>
+                            <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
+                            <createDependencyReducedPom>true</createDependencyReducedPom>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>deploy</id>
+            <properties>
+                <createSourcesJar>true</createSourcesJar>
+            </properties>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-dependency-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>unpack-sources</id>
+                                <phase>generate-sources</phase>
+                                <goals>
+                                    <goal>unpack</goal>
+                                </goals>
+                                <configuration>
+                                    <artifactItems>
+                                        <artifactItem>
+                                            <groupId>org.apache.aries.application</groupId>
+                                            <artifactId>org.apache.aries.application.api</artifactId>
+                                            <classifier>sources</classifier>
+                                        </artifactItem>
+                                        <artifactItem>
+                                            <groupId>org.apache.aries.application</groupId>
+                                            <artifactId>org.apache.aries.application.management</artifactId>
+                                            <classifier>sources</classifier>
+                                        </artifactItem>
+                                        <artifactItem>
+                                            <groupId>org.apache.aries.application</groupId>
+                                            <artifactId>org.apache.aries.application.runtime</artifactId>
+                                            <classifier>sources</classifier>
+                                        </artifactItem>
+                                        <artifactItem>
+                                            <groupId>org.apache.aries.application</groupId>
+                                            <artifactId>org.apache.aries.application.utils</artifactId>
+                                            <classifier>sources</classifier>
+                                        </artifactItem>
+                                    </artifactItems>
+                                    <outputDirectory>${project.build.directory}/sources</outputDirectory>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-source-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>attach-sources</id>
+                                <phase>process-classes</phase>
+                                <goals>
+                                    <goal>jar</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-javadoc-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>package</id>
+                                <phase>package</phase>
+                                <goals>
+                                    <goal>jar</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                        <configuration>
+                            <minmemory>128m</minmemory>
+                            <maxmemory>512m</maxmemory>
+                            <sourcepath>${project.build.directory}/sources</sourcepath>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+</project>

Added: aries/tags/application-0.3/application-converters/pom.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-converters/pom.xml?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-converters/pom.xml (added)
+++ aries/tags/application-0.3/application-converters/pom.xml Sun Feb 27 20:20:13 2011
@@ -0,0 +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 WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <artifactId>application</artifactId>
+        <groupId>org.apache.aries.application</groupId>
+        <version>0.3</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>org.apache.aries.application.converters</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Aries Application Converters</name>
+
+    <properties>
+        <aries.osgi.export.pkg>
+        </aries.osgi.export.pkg>
+        <aries.osgi.private.pkg>
+            org.apache.aries.application.converters;
+        </aries.osgi.private.pkg>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>asm</groupId>
+            <artifactId>asm-all</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.application</groupId>
+            <artifactId>org.apache.aries.application.api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.testsupport</groupId>
+            <artifactId>org.apache.aries.testsupport.unit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.web</groupId>
+            <artifactId>org.apache.aries.web.urlhandler</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+        	<groupId>org.apache.aries.application</groupId>
+        	<artifactId>org.apache.aries.application.utils</artifactId>
+        	<scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+</project>

Added: aries/tags/application-0.3/application-converters/src/main/java/org/apache/aries/application/converters/WabConverterService.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-converters/src/main/java/org/apache/aries/application/converters/WabConverterService.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-converters/src/main/java/org/apache/aries/application/converters/WabConverterService.java (added)
+++ aries/tags/application-0.3/application-converters/src/main/java/org/apache/aries/application/converters/WabConverterService.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,80 @@
+/*
+ * 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.converters;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.apache.aries.application.filesystem.IDirectory;
+import org.apache.aries.application.filesystem.IFile;
+import org.apache.aries.application.management.BundleInfo;
+import org.apache.aries.application.management.spi.convert.BundleConversion;
+import org.apache.aries.application.management.spi.convert.BundleConverter;
+import org.apache.aries.application.utils.management.SimpleBundleInfo;
+import org.apache.aries.application.utils.manifest.BundleManifest;
+import org.apache.aries.web.converter.WabConversion;
+import org.apache.aries.web.converter.WarToWabConverter;
+import org.apache.aries.web.converter.WarToWabConverter.InputStreamProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WabConverterService implements BundleConverter {
+    private static final String WAR_FILE_EXTENSION = ".war";
+    private static final Logger LOGGER = LoggerFactory.getLogger(WabConverterService.class);
+    
+    private WarToWabConverter wabConverter;
+
+    public WarToWabConverter getWabConverter() {
+        return wabConverter;
+    }
+
+    public void setWabConverter(WarToWabConverter wabConverter) {
+        this.wabConverter = wabConverter;
+    }
+
+    public BundleConversion convert(IDirectory parentEba, final IFile toBeConverted) {
+        if (toBeConverted.getName().endsWith(WAR_FILE_EXTENSION)) {
+            try {
+            	final WabConversion conversion = wabConverter.convert(new InputStreamProvider() {
+                    public InputStream getInputStream() throws IOException {
+                        return toBeConverted.open();
+                    }
+                }, toBeConverted.getName(), new Properties());
+            	            	
+                return new BundleConversion() {
+
+					public BundleInfo getBundleInfo() throws IOException {
+						return new SimpleBundleInfo(BundleManifest.fromBundle(conversion.getWAB()), toBeConverted.toString());
+					}
+
+					public InputStream getInputStream() throws IOException {
+						return conversion.getWAB();
+					}
+                	
+                };
+            } catch (IOException e) {
+                LOGGER.error("Encountered an exception while converting " + toBeConverted.getName() 
+                        + " in " + parentEba.getName(), e);
+            }
+        }
+
+        return null;
+    }
+}

Added: aries/tags/application-0.3/application-converters/src/main/resources/OSGI-INF/blueprint/aries.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-converters/src/main/resources/OSGI-INF/blueprint/aries.xml?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-converters/src/main/resources/OSGI-INF/blueprint/aries.xml (added)
+++ aries/tags/application-0.3/application-converters/src/main/resources/OSGI-INF/blueprint/aries.xml Sun Feb 27 20:20:13 2011
@@ -0,0 +1,34 @@
+<?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">
+
+  <reference id="converterService" interface="org.apache.aries.web.converter.WarToWabConverter" />
+  
+  <bean id="bundleConverter" class="org.apache.aries.application.converters.WabConverterService">
+    <property name="wabConverter" value="converterService" />
+  </bean>
+  
+  <service interface="org.apache.aries.application.management.spi.convert.BundleConverter" ref="bundleConverter">
+      <service-properties>
+          <entry key="convert-type" value="war" />
+      </service-properties>
+  </service>
+
+</blueprint>
\ No newline at end of file

Added: aries/tags/application-0.3/application-default-local-platform/pom.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-default-local-platform/pom.xml?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-default-local-platform/pom.xml (added)
+++ aries/tags/application-0.3/application-default-local-platform/pom.xml Sun Feb 27 20:20:13 2011
@@ -0,0 +1,50 @@
+<?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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <artifactId>application</artifactId>
+        <groupId>org.apache.aries.application</groupId>
+        <version>0.3</version>
+    </parent>
+    <artifactId>org.apache.aries.application.default.local.platform</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Aries Application Default local platform</name>
+    <description>
+      Implementation of the default local Platform Repository
+    </description>
+    <properties>
+        <aries.osgi.export.pkg>
+        </aries.osgi.export.pkg>
+        <aries.osgi.private.pkg>
+            org.apache.aries.application.local.platform.impl
+        </aries.osgi.private.pkg>
+    </properties>
+    <dependencies>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.application</groupId>
+            <artifactId>org.apache.aries.application.api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+</project>

Added: aries/tags/application-0.3/application-default-local-platform/src/main/java/org/apache/aries/application/local/platform/impl/DefaultLocalPlatform.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-default-local-platform/src/main/java/org/apache/aries/application/local/platform/impl/DefaultLocalPlatform.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-default-local-platform/src/main/java/org/apache/aries/application/local/platform/impl/DefaultLocalPlatform.java (added)
+++ aries/tags/application-0.3/application-default-local-platform/src/main/java/org/apache/aries/application/local/platform/impl/DefaultLocalPlatform.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+package org.apache.aries.application.local.platform.impl;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.aries.application.management.spi.runtime.LocalPlatform;
+
+public class DefaultLocalPlatform implements LocalPlatform {
+
+  public File getTemporaryDirectory() throws IOException {
+    File f = File.createTempFile("ebaTmp", null);
+    f.delete();
+    f.mkdir();
+    return f;
+  } 
+  public File getTemporaryFile () throws IOException { 
+    return File.createTempFile("ebaTmp", null);
+  }
+}

Added: aries/tags/application-0.3/application-default-local-platform/src/main/resources/OSGI-INF/blueprint/default-local-platform.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-default-local-platform/src/main/resources/OSGI-INF/blueprint/default-local-platform.xml?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-default-local-platform/src/main/resources/OSGI-INF/blueprint/default-local-platform.xml (added)
+++ aries/tags/application-0.3/application-default-local-platform/src/main/resources/OSGI-INF/blueprint/default-local-platform.xml Sun Feb 27 20:20:13 2011
@@ -0,0 +1,27 @@
+<?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="default-local-platform" class="org.apache.aries.application.local.platform.impl.DefaultLocalPlatform" />
+  
+  <service interface="org.apache.aries.application.management.spi.runtime.LocalPlatform" 
+            ref="default-local-platform"
+            ranking="-1" />
+</blueprint>

Added: aries/tags/application-0.3/application-deployment-management/pom.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-deployment-management/pom.xml?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-deployment-management/pom.xml (added)
+++ aries/tags/application-0.3/application-deployment-management/pom.xml Sun Feb 27 20:20:13 2011
@@ -0,0 +1,89 @@
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <artifactId>application</artifactId>
+        <groupId>org.apache.aries.application</groupId>
+        <version>0.3</version>
+    </parent>
+    <artifactId>org.apache.aries.application.deployment.management</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Aries Application Deployment Management</name>
+    <description>
+      Deployment Manager for resolving an Aries Applications.
+    </description>
+
+    <properties>
+        <aries.osgi.export.pkg>
+        </aries.osgi.export.pkg>
+        <aries.osgi.private.pkg>
+            org.apache.aries.application.deployment.management.impl;
+            org.apache.aries.application.deployment.management.internal
+        </aries.osgi.private.pkg>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.application</groupId>
+            <artifactId>org.apache.aries.application.api</artifactId>
+        </dependency>
+        <dependency>
+             <groupId>org.apache.aries</groupId>
+             <artifactId>org.apache.aries.util</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.testsupport</groupId>
+            <artifactId>org.apache.aries.testsupport.unit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <version>4.2.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+        	<groupId>org.apache.aries.application</groupId>
+        	<artifactId>org.apache.aries.application.utils</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.application</groupId>
+            <artifactId>org.apache.aries.application.modeller</artifactId>
+        </dependency>
+        
+        
+    </dependencies>
+
+</project>

Added: aries/tags/application-0.3/application-deployment-management/src/main/java/org/apache/aries/application/deployment/management/impl/DeploymentManifestManagerImpl.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-deployment-management/src/main/java/org/apache/aries/application/deployment/management/impl/DeploymentManifestManagerImpl.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-deployment-management/src/main/java/org/apache/aries/application/deployment/management/impl/DeploymentManifestManagerImpl.java (added)
+++ aries/tags/application-0.3/application-deployment-management/src/main/java/org/apache/aries/application/deployment/management/impl/DeploymentManifestManagerImpl.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,660 @@
+/*
+ * 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.deployment.management.impl;
+
+import static org.apache.aries.application.utils.AppConstants.LOG_ENTRY;
+import static org.apache.aries.application.utils.AppConstants.LOG_EXIT;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+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;
+import org.apache.aries.application.Content;
+import org.apache.aries.application.InvalidAttributeException;
+import org.apache.aries.application.ServiceDeclaration;
+import org.apache.aries.application.deployment.management.internal.MessageUtil;
+import org.apache.aries.application.management.AriesApplication;
+import org.apache.aries.application.management.BundleInfo;
+import org.apache.aries.application.management.ResolveConstraint;
+import org.apache.aries.application.management.ResolverException;
+import org.apache.aries.application.management.spi.resolve.AriesApplicationResolver;
+import org.apache.aries.application.management.spi.resolve.DeploymentManifestManager;
+import org.apache.aries.application.management.spi.resolve.PostResolveTransformer;
+import org.apache.aries.application.management.spi.runtime.LocalPlatform;
+import org.apache.aries.application.modelling.DeployedBundles;
+import org.apache.aries.application.modelling.ExportedPackage;
+import org.apache.aries.application.modelling.ExportedService;
+import org.apache.aries.application.modelling.ImportedBundle;
+import org.apache.aries.application.modelling.ImportedPackage;
+import org.apache.aries.application.modelling.ModelledResource;
+import org.apache.aries.application.modelling.ModelledResourceManager;
+import org.apache.aries.application.modelling.ModellerException;
+import org.apache.aries.application.modelling.ModellingManager;
+import org.apache.aries.application.modelling.utils.ModellingHelper;
+import org.apache.aries.application.utils.AppConstants;
+import org.apache.aries.application.utils.filesystem.FileSystem;
+import org.apache.aries.application.utils.filesystem.IOUtils;
+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.Filter;
+import org.osgi.service.blueprint.container.ServiceUnavailableException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DeploymentManifestManagerImpl implements DeploymentManifestManager
+{
+
+  private final Logger _logger = LoggerFactory.getLogger(DeploymentManifestManagerImpl.class);
+  private AriesApplicationResolver resolver;
+  private PostResolveTransformer postResolveTransformer = null;
+
+  private ModelledResourceManager modelledResourceManager;
+  private LocalPlatform localPlatform;
+  private ModellingManager modellingManager;
+  private ModellingHelper modellingHelper;
+
+  public void setModellingManager (ModellingManager m) {
+    modellingManager = m; 
+  }
+  
+  public void setModellingHelper (ModellingHelper mh) { 
+    modellingHelper = mh;
+  }
+
+  public LocalPlatform getLocalPlatform()
+  {
+    return localPlatform;
+  }
+
+  public void setLocalPlatform(LocalPlatform localPlatform)
+  {
+    this.localPlatform = localPlatform;
+  }
+
+  public ModelledResourceManager getModelledResourceManager()
+  {
+    return modelledResourceManager;
+  }
+
+  public void setModelledResourceManager(ModelledResourceManager modelledResourceManager)
+  {
+    this.modelledResourceManager = modelledResourceManager;
+  }
+
+  public void setPostResolveTransformer(PostResolveTransformer transformer) {
+    postResolveTransformer = transformer;
+  }
+  
+  public void setResolver(AriesApplicationResolver resolver)
+  {
+    this.resolver = resolver;
+  }
+
+  /**
+   * Perform provisioning to work out the 'freeze dried list' of the eba
+   * @param app - Aries application
+   * @param ResolveConstraint - resolver constraint for limiting the resolving results
+   * @return manifest the generated deployment manifest
+   * @throws ResolverException
+   */
+  @Override
+  public Manifest generateDeploymentManifest(AriesApplication app,  ResolveConstraint... constraints ) throws ResolverException
+  {
+
+    _logger.debug(LOG_ENTRY, "generateDeploymentManifest", new Object[]{app, constraints});
+    ApplicationMetadata appMetadata = app.getApplicationMetadata();
+    Collection<ModelledResource> byValueBundles = null;
+    try {
+      // find out blueprint information
+      byValueBundles = getByValueBundles(app);
+      // find out by value bundles and then by reference bundles
+    } catch (Exception e) {
+      throw new ResolverException (e);
+    }
+
+    Collection<Content> bundlesToResolve = new ArrayList<Content>();
+    bundlesToResolve.addAll(appMetadata.getApplicationContents());    
+    bundlesToResolve.addAll(app.getApplicationMetadata().getUseBundles());
+
+    //If we pass in provision bundles (e.g. import deployment manifest sanity check), we add them into our bundlesToResolve set.
+    // This is because we want to make sure all bundles we passed into resolver the same as what we are going to get from resolver. 
+    List<Content> restrictedReqs = new ArrayList<Content>();
+    for (ResolveConstraint constraint : constraints ) {
+      Content content = ManifestHeaderProcessor.parseContent(constraint.getBundleName(), constraint.getVersionRange().toString());
+      restrictedReqs.add(content);
+    }
+    
+    DeployedBundles deployedBundles = generateDeployedBundles (appMetadata, 
+        byValueBundles, restrictedReqs);
+    
+    Manifest man = generateDeploymentManifest(appMetadata.getApplicationSymbolicName(),
+        appMetadata.getApplicationVersion().toString(), deployedBundles);
+    _logger.debug(LOG_EXIT, "generateDeploymentManifest", new Object[] {man});
+    return man;
+  }
+
+  /**
+   * Perform provisioning to work out the 'freeze dried list' of the eba
+   * @param appContent - the application content in the application.mf
+   * @param useBundleContent - use bundle entry in the application.mf
+   * @param providedByValueBundles - bundles contained in the eba  
+   * @return
+   * @throws ResolverException
+   */
+  @Override
+  public DeployedBundles generateDeployedBundles
+  ( 
+      ApplicationMetadata appMetadata, 
+      Collection<ModelledResource> provideByValueBundles, 
+      Collection<Content> otherBundles) throws ResolverException {  
+    
+    _logger.debug(LOG_ENTRY, "generateDeployedBundles", new Object[]{appMetadata,
+        provideByValueBundles,otherBundles });
+    
+    Collection<Content> useBundleSet = appMetadata.getUseBundles();
+    Collection<Content> appContent = appMetadata.getApplicationContents();
+    
+    Collection<Content> bundlesToResolve = new ArrayList<Content>();
+    Set<ImportedBundle> appContentIB = toImportedBundle(appContent);
+    Set<ImportedBundle> useBundleIB = toImportedBundle(useBundleSet);
+
+
+    bundlesToResolve.addAll(useBundleSet);
+
+    bundlesToResolve.addAll(appContent);
+    bundlesToResolve.addAll(otherBundles);
+    Collection<ModelledResource> byValueBundles = new ArrayList<ModelledResource>(provideByValueBundles);
+    ModelledResource fakeBundleResource;
+    try { 
+      fakeBundleResource = createFakeBundle(appMetadata.getApplicationImportServices());
+    } catch (InvalidAttributeException iax) { 
+      ResolverException rx = new ResolverException (iax);
+      _logger.debug(LOG_EXIT, "generateDeploymentManifest", new Object[] {rx});
+
+      throw rx;
+    }
+    byValueBundles.add(fakeBundleResource);
+    
+    String appSymbolicName = appMetadata.getApplicationSymbolicName();
+    String appVersion = appMetadata.getApplicationVersion().toString();
+    String uniqueName = appSymbolicName + "_" + appVersion;
+    
+    DeployedBundles deployedBundles = modellingHelper.createDeployedBundles(appSymbolicName, appContentIB, useBundleIB, Arrays.asList(fakeBundleResource));
+    Collection<ModelledResource> bundlesToBeProvisioned = resolver.resolve(
+        appSymbolicName, appVersion, byValueBundles, bundlesToResolve);
+    pruneFakeBundleFromResults (bundlesToBeProvisioned);
+
+    if (bundlesToBeProvisioned.isEmpty()) {
+      throw new ResolverException(MessageUtil.getMessage("EMPTY_DEPLOYMENT_CONTENT",uniqueName));
+    } 
+    for (ModelledResource rbm : bundlesToBeProvisioned)
+    {
+      deployedBundles.addBundle(rbm);
+    }
+    Collection<ModelledResource> requiredUseBundle = deployedBundles.getRequiredUseBundle();
+    if (requiredUseBundle.size() < useBundleSet.size())
+    {
+      // Some of the use-bundle entries were redundant so resolve again with just the good ones.
+      deployedBundles = modellingHelper.createDeployedBundles(appSymbolicName, appContentIB, useBundleIB, Arrays.asList(fakeBundleResource));
+      bundlesToResolve.clear();
+      bundlesToResolve.addAll(appContent);
+      Collection<ImportedBundle> slimmedDownUseBundle = narrowUseBundles(useBundleIB, requiredUseBundle);
+      bundlesToResolve.addAll(toContent(slimmedDownUseBundle));
+      bundlesToBeProvisioned = resolver.resolve(appSymbolicName, appVersion, byValueBundles, bundlesToResolve);
+      pruneFakeBundleFromResults (bundlesToBeProvisioned);
+      for (ModelledResource rbm : bundlesToBeProvisioned)
+      {
+        deployedBundles.addBundle(rbm);
+      }
+    }
+
+    // Check for circular dependencies. No shared bundle can depend on any 
+    // isolated bundle. 
+    Collection<ModelledResource> sharedBundles = new HashSet<ModelledResource>();
+    sharedBundles.addAll (deployedBundles.getDeployedProvisionBundle());
+    sharedBundles.addAll (deployedBundles.getRequiredUseBundle()); 
+
+    Collection<ModelledResource> appContentBundles = deployedBundles.getDeployedContent();
+    Collection<Content> requiredSharedBundles = new ArrayList<Content>();
+    for (ModelledResource mr : sharedBundles) { 
+      String version = mr.getExportedBundle().getVersion();
+      String exactVersion = "[" + version + "," + version + "]";
+
+      Content ib = ManifestHeaderProcessor.parseContent(mr.getExportedBundle().getSymbolicName(), 
+          exactVersion);
+      requiredSharedBundles.add(ib);
+
+    }
+    // This will throw a ResolverException if the shared content does not resolve
+    Collection<ModelledResource> resolvedSharedBundles = resolver.resolve(appSymbolicName, appVersion
+        , byValueBundles, requiredSharedBundles);
+
+    // we need to find out whether any shared bundles depend on the isolated bundles
+    List<String> suspects = findSuspects (resolvedSharedBundles, sharedBundles, appContentBundles);
+    // If we have differences, it means that we have shared bundles trying to import packages
+    // from isolated bundles. We need to build up the error message and throw a ResolverException
+    if (!suspects.isEmpty()) { 
+    	
+    	
+      StringBuilder msgs = new StringBuilder();
+      List<String> unsatisfiedRequirements = new ArrayList<String>();
+
+      Map<String, List<String>> isolatedBundles = new HashMap<String, List<String>>();
+      // Find the isolated bundles and store all the packages that they export in a map.
+      for (ModelledResource mr : resolvedSharedBundles) {
+        String mrName = mr.getSymbolicName() + "_" + mr.getExportedBundle().getVersion();
+        if (suspects.contains(mrName)) {
+          List<String> exportedPackages = new ArrayList<String>();
+          isolatedBundles.put(mrName, exportedPackages);
+          for (ExportedPackage ep : mr.getExportedPackages()) {
+            exportedPackages.add(ep.getPackageName());
+          }
+        }
+      }
+      // Now loop through the shared bundles, reading the imported packages, and find which ones 
+      // are exported from the isolated bundles.
+      for (ModelledResource mr : resolvedSharedBundles) {
+        String mrName = mr.getSymbolicName() + "_" + mr.getExportedBundle().getVersion();
+        // if current resource isn't an isolated bundle check it's requirements
+        if (!!! suspects.contains(mrName)) {
+          // Iterate through the imported packages of the current shared bundle.
+          for (ImportedPackage ip : mr.getImportedPackages()) {
+            String packageName = ip.getPackageName();
+            List<String> bundlesExportingPackage = new ArrayList<String>();
+            // Loop through each exported package of each isolated bundle, and if we
+            // get a match store the info away.
+            for (Map.Entry<String, List<String>> currBundle : isolatedBundles.entrySet()) {
+
+              List<String> exportedPackages = currBundle.getValue();
+              if (exportedPackages != null && exportedPackages.contains(packageName)) {
+                bundlesExportingPackage.add(currBundle.getKey());
+              }
+            }
+            // If we have found at least one matching entry, we construct the sub message for the
+            // exception.
+            if (!!! bundlesExportingPackage.isEmpty()) {
+              String newMsg;
+              if (bundlesExportingPackage.size() > 1) {
+                newMsg = MessageUtil.getMessage("SHARED_BUNDLE_IMPORTING_FROM_ISOLATED_BUNDLES", 
+                    new Object[] {mrName, packageName, bundlesExportingPackage}); 
+              } else {
+                newMsg = MessageUtil.getMessage("SHARED_BUNDLE_IMPORTING_FROM_ISOLATED_BUNDLE", 
+                    new Object[] {mrName, packageName, bundlesExportingPackage});
+              }
+              msgs.append("\n");
+              msgs.append(newMsg);
+              unsatisfiedRequirements.add(newMsg);
+            }
+          }
+        }
+      }
+      // Once we have iterated over all bundles and have got our translated submessages, 
+      // throw the exception.
+      // Well! if the msgs is empty, no need to throw an exception
+      if (msgs.length() !=0) {
+        String message = MessageUtil.getMessage(
+            "SUSPECTED_CIRCULAR_DEPENDENCIES", new Object[] {appSymbolicName, msgs});
+        ResolverException rx = new ResolverException (message);
+        rx.setUnsatisfiedRequirements(unsatisfiedRequirements);
+        _logger.debug(LOG_EXIT, "generateDeploymentManifest", new Object[] {rx});
+        throw (rx);
+      }
+    }
+    
+    checkForIsolatedContentInProvisionBundle(appSymbolicName, deployedBundles);
+      
+    if (postResolveTransformer != null) try {  
+      deployedBundles = postResolveTransformer.postResolveProcess (appMetadata, deployedBundles);
+    } catch (ServiceUnavailableException e) { 
+      _logger.debug(MessageUtil.getMessage("POST_RESOLVE_TRANSFORMER_UNAVAILABLE",e));
+    }
+    return deployedBundles;
+  }
+  
+
+  @Override
+  public Manifest generateDeploymentManifest(String appSymbolicName,
+      String appVersion, DeployedBundles deployedBundles)
+      throws ResolverException 
+    {
+    
+    _logger.debug (LOG_ENTRY, "generateDeploymentManifest", 
+        new Object[]{appSymbolicName, appVersion, deployedBundles});
+    Map<String, String> deploymentManifestMap = generateDeploymentAttributes(appSymbolicName, 
+        appVersion, deployedBundles);
+    Manifest man = convertMapToManifest(deploymentManifestMap);
+    _logger.debug (LOG_EXIT, "generateDeploymentManifest", man);
+    return man;
+  }
+    
+  /**
+   * Returns a Collection of the {@link ImportedBundle} objects that are
+   * satisfied by the contents of the Collection of requiredUseBundles.
+   * 
+   * @param useBundleSet
+   * @param requiredUseBundle
+   * @return the collection of ImportedBundle objects
+   */
+  private Collection<ImportedBundle> narrowUseBundles(
+      Collection<ImportedBundle> useBundleSet,
+      Collection<ModelledResource> requiredUseBundle) {
+    _logger.debug(LOG_ENTRY, "narrowUseBundles", new Object[] {useBundleSet,requiredUseBundle});
+    Collection<ImportedBundle> result = new HashSet<ImportedBundle>();
+
+    outer : for(ImportedBundle ib : useBundleSet) {
+      for(ModelledResource mb : requiredUseBundle) {
+        if(ib.isSatisfied(mb.getExportedBundle())) {
+          result.add(ib);
+          continue outer;
+        }
+      }
+    }
+    _logger.debug(LOG_EXIT, "narrowUseBundles", result);
+    return result;
+  }
+
+
+
+  private Map<String,String> generateDeploymentAttributes(String appSymbolicName, String version, 
+      DeployedBundles deployedBundles) throws ResolverException
+  {
+    _logger.debug(LOG_ENTRY, "generateDeploymentAttributes", new Object[] {appSymbolicName, version});
+    Map<String,String> result = new HashMap<String, String>();
+    String content = deployedBundles.getContent();
+    if (!content.isEmpty()) {
+      result.put(AppConstants.DEPLOYMENT_CONTENT, content);
+    } else {
+      throw new ResolverException(MessageUtil.getMessage("EMPTY_DEPLOYMENT_CONTENT", appSymbolicName));
+    }
+
+    String useBundle = deployedBundles.getUseBundle();
+    if (!useBundle.isEmpty()) {
+      result.put(AppConstants.DEPLOYMENT_USE_BUNDLE, useBundle);
+    }
+
+    String provisionBundle = deployedBundles.getProvisionBundle();
+    if (!provisionBundle.isEmpty()) {
+      result.put(AppConstants.DEPLOYMENT_PROVISION_BUNDLE, provisionBundle);
+    }
+
+
+    String importServices = deployedBundles.getDeployedImportService();
+    if (!importServices.isEmpty()) { 
+      result.put(AppConstants.DEPLOYMENTSERVICE_IMPORT, importServices);
+    }
+
+    String importPackages = deployedBundles.getImportPackage();
+    if (!importPackages.isEmpty()) {
+      result.put(Constants.IMPORT_PACKAGE, importPackages);
+    }
+
+    result.put(AppConstants.APPLICATION_VERSION, version);
+    result.put(AppConstants.APPLICATION_SYMBOLIC_NAME, appSymbolicName);
+    
+    result.putAll(deployedBundles.getExtraHeaders());
+    
+    _logger.debug(LOG_EXIT, "generateDeploymentAttributes", result);
+    return result;
+  }
+
+  private Manifest convertMapToManifest(Map<String,String> attributes)
+  {
+    _logger.debug(LOG_ENTRY, "convertMapToManifest", new Object[]{attributes});
+    Manifest man = new Manifest();
+    Attributes att = man.getMainAttributes();
+    att.putValue(Attributes.Name.MANIFEST_VERSION.toString(), AppConstants.MANIFEST_VERSION);
+    for (Map.Entry<String, String> entry : attributes.entrySet()) {
+      att.putValue(entry.getKey(),  entry.getValue());
+    }
+    _logger.debug(LOG_EXIT, "convertMapToManifest", new Object[]{man});
+    return man;
+  }
+
+
+
+
+  private static final String FAKE_BUNDLE_NAME = "aries.internal.fake.service.bundle";
+
+  // create a 'mock' bundle that does nothing but export services required by 
+  // Application-ImportService
+  private ModelledResource createFakeBundle (Collection<ServiceDeclaration> appImportServices) throws InvalidAttributeException 
+  {
+    _logger.debug(LOG_ENTRY, "createFakeBundle", new Object[]{appImportServices});
+    Attributes attrs = new Attributes();
+    attrs.putValue(Constants.BUNDLE_SYMBOLICNAME, FAKE_BUNDLE_NAME);
+    attrs.putValue(Constants.BUNDLE_VERSION_ATTRIBUTE, "1.0");
+    attrs.putValue(Constants.BUNDLE_MANIFESTVERSION, "2");
+
+    // Build an ExportedService for every Application-ImportService entry
+    Collection<ExportedService> exportedServices = new ArrayList<ExportedService>();
+    for (ServiceDeclaration sDec : appImportServices) { 
+      Collection<String> ifaces = Arrays.asList(sDec.getInterfaceName());
+      Filter filter = sDec.getFilter();
+      Map<String, String> serviceProperties;
+      if (filter != null) { 
+        serviceProperties = ManifestHeaderProcessor.parseFilter(filter.toString());
+      } else { 
+        serviceProperties = new HashMap<String, String>();
+      }
+      serviceProperties.put("service.imported", "");
+      exportedServices.add (modellingManager.getExportedService("", 0, ifaces, new HashMap<String, Object>(serviceProperties)));
+    }
+    ModelledResource fakeBundle = modellingManager.getModelledResource(null, attrs, null, exportedServices);
+
+    _logger.debug(LOG_EXIT, "createFakeBundle", new Object[]{fakeBundle});
+    return fakeBundle;
+  }
+
+  private void pruneFakeBundleFromResults (Collection<ModelledResource> results) { 
+    _logger.debug(LOG_ENTRY, "pruneFakeBundleFromResults", new Object[]{results});
+    boolean fakeBundleRemoved = false;
+    Iterator<ModelledResource> it = results.iterator();
+    while (!fakeBundleRemoved && it.hasNext()) { 
+      ModelledResource mr = it.next();
+      if (mr.getExportedBundle().getSymbolicName().equals(FAKE_BUNDLE_NAME)) { 
+        it.remove();
+        fakeBundleRemoved = true;
+      }
+    }
+    _logger.debug(LOG_EXIT, "pruneFakeBundleFromResults");
+
+  }
+
+  /**
+   * We've done a sanity check resolve on our sharedBundles and received back 
+   * resolvedSharedBundles. The resolvedSharedBundles should not contain any bundles listed in the isolated bundle list.
+   * If this is not true, we've found a case of shared bundles depending on isolated bundles. 
+   * This method extracts the name_versions of those bundles in resolvedSharedBundles
+   * that do not appear in sharedBundles. 
+   * @param resolvedSharedBundles What we got back from the resolver
+   * @param sharedBundles         What we expected to get back from the resolver
+   * @param appContentBundles     The isolated bundles
+   * @return                      The isolated bundles depended by the shared bundles
+   */
+  private List<String> findSuspects (Collection<ModelledResource> resolvedSharedBundles, 
+      Collection<ModelledResource> sharedBundles, Collection<ModelledResource> appContentBundles){
+    _logger.debug(LOG_ENTRY, "findSuspects", new Object[]{resolvedSharedBundles,sharedBundles, appContentBundles });
+    Set<String> expectedBundles = new HashSet<String>();
+    Set<String> isolatedBundles = new HashSet<String>();
+    for (ModelledResource sb : sharedBundles) { 
+      expectedBundles.add(sb.getExportedBundle().getSymbolicName() + "_" + 
+          sb.getExportedBundle().getVersion());
+    }
+    for (ModelledResource sb : appContentBundles) { 
+    	isolatedBundles.add(sb.getExportedBundle().getSymbolicName() + "_" + 
+            sb.getExportedBundle().getVersion());
+    }
+    List<String> suspects = new ArrayList<String>();
+    for (ModelledResource mr : resolvedSharedBundles) {
+      String thisBundle = mr.getExportedBundle().getSymbolicName() + "_" + 
+      mr.getExportedBundle().getVersion();
+      if (!expectedBundles.contains(thisBundle) && (isolatedBundles.contains(thisBundle))) { 
+        suspects.add(thisBundle);   
+      }
+    }
+    _logger.debug(LOG_EXIT, "findSuspects", new Object[]{suspects});
+
+    return suspects;
+  }
+  
+  /**
+   * Check whether there are isolated bundles deployed into both deployed content and provision bundles. This almost
+   * always indicates a resolution problem hence we throw a ResolverException.
+   * Note that we check provision bundles rather than provision bundles and deployed use bundles. So in any corner case
+   * where the rejected deployment is actually intended, it can still be achieved by introducing a use bundle clause.
+   * 
+   * @param applicationSymbolicName
+   * @param appContentBundles
+   * @param provisionBundles
+   * @throws ResolverException
+   */
+  private void checkForIsolatedContentInProvisionBundle(String applicationSymbolicName, DeployedBundles db)
+    throws ResolverException
+  {
+    for (ModelledResource isolatedBundle : db.getDeployedContent()) {
+      for (ModelledResource provisionBundle : db.getDeployedProvisionBundle()) {
+        if (isolatedBundle.getSymbolicName().equals(provisionBundle.getSymbolicName()) 
+            && providesPackage(provisionBundle, db.getImportPackage())) {
+          
+          throw new ResolverException(
+              MessageUtil.getMessage("ISOLATED_CONTENT_PROVISIONED", 
+                  applicationSymbolicName,
+                  isolatedBundle.getSymbolicName(),
+                  isolatedBundle.getVersion(),
+                  provisionBundle.getVersion()));
+        }
+      }
+    }
+  }
+  
+  /**
+   * Can the modelled resource provide a package against the given import specificiation
+   * @param bundle
+   * @param importPackages
+   * @return
+   */
+  private boolean providesPackage(ModelledResource bundle, String importPackages)
+  {
+    Map<String, NameValueMap<String, String>> imports = ManifestHeaderProcessor.parseImportString(importPackages);
+    
+    try {
+      for (Map.Entry<String, NameValueMap<String,String>> e : imports.entrySet()) {
+        ImportedPackage importPackage = modellingManager.getImportedPackage(e.getKey(), e.getValue());
+        
+        for (ExportedPackage export : bundle.getExportedPackages()) {
+          if (importPackage.isSatisfied(export)) return true;
+        }
+      }
+    } catch (InvalidAttributeException iae) {
+      _logger.error(MessageUtil.getMessage("UNEXPECTED_EXCEPTION_PARSING_IMPORTS", iae, importPackages), iae);
+    }
+    
+    return false;
+  }
+
+  /**
+   * Covert a collection of contents to a collection of ImportedBundle objects
+   * @param content a collection of content
+   * @return a collection of ImportedBundle objects
+   * @throws ResolverException
+   */
+  private Set<ImportedBundle> toImportedBundle(Collection<Content> content) throws ResolverException
+  {
+
+    _logger.debug(LOG_ENTRY, "toImportedBundle", new Object[]{content});
+
+    Set<ImportedBundle> result = new HashSet<ImportedBundle>();
+    for (Content c : content) {
+      try {
+        result.add(modellingManager.getImportedBundle(c.getContentName(), c.getVersion().toString()));
+      } catch (InvalidAttributeException iax) { 
+        ResolverException rx = new ResolverException (iax);
+        _logger.debug(LOG_EXIT, "toImportedBundle", new Object[]{rx});
+        throw rx;
+      }
+    }
+
+    _logger.debug(LOG_EXIT, "toImportedBundle", new Object[]{result});
+
+    return result;
+  }
+
+  private Collection<Content> toContent(Collection<ImportedBundle> ibs)
+  {
+    Collection<Content> contents = new ArrayList<Content>();
+    for (ImportedBundle ib : ibs) {
+      contents.add(ManifestHeaderProcessor.parseContent(ib.getSymbolicName(), ib.getVersionRange()));
+    }
+    return contents;
+  }
+  /**
+   * Get a list of bundles included by value in this application.
+   * @param app The Aries Application
+   * @return a list of by value bundles
+   * @throws IOException
+   * @throws InvalidAttributeException
+   * @throws ModellerException
+   */
+  private Collection<ModelledResource> getByValueBundles(AriesApplication app) throws IOException, InvalidAttributeException, ModellerException {
+
+    _logger.debug(LOG_ENTRY, "getByValueBundles", new Object[]{app});
+
+    Collection<BundleInfo> bundles = app.getBundleInfo();
+    Collection<ModelledResource> result = new ArrayList<ModelledResource>();
+
+    for (BundleInfo bundleInfo: bundles) {      
+      // find out the eba directory
+      String bundleLocation = bundleInfo.getLocation();
+      String bundleFileName = bundleLocation.substring(bundleLocation.lastIndexOf('/') + 1);
+      // just the portion of root directory excluding !      
+      URL jarUrl = new URL(bundleLocation);
+      URLConnection jarCon = jarUrl.openConnection();
+      jarCon.connect();
+      InputStream in = jarCon.getInputStream();
+      File temp = new File(getLocalPlatform().getTemporaryDirectory() + bundleFileName);
+      OutputStream out = new FileOutputStream(temp);
+      IOUtils.copy(in, out);
+      IOUtils.close(out);
+      result.add(modelledResourceManager.getModelledResource(null, FileSystem.getFSRoot(temp)));
+      // delete the temp file
+      temp.delete();
+    }
+    _logger.debug(LOG_EXIT, "getByValueBundles", new Object[]{result});
+    return result;
+  }
+
+
+}

Added: aries/tags/application-0.3/application-deployment-management/src/main/java/org/apache/aries/application/deployment/management/internal/MessageUtil.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-deployment-management/src/main/java/org/apache/aries/application/deployment/management/internal/MessageUtil.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-deployment-management/src/main/java/org/apache/aries/application/deployment/management/internal/MessageUtil.java (added)
+++ aries/tags/application-0.3/application-deployment-management/src/main/java/org/apache/aries/application/deployment/management/internal/MessageUtil.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,139 @@
+/*
+ * 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.deployment.management.internal;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ResourceBundle;
+
+public class MessageUtil
+{
+  /** The resource bundle for blueprint messages */
+  private final static ResourceBundle messages = ResourceBundle.getBundle("org.apache.aries.application.deployment.management.messages.DeploymentManagementMessages");
+  private static class Message {
+    public String msgKey;
+    public Object[] inserts;
+    public Exception cause;
+    
+    public Message(String msgKey, Exception cause, Object[] inserts) {
+      this.msgKey = msgKey;
+      this.cause = cause;
+      this.inserts = inserts;
+    }
+  }
+  
+  private List<Message> errors = new ArrayList<Message>();
+  private List<Message> warnings = new ArrayList<Message>();
+  private final String fileName;
+  
+  public MessageUtil(String fileName) {
+    this.fileName = fileName;
+  }
+  
+  public String getFileName() {
+    return fileName;
+  }
+  
+  public void processMessages()
+  {
+    
+      for (Message m : errors) {
+        //Tr.error(tc, m.msgKey, m.inserts);
+        // use logger
+      }
+    
+
+    
+      for (Message m : warnings) {
+        //Tr.warning(tc, m.msgKey, m.inserts);
+        // use logger
+      }        
+          
+  }
+  
+  public List<String> getErrors()
+  {
+    List<String> result = new ArrayList<String>(warnings.size());
+    for (Message m : warnings) {
+      result.add(MessageFormat.format(messages.getString(m.msgKey), m.inserts));
+    }
+    
+    return result;    
+  }
+  
+  public List<String> getWarnings()
+  {
+    List<String> result = new ArrayList<String>(warnings.size());
+    for (Message m : warnings) {
+      result.add(MessageFormat.format(messages.getString(m.msgKey), m.inserts));
+    }
+    
+    return result;
+  }
+  
+  
+  public void clear() 
+  {
+    errors.clear();
+    warnings.clear();
+  }
+  
+  public boolean hasErrors() 
+  {
+    return !!!errors.isEmpty();
+  }
+  
+  public void error(String msgKey, Object ... inserts) 
+  {
+    errors.add(new Message(msgKey, null, inserts));
+  }
+  
+  public void error(String msgKey, Exception e, Object ... inserts)
+  {
+    errors.add(new Message(msgKey, e, inserts));
+  }
+  
+  public void warning(String msgKey, Object ... inserts)
+  {
+    warnings.add(new Message(msgKey, null, inserts));
+  }
+  
+  public void warning(String msgKey, Exception e, Object ... inserts)
+  {
+    warnings.add(new Message(msgKey, e, inserts));
+  }
+  /**
+   * Resolve a message from the bundle, including any necessary formatting.
+   * 
+   * @param key     the message key.
+   * @param inserts any required message inserts.
+   * @return        the message translated into the server local.
+   */
+  public static final String getMessage(String key, Object ... inserts)
+  {
+    String msg = messages.getString(key);
+    
+    if (inserts.length > 0)
+      msg = MessageFormat.format(msg, inserts);
+    
+    return msg;
+  }
+}

Added: aries/tags/application-0.3/application-deployment-management/src/main/resources/OSGI-INF/blueprint/deployment-manager.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-deployment-management/src/main/resources/OSGI-INF/blueprint/deployment-manager.xml?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-deployment-management/src/main/resources/OSGI-INF/blueprint/deployment-manager.xml (added)
+++ aries/tags/application-0.3/application-deployment-management/src/main/resources/OSGI-INF/blueprint/deployment-manager.xml Sun Feb 27 20:20:13 2011
@@ -0,0 +1,40 @@
+<?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="deploymentManifestManager" class="org.apache.aries.application.deployment.management.impl.DeploymentManifestManagerImpl">
+    <property name="resolver" ref="resolver"/>
+    <property name="postResolveTransformer" ref="postResolveTransformer"/>
+    <property name="modelledResourceManager" ref = "modelledResourceManager"/>
+    <property name="localPlatform" ref="localPlatform"/>
+    <property name="modellingManager" ref="modellingManager"/>
+    <property name="modellingHelper" ref="modellingHelper"/>
+  </bean>
+  
+  <reference id="modellingManager" interface="org.apache.aries.application.modelling.ModellingManager"/>
+  <reference id="modellingHelper" interface="org.apache.aries.application.modelling.utils.ModellingHelper"/>
+  <reference id="modelledResourceManager" interface="org.apache.aries.application.modelling.ModelledResourceManager"/>
+  <reference id="localPlatform" interface="org.apache.aries.application.management.spi.runtime.LocalPlatform"/>
+  <reference id="resolver" interface="org.apache.aries.application.management.spi.resolve.AriesApplicationResolver"/>
+  <reference id="postResolveTransformer" interface="org.apache.aries.application.management.spi.resolve.PostResolveTransformer"/>
+  
+  <service id ="deploymentManifestManager-Service" ref="deploymentManifestManager" interface="org.apache.aries.application.management.spi.resolve.DeploymentManifestManager"/>
+    
+</blueprint>
\ No newline at end of file

Added: aries/tags/application-0.3/application-deployment-management/src/main/resources/org/apache/aries/application/deployment/management/messages/DeploymentManagementMessages.properties
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-deployment-management/src/main/resources/org/apache/aries/application/deployment/management/messages/DeploymentManagementMessages.properties?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-deployment-management/src/main/resources/org/apache/aries/application/deployment/management/messages/DeploymentManagementMessages.properties (added)
+++ aries/tags/application-0.3/application-deployment-management/src/main/resources/org/apache/aries/application/deployment/management/messages/DeploymentManagementMessages.properties Sun Feb 27 20:20:13 2011
@@ -0,0 +1,28 @@
+#
+# 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.
+#
+SHARED_BUNDLE_IMPORTING_FROM_ISOLATED_BUNDLE=Shared bundle {0} has a dependency for package {1} which is exported from application bundle {2}
+SHARED_BUNDLE_IMPORTING_FROM_ISOLATED_BUNDLES=Shared bundle {0} has a dependency for package {1} which is exported from application bundles {2} 
+
+SUSPECTED_CIRCULAR_DEPENDENCIES=Resolution of asset {0} indicates invalid dependencies of shared content on application content: {1} 
+
+EMPTY_DEPLOYMENT_CONTENT=Enterprise application {0} contains no content. 
+POST_RESOLVE_TRANSFORMER_UNAVAILABLE=An instance of the PostResolveTransformer was injected earlier but is currently inaccessible. Exception: {0}
+
+ISOLATED_CONTENT_PROVISIONED=Enterprise application {0} has resolved to a configuration where bundle {1} is deployed as part of the deployment content at version {2} and also as part of provisioned content at version {3}.
+UNEXPECTED_EXCEPTION_PARSING_IMPORTS=An unexpected exception {0} was encountered during parsing the generated import package statement {1}.
\ No newline at end of file