aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From z..@apache.org
Subject svn commit: r1075132 [13/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-ap...
Date Sun, 27 Feb 2011 20:20:30 GMT
Added: aries/tags/application-0.3/application-obr-resolver/src/main/resources/OSGI-INF/blueprint/obr-resolver.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-obr-resolver/src/main/resources/OSGI-INF/blueprint/obr-resolver.xml?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-obr-resolver/src/main/resources/OSGI-INF/blueprint/obr-resolver.xml (added)
+++ aries/tags/application-0.3/application-obr-resolver/src/main/resources/OSGI-INF/blueprint/obr-resolver.xml Sun Feb 27 20:20:13 2011
@@ -0,0 +1,51 @@
+<?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="obr-resolver" class="org.apache.aries.application.resolver.obr.OBRAriesResolver" scope="singleton">
+        <argument>
+            <reference interface="org.apache.felix.bundlerepository.RepositoryAdmin"/>
+        </argument>
+        <property name="platformRepository" ref="platformRepository"/>
+        <property name="modellingManager" ref="modellingManager"/>
+        <property name="modellingHelper" ref="modellingHelper"/>
+        
+    </bean>
+    <reference id="platformRepository" interface="org.apache.aries.application.management.spi.repository.PlatformRepository"/>
+    <reference id="modellingManager" interface="org.apache.aries.application.modelling.ModellingManager"/>
+    <reference id="modellingHelper" interface="org.apache.aries.application.modelling.utils.ModellingHelper"/>
+    <service ref="obr-resolver" interface="org.apache.aries.application.management.spi.resolve.AriesApplicationResolver"/>
+            
+    
+    <bean id="repository-generator" class="org.apache.aries.application.resolver.obr.impl.RepositoryGeneratorImpl" activation="lazy">
+        <argument>
+            <reference interface="org.apache.felix.bundlerepository.RepositoryAdmin"/>
+        </argument>
+        <property name="bundleResourceTransformers" ref="bundle-resource-transformers"/>
+    </bean>
+    <service id="repository-generator-service" ref="repository-generator" interface="org.apache.aries.application.management.spi.repository.RepositoryGenerator"/>
+    
+    <reference-list id="bundle-resource-transformers" 
+      interface="org.apache.aries.application.resolver.obr.ext.BundleResourceTransformer"
+      availability="optional"/>
+    
+
+</blueprint>
+

Added: aries/tags/application-0.3/application-obr-resolver/src/main/resources/org/apache/aries/application/resolver/messages/ResolverMessages.properties
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-obr-resolver/src/main/resources/org/apache/aries/application/resolver/messages/ResolverMessages.properties?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-obr-resolver/src/main/resources/org/apache/aries/application/resolver/messages/ResolverMessages.properties (added)
+++ aries/tags/application-0.3/application-obr-resolver/src/main/resources/org/apache/aries/application/resolver/messages/ResolverMessages.properties Sun Feb 27 20:20:13 2011
@@ -0,0 +1,127 @@
+#
+# 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.
+#
+RESOLVER_UNABLE_TO_READ_REPOSITORY_EXCEPTION=An internal error occurred. When provisioning the EBA archive {0}, cannot read the repository {1}.
+
+RESOLVER_UNABLE_TO_RESOLVE=The system cannot provision the EBA {0} because the following problems in the dependency chain were detected: {1}
+#
+# The following sentences will be added as separate lines following the message above. They are NOT used as independent messages.
+#
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE=The package dependency {0} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_WITH_ATTRS=The package dependency {0} with attributes {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_WITH_VERSION=The package dependency {0} with the version {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_WITH_VERSION_LOW=The package dependency {0} with the version greater than or equal to {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_WITH_VERSION_LOW_UP=The package dependency {0} with the version greater than or equal to {1} and less than or equal to {2} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_WITH_VERSION_LOW_UPEX=The package dependency {0} with the version greater than or equal to {1} and less than {2} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_WITH_VERSION_LOWEX=The package dependency {0} with the version greater than {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_WITH_VERSION_LOWEX_UP=The package dependency {0} with the version greater than {1} and less than or equal to {2} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_WITH_VERSION_LOWEX_UPEX=The package dependency {0} with the version greater than {1} and less than {2} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_WITH_ATTRS_WITH_VERSION=The package dependency {0} with attributes {1} and the version {2} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_WITH_ATTRS_WITH_VERSION_LOW=The package dependency {0} with attributes {1} and the version greater than or equal to {2} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_WITH_ATTRS_WITH_VERSION_LOW_UP=The package dependency {0} with attributes {1} and the version greater than or equal to {2} and less than or equal to {3} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_WITH_ATTRS_WITH_VERSION_LOW_UPEX=The package dependency {0} with attributes {1} and the version greater than or equal to {2} and less than {3} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_WITH_ATTRS_WITH_VERSION_LOWEX=The package dependency {0} with attributes {1} and the version greater than {2} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_WITH_ATTRS_WITH_VERSION_LOWEX_UP=The package dependency {0} with attributes {1} and the version greater than {2} and below than or equal to {3} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_WITH_ATTRS_WITH_VERSION_LOWEX_UPEX=The package dependency {0} with attributes {1} and the version greater than {2} and less than {3} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_REQUIRED_BY_BUNDLE=The package dependency {0} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_REQUIRED_BY_BUNDLE_WITH_ATTRS=The package dependency {0} with attributes {2} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_REQUIRED_BY_BUNDLE_WITH_VERSION=The package dependency {0} with the version {2} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_REQUIRED_BY_BUNDLE_WITH_VERSION_LOW=The package dependency {0} with the version greater than or equal to {2} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_REQUIRED_BY_BUNDLE_WITH_VERSION_LOW_UP=The package dependency {0} with the version greater than or equal to {2} and less than or equal to {3} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_REQUIRED_BY_BUNDLE_WITH_VERSION_LOW_UPEX=The package dependency {0} with the version greater than or equal to {2} and less than {3} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_REQUIRED_BY_BUNDLE_WITH_VERSION_LOWEX=The package dependency {0} with the version greater than {2} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_REQUIRED_BY_BUNDLE_WITH_VERSION_LOWEX_UP=The package dependency {0} with the version greater than {2} and less than or equal to {3} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_REQUIRED_BY_BUNDLE_WITH_VERSION_LOWEX_UPEX=The package dependency {0} with the version greater than {2} and less than {3} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_REQUIRED_BY_BUNDLE_WITH_ATTRS_WITH_VERSION=The package dependency {0} with attributes {2} and the version {3} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_REQUIRED_BY_BUNDLE_WITH_ATTRS_WITH_VERSION_LOW=The package dependency {0} with attributes {2} and the version greater than or equal to {3} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_REQUIRED_BY_BUNDLE_WITH_ATTRS_WITH_VERSION_LOW_UP=The package dependency {0} with attributes {2} and the version greater than or equal to {3} and less than or equal to {4} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_REQUIRED_BY_BUNDLE_WITH_ATTRS_WITH_VERSION_LOW_UPEX=The package dependency {0} with attributes {2} and the version greater than or equal to {3} and less than {4} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_REQUIRED_BY_BUNDLE_WITH_ATTRS_WITH_VERSION_LOWEX=The package dependency {0} with attributes {2} and the version greater than {3} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_REQUIRED_BY_BUNDLE_WITH_ATTRS_WITH_VERSION_LOWEX_UP=The package dependency {0} with attributes {2} and the version greater than {3} and below than or equal to {4} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_PACKAGE_REQUIRED_BY_BUNDLE_WITH_ATTRS_WITH_VERSION_LOWEX_UPEX=The package dependency {0} with attributes {2} and the version greater than {3} and less than {4} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE=The bundle dependency {0} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_WITH_ATTRS=The bundle dependency {0} with attributes {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_WITH_VERSION=The bundle dependency {0} with the version {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_WITH_VERSION_LOW=The bundle dependency {0} with the version greater than or equal to {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_WITH_VERSION_LOW_UP=The bundle dependency {0} with the version greater than or equal to {1} and less than or equal to {2} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_WITH_VERSION_LOW_UPEX=The bundle dependency {0} with the version greater than or equal to {1} and less than {2} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_WITH_VERSION_LOWEX=The bundle dependency {0} with the version greater than {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_WITH_VERSION_LOWEX_UP=The bundle dependency {0} with the version greater than {1} and less than or equal to {2} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_WITH_VERSION_LOWEX_UPEX=The bundle dependency {0} with the version greater than {1} and less than {2} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_WITH_ATTRS_WITH_VERSION=The bundle dependency {0} with attributes {1} and the version {2} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_WITH_ATTRS_WITH_VERSION_LOW=The bundle dependency {0} with attributes {1} and the version greater than or equal to {2} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_WITH_ATTRS_WITH_VERSION_LOW_UP=The bundle dependency {0} with attributes {1} and the version greater than or equal to {2} and less than or equal to {3} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_WITH_ATTRS_WITH_VERSION_LOW_UPEX=The bundle dependency {0} with attributes {1} and the version greater than or equal to {2} and less than {3} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_WITH_ATTRS_WITH_VERSION_LOWEX=The bundle dependency {0} with attributes {1} and the version greater than {2} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_WITH_ATTRS_WITH_VERSION_LOWEX_UP=The bundle dependency {0} with attributes {1} and the version greater than {2} and less than or equal to {3} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_WITH_ATTRS_WITH_VERSION_LOWEX_UPEX=The bundle dependency {0} with attributes {1} and the version greater than {2} and less than {3} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_REQUIRED_BY_BUNDLE=The bundle dependency {0} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_REQUIRED_BY_BUNDLE_WITH_ATTRS=The bundle dependency {0} with attributes {2} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_REQUIRED_BY_BUNDLE_WITH_VERSION=The bundle dependency {0} with the version {2} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_REQUIRED_BY_BUNDLE_WITH_VERSION_LOW=The bundle dependency {0} with the version greater than or equal to {2} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_REQUIRED_BY_BUNDLE_WITH_VERSION_LOW_UP=The bundle dependency {0} with the version greater than or equal to {2} and less than or equal to {3} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_REQUIRED_BY_BUNDLE_WITH_VERSION_LOW_UPEX=The bundle dependency {0} with the version greater than or equal to {2} and less than {3} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_REQUIRED_BY_BUNDLE_WITH_VERSION_LOWEX=The bundle dependency {0} with the version greater than {2} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_REQUIRED_BY_BUNDLE_WITH_VERSION_LOWEX_UP=The bundle dependency {0} with the version greater than {2} and less than or equal to {3} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_REQUIRED_BY_BUNDLE_WITH_VERSION_LOWEX_UPEX=The bundle dependency {0} with the version greater than {2} and less than {3} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_REQUIRED_BY_BUNDLE_WITH_ATTRS_WITH_VERSION=The bundle dependency {0} with attributes {2} and the version {3} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_REQUIRED_BY_BUNDLE_WITH_ATTRS_WITH_VERSION_LOW=The bundle dependency {0} with attributes {2} and the version greater than or equal to {3} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_REQUIRED_BY_BUNDLE_WITH_ATTRS_WITH_VERSION_LOW_UP=The bundle dependency {0} with attributes {2} and the version greater than or equal to {3} and less than or equal to {4} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_REQUIRED_BY_BUNDLE_WITH_ATTRS_WITH_VERSION_LOW_UPEX=The bundle dependency {0} with attributes {2} and the version greater than or equal to {3} and less than {4} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_REQUIRED_BY_BUNDLE_WITH_ATTRS_WITH_VERSION_LOWEX=The bundle dependency {0} with attributes {2} and the version greater than {3} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_REQUIRED_BY_BUNDLE_WITH_ATTRS_WITH_VERSION_LOWEX_UP=The bundle dependency {0} with attributes {2} and the version greater than {3} and less than or equal to {4} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_BUNDLE_REQUIRED_BY_BUNDLE_WITH_ATTRS_WITH_VERSION_LOWEX_UPEX=The bundle dependency {0} with attributes {2} and the version greater than {3} and less than {4} required by bundle {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE=The service dependency cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_WITH_ATTRS=The service dependency with attributes {0} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_WITH_VERSION=The service dependency with the version {0} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_WITH_VERSION_LOW=The service dependency with the version greater than or equal to {0} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_WITH_VERSION_LOW_UP=The service dependency with the version greater than or equal to {0} and less than or equal to {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_WITH_VERSION_LOW_UPEX=The service dependency with the version greater than or equal to {0} and less than {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_WITH_VERSION_LOWEX=The service dependency with the version greater than {0} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_WITH_VERSION_LOWEX_UP=The service dependency with the version greater than {0} and less than or equal to {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_WITH_VERSION_LOWEX_UPEX=The service dependency with the version greater than {0} and less than {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_WITH_ATTRS_WITH_VERSION=The service dependency with attributes {0} and the version {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_WITH_ATTRS_WITH_VERSION_LOW=The service dependency with attributes {0} and the version greater than or equal to {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_WITH_ATTRS_WITH_VERSION_LOW_UP=The service dependency with attributes {0} and the version greater than or equal to {1} and less than or equal to {2} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_WITH_ATTRS_WITH_VERSION_LOW_UPEX=The service dependency with attributes {0} and the version greater than or equal to {1} and less than {2} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_WITH_ATTRS_WITH_VERSION_LOWEX=The service dependency with attributes {0} and the version greater than {1} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_WITH_ATTRS_WITH_VERSION_LOWEX_UP=The service dependency with attributes {0} and the version greater than {1} and less than or equal to {2} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_WITH_ATTRS_WITH_VERSION_LOWEX_UPEX=The service dependency with attributes {0} and the version greater than {1} and less than {2} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_REQUIRED_BY_BUNDLE=The service dependency required by bundle {0} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_REQUIRED_BY_BUNDLE_WITH_ATTRS=The service dependency with attributes {1} required by bundle {0} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_REQUIRED_BY_BUNDLE_WITH_VERSION=The service dependency with the version {1} required by bundle {0} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_REQUIRED_BY_BUNDLE_WITH_VERSION_LOW=The service dependency with the version greater than or equal to {1} required by bundle {0} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_REQUIRED_BY_BUNDLE_WITH_VERSION_LOW_UP=The service dependency with the version greater than or equal to {2} and less than or equal to {1} required by bundle {0} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_REQUIRED_BY_BUNDLE_WITH_VERSION_LOW_UPEX=The service dependency with the version greater than or equal to {2} and less than {1} required by bundle {0} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_REQUIRED_BY_BUNDLE_WITH_VERSION_LOWEX=The service dependency with the version greater than {1} required by bundle {0} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_REQUIRED_BY_BUNDLE_WITH_VERSION_LOWEX_UP=The service dependency with the version greater than {2} and less than or equal to {1} required by bundle {0} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_REQUIRED_BY_BUNDLE_WITH_VERSION_LOWEX_UPEX=The service dependency with the version greater than {2} and less than {1} required by bundle {0} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_REQUIRED_BY_BUNDLE_WITH_ATTRS_WITH_VERSION=The service dependency with attributes {1} and the version {2} required by bundle {0} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_REQUIRED_BY_BUNDLE_WITH_ATTRS_WITH_VERSION_LOW=The service dependency with attributes {1} and the version greater than or equal to {2} required by bundle {0} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_REQUIRED_BY_BUNDLE_WITH_ATTRS_WITH_VERSION_LOW_UP=The service dependency with attributes {1} and the version greater than or equal to {3} and less than or equal to {2} required by bundle {0} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_REQUIRED_BY_BUNDLE_WITH_ATTRS_WITH_VERSION_LOW_UPEX=The service dependency with attributes {1} and the version greater than or equal to {3} and less than {2} required by bundle {0}  cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_REQUIRED_BY_BUNDLE_WITH_ATTRS_WITH_VERSION_LOWEX=The service dependency with attributes {1} and the version greater than {2} required by bundle {0} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_REQUIRED_BY_BUNDLE_WITH_ATTRS_WITH_VERSION_LOWEX_UP=The service dependency with attributes {1} and the version greater than {3} and less than or equal to {2} required by bundle {0} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_SERVICE_REQUIRED_BY_BUNDLE_WITH_ATTRS_WITH_VERSION_LOWEX_UPEX=The service dependency with attributes {1} and the version greater than {3} and less than {2} required by bundle {0} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_FILTER=A dependency of unspecified type with filter {0} cannot be resolved.
+RESOLVER_UNABLE_TO_RESOLVE_FILTER_REQUIRED_BY_BUNDLE=A dependency of unspecified type with filter {0} required by bundle {1} cannot be resolved.
+#
+# End of sentences added
+NO_EXPORTED_BUNDLE=An internal error occurred. The runtime was unable to model the provisioned resource as a bundle.
+TOO_MANY_EXPORTED_BUNDLES=An internal error occurred. The runtime was unable to model the provisioned resource as a bundle.
+

Added: aries/tags/application-0.3/application-obr-resolver/src/test/java/org/apache/aries/application/resolver/obr/impl/AriesResolverTest.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-obr-resolver/src/test/java/org/apache/aries/application/resolver/obr/impl/AriesResolverTest.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-obr-resolver/src/test/java/org/apache/aries/application/resolver/obr/impl/AriesResolverTest.java (added)
+++ aries/tags/application-0.3/application-obr-resolver/src/test/java/org/apache/aries/application/resolver/obr/impl/AriesResolverTest.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,271 @@
+/*
+ * 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.resolver.obr.impl;
+
+
+import static junit.framework.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.aries.application.resolver.obr.OBRAriesResolver;
+import org.apache.aries.unittest.mocks.Skeleton;
+import org.apache.felix.bundlerepository.Capability;
+import org.apache.felix.bundlerepository.Reason;
+import org.apache.felix.bundlerepository.RepositoryAdmin;
+import org.apache.felix.bundlerepository.Requirement;
+import org.apache.felix.bundlerepository.Resolver;
+import org.apache.felix.bundlerepository.Resource;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Version;
+
+
+public class AriesResolverTest extends OBRAriesResolver
+{
+  Resolver resolver;
+  ResolverMock resolverMock;
+  
+  
+  public AriesResolverTest() {
+    super(Skeleton.newMock(RepositoryAdmin.class));
+  }
+  static class ResolverMock {
+    private final List<Resource> resources = new ArrayList<Resource>();
+    private final Map<String, List<Requirement>> requirements = new HashMap<String, List<Requirement>>();
+    private String curRes;
+    private ResourceMock curResMock;
+    private RequirementMock curReqMock;
+    
+    public Reason[] getReason(Resource r)
+    {
+      Requirement[] reqs = requirements.get(r.getSymbolicName() + "_" + r.getVersion()).toArray(new Requirement[0]);
+      
+      Reason[] reasons = new Reason[reqs.length];
+      int i=0;
+      for (Requirement req : reqs) {
+        
+        reasons[i++] = new ReasonMock(r, req);
+      }
+      return reasons;
+    }
+    
+    public Resource[] getRequiredResources()
+    {
+      return resources.toArray(new Resource[0]);
+    }
+    
+    public ResolverMock res(String name, String version)
+    {
+      curRes = name + "_" + version;
+      curResMock = new ResourceMock(name,version);
+      resources.add(Skeleton.newMock(curResMock, Resource.class));
+      requirements.put(curRes, new ArrayList<Requirement>());
+      return this;
+    }
+    
+    public ResolverMock optional() 
+    {
+      curReqMock.optional = true;
+      return this;
+    }
+    
+    public ResolverMock req(String name)
+    {
+      // requirements are based on String, so that we have valid equals and hashCode implementations
+      curReqMock = new RequirementMock(name);
+      requirements.get(curRes).add(Skeleton.newMock(curReqMock, Requirement.class));
+      curResMock.addCapability(name);
+      return this;
+    }
+  }
+  
+  static class CapabilityMock {
+    private final String cap;
+    
+    CapabilityMock(String cap) {
+      this.cap = cap;
+    }
+    
+    @Override
+    public String toString() {
+      return cap;
+    }
+  }
+  
+  static class RequirementMock {
+    private final String req;
+    public boolean optional = false;
+    
+    RequirementMock(String req) {
+      this.req = req;
+    }
+    
+    public boolean isSatisfied(Capability c) {
+      return c.toString().equals(req);
+    }
+    
+    public boolean isOptional() {
+      return optional;
+    }
+  }
+  static class ReasonMock implements Reason{
+    private final Resource res;
+    private final Requirement req;
+    ReasonMock (Resource res, Requirement req) {
+      this.res = res;
+      this.req = req;
+    }
+    
+    public Resource getResource() {
+      return this.res;
+    }
+    public Requirement getRequirement()
+    {
+      return this.req;
+    }
+  }
+  static class ResourceMock {
+    private final String name;
+    private final Version version;
+    private final List<Capability> capabilities;
+    
+    ResourceMock(String name, String version) { 
+      this.name = name; 
+      this.version = new Version(version); 
+      capabilities = new ArrayList<Capability>();
+    }
+    
+    public void addCapability(String cap) {
+      capabilities.add(Skeleton.newMock(new CapabilityMock(cap), Capability.class));
+    }
+    
+    public Capability[] getCapabilities() {
+      return capabilities.toArray(new Capability[0]);
+    }
+    
+    public Version getVersion() { return version; }
+    public String getSymbolicName() { return name; }
+  }
+  
+  @Before
+  public void before()
+  {
+    resolverMock = new ResolverMock();
+    resolver = Skeleton.newMock(resolverMock, Resolver.class);
+  }
+  
+  @Test
+  public void testIncompatible()
+  {
+    resolverMock
+      .res("com.ibm.test", "0.0.0")
+        .req("a")
+        .req("b")
+      .res("com.ibm.test", "1.0.0")
+        .req("a")
+        .req("c");
+    
+    List<Resource> res = retrieveRequiredResources(resolver);
+    assertEquals(2, res.size());
+    assertResource(res.get(0), "com.ibm.test", "0.0.0");
+    assertResource(res.get(1), "com.ibm.test", "1.0.0");
+  }
+  
+  @Test 
+  public void testLeftRedundant()
+  {
+    resolverMock
+      .res("com.ibm.test", "0.0.0")
+        .req("a")
+        .req("b")
+      .res("com.ibm.test", "1.0.0")
+        .req("a")
+        .req("b")
+        .req("c");
+
+    List<Resource> res = retrieveRequiredResources(resolver);
+    assertEquals(1, res.size());
+    assertResource(res.get(0), "com.ibm.test", "1.0.0");
+  }
+  
+  @Test
+  public void testRightRedundant()
+  {
+    resolverMock
+      .res("com.ibm.test", "0.0.0")
+        .req("a")
+        .req("b")
+        .req("c")
+      .res("com.ibm.test", "1.0.0")
+        .req("a")
+        .req("c");
+
+    List<Resource> res = retrieveRequiredResources(resolver);
+    assertEquals(1, res.size());
+    assertResource(res.get(0), "com.ibm.test", "0.0.0");
+  }
+  
+  @Test
+  public void testEquivalent()
+  {
+    resolverMock
+      .res("com.ibm.test", "0.0.0")
+        .req("a")
+        .req("b")
+      .res("com.ibm.test", "2.0.0")
+        .req("a")
+        .req("b")
+      .res("com.ibm.test", "1.0.0")
+        .req("a")
+        .req("b");
+  
+    List<Resource> res = retrieveRequiredResources(resolver);
+    assertEquals(1, res.size());
+    assertResource(res.get(0), "com.ibm.test", "2.0.0");
+  }
+  
+  @Test
+  public void testEquivalentWithOptionals()
+  {
+    // 1.1.0 and 1.0.0 are incompatible if we leave aside that "c" is optional. 
+    // "bundle" is the downgrade dependency on 1.0.0, "c" is the optional service requirement for the CommentService
+    resolverMock
+      .res("com.ibm.test", "1.0.0")
+        .req("a")
+        .req("b")
+        .req("bundle")
+      .res("com.ibm.test", "1.1.0")
+        .req("a")
+        .req("b")
+        .req("c").optional();
+    
+    List<Resource> res = retrieveRequiredResources(resolver);
+    assertEquals(1, res.size());
+    assertResource(res.get(0), "com.ibm.test", "1.0.0");    
+  }
+  
+  private void assertResource(Resource r, String name, String version)
+  {
+    assertEquals(name, r.getSymbolicName());
+    assertEquals(version, r.getVersion().toString());
+  }
+}

Added: aries/tags/application-0.3/application-runtime-framework-management/pom.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-runtime-framework-management/pom.xml?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-runtime-framework-management/pom.xml (added)
+++ aries/tags/application-0.3/application-runtime-framework-management/pom.xml Sun Feb 27 20:20:13 2011
@@ -0,0 +1,88 @@
+<?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/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.runtime.framework.management</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Aries Bundle Framework Manager provider</name>
+    <description>
+        A bundle framework manager implementation
+    </description>
+
+    <properties>
+        <aries.osgi.export.pkg>
+        </aries.osgi.export.pkg>
+        <aries.osgi.private.pkg>
+			org.apache.aries.application.runtime.framework.management
+        </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.application</groupId>
+            <artifactId>org.apache.aries.application.runtime.framework</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.application</groupId>
+            <artifactId>org.apache.aries.application.utils</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>
+            <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>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+  
+</project>

Added: aries/tags/application-0.3/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/BundleFrameworkManagerImpl.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/BundleFrameworkManagerImpl.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/BundleFrameworkManagerImpl.java (added)
+++ aries/tags/application-0.3/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/BundleFrameworkManagerImpl.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,335 @@
+/*
+ * 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.framework.management;
+
+import static org.apache.aries.application.utils.AppConstants.LOG_ENTRY;
+import static org.apache.aries.application.utils.AppConstants.LOG_EXCEPTION;
+import static org.apache.aries.application.utils.AppConstants.LOG_EXIT;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.aries.application.DeploymentContent;
+import org.apache.aries.application.DeploymentMetadata;
+import org.apache.aries.application.management.AriesApplication;
+import org.apache.aries.application.management.UpdateException;
+import org.apache.aries.application.management.spi.framework.BundleFramework;
+import org.apache.aries.application.management.spi.framework.BundleFrameworkConfiguration;
+import org.apache.aries.application.management.spi.framework.BundleFrameworkConfigurationFactory;
+import org.apache.aries.application.management.spi.framework.BundleFrameworkFactory;
+import org.apache.aries.application.management.spi.framework.BundleFrameworkManager;
+import org.apache.aries.application.management.spi.repository.ContextException;
+import org.apache.aries.application.management.spi.repository.BundleRepository.BundleSuggestion;
+import org.apache.aries.application.management.spi.update.UpdateStrategy;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class BundleFrameworkManagerImpl implements BundleFrameworkManager
+{
+  private static final Logger LOGGER = LoggerFactory.getLogger(BundleFrameworkManagerImpl.class);
+
+  BundleContext _ctx;
+  BundleFramework _sharedBundleFramework;
+  BundleFrameworkFactory _bundleFrameworkFactory;
+  BundleFrameworkConfigurationFactory _bundleFrameworkConfigurationFactory;
+  Map<Bundle, BundleFramework> _frameworks = new HashMap<Bundle, BundleFramework>();
+  Map<String, BundleFramework> _frameworksByAppScope = new HashMap<String, BundleFramework>();
+  private List<UpdateStrategy> _updateStrategies = Collections.emptyList();
+
+  public void setUpdateStrategies(List<UpdateStrategy> updateStrategies)
+  {
+    _updateStrategies = updateStrategies;
+  }
+
+  public void setBundleContext(BundleContext ctx)
+  {
+    _ctx = ctx;
+  }
+
+  public void setBundleFrameworkFactory(BundleFrameworkFactory bff)
+  {
+    _bundleFrameworkFactory = bff;
+  }
+
+  public void setBundleFrameworkConfigurationFactory(BundleFrameworkConfigurationFactory bfcf)
+  {
+    _bundleFrameworkConfigurationFactory = bfcf;
+  }
+
+  public void init()
+  {
+    synchronized (BundleFrameworkManager.SHARED_FRAMEWORK_LOCK) {
+      try {
+        _sharedBundleFramework = SharedBundleFramework.getSharedBundleFramework(_ctx,
+            _bundleFrameworkConfigurationFactory,
+            _bundleFrameworkFactory);
+        _frameworks.put(_sharedBundleFramework.getFrameworkBundle(), _sharedBundleFramework);
+      } catch (ContextException e) {
+        LOGGER.error(LOG_EXCEPTION, e);
+      }
+    }
+  }
+
+  public BundleFramework getBundleFramework(Bundle frameworkBundle)
+  {
+    BundleFramework framework = null;
+    synchronized (BundleFrameworkManager.SHARED_FRAMEWORK_LOCK) {
+      framework = _frameworks.get(frameworkBundle);
+    }
+    return framework;
+  }
+
+  public Bundle installIsolatedBundles(Collection<BundleSuggestion> bundlesToInstall,
+      AriesApplication app) throws BundleException
+  {
+    Bundle frameworkBundle = null;
+
+    synchronized (BundleFrameworkManager.SHARED_FRAMEWORK_LOCK) {
+      // We need to create a new isolated framework for this content and install
+      // the bundles to it
+      BundleFramework isolatedFramework = isolatedInstall(bundlesToInstall, _sharedBundleFramework
+          .getIsolatedBundleContext(), app);
+
+      _frameworks.put(isolatedFramework.getFrameworkBundle(), isolatedFramework);
+      _frameworksByAppScope.put(app.getApplicationMetadata().getApplicationScope(), isolatedFramework);
+
+      frameworkBundle = isolatedFramework.getFrameworkBundle();
+    }
+
+    return frameworkBundle;
+  }
+
+  public Collection<Bundle> installSharedBundles(Collection<BundleSuggestion> bundlesToInstall,
+      AriesApplication app) throws BundleException
+  {
+    Collection<Bundle> installedBundles = new ArrayList<Bundle>();
+
+    synchronized (BundleFrameworkManager.SHARED_FRAMEWORK_LOCK) {
+      // Shared bundle : Install to the shared bundle framework
+      for (BundleSuggestion suggestion : bundlesToInstall)
+        installedBundles.add(_sharedBundleFramework.install(suggestion, app));
+    }
+
+    return installedBundles;
+  }
+
+  private BundleFramework isolatedInstall(Collection<BundleSuggestion> bundlesToBeInstalled,
+      BundleContext parentCtx, AriesApplication app) throws BundleException
+  {
+    LOGGER.debug(LOG_ENTRY, "isolatedInstall", new Object[] { bundlesToBeInstalled, app });
+
+    /**
+     * Build the configuration information for this application framework
+     */
+    BundleFrameworkConfiguration config = _bundleFrameworkConfigurationFactory
+        .createBundleFrameworkConfig(app.getApplicationMetadata().getApplicationScope(), parentCtx,
+            app);
+
+    /**
+     * Install and start the new isolated bundle framework
+     */
+    BundleFramework bundleFramework = _bundleFrameworkFactory.createBundleFramework(parentCtx,
+        config);
+
+    // We should now have a bundleFramework
+    if (bundleFramework != null) {
+
+      boolean frameworkStarted = false;
+      try {
+        // Start the empty framework bundle
+        bundleFramework.start();
+        frameworkStarted = true;
+      } catch (BundleException e) {
+        // This may fail if the framework bundle has exports but we will retry later
+      }
+
+      /**
+       * Install the bundles into the new framework
+       */
+      
+      try {
+        List<Bundle> installedBundles = new ArrayList<Bundle>();
+        BundleContext frameworkBundleContext = bundleFramework.getIsolatedBundleContext();
+        if (frameworkBundleContext != null) {
+          for (BundleSuggestion suggestion : bundlesToBeInstalled)
+            installedBundles.add(bundleFramework.install(suggestion, app));
+        }
+        
+        // Finally, start the whole lot
+        if (!frameworkStarted)
+          bundleFramework.start();
+      } catch (BundleException be) {
+        bundleFramework.close();
+        throw be;
+      } catch (RuntimeException re) {
+        bundleFramework.close();
+        throw re;
+      }
+    }
+
+    LOGGER.debug(LOG_EXIT, "isolatedInstall", bundleFramework);
+
+    return bundleFramework;
+  }
+
+  public BundleFramework getSharedBundleFramework()
+  {
+    synchronized (BundleFrameworkManager.SHARED_FRAMEWORK_LOCK) {
+      return _sharedBundleFramework;
+    }
+  }
+
+  public void uninstallBundle(Bundle b) throws BundleException
+  {
+    synchronized (BundleFrameworkManager.SHARED_FRAMEWORK_LOCK) {
+      BundleFramework framework = getBundleFramework(b);
+      if (framework != null) {
+        framework.close();
+        
+        // clean up our maps so we don't leak memory
+        _frameworks.remove(b);
+        Iterator<BundleFramework> it = _frameworksByAppScope.values().iterator();
+        while (it.hasNext()) {
+          if (it.next().equals(framework)) it.remove();
+        }
+      }
+    }
+  }
+
+  public void startBundle(Bundle b) throws BundleException
+  {
+    synchronized (BundleFrameworkManager.SHARED_FRAMEWORK_LOCK) {
+      BundleFramework framework = getBundleFramework(b);
+      if (framework != null) // App Content
+      {
+        for (Bundle bundle : framework.getBundles())
+          framework.start(bundle);
+      } else // Shared bundle
+      _sharedBundleFramework.start(b);
+    }
+  }
+
+  public void stopBundle(Bundle b) throws BundleException
+  {
+    synchronized (BundleFrameworkManager.SHARED_FRAMEWORK_LOCK) {
+      BundleFramework framework = getBundleFramework(b);
+      if (framework != null) // App Content
+      {
+        for (Bundle bundle : framework.getBundles())
+          framework.stop(bundle);
+      }
+      // Do not stop shared bundles
+    }
+  }
+
+  public boolean allowsUpdate(DeploymentMetadata newMetadata, DeploymentMetadata oldMetadata)
+  {
+    for (UpdateStrategy strategy : _updateStrategies) {
+      if (strategy.allowsUpdate(newMetadata, oldMetadata)) {
+        return true;
+      }
+    }
+
+    return false;
+  }
+
+  public void updateBundles(final DeploymentMetadata newMetadata,
+      final DeploymentMetadata oldMetadata, final AriesApplication app,
+      final BundleLocator locator, final Set<Bundle> bundles, final boolean startBundles)
+      throws UpdateException
+  {
+    UpdateStrategy strategy = null;
+
+    for (UpdateStrategy us : _updateStrategies) {
+      if (us.allowsUpdate(newMetadata, oldMetadata)) {
+        strategy = us;
+        break;
+      }
+    }
+
+    if (strategy == null)
+      throw new IllegalArgumentException(
+          "No UpdateStrategy supports the supplied DeploymentMetadata changes.");
+
+    synchronized (BundleFrameworkManager.SHARED_FRAMEWORK_LOCK) {
+      final BundleFramework appFwk = _frameworksByAppScope.get(app.getApplicationMetadata().getApplicationScope());
+
+      strategy.update(new UpdateStrategy.UpdateInfo() {
+
+        public void register(Bundle bundle)
+        {
+          bundles.add(bundle);
+        }
+
+        public void unregister(Bundle bundle)
+        {
+          bundles.remove(bundle);
+        }
+
+        public Map<DeploymentContent, BundleSuggestion> suggestBundle(
+            Collection<DeploymentContent> bundles) throws BundleException
+        {
+          return locator.suggestBundle(bundles);
+        }
+
+        public boolean startBundles()
+        {
+          return startBundles;
+        }
+
+        public BundleFramework getSharedFramework()
+        {
+          return _sharedBundleFramework;
+        }
+
+        public DeploymentMetadata getOldMetadata()
+        {
+          return oldMetadata;
+        }
+
+        public DeploymentMetadata getNewMetadata()
+        {
+          return newMetadata;
+        }
+
+        public AriesApplication getApplication()
+        {
+          return app;
+        }
+
+        public BundleFramework getAppFramework()
+        {
+          return appFwk;
+        }
+      });
+    }
+  }
+
+}
+

Added: aries/tags/application-0.3/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/SharedBundleFramework.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/SharedBundleFramework.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/SharedBundleFramework.java (added)
+++ aries/tags/application-0.3/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/SharedBundleFramework.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,152 @@
+/*
+ * 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.runtime.framework.management;
+
+import java.util.Properties;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+import org.osgi.framework.InvalidSyntaxException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.aries.application.management.spi.framework.BundleFramework;
+import org.apache.aries.application.management.spi.framework.BundleFrameworkConfiguration;
+import org.apache.aries.application.management.spi.framework.BundleFrameworkConfigurationFactory;
+import org.apache.aries.application.management.spi.framework.BundleFrameworkFactory;
+import org.apache.aries.application.management.spi.repository.ContextException;
+
+import static org.apache.aries.application.utils.AppConstants.LOG_ENTRY;
+import static org.apache.aries.application.utils.AppConstants.LOG_EXIT;
+
+public class SharedBundleFramework
+{
+  private static final Logger LOGGER = LoggerFactory.getLogger(SharedBundleFramework.class);
+  private static BundleFramework sharedFramework;
+
+  /**
+   * This is not the right way to make blueprint usable by applications, but
+   * it is all we have time to make work. I have locked down the version
+   * ranges so that this can be fixed properly in the future. NB The
+   * org.osgi.service.blueprint package is deliberately unversioned as it is
+   * not part of the osgi compendium.
+   */
+  private static final String RUNTIME_PACKAGES = "org.osgi.service.blueprint,org.osgi.service.blueprint.container;version=\"[1.0.0,1.0.1]\",org.osgi.service.blueprint.reflect;version=\"[1.0.0,1.0.1]\",org.apache.aries.transaction.exception;version=\"[0.1,1.0.0)\"";
+
+  /**
+   * create using any bundle context in EBA App framework as we want to create
+   * a child framework under EBA App framework
+   * 
+   * @param bc
+   * @throws BundleException
+   * @throws InvalidSyntaxException
+   */
+  private static void createSharedBundleFramework(BundleContext bc,
+      BundleFrameworkConfigurationFactory bundleFrameworkConfigFactory,
+      BundleFrameworkFactory bundleFrameworkFactory) throws ContextException
+  {
+    LOGGER.debug(LOG_ENTRY, "createSharedBundleFramework", new Object[] { bc,
+        bundleFrameworkFactory });
+
+    try {
+
+      BundleFrameworkConfiguration config = 
+        new SharedBundleFrameworkConfiguration(
+            bundleFrameworkConfigFactory.createBundleFrameworkConfig(
+                BundleFramework.SHARED_BUNDLE_FRAMEWORK, 
+                bc));
+      
+      sharedFramework = bundleFrameworkFactory.createBundleFramework(bc, config);
+
+      sharedFramework.start();
+
+    } catch (BundleException e) {
+      LOGGER.debug(LOG_EXIT, "createSharedBundleFramework", e);
+      throw new ContextException("Unable to create or start the shared framework composite bundle "
+          + sharedFramework, e);
+    }
+
+    LOGGER.debug(LOG_EXIT, "createSharedBundleFramework");
+  }
+
+  /**
+   * pass in the EBA framework bundle context and get the shared bundle
+   * framework associated with the bundle context
+   * 
+   * @param bc
+   *            any bundle context in EBA framework
+   * @return the composite bundle associated with the shared bundle framework
+   * @throws BundleException
+   * @throws InvalidSyntaxException
+   * @throws SharedFrameworkCreationException
+   */
+  public synchronized static BundleFramework getSharedBundleFramework(BundleContext bc,
+      BundleFrameworkConfigurationFactory bfcf,
+      BundleFrameworkFactory bff) throws ContextException
+  {
+    LOGGER.debug(LOG_ENTRY, "getSharedBundleFramework", new Object[] { bc, bff });
+
+    if (sharedFramework == null) {
+      createSharedBundleFramework(bc, bfcf, bff);
+    }
+
+    LOGGER.debug(LOG_EXIT, "getSharedBundleFramework", sharedFramework);
+
+    return sharedFramework;
+  }
+
+  /**
+   * Wrapper for the basic framework configuration
+   * @author cwilkin
+   *
+   */
+  private static class SharedBundleFrameworkConfiguration implements BundleFrameworkConfiguration
+  {
+    BundleFrameworkConfiguration basicConfig = null;
+
+    public SharedBundleFrameworkConfiguration(BundleFrameworkConfiguration basicConfig)  {
+      this.basicConfig = basicConfig;
+    }
+
+    public String getFrameworkID()
+    {
+      return basicConfig.getFrameworkID();
+    }
+
+    public Properties getFrameworkManifest()
+    {
+
+      Properties compositeManifest = basicConfig.getFrameworkManifest();
+      
+      compositeManifest.put(Constants.BUNDLE_SYMBOLICNAME, BundleFramework.SHARED_BUNDLE_FRAMEWORK);
+
+      // Add blueprint so that it is available to applications.
+      compositeManifest.put(Constants.IMPORT_PACKAGE, RUNTIME_PACKAGES);
+      
+      return compositeManifest;
+    }
+
+    public Properties getFrameworkProperties()
+    {
+      return basicConfig.getFrameworkProperties();
+    }
+
+  }
+}

Added: aries/tags/application-0.3/application-runtime-framework-management/src/main/resources/OSGI-INF/blueprint/bundle-framework-management.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-runtime-framework-management/src/main/resources/OSGI-INF/blueprint/bundle-framework-management.xml?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-runtime-framework-management/src/main/resources/OSGI-INF/blueprint/bundle-framework-management.xml (added)
+++ aries/tags/application-0.3/application-runtime-framework-management/src/main/resources/OSGI-INF/blueprint/bundle-framework-management.xml Sun Feb 27 20:20:13 2011
@@ -0,0 +1,39 @@
+<?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="equinox-bundle-framework-manager" class="org.apache.aries.application.runtime.framework.management.BundleFrameworkManagerImpl" init-method="init">
+      <property name="bundleFrameworkFactory" ref="bundle-framework-factory"/>
+      <property name="bundleFrameworkConfigurationFactory" ref="bundle-framework-configuration-factory"/>
+      <property name="bundleContext" ref="blueprintBundleContext"/>
+      <property name="updateStrategies" ref="strategies" />
+  </bean>
+
+  <service interface="org.apache.aries.application.management.spi.framework.BundleFrameworkManager"
+            ref="equinox-bundle-framework-manager"
+            ranking="-1"/>
+            
+  <reference id="bundle-framework-factory" interface="org.apache.aries.application.management.spi.framework.BundleFrameworkFactory"/>
+  
+  <reference id="bundle-framework-configuration-factory" interface="org.apache.aries.application.management.spi.framework.BundleFrameworkConfigurationFactory"/>
+
+  <reference-list id="strategies" interface="org.apache.aries.application.management.spi.update.UpdateStrategy" availability="optional" />
+
+</blueprint>

Added: aries/tags/application-0.3/application-runtime-framework-management/src/test/java/org/apache/aries/application/runtime/framework/management/BundleFrameworkManagerTest.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-runtime-framework-management/src/test/java/org/apache/aries/application/runtime/framework/management/BundleFrameworkManagerTest.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-runtime-framework-management/src/test/java/org/apache/aries/application/runtime/framework/management/BundleFrameworkManagerTest.java (added)
+++ aries/tags/application-0.3/application-runtime-framework-management/src/test/java/org/apache/aries/application/runtime/framework/management/BundleFrameworkManagerTest.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,86 @@
+package org.apache.aries.application.runtime.framework.management;
+import java.util.Arrays;
+
+import org.apache.aries.application.management.AriesApplication;
+import org.apache.aries.application.management.spi.framework.BundleFramework;
+import org.apache.aries.application.management.spi.framework.BundleFrameworkConfiguration;
+import org.apache.aries.application.management.spi.framework.BundleFrameworkConfigurationFactory;
+import org.apache.aries.application.management.spi.framework.BundleFrameworkFactory;
+import org.apache.aries.application.management.spi.repository.BundleRepository.BundleSuggestion;
+import org.apache.aries.application.runtime.framework.management.BundleFrameworkManagerImpl;
+import org.apache.aries.unittest.mocks.MethodCall;
+import org.apache.aries.unittest.mocks.Skeleton;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+import static junit.framework.Assert.*;
+
+/*
+ * 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.
+ */
+
+public class BundleFrameworkManagerTest {
+  private BundleFrameworkManagerImpl sut;
+  private Skeleton frameworkFactory;
+  
+  @Before
+  public void setup() {
+    sut = new BundleFrameworkManagerImpl();
+
+    BundleFrameworkConfigurationFactory bfcf = Skeleton.newMock(BundleFrameworkConfigurationFactory.class);
+    sut.setBundleFrameworkConfigurationFactory(bfcf);
+    
+    BundleFrameworkFactory bff = Skeleton.newMock(BundleFrameworkFactory.class);
+    sut.setBundleFrameworkFactory(bff); 
+    frameworkFactory = Skeleton.getSkeleton(bff);
+    
+    sut.init();
+  }
+  
+  @Test
+  public void testFailedInstall() throws Exception {
+    /*
+     * Mock up a failing framework install
+     */
+    BundleFramework fwk = Skeleton.newMock(new Object() {
+      public Bundle install(BundleSuggestion suggestion, AriesApplication app) throws BundleException {
+        throw new BundleException("Expected failure");
+      }
+    }, BundleFramework.class);
+
+    frameworkFactory.setReturnValue(
+        new MethodCall(BundleFrameworkFactory.class, "createBundleFramework", 
+            BundleContext.class, BundleFrameworkConfiguration.class), 
+        fwk);    
+    
+    try {
+      sut.installIsolatedBundles(Arrays.asList(Skeleton.newMock(BundleSuggestion.class)), 
+          Skeleton.newMock(AriesApplication.class));
+      
+      fail("Expected a BundleException");
+      
+    } catch (BundleException be) {
+      // when a failure occurred we need to have cleaned up the new framework, otherwise it is
+      // left as floating debris
+      Skeleton.getSkeleton(fwk).assertCalled(new MethodCall(BundleFramework.class, "close"));
+    }
+  }
+}

Added: aries/tags/application-0.3/application-runtime-framework/pom.xml
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-runtime-framework/pom.xml?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-runtime-framework/pom.xml (added)
+++ aries/tags/application-0.3/application-runtime-framework/pom.xml Sun Feb 27 20:20:13 2011
@@ -0,0 +1,93 @@
+<?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/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.runtime.framework</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Aries Bundle Framework provider</name>
+    <description>
+        An equinox based bundle framework runtime implementation
+    </description>
+
+    <properties>
+        <aries.osgi.export.pkg>
+        org.apache.aries.application.runtime.framework.utils
+        </aries.osgi.export.pkg>
+        <aries.osgi.private.pkg>
+            org.apache.aries.application.runtime.framework;
+			org.apache.aries.application.runtime.framework.config
+        </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.application</groupId>
+            <artifactId>org.apache.aries.application.utils</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>
+            <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>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+        	<groupId>org.eclipse</groupId>
+        	<artifactId>osgi</artifactId>
+        	<version>3.5.0.v20090520</version>
+        	<type>jar</type>
+        	<scope>provided</scope>
+        </dependency>
+    </dependencies>
+  
+</project>

Added: aries/tags/application-0.3/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/BundleFrameworkFactoryImpl.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/BundleFrameworkFactoryImpl.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/BundleFrameworkFactoryImpl.java (added)
+++ aries/tags/application-0.3/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/BundleFrameworkFactoryImpl.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,51 @@
+/*
+ * 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.framework;
+
+import org.apache.aries.application.management.spi.framework.BundleFramework;
+import org.apache.aries.application.management.spi.framework.BundleFrameworkConfiguration;
+import org.apache.aries.application.management.spi.framework.BundleFrameworkFactory;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.framework.CompositeBundle;
+import org.osgi.service.framework.CompositeBundleFactory;
+
+public class BundleFrameworkFactoryImpl implements BundleFrameworkFactory
+{  
+  public BundleFramework createBundleFramework(BundleContext bc, BundleFrameworkConfiguration config) throws BundleException
+  {
+    BundleFramework framework = null;
+    ServiceReference sr = bc.getServiceReference(CompositeBundleFactory.class.getName());
+
+    if (sr != null) {
+      CompositeBundleFactory cbf = (CompositeBundleFactory) bc.getService(sr);
+
+      CompositeBundle compositeBundle = cbf.installCompositeBundle(
+          config.getFrameworkProperties(), 
+          config.getFrameworkID(),
+          config.getFrameworkManifest());
+
+      framework = new BundleFrameworkImpl(compositeBundle);
+    } else throw new BundleException("Failed to obtain framework factory service");
+
+    return framework;
+  }
+}

Added: aries/tags/application-0.3/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/BundleFrameworkImpl.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/BundleFrameworkImpl.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/BundleFrameworkImpl.java (added)
+++ aries/tags/application-0.3/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/BundleFrameworkImpl.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,168 @@
+/*
+ * 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.framework;
+
+import static org.apache.aries.application.utils.AppConstants.LOG_ENTRY;
+import static org.apache.aries.application.utils.AppConstants.LOG_EXCEPTION;
+import static org.apache.aries.application.utils.AppConstants.LOG_EXIT;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.aries.application.management.AriesApplication;
+import org.apache.aries.application.management.spi.framework.BundleFramework;
+import org.apache.aries.application.management.spi.repository.BundleRepository.BundleSuggestion;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.launch.Framework;
+import org.osgi.service.framework.CompositeBundle;
+import org.osgi.service.packageadmin.PackageAdmin;
+import org.osgi.util.tracker.ServiceTracker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class BundleFrameworkImpl implements BundleFramework
+{
+  private static final Logger LOGGER = LoggerFactory.getLogger(BundleFrameworkImpl.class);
+
+  List<Bundle> _bundles;
+  CompositeBundle _compositeBundle;
+
+  ServiceTracker _packageAdminTracker;
+
+  BundleFrameworkImpl(CompositeBundle cb)
+  {
+    _compositeBundle = cb;
+    _bundles = new ArrayList<Bundle>();
+  }
+
+  @Override
+  public void start() throws BundleException
+  {
+        _compositeBundle.start(Bundle.START_ACTIVATION_POLICY);
+  if ( _packageAdminTracker == null)
+  {
+      _packageAdminTracker = new ServiceTracker(_compositeBundle.getCompositeFramework().getBundleContext(),
+          PackageAdmin.class.getName(), null);
+      _packageAdminTracker.open();
+  }
+    
+  }
+  
+  @Override
+  public void init() throws BundleException
+  {
+    if (_compositeBundle.getCompositeFramework().getState() != Framework.ACTIVE)
+    {
+      _compositeBundle.getCompositeFramework().start();
+  
+      _packageAdminTracker = new ServiceTracker(_compositeBundle.getCompositeFramework().getBundleContext(),
+          PackageAdmin.class.getName(), null);
+      _packageAdminTracker.open();
+    }
+  }
+
+  public void close() throws BundleException
+  {
+    // close out packageadmin service tracker
+    if (_packageAdminTracker != null) {
+      try {
+        _packageAdminTracker.close();
+      } catch (IllegalStateException ise) {
+        // Ignore this error because this can happen when we're trying to close the tracker on a
+        // framework that has closed/is closing.
+      }
+    }
+
+    _compositeBundle.stop();
+    _compositeBundle.uninstall();
+  }
+
+  public void start(Bundle b) throws BundleException
+  {
+    if (b.getState() != Bundle.ACTIVE && !isFragment(b)) 
+      b.start(Bundle.START_ACTIVATION_POLICY);
+  }
+
+  public void stop(Bundle b) throws BundleException
+  {
+    if (!isFragment(b))
+      b.stop();
+  }
+
+  public Bundle getFrameworkBundle()
+  {
+    return _compositeBundle;
+  }
+
+  public BundleContext getIsolatedBundleContext()
+  {
+    return _compositeBundle.getCompositeFramework().getBundleContext();
+  }
+
+  public List<Bundle> getBundles()
+  {
+    return _bundles;
+  }
+
+  /**
+   * This method uses the PackageAdmin service to identify if a bundle
+   * is a fragment.
+   * @param b
+   * @return
+   */
+  private boolean isFragment(Bundle b)
+  {
+    LOGGER.debug(LOG_ENTRY, "isFragment", new Object[] { b });
+
+    PackageAdmin admin = null;
+    boolean isFragment = false;
+
+    try {
+      if (_packageAdminTracker != null) {
+        admin = (PackageAdmin) _packageAdminTracker.getService();
+        if (admin != null) {
+          isFragment = (admin.getBundleType(b) == PackageAdmin.BUNDLE_TYPE_FRAGMENT);
+        }
+      }
+    } catch (RuntimeException re) {
+      LOGGER.debug(LOG_EXCEPTION, re);
+    }
+
+    LOGGER.debug(LOG_EXIT, "isFragment", new Object[] { Boolean.valueOf(isFragment) });
+
+    return isFragment;
+  }
+
+  public Bundle install(BundleSuggestion suggestion, AriesApplication app) throws BundleException
+  {
+    Bundle installedBundle = suggestion.install(this, app);
+    _bundles.add(installedBundle);
+    
+    return installedBundle;
+  }
+
+  public void uninstall(Bundle b) throws BundleException
+  {
+    b.uninstall();
+    _bundles.remove(b);
+  }
+}
+

Added: aries/tags/application-0.3/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/config/BundleFrameworkConfigurationFactoryImpl.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/config/BundleFrameworkConfigurationFactoryImpl.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/config/BundleFrameworkConfigurationFactoryImpl.java (added)
+++ aries/tags/application-0.3/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/config/BundleFrameworkConfigurationFactoryImpl.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,133 @@
+/*
+ * 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.framework.config;
+
+import java.util.Collection;
+import java.util.Properties;
+
+import org.apache.aries.application.Content;
+import org.apache.aries.application.DeploymentMetadata;
+import org.apache.aries.application.management.AriesApplication;
+import org.apache.aries.application.management.spi.framework.BundleFrameworkConfiguration;
+import org.apache.aries.application.management.spi.framework.BundleFrameworkConfigurationFactory;
+import org.apache.aries.application.runtime.framework.utils.EquinoxFrameworkConstants;
+import org.apache.aries.application.runtime.framework.utils.EquinoxFrameworkUtils;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
+
+public class BundleFrameworkConfigurationFactoryImpl implements BundleFrameworkConfigurationFactory
+{
+
+  public BundleFrameworkConfiguration createBundleFrameworkConfig(String frameworkId,
+      BundleContext parentCtx, AriesApplication app)
+  {
+
+    BundleFrameworkConfiguration config = null;
+    DeploymentMetadata metadata = app.getDeploymentMetadata();
+    /**
+     * Set up framework config properties
+     */
+    Properties frameworkConfig = new Properties();
+
+    String flowedSystemPackages = EquinoxFrameworkUtils.calculateSystemPackagesToFlow(
+        EquinoxFrameworkUtils.getSystemExtraPkgs(parentCtx), metadata.getImportPackage());
+    frameworkConfig.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, flowedSystemPackages);
+
+    /**
+     * Set up BundleManifest for the framework bundle
+     */
+    Properties frameworkBundleManifest = new Properties();
+    frameworkBundleManifest.put(Constants.BUNDLE_SYMBOLICNAME, metadata
+        .getApplicationSymbolicName());
+    frameworkBundleManifest.put(Constants.BUNDLE_VERSION, metadata.getApplicationVersion()
+        .toString());
+
+    /**
+     * Set up Import-Package header for framework manifest
+     */
+    // Extract the import packages and remove anything we already have available in the current framework
+    Collection<Content> imports = EquinoxFrameworkUtils.calculateImports(metadata
+        .getImportPackage(), EquinoxFrameworkUtils.getExportPackages(parentCtx));
+
+    if (imports != null && !imports.isEmpty()) {
+      StringBuffer buffer = new StringBuffer();
+      for (Content i : imports)
+        buffer.append(EquinoxFrameworkUtils.contentToString(i) + ",");
+      frameworkBundleManifest.put(Constants.IMPORT_PACKAGE, buffer
+          .substring(0, buffer.length() - 1));
+    }
+
+    /**
+     * Set up CompositeServiceFilter-Import header for framework manifest
+     */
+    StringBuffer serviceImportFilter = new StringBuffer("(" + Constants.OBJECTCLASS + "="
+        + EquinoxFrameworkConstants.TRANSACTION_REGISTRY_BUNDLE + ")");
+
+    for (Filter importFilter : metadata.getDeployedServiceImport()) {
+      if (serviceImportFilter.length() > 0) {
+        serviceImportFilter.append(",");
+      }
+      serviceImportFilter.append(importFilter.toString());
+    }
+
+    frameworkBundleManifest.put(EquinoxFrameworkConstants.COMPOSITE_SERVICE_FILTER_IMPORT,
+        serviceImportFilter.toString());
+
+    config = new BundleFrameworkConfigurationImpl(frameworkId, frameworkConfig,
+        frameworkBundleManifest);
+
+    return config;
+  }
+
+  public BundleFrameworkConfiguration createBundleFrameworkConfig(String frameworkId,
+      BundleContext parentCtx)
+  {
+    BundleFrameworkConfiguration config = null;
+
+    /**
+     * Set up framework config properties
+     */
+    Properties frameworkConfig = new Properties();
+
+    if (parentCtx.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA) != null)
+      frameworkConfig.put(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA, parentCtx
+          .getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA));
+
+    /**
+     * Set up BundleManifest for the framework bundle
+     */
+    Properties frameworkBundleManifest = new Properties();
+
+    /**
+     * Set up CompositeServiceFilter-Import header for framework manifest
+     */
+    StringBuffer serviceImportFilter = new StringBuffer("(" + Constants.OBJECTCLASS + "="
+        + EquinoxFrameworkConstants.TRANSACTION_REGISTRY_BUNDLE + ")");
+
+    frameworkBundleManifest.put(EquinoxFrameworkConstants.COMPOSITE_SERVICE_FILTER_IMPORT,
+        serviceImportFilter.toString());
+
+    config = new BundleFrameworkConfigurationImpl(frameworkId, frameworkConfig,
+        frameworkBundleManifest);
+
+    return config;
+  }
+}

Added: aries/tags/application-0.3/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/config/BundleFrameworkConfigurationImpl.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/config/BundleFrameworkConfigurationImpl.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/config/BundleFrameworkConfigurationImpl.java (added)
+++ aries/tags/application-0.3/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/config/BundleFrameworkConfigurationImpl.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,56 @@
+/*
+ * 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.framework.config;
+
+import java.util.Properties;
+
+import org.apache.aries.application.management.spi.framework.BundleFrameworkConfiguration;
+
+public class BundleFrameworkConfigurationImpl implements BundleFrameworkConfiguration
+{
+
+  String frameworkId;
+  Properties frameworkBundleManifest;
+  Properties frameworkConfig;
+
+  public BundleFrameworkConfigurationImpl(String frameworkId, Properties frameworkConfig,
+      Properties frameworkBundleManifest)
+  {
+    this.frameworkId = frameworkId;
+    this.frameworkConfig = frameworkConfig;
+    this.frameworkBundleManifest = frameworkBundleManifest;
+  }
+
+  public String getFrameworkID()
+  {
+    return frameworkId;
+  }
+
+  public Properties getFrameworkManifest()
+  {
+    return frameworkBundleManifest;
+  }
+
+  public Properties getFrameworkProperties()
+  {
+    return frameworkConfig;
+  }
+
+}

Added: aries/tags/application-0.3/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/utils/EquinoxFrameworkConstants.java
URL: http://svn.apache.org/viewvc/aries/tags/application-0.3/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/utils/EquinoxFrameworkConstants.java?rev=1075132&view=auto
==============================================================================
--- aries/tags/application-0.3/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/utils/EquinoxFrameworkConstants.java (added)
+++ aries/tags/application-0.3/application-runtime-framework/src/main/java/org/apache/aries/application/runtime/framework/utils/EquinoxFrameworkConstants.java Sun Feb 27 20:20:13 2011
@@ -0,0 +1,29 @@
+/*
+ * 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.framework.utils;
+
+public interface EquinoxFrameworkConstants
+{
+  public static final String TRANSACTION_BUNDLE = "javax.transaction";
+  public static final String TRANSACTION_BUNDLE_VERSION = "1.1.0";
+  public static final String TRANSACTION_REGISTRY_BUNDLE = "javax.transaction.TransactionSynchronizationRegistry";
+  public static final String COMPOSITE_SERVICE_FILTER_IMPORT = "CompositeServiceFilter-Import";
+  
+}



Mime
View raw message