aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hugh...@apache.org
Subject svn commit: r1199354 [1/2] - in /aries/branches/oct-2011-release: ./ application/ application/application-itests/ application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/util/ application/application-itests/src/test/jav...
Date Tue, 08 Nov 2011 17:27:37 GMT
Author: hughesj
Date: Tue Nov  8 17:27:34 2011
New Revision: 1199354

URL: http://svn.apache.org/viewvc?rev=1199354&view=rev
Log:
Merging trunk into the branch from r1189798-1199347 in preparation to reintegration

Added:
    aries/branches/oct-2011-release/application/application-itests/src/test/java/org/apache/aries/isolated/config/
      - copied from r1199347, aries/trunk/application/application-itests/src/test/java/org/apache/aries/isolated/config/
    aries/branches/oct-2011-release/application/application-itests/src/test/java/org/apache/aries/isolated/config/HelloWorldManagedServiceImpl.java
      - copied unchanged from r1199347, aries/trunk/application/application-itests/src/test/java/org/apache/aries/isolated/config/HelloWorldManagedServiceImpl.java
    aries/branches/oct-2011-release/application/application-itests/src/test/resources/isolated/config/
      - copied from r1199347, aries/trunk/application/application-itests/src/test/resources/isolated/config/
    aries/branches/oct-2011-release/application/application-itests/src/test/resources/isolated/config/APPLICATION-BP.MF
      - copied unchanged from r1199347, aries/trunk/application/application-itests/src/test/resources/isolated/config/APPLICATION-BP.MF
    aries/branches/oct-2011-release/application/application-itests/src/test/resources/isolated/config/APPLICATION-MN.MF
      - copied unchanged from r1199347, aries/trunk/application/application-itests/src/test/resources/isolated/config/APPLICATION-MN.MF
    aries/branches/oct-2011-release/application/application-itests/src/test/resources/isolated/config/blueprint.xml
      - copied unchanged from r1199347, aries/trunk/application/application-itests/src/test/resources/isolated/config/blueprint.xml
    aries/branches/oct-2011-release/application/application-resolve-transform-cm/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm-itests/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm-itests/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm-itests/LICENSE
      - copied unchanged from r1199347, aries/trunk/application/application-resolve-transform-cm-itests/LICENSE
    aries/branches/oct-2011-release/application/application-resolve-transform-cm-itests/NOTICE
      - copied unchanged from r1199347, aries/trunk/application/application-resolve-transform-cm-itests/NOTICE
    aries/branches/oct-2011-release/application/application-resolve-transform-cm-itests/pom.xml
      - copied unchanged from r1199347, aries/trunk/application/application-resolve-transform-cm-itests/pom.xml
    aries/branches/oct-2011-release/application/application-resolve-transform-cm-itests/src/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm-itests/src/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm-itests/src/test/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm-itests/src/test/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm-itests/src/test/java/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm-itests/src/test/java/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm-itests/src/test/java/org/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm-itests/src/test/java/org/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm-itests/src/test/java/org/apache/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm-itests/src/test/java/org/apache/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm-itests/src/test/java/org/apache/aries/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm-itests/src/test/java/org/apache/aries/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm-itests/src/test/java/org/apache/aries/application/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm-itests/src/test/java/org/apache/aries/application/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm-itests/src/test/java/org/apache/aries/application/resolve/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm-itests/src/test/java/org/apache/aries/application/resolve/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm-itests/src/test/java/org/apache/aries/application/resolve/transform/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm-itests/src/test/java/org/apache/aries/application/resolve/transform/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm-itests/src/test/java/org/apache/aries/application/resolve/transform/cm/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm-itests/src/test/java/org/apache/aries/application/resolve/transform/cm/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm-itests/src/test/java/org/apache/aries/application/resolve/transform/cm/itest/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm-itests/src/test/java/org/apache/aries/application/resolve/transform/cm/itest/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm-itests/src/test/java/org/apache/aries/application/resolve/transform/cm/itest/ConfigurationPostResolverTest.java
      - copied unchanged from r1199347, aries/trunk/application/application-resolve-transform-cm-itests/src/test/java/org/apache/aries/application/resolve/transform/cm/itest/ConfigurationPostResolverTest.java
    aries/branches/oct-2011-release/application/application-resolve-transform-cm/LICENSE
      - copied unchanged from r1199347, aries/trunk/application/application-resolve-transform-cm/LICENSE
    aries/branches/oct-2011-release/application/application-resolve-transform-cm/NOTICE
      - copied unchanged from r1199347, aries/trunk/application/application-resolve-transform-cm/NOTICE
    aries/branches/oct-2011-release/application/application-resolve-transform-cm/pom.xml
      - copied unchanged from r1199347, aries/trunk/application/application-resolve-transform-cm/pom.xml
    aries/branches/oct-2011-release/application/application-resolve-transform-cm/src/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm/src/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm/src/main/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm/src/main/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm/src/main/java/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm/src/main/java/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm/src/main/java/org/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm/src/main/java/org/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm/src/main/java/org/apache/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm/src/main/java/org/apache/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm/src/main/java/org/apache/aries/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm/src/main/java/org/apache/aries/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm/src/main/java/org/apache/aries/application/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm/src/main/java/org/apache/aries/application/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm/src/main/java/org/apache/aries/application/resolve/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm/src/main/java/org/apache/aries/application/resolve/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm/src/main/java/org/apache/aries/application/resolve/transform/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm/src/main/java/org/apache/aries/application/resolve/transform/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm/src/main/java/org/apache/aries/application/resolve/transform/cm/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm/src/main/java/org/apache/aries/application/resolve/transform/cm/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm/src/main/java/org/apache/aries/application/resolve/transform/cm/ConfigurationPostResolveTransformerImpl.java
      - copied unchanged from r1199347, aries/trunk/application/application-resolve-transform-cm/src/main/java/org/apache/aries/application/resolve/transform/cm/ConfigurationPostResolveTransformerImpl.java
    aries/branches/oct-2011-release/application/application-resolve-transform-cm/src/main/resources/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm/src/main/resources/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm/src/main/resources/OSGI-INF/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm/src/main/resources/OSGI-INF/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm/src/main/resources/OSGI-INF/blueprint/
      - copied from r1199347, aries/trunk/application/application-resolve-transform-cm/src/main/resources/OSGI-INF/blueprint/
    aries/branches/oct-2011-release/application/application-resolve-transform-cm/src/main/resources/OSGI-INF/blueprint/blueprint.xml
      - copied unchanged from r1199347, aries/trunk/application/application-resolve-transform-cm/src/main/resources/OSGI-INF/blueprint/blueprint.xml
    aries/branches/oct-2011-release/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BaseBlueprintContainerBTCustomizerTest.java
      - copied unchanged from r1199347, aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BaseBlueprintContainerBTCustomizerTest.java
    aries/branches/oct-2011-release/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/ConstructorFinder.java
      - copied unchanged from r1199347, aries/trunk/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/ConstructorFinder.java
    aries/branches/oct-2011-release/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassStaticInitOfChild.java
      - copied unchanged from r1199347, aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassStaticInitOfChild.java
    aries/branches/oct-2011-release/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassStaticInitOfChildParent.java
      - copied unchanged from r1199347, aries/trunk/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/ProxyTestClassStaticInitOfChildParent.java
Modified:
    aries/branches/oct-2011-release/   (props changed)
    aries/branches/oct-2011-release/application/application-itests/pom.xml
    aries/branches/oct-2011-release/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/util/IsolationTestUtils.java
    aries/branches/oct-2011-release/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/AbstractParserProxy.java
    aries/branches/oct-2011-release/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ModelledResourceManagerImpl.java
    aries/branches/oct-2011-release/application/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/SharedBundleFramework.java
    aries/branches/oct-2011-release/application/pom.xml
    aries/branches/oct-2011-release/blueprint/blueprint-cm/src/main/java/org/apache/aries/blueprint/compendium/cm/CmNamespaceHandler.java
    aries/branches/oct-2011-release/blueprint/blueprint-cm/src/main/resources/OSGI-INF/blueprint/blueprint-cm.xml
    aries/branches/oct-2011-release/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java
    aries/branches/oct-2011-release/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2BTCustomizerTest.java
    aries/branches/oct-2011-release/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerBTCustomizerTest.java
    aries/branches/oct-2011-release/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/AbstractWovenProxyAdapter.java
    aries/branches/oct-2011-release/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/WovenProxyGeneratorTest.java
    aries/branches/oct-2011-release/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/JmxConstants.java
    aries/branches/oct-2011-release/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/BundleStateMBean.java
    aries/branches/oct-2011-release/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/ServiceStateMBean.java
    aries/branches/oct-2011-release/sandbox/jmx-next/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/BlueprintMetadataMBean.java   (props changed)
    aries/branches/oct-2011-release/sandbox/jmx-next/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/BlueprintStateMBean.java   (props changed)
    aries/branches/oct-2011-release/sandbox/jmx-next/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/Item.java   (props changed)
    aries/branches/oct-2011-release/sandbox/jmx-next/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/JmxConstants.java   (props changed)
    aries/branches/oct-2011-release/sandbox/jmx-next/jmx-blueprint-core/src/main/java/org/apache/aries/jmx/blueprint/impl/Activator.java   (props changed)
    aries/branches/oct-2011-release/sandbox/jmx-next/jmx-blueprint-core/src/main/java/org/apache/aries/jmx/blueprint/impl/BlueprintMetadata.java   (props changed)
    aries/branches/oct-2011-release/sandbox/jmx-next/jmx-blueprint-core/src/main/java/org/apache/aries/jmx/blueprint/impl/BlueprintState.java   (props changed)
    aries/branches/oct-2011-release/sandbox/jmx-next/jmx-blueprint-core/src/test/java/org/apache/aries/jmx/blueprint/impl/BlueprintMetadataTest.java   (props changed)
    aries/branches/oct-2011-release/sandbox/jmx-next/jmx-blueprint-core/src/test/java/org/apache/aries/jmx/blueprint/impl/BlueprintStateTest.java   (props changed)
    aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/codec/BundleWiringData.java
    aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/codec/ServiceData.java
    aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/BundleState.java
    aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/ServiceState.java
    aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/util/TypeUtils.java
    aries/branches/oct-2011-release/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/BundleRevisionsStateMBeanTest.java
    aries/branches/oct-2011-release/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/BundleStateMBeanTest.java
    aries/branches/oct-2011-release/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/framework/ServiceStateMBeanTest.java
    aries/branches/oct-2011-release/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/test/blueprint/BlueprintMBeanTest.java   (props changed)
    aries/branches/oct-2011-release/sandbox/jmx-next/jmx-itests/src/test/java/org/apache/aries/jmx/test/blueprint/framework/   (props changed)

Propchange: aries/branches/oct-2011-release/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov  8 17:27:34 2011
@@ -1 +1 @@
-/aries/trunk:1185252-1190455
+/aries/trunk:1185252-1199347

Modified: aries/branches/oct-2011-release/application/application-itests/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/oct-2011-release/application/application-itests/pom.xml?rev=1199354&r1=1199353&r2=1199354&view=diff
==============================================================================
--- aries/branches/oct-2011-release/application/application-itests/pom.xml (original)
+++ aries/branches/oct-2011-release/application/application-itests/pom.xml Tue Nov  8 17:27:34 2011
@@ -197,6 +197,11 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+		    <groupId>org.apache.aries.application</groupId>
+		    <artifactId>org.apache.aries.application.resolve.transform.cm</artifactId>
+		    <version>0.3.1-SNAPSHOT</version>
+       	</dependency>
+        <dependency>
              <groupId>org.apache.aries.application</groupId>
              <artifactId>org.apache.aries.application.default.local.platform</artifactId>
             <version>0.3.1-SNAPSHOT</version>

Modified: aries/branches/oct-2011-release/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/util/IsolationTestUtils.java
URL: http://svn.apache.org/viewvc/aries/branches/oct-2011-release/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/util/IsolationTestUtils.java?rev=1199354&r1=1199353&r2=1199354&view=diff
==============================================================================
--- aries/branches/oct-2011-release/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/util/IsolationTestUtils.java (original)
+++ aries/branches/oct-2011-release/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/util/IsolationTestUtils.java Tue Nov  8 17:27:34 2011
@@ -20,8 +20,11 @@ package org.apache.aries.application.run
 
 import java.io.File;
 import java.io.FileOutputStream;
+import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
 import java.net.MalformedURLException;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Hashtable;
@@ -146,6 +149,42 @@ public class IsolationTestUtils {
     repoAdmin.addRepository(new File("repo.xml").toURI().toString());
   }
   
+  public static HelloWorld findHelloWorldService(BundleContext ctx) throws Exception
+  {
+	  if (ctx != null)
+	  {
+	      // Dive into the context and pull out the composite bundle for the app
+	      Filter osgiFilter = FrameworkUtil.createFilter("(" + Constants.OBJECTCLASS + "=" + HelloWorld.class.getName() + ")");
+	      ServiceTracker tracker = new ServiceTracker(ctx, 
+	          osgiFilter,
+	          null);
+	      
+	      tracker.open();
+	      final Object hw = tracker.waitForService(DEFAULT_TIMEOUT);
+	      tracker.close();
+	
+	      if (hw != null) {
+	        // proxy because the class space between the sample app and the test bundle is not consistent
+	        return new HelloWorld() {
+	          public String getMessage() {
+	            try {
+	              Method m = hw.getClass().getMethod("getMessage");
+	              return (String) m.invoke(hw);
+	            } catch (Exception e) {
+	              throw new RuntimeException(e);
+	            }
+	          }
+	        };
+	      } else {
+	        return null;
+	      }	 
+	  }
+	  else
+	  {
+		  return null;
+	  }
+  }
+  
   /**
    * Find the {@link HelloWorld} service for the isolated app
    * @return the service object, suitably proxied so that it can be actually used, or null if the service is not present
@@ -156,34 +195,9 @@ public class IsolationTestUtils {
     BundleContext appContext = IsolationTestUtils.findIsolatedAppBundleContext(runtimeCtx, appName);
     
     if (appContext != null) {  
-      // Dive into the context and pull out the composite bundle for the app
-      Filter osgiFilter = FrameworkUtil.createFilter("(" + Constants.OBJECTCLASS + "=" + HelloWorld.class.getName() + ")");
-      ServiceTracker tracker = new ServiceTracker(appContext, 
-          osgiFilter,
-          null);
-      
-      tracker.open();
-      final Object hw = tracker.waitForService(DEFAULT_TIMEOUT);
-      tracker.close();
-
-      if (hw != null) {
-        // proxy because the class space between the sample app and the test bundle is not consistent
-        return new HelloWorld() {
-          public String getMessage() {
-            try {
-              Method m = hw.getClass().getMethod("getMessage");
-              return (String) m.invoke(hw);
-            } catch (Exception e) {
-              throw new RuntimeException(e);
-            }
-          }
-        };
-      } else {
-        return null;
-      }
-
+    	return findHelloWorldService(appContext);
     } else {
       throw new IllegalStateException("Expected to find isolated app ctx, but didn't");
     }
   }
-}
+}
\ No newline at end of file

Modified: aries/branches/oct-2011-release/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/AbstractParserProxy.java
URL: http://svn.apache.org/viewvc/aries/branches/oct-2011-release/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/AbstractParserProxy.java?rev=1199354&r1=1199353&r2=1199354&view=diff
==============================================================================
--- aries/branches/oct-2011-release/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/AbstractParserProxy.java (original)
+++ aries/branches/oct-2011-release/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/AbstractParserProxy.java Tue Nov  8 17:27:34 2011
@@ -323,6 +323,9 @@ abstract public class AbstractParserProx
 	      blacklisted |= iface.equals("javax.transaction.UserTransaction");
 	      blacklisted |= iface.equals("javax.transaction.TransactionSynchronizationRegistry");
 	      
+	      // ConfigurationAdmin - detect interface
+	      blacklisted |= iface.equals("org.osgi.service.cm.ConfigurationAdmin");
+	               
 	      // Don't provision against JNDI references
 	      if (blueprintFilter != null && blueprintFilter.trim().length() != 0) { 
 	        Map<String, String> filter = ManifestHeaderProcessor.parseFilter(blueprintFilter);

Modified: aries/branches/oct-2011-release/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ModelledResourceManagerImpl.java
URL: http://svn.apache.org/viewvc/aries/branches/oct-2011-release/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ModelledResourceManagerImpl.java?rev=1199354&r1=1199353&r2=1199354&view=diff
==============================================================================
--- aries/branches/oct-2011-release/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ModelledResourceManagerImpl.java (original)
+++ aries/branches/oct-2011-release/application/application-modeller/src/main/java/org/apache/aries/application/modelling/impl/ModelledResourceManagerImpl.java Tue Nov  8 17:27:34 2011
@@ -233,7 +233,13 @@ public class ModelledResourceManagerImpl
         String directoryName = "";
         String fileName = "";
         if (directoryFullPath.lastIndexOf("/") != -1) {
-            directoryName = directoryFullPath.substring(0, directoryFullPath.lastIndexOf("/"));
+        	// This bundle may be nested within another archive. In that case, we need to trim
+        	// /bundleFileName.jar from the front of the directory. 
+        	int bundleNameLength = bundle.getName().length();
+            directoryName = directoryFullPath.substring(bundleNameLength, directoryFullPath.lastIndexOf("/"));
+            if (directoryName.startsWith("/") && directoryName.length() > 1) { 
+            	directoryName = directoryName.substring(1);
+            }
             fileName = directoryFullPath.substring(directoryFullPath.lastIndexOf("/") + 1);
         } else {
             if (file.isFile()) {

Modified: aries/branches/oct-2011-release/application/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/SharedBundleFramework.java
URL: http://svn.apache.org/viewvc/aries/branches/oct-2011-release/application/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/SharedBundleFramework.java?rev=1199354&r1=1199353&r2=1199354&view=diff
==============================================================================
--- aries/branches/oct-2011-release/application/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/SharedBundleFramework.java (original)
+++ aries/branches/oct-2011-release/application/application-runtime-framework-management/src/main/java/org/apache/aries/application/runtime/framework/management/SharedBundleFramework.java Tue Nov  8 17:27:34 2011
@@ -19,23 +19,15 @@
 
 package org.apache.aries.application.runtime.framework.management;
 
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map;
 import java.util.Properties;
-import java.util.Set;
-import java.util.jar.Attributes;
 
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.Constants;
 import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.Version;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.aries.application.Content;
-import org.apache.aries.application.management.BundleInfo;
 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;
@@ -57,7 +49,7 @@ public class SharedBundleFramework
    * 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)\"";
+  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)\",org.osgi.service.cm;resolution:=optional";
 
   /**
    * create using any bundle context in EBA App framework as we want to create
@@ -145,7 +137,7 @@ public class SharedBundleFramework
       Properties compositeManifest = basicConfig.getFrameworkManifest();
       
       compositeManifest.put(Constants.BUNDLE_SYMBOLICNAME, BundleFramework.SHARED_BUNDLE_FRAMEWORK);
-
+      
       // Add blueprint so that it is available to applications, unless configuration has already been provided.
       String existingImports = (String) compositeManifest.get(Constants.IMPORT_PACKAGE);
       if (existingImports == null){

Modified: aries/branches/oct-2011-release/application/pom.xml
URL: http://svn.apache.org/viewvc/aries/branches/oct-2011-release/application/pom.xml?rev=1199354&r1=1199353&r2=1199354&view=diff
==============================================================================
--- aries/branches/oct-2011-release/application/pom.xml (original)
+++ aries/branches/oct-2011-release/application/pom.xml Tue Nov  8 17:27:34 2011
@@ -49,6 +49,8 @@
       <module>application-modeller-common-test</module>
       <module>application-noop-resolver</module>
       <module>application-obr-resolver</module>
+      <module>application-resolve-transform-cm</module>
+      <module>application-resolve-transform-cm-itests</module>
       <module>application-runtime</module>
 	    <module>application-runtime-isolated</module>
 	    <module>application-runtime-framework</module>

Modified: aries/branches/oct-2011-release/blueprint/blueprint-cm/src/main/java/org/apache/aries/blueprint/compendium/cm/CmNamespaceHandler.java
URL: http://svn.apache.org/viewvc/aries/branches/oct-2011-release/blueprint/blueprint-cm/src/main/java/org/apache/aries/blueprint/compendium/cm/CmNamespaceHandler.java?rev=1199354&r1=1199353&r2=1199354&view=diff
==============================================================================
--- aries/branches/oct-2011-release/blueprint/blueprint-cm/src/main/java/org/apache/aries/blueprint/compendium/cm/CmNamespaceHandler.java (original)
+++ aries/branches/oct-2011-release/blueprint/blueprint-cm/src/main/java/org/apache/aries/blueprint/compendium/cm/CmNamespaceHandler.java Tue Nov  8 17:27:34 2011
@@ -42,9 +42,12 @@ import org.apache.aries.blueprint.mutabl
 import org.apache.aries.blueprint.mutable.MutableIdRefMetadata;
 import org.apache.aries.blueprint.mutable.MutableMapMetadata;
 import org.apache.aries.blueprint.mutable.MutableRefMetadata;
+import org.apache.aries.blueprint.mutable.MutableReferenceMetadata;
 import org.apache.aries.blueprint.mutable.MutableValueMetadata;
+import org.apache.aries.blueprint.reflect.PassThroughMetadataImpl;
 import org.apache.aries.blueprint.utils.PlaceholdersUtils;
 import org.apache.aries.blueprint.utils.ServiceListener;
+import org.osgi.framework.BundleContext;
 import org.osgi.service.blueprint.container.ComponentDefinitionException;
 import org.osgi.service.blueprint.reflect.BeanMetadata;
 import org.osgi.service.blueprint.reflect.BeanProperty;
@@ -54,6 +57,7 @@ import org.osgi.service.blueprint.reflec
 import org.osgi.service.blueprint.reflect.MapMetadata;
 import org.osgi.service.blueprint.reflect.Metadata;
 import org.osgi.service.blueprint.reflect.RefMetadata;
+import org.osgi.service.blueprint.reflect.ReferenceMetadata;
 import org.osgi.service.blueprint.reflect.RegistrationListener;
 import org.osgi.service.blueprint.reflect.ServiceMetadata;
 import org.osgi.service.blueprint.reflect.ValueMetadata;
@@ -202,7 +206,7 @@ public class CmNamespaceHandler implemen
         metadata.setInitMethod("init");
         metadata.setDestroyMethod("destroy");
         metadata.addProperty("blueprintContainer", createRef(context, "blueprintContainer"));
-        metadata.addProperty("configAdmin", createConfigAdminProxy(context));
+        metadata.addProperty("configAdmin", createConfigurationAdminRef(context));
         metadata.addProperty("persistentId", createValue(context, element.getAttribute(PERSISTENT_ID_ATTRIBUTE)));
         String prefix = element.hasAttribute(PLACEHOLDER_PREFIX_ATTRIBUTE)
                                     ? element.getAttribute(PLACEHOLDER_PREFIX_ATTRIBUTE)
@@ -318,7 +322,7 @@ public class CmNamespaceHandler implemen
         factoryMetadata.setRuntimeClass(CmManagedServiceFactory.class);
         factoryMetadata.setInitMethod("init");
         factoryMetadata.setDestroyMethod("destroy");
-        factoryMetadata.addProperty("configAdmin", createConfigAdminProxy(context));
+        factoryMetadata.addProperty("configAdmin", createConfigurationAdminRef(context));
         factoryMetadata.addProperty("blueprintContainer", createRef(context, "blueprintContainer"));
         factoryMetadata.addProperty("factoryPid", createValue(context, element.getAttribute(FACTORY_PID_ATTRIBUTE)));
         String autoExport = element.hasAttribute(AUTO_EXPORT_ATTRIBUTE) ? element.getAttribute(AUTO_EXPORT_ATTRIBUTE) : AUTO_EXPORT_DEFAULT;
@@ -422,7 +426,7 @@ public class CmNamespaceHandler implemen
             metadata.setDestroyMethod("destroy");
         }
         metadata.addProperty("blueprintContainer", createRef(context, "blueprintContainer"));
-        metadata.addProperty("configAdmin", createConfigAdminProxy(context));
+        metadata.addProperty("configAdmin", createConfigurationAdminRef(context));
         metadata.addProperty("managedObjectManager", createRef(context, MANAGED_OBJECT_MANAGER_NAME));
         metadata.addProperty("persistentId", createValue(context, persistentId));
         if (element.hasAttribute(UPDATE_ATTRIBUTE)) {
@@ -451,7 +455,7 @@ public class CmNamespaceHandler implemen
             metadata.setDestroyMethod("destroy");
         }
         metadata.addProperty("blueprintContainer", createRef(context, "blueprintContainer"));
-        metadata.addProperty("configAdmin", createConfigAdminProxy(context));
+        metadata.addProperty("configAdmin", createConfigurationAdminRef(context));
         metadata.addProperty("managedObjectManager", createRef(context, MANAGED_OBJECT_MANAGER_NAME));
         metadata.addProperty("persistentId", createValue(context, persistentId));
         String updateStrategy = element.getAttribute(UPDATE_STRATEGY_ATTRIBUTE);
@@ -468,22 +472,6 @@ public class CmNamespaceHandler implemen
         return component;
     }
 
-    /**
-     * Create a reference to the ConfigurationAdmin service if not already done
-     * and add it to the registry.
-     *
-     * @param context the parser context
-     * @return a metadata pointing to the config admin
-     */
-    private Metadata createConfigAdminProxy(ParserContext context) {
-        MutableBeanMetadata bean = context.createMetadata(MutableBeanMetadata.class);
-        bean.setRuntimeClass(CmNamespaceHandler.class);
-        bean.setFactoryMethod("getConfigAdmin");
-        bean.setActivation(MutableBeanMetadata.ACTIVATION_LAZY);
-        bean.setScope(MutableBeanMetadata.SCOPE_PROTOTYPE);
-        return bean;
-    }
-
     private void registerManagedObjectManager(ParserContext context, ComponentDefinitionRegistry registry) {
         if (registry.getComponentDefinition(MANAGED_OBJECT_MANAGER_NAME) == null) {
             MutableBeanMetadata beanMetadata = context.createMetadata(MutableBeanMetadata.class);
@@ -494,6 +482,10 @@ public class CmNamespaceHandler implemen
         }
     }
     
+    private MutableReferenceMetadata createConfigurationAdminRef(ParserContext context) {
+        return createServiceRef(getBlueprintBundleContext(context), context, ConfigurationAdmin.class, "(objectClass=" + ConfigurationAdmin.class.getName() + ")");
+    }
+    
     private static ValueMetadata createValue(ParserContext context, String value) {
         return createValue(context, value, null);
     }
@@ -510,6 +502,21 @@ public class CmNamespaceHandler implemen
         m.setComponentId(value);
         return m;
     }
+    
+    private MutableReferenceMetadata createServiceRef(BundleContext ctx, ParserContext context, Class<?> cls, String filter) {
+        MutableReferenceMetadata m = context.createMetadata(MutableReferenceMetadata.class);
+        m.setRuntimeInterface(cls);
+        m.setInterface(cls.getName());
+        m.setBundleContext(ctx);
+        m.setActivation(ReferenceMetadata.ACTIVATION_EAGER);
+        m.setAvailability(ReferenceMetadata.AVAILABILITY_MANDATORY);
+        
+        if (filter != null) {
+            m.setFilter(filter);
+        }
+        
+        return m;
+    }
 
     private static IdRefMetadata createIdRef(ParserContext context, String value) {
         MutableIdRefMetadata m = context.createMetadata(MutableIdRefMetadata.class);
@@ -590,4 +597,24 @@ public class CmNamespaceHandler implemen
         return interfaceNames;
     }
 
+    /**
+     * Returns the bundle context within the parser context
+     * 
+     * @param parserContext the parser context
+     * @return the bundle context within the parser context (if it exists)
+     */
+    private BundleContext getBlueprintBundleContext(ParserContext parserContext)
+    {
+        BundleContext blueprintContext = null;
+        
+        if (parserContext != null) {
+            ComponentMetadata metaData = parserContext.getComponentDefinitionRegistry().getComponentDefinition("blueprintBundleContext");
+            
+            if (metaData != null) {
+                blueprintContext = (BundleContext)((PassThroughMetadataImpl)metaData).getObject();   
+            }   
+        }
+        
+        return blueprintContext;
+    }
 }

Modified: aries/branches/oct-2011-release/blueprint/blueprint-cm/src/main/resources/OSGI-INF/blueprint/blueprint-cm.xml
URL: http://svn.apache.org/viewvc/aries/branches/oct-2011-release/blueprint/blueprint-cm/src/main/resources/OSGI-INF/blueprint/blueprint-cm.xml?rev=1199354&r1=1199353&r2=1199354&view=diff
==============================================================================
--- aries/branches/oct-2011-release/blueprint/blueprint-cm/src/main/resources/OSGI-INF/blueprint/blueprint-cm.xml (original)
+++ aries/branches/oct-2011-release/blueprint/blueprint-cm/src/main/resources/OSGI-INF/blueprint/blueprint-cm.xml Tue Nov  8 17:27:34 2011
@@ -28,11 +28,7 @@
                 </array>
             </entry>
         </service-properties>
-        <bean class="org.apache.aries.blueprint.compendium.cm.CmNamespaceHandler">
-            <property name="configAdmin">
-                <reference interface="org.osgi.service.cm.ConfigurationAdmin"/>
-            </property>
-        </bean>
+        <bean class="org.apache.aries.blueprint.compendium.cm.CmNamespaceHandler"/>
     </service>
 
 </blueprint>

Modified: aries/branches/oct-2011-release/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java
URL: http://svn.apache.org/viewvc/aries/branches/oct-2011-release/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java?rev=1199354&r1=1199353&r2=1199354&view=diff
==============================================================================
--- aries/branches/oct-2011-release/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java (original)
+++ aries/branches/oct-2011-release/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java Tue Nov  8 17:27:34 2011
@@ -563,6 +563,10 @@ public class BlueprintContainerImpl impl
                 }
             }
         }
+
+        synchronized (satisfiablesLock) {
+            satisfiables = null;
+        }
     }
 
     private void untrackServiceReference(SatisfiableRecipe recipe, Set<String> stopped, Map<String, List<SatisfiableRecipe>> dependencies) {

Modified: aries/branches/oct-2011-release/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2BTCustomizerTest.java
URL: http://svn.apache.org/viewvc/aries/branches/oct-2011-release/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2BTCustomizerTest.java?rev=1199354&r1=1199353&r2=1199354&view=diff
==============================================================================
--- aries/branches/oct-2011-release/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2BTCustomizerTest.java (original)
+++ aries/branches/oct-2011-release/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainer2BTCustomizerTest.java Tue Nov  8 17:27:34 2011
@@ -24,10 +24,8 @@ import static org.ops4j.pax.exam.contain
 import java.io.InputStream;
 import java.net.URL;
 import java.util.HashMap;
-import java.util.Hashtable;
 import java.util.Map;
 
-import org.apache.aries.itest.AbstractIntegrationTest;
 import org.apache.aries.itest.RichBundleContext;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -38,8 +36,6 @@ import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
 import org.osgi.service.framework.CompositeBundle;
 import org.osgi.service.framework.CompositeBundleFactory;
 
@@ -52,17 +48,10 @@ import static org.apache.aries.itest.Ext
  *
  */
 @RunWith(JUnit4TestRunner.class)
-public class BlueprintContainer2BTCustomizerTest extends AbstractIntegrationTest {
+public class BlueprintContainer2BTCustomizerTest extends BaseBlueprintContainerBTCustomizerTest {
 
     @Test
     public void test() throws Exception {
-        // Create a config to check the property placeholder
-        ConfigurationAdmin ca = context().getService(ConfigurationAdmin.class);        
-        Configuration cf = ca.getConfiguration("blueprint-sample-placeholder", null);
-        Hashtable props = new Hashtable();
-        props.put("key.b", "10");
-        cf.update(props);
-
         
         ServiceReference sr = bundleContext.getServiceReference("org.osgi.service.framework.CompositeBundleFactory");
         if (sr != null) {
@@ -74,14 +63,7 @@ public class BlueprintContainer2BTCustom
             // frameworkConfig.put("osgi.console", "10000");
             
             // construct composite bundle information
-            Map<String, String> compositeManifest = new HashMap<String, String>();
-            compositeManifest.put(Constants.BUNDLE_SYMBOLICNAME, "test-composite");
-            compositeManifest.put(Constants.BUNDLE_VERSION, "1.0.0");
-            // this import-package is used by the blueprint.sample
-            compositeManifest.put(Constants.IMPORT_PACKAGE, "org.osgi.service.blueprint;version=\"[1.0.0,2.0.0)\", org.osgi.service.blueprint.container;version=1.0");
-            // this export-package is used by pax junit runner as it needs to see the blueprint sample package 
-            // for the test after the blueprint sample is started.
-            compositeManifest.put(Constants.EXPORT_PACKAGE, "org.apache.aries.blueprint.sample");
+            Map<String, String> compositeManifest = getCompositeManifest();
             
             CompositeBundle cb = cbf.installCompositeBundle(frameworkConfig, "test-composite", compositeManifest);
 
@@ -92,9 +74,15 @@ public class BlueprintContainer2BTCustom
             InputStream is = new URL(mapo.getURL()).openStream();
             Bundle bundle = compositeBundleContext.installBundle(mapo.getURL(), is);
             assertNotNull(bundle);
+            // install and start the cfg admin bundle in the isolated framework
+            Bundle cfgAdminBundle = installConfigurationAdmin(compositeBundleContext);
+            assertNotNull(cfgAdminBundle);            
             
-            // start the composite bundle then the blueprint sample
+            // start the composite bundle, the config admin then the blueprint sample
             cb.start();
+            cfgAdminBundle.start();         
+            // create a config to check the property placeholder
+            applyCommonConfiguration(compositeBundleContext);
             bundle.start();
             
             // start the blueprint bundle and it should detect the previously started blueprint sample
@@ -115,7 +103,7 @@ public class BlueprintContainer2BTCustom
         return testOptions(
             paxLogging("DEBUG"),
             Helper.blueprintBundles(false),
-//            vmOption ("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006"),
+            //vmOption ("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006"),
             equinox().version("3.5.0")
         );
     }

Modified: aries/branches/oct-2011-release/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerBTCustomizerTest.java
URL: http://svn.apache.org/viewvc/aries/branches/oct-2011-release/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerBTCustomizerTest.java?rev=1199354&r1=1199353&r2=1199354&view=diff
==============================================================================
--- aries/branches/oct-2011-release/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerBTCustomizerTest.java (original)
+++ aries/branches/oct-2011-release/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/BlueprintContainerBTCustomizerTest.java Tue Nov  8 17:27:34 2011
@@ -24,10 +24,8 @@ import static org.ops4j.pax.exam.contain
 import java.io.InputStream;
 import java.net.URL;
 import java.util.HashMap;
-import java.util.Hashtable;
 import java.util.Map;
 
-import org.apache.aries.itest.AbstractIntegrationTest;
 import org.apache.aries.itest.RichBundleContext;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -38,8 +36,6 @@ import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
 import org.osgi.service.framework.CompositeBundle;
 import org.osgi.service.framework.CompositeBundleFactory;
 
@@ -53,17 +49,10 @@ import static org.apache.aries.itest.Ext
  *
  */
 @RunWith(JUnit4TestRunner.class)
-public class BlueprintContainerBTCustomizerTest extends AbstractIntegrationTest {
+public class BlueprintContainerBTCustomizerTest extends BaseBlueprintContainerBTCustomizerTest {
 
     @Test
     public void test() throws Exception {
-        // Create a config to check the property placeholder
-        ConfigurationAdmin ca = context().getService(ConfigurationAdmin.class);
-        Configuration cf = ca.getConfiguration("blueprint-sample-placeholder", null);
-        Hashtable props = new Hashtable();
-        props.put("key.b", "10");
-        cf.update(props);
-
         
         ServiceReference sr = bundleContext.getServiceReference("org.osgi.service.framework.CompositeBundleFactory");
         if (sr != null) {
@@ -75,14 +64,7 @@ public class BlueprintContainerBTCustomi
             // frameworkConfig.put("osgi.console", "10000");
             
             // construct composite bundle information
-            Map<String, String> compositeManifest = new HashMap<String, String>();
-            compositeManifest.put(Constants.BUNDLE_SYMBOLICNAME, "test-composite");
-            compositeManifest.put(Constants.BUNDLE_VERSION, "1.0.0");
-            // this import-package is used by the blueprint.sample
-            compositeManifest.put(Constants.IMPORT_PACKAGE, "org.osgi.service.blueprint;version=\"[1.0.0,2.0.0)\", org.osgi.service.blueprint.container;version=1.0");
-            // this export-package is used by pax junit runner as it needs to see the blueprint sample package 
-            // for the test after the blueprint sample is started.
-            compositeManifest.put(Constants.EXPORT_PACKAGE, "org.apache.aries.blueprint.sample");
+            Map<String, String> compositeManifest = getCompositeManifest();
             
             CompositeBundle cb = cbf.installCompositeBundle(frameworkConfig, "test-composite", compositeManifest);
 
@@ -93,9 +75,13 @@ public class BlueprintContainerBTCustomi
             InputStream is = new URL(mapo.getURL()).openStream();
             Bundle bundle = compositeBundleContext.installBundle(mapo.getURL(), is);
             assertNotNull(bundle);
+            Bundle configAdminBundle = installConfigurationAdmin(compositeBundleContext);
+            assertNotNull(configAdminBundle);
             
-            // start the composite bundle then the blueprint sample
+            // start the composite bundle, config admin then the blueprint sample
             cb.start();
+            configAdminBundle.start();
+            applyCommonConfiguration(compositeBundleContext);
             bundle.start();
 
             // do the test

Modified: aries/branches/oct-2011-release/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/AbstractWovenProxyAdapter.java
URL: http://svn.apache.org/viewvc/aries/branches/oct-2011-release/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/AbstractWovenProxyAdapter.java?rev=1199354&r1=1199353&r2=1199354&view=diff
==============================================================================
--- aries/branches/oct-2011-release/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/AbstractWovenProxyAdapter.java (original)
+++ aries/branches/oct-2011-release/proxy/proxy-impl/src/main/java/org/apache/aries/proxy/impl/common/AbstractWovenProxyAdapter.java Tue Nov  8 17:27:34 2011
@@ -19,6 +19,7 @@
 package org.apache.aries.proxy.impl.common;
 
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.Serializable;
 import java.lang.reflect.Modifier;
 import java.math.BigDecimal;
@@ -241,13 +242,9 @@ public abstract class AbstractWovenProxy
             nonObjectSupers.add(nextSuper);
             nextSuper = nextSuper.getSuperclass();
           }
-          try {
-            superHasNoArgsConstructor = (superClass.getDeclaredConstructor().
-                     getModifiers() & Modifier.PRIVATE) == 0;
-          } catch (NoSuchMethodException nsme) {
-            // This is a no-op here, but means we need to add a no-Args that
-            // delegates to Object#<init>() yuck :(
-          }
+          //Don't use reflection - it can be dangerous
+          superHasNoArgsConstructor = superHasNoArgsConstructor(superName, name);
+
         } else {
           superHasNoArgsConstructor = true;
         }
@@ -274,6 +271,31 @@ public abstract class AbstractWovenProxy
     }
   }
 
+  /**
+   * This method allows us to determine whether a superclass has a
+   * non-private no-args constructor without causing it to initialize.
+   * This avoids a potential ClassCircularityError on Mac VMs if the
+   * initialization references the subclass being woven. Odd, but seen
+   * in the wild!
+   */
+  private final boolean superHasNoArgsConstructor(String superName, String name) {
+    
+    ConstructorFinder cf = new ConstructorFinder();
+    
+    try {
+      InputStream is = loader.getResourceAsStream(superName +".class");
+    
+      if(is == null)
+        throw new IOException();
+      
+      new ClassReader(is).accept(cf, ClassReader.SKIP_FRAMES + ClassReader.SKIP_DEBUG + ClassReader.SKIP_CODE);
+    } catch (IOException ioe) {
+      UnableToProxyException u = new UnableToProxyException(name, ioe);
+      throw new RuntimeException(NLS.MESSAGES.getMessage("cannot.load.superclass", superName.replace('/', '.'), typeBeingWoven.getClassName()), u);
+    }
+    return cf.hasNoArgsConstructor();
+  }
+  
   private boolean checkInterfacesForSerializability(String[] interfaces) throws ClassNotFoundException {
     for(String iface : interfaces)
     {

Modified: aries/branches/oct-2011-release/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/WovenProxyGeneratorTest.java
URL: http://svn.apache.org/viewvc/aries/branches/oct-2011-release/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/WovenProxyGeneratorTest.java?rev=1199354&r1=1199353&r2=1199354&view=diff
==============================================================================
--- aries/branches/oct-2011-release/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/WovenProxyGeneratorTest.java (original)
+++ aries/branches/oct-2011-release/proxy/proxy-impl/src/test/java/org/apache/aries/blueprint/proxy/WovenProxyGeneratorTest.java Tue Nov  8 17:27:34 2011
@@ -30,6 +30,7 @@ import java.io.ObjectOutputStream;
 import java.lang.reflect.Method;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -70,7 +71,7 @@ public class WovenProxyGeneratorTest ext
   }
   
   /** An array of classes that will be woven - note no UnweavableParents should be in here! */
-  private static final Class<?>[] CLASSES = new Class<?>[]{TEST_CLASS, ProxyTestClassSuper.class,
+  private static final List<Class<?>> CLASSES = Arrays.asList(new Class<?>[]{TEST_CLASS, ProxyTestClassSuper.class,
     ProxyTestClassFinalMethod.class, ProxyTestClassFinal.class, ProxyTestClassGeneric.class,
     ProxyTestClassGenericSuper.class, ProxyTestClassCovariant.class, ProxyTestClassCovariantOverride.class,
     ProxyTestClassUnweavableChild.class, ProxyTestClassUnweavableSibling.class, ProxyTestClassInner.class, 
@@ -78,7 +79,11 @@ public class WovenProxyGeneratorTest ext
     ProxyTestClassUnweavableChildWithFinalMethodParent.class, 
     ProxyTestClassUnweavableChildWithDefaultMethodWrongPackageParent.class, 
     ProxyTestClassSerializable.class, ProxyTestClassSerializableWithSVUID.class,
-    ProxyTestClassSerializableChild.class, ProxyTestClassSerializableInterface.class};
+    ProxyTestClassSerializableChild.class, ProxyTestClassSerializableInterface.class,
+    ProxyTestClassStaticInitOfChild.class});
+  
+  /** An array of classes that are loaded by the WeavingLoader, but not actually woven **/
+  private static final List<Class<?>> OTHER_CLASSES = Arrays.asList(new Class<?>[] {ProxyTestClassStaticInitOfChildParent.class});
  
   private static final Map<String, byte[]> rawClasses = new HashMap<String, byte[]>();
   
@@ -101,7 +106,16 @@ public class WovenProxyGeneratorTest ext
       if(bytes == null)
         return super.loadClass(className, b);
       
-      bytes = WovenProxyGenerator.getWovenProxy(bytes, className, this);
+      boolean weave = false;
+      
+      for(Class<?> c : CLASSES) {
+        if(c.getName().equals(className)) {
+          weave = true;
+          break;
+        }
+      }
+      if(weave)
+        bytes = WovenProxyGenerator.getWovenProxy(bytes, className, this);
       
       return defineClass(className, bytes, 0, bytes.length);
     }
@@ -117,7 +131,12 @@ public class WovenProxyGeneratorTest ext
   @BeforeClass
   public static void setUp() throws Exception
   {
-    for(Class<?> clazz : CLASSES) {
+    List<Class<?>> classes = new ArrayList(CLASSES.size() + OTHER_CLASSES.size());
+    
+    classes.addAll(CLASSES);
+    classes.addAll(OTHER_CLASSES);
+    
+    for(Class<?> clazz : classes) {
       InputStream is = clazz.getClassLoader().getResourceAsStream(
           clazz.getName().replace('.', '/') + ".class");
       ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -383,6 +402,19 @@ public class WovenProxyGeneratorTest ext
     assertFalse(woven.getDeclaredField("serialVersionUID").isSynthetic());
   }
   
+  /**
+   * This test covers a weird case on Mac VMs where we sometimes
+   * get a ClassCircularityError if a static initializer in a
+   * non-woven superclass references a subclass that's being
+   * woven, and gets triggered by the weaving process. Not known
+   * to fail on IBM or Sun/Oracle VMs
+   */
+  @Test
+  public void testSuperStaticInitOfChild() throws Exception {
+    Class<?> parent = weavingLoader.loadClass(ProxyTestClassStaticInitOfChildParent.class.getName());
+    parent.getMethod("doStuff").invoke(null);
+  }
+  
   @Override
   protected Object getProxyInstance(Class<?> proxyClass) {
     try {

Modified: aries/branches/oct-2011-release/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/JmxConstants.java
URL: http://svn.apache.org/viewvc/aries/branches/oct-2011-release/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/JmxConstants.java?rev=1199354&r1=1199353&r2=1199354&view=diff
==============================================================================
--- aries/branches/oct-2011-release/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/JmxConstants.java (original)
+++ aries/branches/oct-2011-release/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/JmxConstants.java Tue Nov  8 17:27:34 2011
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) OSGi Alliance (2009). All Rights Reserved.
- * 
+ *
  * Licensed 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
@@ -27,11 +27,11 @@ import javax.management.openmbean.Tabula
 
 /**
  * Constants for OSGi JMX Specification.
- * 
+ *
  * Additionally, this class contains a number of utility types that are used in
  * different places in the specification. These are {@link #LONG_ARRAY_TYPE},
  * {@link #STRING_ARRAY_TYPE}, and {@link #PROPERTIES_TYPE}.
- * 
+ *
  * @version $Rev$
  * @Immutable
  */
@@ -62,7 +62,7 @@ public class JmxConstants {
 	/**
 	 * For an encoded array we need to start with ARRAY_OF. This must be
 	 * followed by one of the names in {@link #SCALAR}.
-	 * 
+	 *
 	 */
 	public final static String			ARRAY_OF			= "Array of ";
 
@@ -72,6 +72,11 @@ public class JmxConstants {
 	 */
 	public final static String			VECTOR_OF			= "Vector of ";
 
+    /**
+     * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+     * {@link org.osgi.framework.Version}
+     */
+    public static final String          VERSION             = "Version";
 	/**
 	 * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
 	 * {@link java.lang.String}
@@ -242,7 +247,7 @@ public class JmxConstants {
 
 	/**
 	 * The key PROPERTY_TYPE.
-	 * 
+	 *
 	 * ### can we call this value PropertyType and service type ServiceType?
 	 */
 	public static final String			TYPE				= "Type";
@@ -250,11 +255,11 @@ public class JmxConstants {
 	/**
 	 * The type of the property. The key is {@link #TYPE} and the type is
 	 * {@link SimpleType#STRING}. This string must follow the following syntax:
-	 * 
+	 *
 	 * TYPE ::= ( 'Array of ' | 'Vector of ' )? {@link #SCALAR}
-	 * 
+	 *
 	 * ### why can't we just use the class name?
-	 * 
+	 *
 	 * ### why do we have to distinguish between primitives and wrappers?
 	 */
 	public static final Item			TYPE_ITEM			= new Item(

Modified: aries/branches/oct-2011-release/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/BundleStateMBean.java
URL: http://svn.apache.org/viewvc/aries/branches/oct-2011-release/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/BundleStateMBean.java?rev=1199354&r1=1199353&r2=1199354&view=diff
==============================================================================
--- aries/branches/oct-2011-release/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/BundleStateMBean.java (original)
+++ aries/branches/oct-2011-release/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/BundleStateMBean.java Tue Nov  8 17:27:34 2011
@@ -32,7 +32,7 @@ import org.osgi.jmx.JmxConstants;
  * emits events that clients can use to get notified of the changes in the
  * bundle state of the framework.
  *
- * @version $Revision$
+ * @version $Id: f5d5197fdabb4e0c420bc47812d38fd14edb61d0 $
  * @ThreadSafe
  */
 public interface BundleStateMBean {
@@ -427,7 +427,12 @@ public interface BundleStateMBean {
 																BUNDLE_TYPE,
 																IDENTIFIER);
 
-    CompositeData getBundle(long id) throws IOException;
+	/** New!!
+	 * @param id The Bundle ID
+	 * @return The Bundle Data
+	 * @throws IOException
+	 */
+	CompositeData getBundle(long id) throws IOException;
 
 	/**
 	 * Answer the list of identifiers of the bundles this bundle depends upon
@@ -494,7 +499,9 @@ public interface BundleStateMBean {
 	 *             if the bundle indicated does not exist
 	 */
 	TabularData getHeaders(long bundleId) throws IOException;
+    TabularData getHeaders(long bundleId, String locale) throws IOException;
     String getHeader(long bundleId, String key) throws IOException;
+    String getHeader(long bundleId, String key, String locale) throws IOException;
 
 	/**
 	 * Answer the list of bundle ids of the bundles which host a fragment

Modified: aries/branches/oct-2011-release/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/ServiceStateMBean.java
URL: http://svn.apache.org/viewvc/aries/branches/oct-2011-release/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/ServiceStateMBean.java?rev=1199354&r1=1199353&r2=1199354&view=diff
==============================================================================
--- aries/branches/oct-2011-release/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/ServiceStateMBean.java (original)
+++ aries/branches/oct-2011-release/sandbox/jmx-next/jmx-api/src/main/java/org/osgi/jmx/framework/ServiceStateMBean.java Tue Nov  8 17:27:34 2011
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) OSGi Alliance (2009, 2010). All Rights Reserved.
- * 
+ *
  * Licensed 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
@@ -18,6 +18,7 @@ package org.osgi.jmx.framework;
 
 import java.io.IOException;
 
+import javax.management.openmbean.CompositeData;
 import javax.management.openmbean.CompositeType;
 import javax.management.openmbean.SimpleType;
 import javax.management.openmbean.TabularData;
@@ -30,7 +31,7 @@ import org.osgi.jmx.JmxConstants;
  * This MBean represents the Service state of the framework. This MBean also
  * emits events that clients can use to get notified of the changes in the
  * service state of the framework.
- * 
+ *
  * @version $Revision$
  * @ThreadSafe
  */
@@ -172,7 +173,7 @@ public interface ServiceStateMBean {
 
 	/**
 	 * Answer the list of interfaces that this service implements
-	 * 
+	 *
 	 * @param serviceId
 	 *            the identifier of the service
 	 * @return the list of interfaces
@@ -185,7 +186,7 @@ public interface ServiceStateMBean {
 
 	/**
 	 * Answer the bundle identifier of the bundle which registered the service
-	 * 
+	 *
 	 * @param serviceId
 	 *            the identifier of the service
 	 * @return the identifier for the bundle
@@ -195,12 +196,13 @@ public interface ServiceStateMBean {
 	 *             if the service indicated does not exist
 	 */
 	long getBundleIdentifier(long serviceId) throws IOException;
+	CompositeData getService(long serviceId) throws IOException;
 
 	/**
 	 * Answer the map of properties associated with this service
-	 * 
+	 *
 	 * @see JmxConstants#PROPERTIES_TYPE for the details of the TabularType
-	 * 
+	 *
 	 * @param serviceId
 	 *            the identifier of the service
 	 * @return the table of properties. These include the standard mandatory
@@ -212,12 +214,14 @@ public interface ServiceStateMBean {
 	 *             if the service indicated does not exist
 	 */
 	TabularData getProperties(long serviceId) throws IOException;
+	CompositeData getProperty(long serviceId, String key) throws IOException;
+	long[] getServiceIds() throws IOException;
 
 	/**
 	 * Answer the service state of the system in tabular form.
-	 * 
+	 *
 	 * @see #SERVICES_TYPE for the details of the TabularType
-	 * 
+	 *
 	 * @return the tabular representation of the service state
 	 * @throws IOException
 	 *             If the operation fails
@@ -225,10 +229,12 @@ public interface ServiceStateMBean {
 	 *             if the service indicated does not exist
 	 */
 	TabularData listServices() throws IOException;
+	TabularData listServices(String clazz, String filter) throws IOException;
+    TabularData listServices(String clazz, String filter, String ... serviceTypeItems) throws IOException;
 
 	/**
 	 * Answer the list of identifiers of the bundles that use the service
-	 * 
+	 *
 	 * @param serviceId
 	 *            the identifier of the service
 	 * @return the list of bundle identifiers

Propchange: aries/branches/oct-2011-release/sandbox/jmx-next/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/BlueprintMetadataMBean.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov  8 17:27:34 2011
@@ -0,0 +1 @@
+/aries/trunk/sandbox/jmx-next/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/BlueprintMetadataMBean.java:1189798-1199347

Propchange: aries/branches/oct-2011-release/sandbox/jmx-next/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/BlueprintStateMBean.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov  8 17:27:34 2011
@@ -0,0 +1 @@
+/aries/trunk/sandbox/jmx-next/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/BlueprintStateMBean.java:1189798-1199347

Propchange: aries/branches/oct-2011-release/sandbox/jmx-next/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/Item.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov  8 17:27:34 2011
@@ -0,0 +1 @@
+/aries/trunk/sandbox/jmx-next/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/Item.java:1189798-1199347

Propchange: aries/branches/oct-2011-release/sandbox/jmx-next/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/JmxConstants.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov  8 17:27:34 2011
@@ -0,0 +1 @@
+/aries/trunk/sandbox/jmx-next/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/JmxConstants.java:1189798-1199347

Propchange: aries/branches/oct-2011-release/sandbox/jmx-next/jmx-blueprint-core/src/main/java/org/apache/aries/jmx/blueprint/impl/Activator.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov  8 17:27:34 2011
@@ -0,0 +1 @@
+/aries/trunk/sandbox/jmx-next/jmx-blueprint-core/src/main/java/org/apache/aries/jmx/blueprint/impl/Activator.java:1189798-1199347

Propchange: aries/branches/oct-2011-release/sandbox/jmx-next/jmx-blueprint-core/src/main/java/org/apache/aries/jmx/blueprint/impl/BlueprintMetadata.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov  8 17:27:34 2011
@@ -0,0 +1 @@
+/aries/trunk/sandbox/jmx-next/jmx-blueprint-core/src/main/java/org/apache/aries/jmx/blueprint/impl/BlueprintMetadata.java:1189798-1199347

Propchange: aries/branches/oct-2011-release/sandbox/jmx-next/jmx-blueprint-core/src/main/java/org/apache/aries/jmx/blueprint/impl/BlueprintState.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov  8 17:27:34 2011
@@ -0,0 +1 @@
+/aries/trunk/sandbox/jmx-next/jmx-blueprint-core/src/main/java/org/apache/aries/jmx/blueprint/impl/BlueprintState.java:1189798-1199347

Propchange: aries/branches/oct-2011-release/sandbox/jmx-next/jmx-blueprint-core/src/test/java/org/apache/aries/jmx/blueprint/impl/BlueprintMetadataTest.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov  8 17:27:34 2011
@@ -0,0 +1 @@
+/aries/trunk/sandbox/jmx-next/jmx-blueprint-core/src/test/java/org/apache/aries/jmx/blueprint/impl/BlueprintMetadataTest.java:1189798-1199347

Propchange: aries/branches/oct-2011-release/sandbox/jmx-next/jmx-blueprint-core/src/test/java/org/apache/aries/jmx/blueprint/impl/BlueprintStateTest.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov  8 17:27:34 2011
@@ -0,0 +1 @@
+/aries/trunk/sandbox/jmx-next/jmx-blueprint-core/src/test/java/org/apache/aries/jmx/blueprint/impl/BlueprintStateTest.java:1189798-1199347

Modified: aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/codec/BundleWiringData.java
URL: http://svn.apache.org/viewvc/aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/codec/BundleWiringData.java?rev=1199354&r1=1199353&r2=1199354&view=diff
==============================================================================
--- aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/codec/BundleWiringData.java (original)
+++ aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/codec/BundleWiringData.java Tue Nov  8 17:27:34 2011
@@ -37,22 +37,24 @@ public class BundleWiringData {
     private final long bundleId;
     private final List<BundleCapability> capabilities;
     private final List<BundleRequirement> requirements;
+    private List<BundleWire> requiredWires;
 
     public BundleWiringData(long bundleId, List<BundleCapability> capabilities, List<BundleRequirement> requirements, List<BundleWire> requiredWires) {
         this.bundleId = bundleId;
         this.capabilities = capabilities;
         this.requirements = requirements;
+        this.requiredWires = requiredWires;
     }
 
     public CompositeData toCompositeData() {
         try {
             Map<String, Object> items = new HashMap<String, Object>();
             items.put(BundleRevisionsStateMBean.BUNDLE_ID, bundleId);
-            items.put(BundleRevisionsStateMBean.BUNDLE_REVISION_ID, null);
+            items.put(BundleRevisionsStateMBean.BUNDLE_REVISION_ID, null); // TODO
 
             items.put(BundleRevisionsStateMBean.REQUIREMENTS, getRequirements());
             items.put(BundleRevisionsStateMBean.CAPABILITIES, getCapabilities());
-            items.put(BundleRevisionsStateMBean.BUNDLE_WIRES_TYPE, null);
+            items.put(BundleRevisionsStateMBean.BUNDLE_WIRES_TYPE, getRequiredWires());
 
             return new CompositeDataSupport(BundleRevisionsStateMBean.BUNDLE_WIRING_TYPE, items);
         } catch (OpenDataException e) {
@@ -75,7 +77,7 @@ public class BundleWiringData {
         for (int i=0; i < requirements.size(); i++) {
             BundleRequirement requirement = requirements.get(i);
             reqData[i] = getCapReqCompositeData(BundleRevisionsStateMBean.BUNDLE_REQUIREMENT_TYPE,
-                    requirement.getNamespace(), requirement.getAttributes().entrySet(), requirement.getDirectives().entrySet());
+                requirement.getNamespace(), requirement.getAttributes().entrySet(), requirement.getDirectives().entrySet());
         }
         return reqData;
     }
@@ -103,4 +105,31 @@ public class BundleWiringData {
         CompositeData req = new CompositeDataSupport(type, reqItems);
         return req;
     }
+
+    private CompositeData[] getRequiredWires() throws OpenDataException {
+        CompositeData[] reqWiresData = new CompositeData[requiredWires.size()];
+        for (int i=0; i < requiredWires.size(); i++) {
+            BundleWire requiredWire = requiredWires.get(i);
+            Map<String, Object> wireItems = new HashMap<String, Object>();
+
+            BundleCapability capability = requiredWire.getCapability();
+            wireItems.put(BundleRevisionsStateMBean.PROVIDER_BUNDLE_ID, capability.getRevision().getBundle().getBundleId());
+            wireItems.put(BundleRevisionsStateMBean.PROVIDER_BUNDLE_REVISION_ID, null); // TODO
+            wireItems.put(BundleRevisionsStateMBean.BUNDLE_CAPABILITY,
+                    getCapReqCompositeData(BundleRevisionsStateMBean.BUNDLE_CAPABILITY_TYPE,
+                    capability.getNamespace(), capability.getAttributes().entrySet(), capability.getDirectives().entrySet()));
+
+            BundleRequirement requirement = requiredWire.getRequirement();
+            wireItems.put(BundleRevisionsStateMBean.REQUIRER_BUNDLE_ID, requirement.getRevision().getBundle().getBundleId());
+            wireItems.put(BundleRevisionsStateMBean.REQUIRER_BUNDLE_REVISION_ID, null); // TODO
+
+            wireItems.put(BundleRevisionsStateMBean.BUNDLE_REQUIREMENT,
+                getCapReqCompositeData(BundleRevisionsStateMBean.BUNDLE_REQUIREMENT_TYPE,
+                requirement.getNamespace(), requirement.getAttributes().entrySet(), requirement.getDirectives().entrySet()));
+
+            CompositeData wireData = new CompositeDataSupport(BundleRevisionsStateMBean.BUNDLE_WIRE_TYPE, wireItems);
+            reqWiresData[i] = wireData;
+        }
+        return reqWiresData;
+    }
 }

Modified: aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/codec/ServiceData.java
URL: http://svn.apache.org/viewvc/aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/codec/ServiceData.java?rev=1199354&r1=1199353&r2=1199354&view=diff
==============================================================================
--- aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/codec/ServiceData.java (original)
+++ aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/codec/ServiceData.java Tue Nov  8 17:27:34 2011
@@ -25,6 +25,7 @@ import static org.osgi.jmx.framework.Ser
 import static org.osgi.jmx.framework.ServiceStateMBean.SERVICE_TYPE;
 import static org.osgi.jmx.framework.ServiceStateMBean.USING_BUNDLES;
 
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -41,7 +42,7 @@ import org.osgi.jmx.framework.ServiceSta
  * <tt>ServiceData</tt> represents Service Type @see {@link ServiceStateMBean#SERVICE_TYPE}. It is a codec for the
  * <code>CompositeData</code> representing an OSGi <code>ServiceReference</code>.
  * </p>
- * 
+ *
  * @version $Rev$ $Date$
  */
 public class ServiceData {
@@ -50,23 +51,23 @@ public class ServiceData {
      * @see ServiceStateMBean#IDENTIFIER_ITEM
      */
     private long serviceId;
-    
+
     /**
      * @see ServiceStateMBean#BUNDLE_IDENTIFIER_ITEM
      */
     private long bundleId;
-    
+
     /**
      * @see ServiceStateMBean#OBJECT_CLASS_ITEM
      */
     private String[] serviceInterfaces;
-    
+
     // keep properties for next version of the spec
     ///**
     // * @see ServiceStateMBean#PROPERTIES_ITEM
     // */
     //private List<PropertyData<? extends Object>> properties = new ArrayList<PropertyData<? extends Object>>();
-    
+
     /**
      * @see ServiceStateMBean#USING_BUNDLES_ITEM
      */
@@ -94,29 +95,46 @@ public class ServiceData {
      * @return
      */
     public CompositeData toCompositeData() {
-        CompositeData result = null;
+        return toCompositeData(ServiceStateMBean.SERVICE_TYPE.keySet());
+    }
+
+    public CompositeData toCompositeData(Collection<String> itemNames) {
         Map<String, Object> items = new HashMap<String, Object>();
+
         items.put(IDENTIFIER, this.serviceId);
-        items.put(BUNDLE_IDENTIFIER, this.bundleId);
-        items.put(OBJECT_CLASS, this.serviceInterfaces);
+
+        if (itemNames.contains(BUNDLE_IDENTIFIER))
+            items.put(BUNDLE_IDENTIFIER, this.bundleId);
+
+        if (itemNames.contains(OBJECT_CLASS))
+            items.put(OBJECT_CLASS, this.serviceInterfaces);
+
         //TabularData propertiesTable = new TabularDataSupport(PROPERTIES_TYPE);
         //for (PropertyData<? extends Object> propertyData : this.properties) {
         //    propertiesTable.put(propertyData.toCompositeData());
         //}
         // items.put(PROPERTIES, propertiesTable);
-        items.put(USING_BUNDLES, toLong(this.usingBundles));
+
+        if (itemNames.contains(USING_BUNDLES))
+            items.put(USING_BUNDLES, toLong(this.usingBundles));
+
+        String[] allItemNames = SERVICE_TYPE.keySet().toArray(new String [] {});
+        Object[] itemValues = new Object[allItemNames.length];
+        for (int i=0; i < allItemNames.length; i++) {
+            itemValues[i] = items.get(allItemNames[i]);
+        }
+
         try {
-            result = new CompositeDataSupport(SERVICE_TYPE, items);
+            return new CompositeDataSupport(SERVICE_TYPE, allItemNames, itemValues);
         } catch (OpenDataException e) {
             throw new IllegalStateException("Failed to create CompositeData for ServiceReference with "
                     + Constants.SERVICE_ID + " [" + this.serviceId + "]", e);
         }
-        return result;
     }
 
     /**
      * Constructs a <code>ServiceData</code> object from the given <code>CompositeData</code>
-     * 
+     *
      * @param compositeData
      * @return
      * @throws IlleglArugmentException

Modified: aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/BundleState.java
URL: http://svn.apache.org/viewvc/aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/BundleState.java?rev=1199354&r1=1199353&r2=1199354&view=diff
==============================================================================
--- aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/BundleState.java (original)
+++ aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/BundleState.java Tue Nov  8 17:27:34 2011
@@ -115,11 +115,23 @@ public class BundleState extends Notific
     /**
      * @see org.osgi.jmx.framework.BundleStateMBean#getHeaders(long)
      */
-    @SuppressWarnings("unchecked")
     public TabularData getHeaders(long bundleId) throws IOException, IllegalArgumentException {
         Bundle bundle = resolveBundle(bundleContext, bundleId);
-        List<Header> headers = new ArrayList<Header>();
         Dictionary<String, String> bundleHeaders = bundle.getHeaders();
+        return getHeaders(bundleHeaders);
+    }
+
+    /**
+     * @see org.osgi.jmx.framework.BundleStateMBean#getHeaders(long, java.lang.String)
+     */
+    public TabularData getHeaders(long bundleId, String locale) throws IOException, IllegalArgumentException {
+        Bundle bundle = resolveBundle(bundleContext, bundleId);
+        Dictionary<String, String> bundleHeaders = bundle.getHeaders(locale);
+        return getHeaders(bundleHeaders);
+    }
+
+    private TabularData getHeaders(Dictionary<String, String> bundleHeaders) {
+        List<Header> headers = new ArrayList<Header>();
         Enumeration<String> keys = bundleHeaders.keys();
         while (keys.hasMoreElements()) {
             String key = keys.nextElement();
@@ -132,12 +144,23 @@ public class BundleState extends Notific
         return headerTable;
     }
 
+    /**
+     * @see org.osgi.jmx.framework.BundleStateMBean#getHeader(long, java.lang.String)
+     */
     public String getHeader(long bundleId, String key) throws IOException {
         Bundle bundle = resolveBundle(bundleContext, bundleId);
         return bundle.getHeaders().get(key);
     }
 
     /**
+     * @see org.osgi.jmx.framework.BundleStateMBean#getHeader(long, java.lang.String, java.lang.String)
+     */
+    public String getHeader(long bundleId, String key, String locale) throws IOException {
+        Bundle bundle = resolveBundle(bundleContext, bundleId);
+        return bundle.getHeaders(locale).get(key);
+    }
+
+    /**
      * @see org.osgi.jmx.framework.BundleStateMBean#getHosts(long)
      */
     public long[] getHosts(long fragmentId) throws IOException, IllegalArgumentException {

Modified: aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/ServiceState.java
URL: http://svn.apache.org/viewvc/aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/ServiceState.java?rev=1199354&r1=1199353&r2=1199354&view=diff
==============================================================================
--- aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/ServiceState.java (original)
+++ aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/framework/ServiceState.java Tue Nov  8 17:27:34 2011
@@ -21,6 +21,8 @@ import static org.apache.aries.jmx.util.
 import static org.osgi.jmx.JmxConstants.PROPERTIES_TYPE;
 
 import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.RejectedExecutionException;
@@ -34,6 +36,7 @@ import javax.management.MBeanServer;
 import javax.management.Notification;
 import javax.management.NotificationBroadcasterSupport;
 import javax.management.ObjectName;
+import javax.management.openmbean.CompositeData;
 import javax.management.openmbean.TabularData;
 import javax.management.openmbean.TabularDataSupport;
 
@@ -55,7 +58,7 @@ import org.osgi.service.log.LogService;
 /**
  * Implementation of <code>ServiceStateMBean</code> which emits JMX <code>Notification</code> for framework
  * <code>ServiceEvent</code> events
- * 
+ *
  * @version $Rev$ $Date$
  */
 public class ServiceState extends NotificationBroadcasterSupport implements ServiceStateMBean, MBeanRegistration {
@@ -109,6 +112,14 @@ public class ServiceState extends Notifi
     }
 
     /**
+     * @see org.osgi.jmx.framework.ServiceStateMBean#getProperty(long, java.lang.String)
+     */
+    public CompositeData getProperty(long serviceId, String key) throws IOException {
+        ServiceReference reference = resolveService(bundleContext, serviceId);
+            return PropertyData.newInstance(key, reference.getProperty(key)).toCompositeData();
+    }
+
+    /**
      * @see org.osgi.jmx.framework.ServiceStateMBean#getUsingBundles(long)
      */
     public long[] getUsingBundles(long serviceId) throws IOException {
@@ -118,19 +129,44 @@ public class ServiceState extends Notifi
     }
 
     /**
+     * @see org.osgi.jmx.framework.ServiceStateMBean#getService(long)
+     */
+    public CompositeData getService(long serviceId) throws IOException {
+        return new ServiceData(resolveService(bundleContext, serviceId)).toCompositeData();
+    }
+
+    /**
      * @see org.osgi.jmx.framework.ServiceStateMBean#listServices()
      */
     public TabularData listServices() throws IOException {
+        return listServices(null, null);
+    }
+
+    /**
+     * @see org.osgi.jmx.framework.ServiceStateMBean#listServices(java.lang.String, java.lang.String)
+     */
+    public TabularData listServices(String clazz, String filter) throws IOException {
+        return listServices(clazz, filter, ServiceStateMBean.SERVICE_TYPE.keySet());
+    }
+
+    /**
+     * @see org.osgi.jmx.framework.ServiceStateMBean#listServices(java.lang.String, java.lang.String, java.lang.String...)
+     */
+    public TabularData listServices(String clazz, String filter, String ... serviceTypeItems) throws IOException {
+        return listServices(clazz, filter, Arrays.asList(serviceTypeItems));
+    }
+
+    private TabularData listServices(String clazz, String filter, Collection<String> serviceTypeItems) throws IOException {
         TabularData servicesTable = new TabularDataSupport(SERVICES_TYPE);
         ServiceReference[] allServiceReferences = null;
         try {
-            allServiceReferences = bundleContext.getAllServiceReferences(null, null);
+            allServiceReferences = bundleContext.getAllServiceReferences(clazz, filter);
         } catch (InvalidSyntaxException e) {
             throw new IllegalStateException("Failed to retrieve all service references", e);
         }
         if (allServiceReferences != null) {
             for (ServiceReference reference : allServiceReferences) {
-                servicesTable.put(new ServiceData(reference).toCompositeData());
+                servicesTable.put(new ServiceData(reference).toCompositeData(serviceTypeItems));
             }
         }
         return servicesTable;
@@ -148,6 +184,27 @@ public class ServiceState extends Notifi
     }
 
     /**
+     * @see org.osgi.jmx.framework.ServiceStateMBean#getServiceIds()
+     */
+    public long[] getServiceIds() throws IOException {
+        try {
+            ServiceReference<?>[] refs = bundleContext.getAllServiceReferences(null, null);
+            long[] ids = new long[refs.length];
+            for (int i=0; i < refs.length; i++) {
+                ServiceReference<?> ref = refs[i];
+                long id = (Long) ref.getProperty(Constants.SERVICE_ID);
+                ids[i] = id;
+            }
+
+            return ids;
+        } catch (InvalidSyntaxException e) {
+            IOException ioe = new IOException();
+            ioe.initCause(e);
+            throw ioe;
+        }
+    }
+
+    /**
      * @see javax.management.MBeanRegistration#postDeregister()
      */
     public void postDeregister() {
@@ -218,7 +275,7 @@ public class ServiceState extends Notifi
                // ignore
             }
         }
-        if (eventDispatcher != null) {  
+        if (eventDispatcher != null) {
             eventDispatcher.shutdown();
         }
     }
@@ -229,5 +286,4 @@ public class ServiceState extends Notifi
     protected ExecutorService getEventDispatcher() {
         return eventDispatcher;
     }
-
 }

Modified: aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/util/TypeUtils.java
URL: http://svn.apache.org/viewvc/aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/util/TypeUtils.java?rev=1199354&r1=1199353&r2=1199354&view=diff
==============================================================================
--- aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/util/TypeUtils.java (original)
+++ aries/branches/oct-2011-release/sandbox/jmx-next/jmx-core/src/main/java/org/apache/aries/jmx/util/TypeUtils.java Tue Nov  8 17:27:34 2011
@@ -35,6 +35,7 @@ import static org.osgi.jmx.JmxConstants.
 import static org.osgi.jmx.JmxConstants.P_SHORT;
 import static org.osgi.jmx.JmxConstants.SHORT;
 import static org.osgi.jmx.JmxConstants.STRING;
+import static org.osgi.jmx.JmxConstants.VERSION;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
@@ -46,9 +47,11 @@ import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.osgi.framework.Version;
+
 /**
  * This class provides common utilities related to type conversions for the MBean implementations
- * 
+ *
  * @version $Rev$ $Date$
  */
 public class TypeUtils {
@@ -87,6 +90,7 @@ public class TypeUtils {
         wrapperTypes.put(SHORT, Short.class);
         wrapperTypes.put(BOOLEAN, Boolean.class);
         wrapperTypes.put(CHARACTER, Character.class);
+        wrapperTypes.put(VERSION, Version.class);
         mathTypes.put(BIGDECIMAL, BigDecimal.class);
         mathTypes.put(BIGINTEGER, BigInteger.class);
         types.put(STRING, String.class);
@@ -97,7 +101,7 @@ public class TypeUtils {
 
     /**
      * Converts a <code>Dictionary</code> object to a <code>Map</code>
-     * 
+     *
      * @param dictionary
      * @return
      */
@@ -113,7 +117,7 @@ public class TypeUtils {
 
     /**
      * Converts primitive long[] array to Long[]
-     * 
+     *
      * @param array
      * @return
      */
@@ -127,7 +131,7 @@ public class TypeUtils {
 
     /**
      * Converts Long[] array to primitive
-     * 
+     *
      * @param array
      * @return
      */
@@ -141,7 +145,7 @@ public class TypeUtils {
 
     /**
      * Converts a String value to an Object of the specified type
-     * 
+     *
      * @param type
      *            one of types listed in {@link #types}
      * @param value
@@ -175,7 +179,7 @@ public class TypeUtils {
                 String parseMethodName = "parse" + new String(simpleTypeName);
                 Method parseMethod = promotedType.getDeclaredMethod(parseMethodName, String.class);
                 result = (T) parseMethod.invoke(null, value);
-            } 
+            }
         } catch (SecurityException e) {
             throw new IllegalArgumentException("Cannot convert value [" + value + "] to type [" + type + "]", e);
         } catch (NoSuchMethodException e) {



Mime
View raw message