You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2009/07/15 20:45:25 UTC

svn commit: r794356 - in /geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint: container/BlueprintContainerImpl.java container/BlueprintEventDispatcher.java utils/JavaUtils.java

Author: gawor
Date: Wed Jul 15 18:45:25 2009
New Revision: 794356

URL: http://svn.apache.org/viewvc?rev=794356&view=rev
Log:
CONTAINER_VERSION_PROPERTY should be of type Version

Modified:
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintContainerImpl.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintEventDispatcher.java
    geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/utils/JavaUtils.java

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintContainerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintContainerImpl.java?rev=794356&r1=794355&r2=794356&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintContainerImpl.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintContainerImpl.java Wed Jul 15 18:45:25 2009
@@ -49,6 +49,7 @@
 import org.apache.geronimo.blueprint.namespace.ComponentDefinitionRegistryImpl;
 import org.apache.geronimo.blueprint.namespace.NamespaceHandlerRegistryImpl;
 import org.apache.geronimo.blueprint.utils.HeaderParser;
+import org.apache.geronimo.blueprint.utils.JavaUtils;
 import org.apache.geronimo.blueprint.utils.HeaderParser.PathElement;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
@@ -299,7 +300,7 @@
                             props.put(BlueprintConstants.CONTAINER_SYMBOLIC_NAME_PROPERTY,
                                       bundleContext.getBundle().getSymbolicName());
                             props.put(BlueprintConstants.CONTAINER_VERSION_PROPERTY,
-                                      bundleContext.getBundle().getHeaders().get(Constants.BUNDLE_VERSION));
+                                      JavaUtils.getBundleVersion(bundleContext.getBundle()));
                             registration = bundleContext.registerService(BlueprintContainer.class.getName(), this, props);
                             eventDispatcher.blueprintEvent(new BlueprintEvent(BlueprintEvent.CREATED, getBundleContext().getBundle(), getExtenderBundle()));
                             state = State.Created;

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintEventDispatcher.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintEventDispatcher.java?rev=794356&r1=794355&r2=794356&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintEventDispatcher.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/container/BlueprintEventDispatcher.java Wed Jul 15 18:45:25 2009
@@ -26,6 +26,7 @@
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
+import org.apache.geronimo.blueprint.utils.JavaUtils;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
@@ -141,12 +142,6 @@
             }
         }
     }
-
-    private static Version getBundleVersion(Bundle bundle) {
-        Dictionary headers = bundle.getHeaders();
-        String version = (String)headers.get(Constants.BUNDLE_VERSION);
-        return (version != null) ? Version.parseVersion(version) : null;
-    }
     
     public void destroy() {
         this.executor.shutdown();
@@ -175,14 +170,14 @@
             props.put(EventConstants.BUNDLE, event.getBundle());
             props.put(EventConstants.BUNDLE_SYMBOLICNAME, event.getBundle().getSymbolicName());
             props.put(EventConstants.BUNDLE_ID, event.getBundle().getBundleId());
-            Version version = getBundleVersion(event.getBundle());
+            Version version = JavaUtils.getBundleVersion(event.getBundle());
             if (version != null) {
                 props.put(EventConstants.BUNDLE_VERSION, version);
             }
             props.put(EventConstants.EXTENDER_BUNDLE, event.getExtenderBundle());
             props.put(EventConstants.EXTENDER_BUNDLE_ID, event.getExtenderBundle().getBundleId());
             props.put(EventConstants.EXTENDER_BUNDLE_SYMBOLICNAME, event.getExtenderBundle().getSymbolicName());
-            version = getBundleVersion(event.getExtenderBundle());
+            version = JavaUtils.getBundleVersion(event.getExtenderBundle());
             if (version != null) {
                 props.put(EventConstants.EXTENDER_BUNDLE_VERSION, version);
             }

Modified: geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/utils/JavaUtils.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/utils/JavaUtils.java?rev=794356&r1=794355&r2=794356&view=diff
==============================================================================
--- geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/utils/JavaUtils.java (original)
+++ geronimo/sandbox/blueprint/blueprint-core/src/main/java/org/apache/geronimo/blueprint/utils/JavaUtils.java Wed Jul 15 18:45:25 2009
@@ -20,7 +20,10 @@
 import java.util.Enumeration;
 import java.util.Hashtable;
 
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
 
 /**
  * @version $Rev$ $Date$
@@ -47,4 +50,10 @@
         return props;
     }
     
+    public static Version getBundleVersion(Bundle bundle) {
+        Dictionary headers = bundle.getHeaders();
+        String version = (String)headers.get(Constants.BUNDLE_VERSION);
+        return (version != null) ? Version.parseVersion(version) : null;
+    }
+    
 }