geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwo...@apache.org
Subject svn commit: r885366 - in /geronimo/sandbox/rex: org.apache.geronimo.blueprint.jmx.impl/ org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/ org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronim...
Date Mon, 30 Nov 2009 09:49:16 GMT
Author: rwonly
Date: Mon Nov 30 09:49:16 2009
New Revision: 885366

URL: http://svn.apache.org/viewvc?rev=885366&view=rev
Log:
make our codes compatible with jdk 1.5, have not tested yet.

Modified:
    geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/pom.xml
    geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/Activator.java
    geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/BlueprintMetadata.java
    geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/RegistrationStandardMBean.java
    geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/codec/BPComponentMetadata.java
    geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/codec/BPServiceMetadata.java
    geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/BlueprintMetadataMBean.java
    geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/Item.java
    geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/JmxConstants.java

Modified: geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/pom.xml?rev=885366&r1=885365&r2=885366&view=diff
==============================================================================
--- geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/pom.xml (original)
+++ geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/pom.xml Mon Nov 30 09:49:16
2009
@@ -13,20 +13,32 @@
   
     <dependencies>
         <dependency>
-                <groupId>org.osgi</groupId>
-                <artifactId>org.osgi.core</artifactId>
-                <version>4.2.0</version>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <version>4.2.0</version>
         </dependency>
         <dependency>
-                <groupId>org.osgi</groupId>
-                <artifactId>org.osgi.compendium</artifactId>
-                <version>4.2.0</version>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <version>4.2.0</version>
         </dependency>
         <dependency>
-                <groupId>org.apache.geronimo.blueprint</groupId>
-                <artifactId>org.apache.geronimo.blueprint.jmx</artifactId>
-                <version>1.0-SNAPSHOT</version>
+            <groupId>org.apache.geronimo.blueprint</groupId>
+            <artifactId>org.apache.geronimo.blueprint.jmx</artifactId>
+            <version>1.0-SNAPSHOT</version>
         </dependency>
+        <dependency>
+            <groupId>org.easymock</groupId>
+            <artifactId>easymock</artifactId>
+            <version>2.5.2</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.easymock</groupId>
+            <artifactId>easymockclassextension</artifactId>
+            <version>2.4</version>
+            <scope>test</scope>
+        </dependency>  
     </dependencies>
 
     <build>

Modified: geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/Activator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/Activator.java?rev=885366&r1=885365&r2=885366&view=diff
==============================================================================
--- geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/Activator.java
(original)
+++ geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/Activator.java
Mon Nov 30 09:49:16 2009
@@ -24,7 +24,9 @@
 
     protected BundleContext bundleContext;
 
-    protected StandardMBean blueprintState;
+    /* the StardardMBean does not implement the MBeanRegistration in jdk1.5*/   
+    //protected StandardMBean blueprintState;
+    protected BlueprintState blueprintState;
     protected ObjectName blueprintStateName;
 
     protected StandardMBean blueprintMetadata;
@@ -104,13 +106,17 @@
     }
 
     protected synchronized void registerServices(MBeanServer mbeanServer) {
-        // create BlueprintMetadataMBean
-        try {
-            blueprintState = new RegistrationStandardMBean(new BlueprintState(bundleContext),
BlueprintStateMBean.class);
-        } catch (NotCompliantMBeanException e) {
-            System.out.println("Unable to create StandardMBean for BlueprintState" + e);
// Severe
-            return;
-        }
+        // create BlueprintStateMBean
+        
+        /* the StardardMBean does not implement the MBeanRegistration in jdk1.5*/       

+        //        try {
+        //            blueprintState = new RegistrationStandardMBean(new BlueprintState(bundleContext),
BlueprintStateMBean.class);
+        //        } catch (NotCompliantMBeanException e) {
+        //            System.out.println("Unable to create StandardMBean for BlueprintState"
+ e); // Severe
+        //            return;
+        //        }
+        blueprintState = new BlueprintState(bundleContext);
+        
         // register BlueprintStateMBean to MBean server
         System.out.println("Registering bundle state monitor with MBeanServer: " + mbeanServer
+ " with name: "
                 + blueprintStateName); // Fine

Modified: geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/BlueprintMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/BlueprintMetadata.java?rev=885366&r1=885365&r2=885366&view=diff
==============================================================================
--- geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/BlueprintMetadata.java
(original)
+++ geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/BlueprintMetadata.java
Mon Nov 30 09:49:16 2009
@@ -62,7 +62,7 @@
 
     public String[] getComponentIds(long containerServiceId) {
         BlueprintContainer container = getBlueprintContainer(containerServiceId);
-        return container.getComponentIds().toArray(new String[0]);
+        return (String[])container.getComponentIds().toArray(new String[0]);
     }
 
     /*
@@ -73,7 +73,7 @@
      */
     public String[] getComponentIdsByType(long containerServiceId, String type) {
         BlueprintContainer container = getBlueprintContainer(containerServiceId);
-        Collection<ComponentMetadata> components;
+        Collection<? extends ComponentMetadata> components;
         if (type.equals(BlueprintMetadataMBean.SERVICE_METADATA)) {
             components = container.getMetadata(ServiceMetadata.class);
         } else if (type.equals(BlueprintMetadataMBean.BEAN_METADATA)) {

Modified: geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/RegistrationStandardMBean.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/RegistrationStandardMBean.java?rev=885366&r1=885365&r2=885366&view=diff
==============================================================================
--- geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/RegistrationStandardMBean.java
(original)
+++ geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/RegistrationStandardMBean.java
Mon Nov 30 09:49:16 2009
@@ -6,48 +6,48 @@
 import javax.management.ObjectName;
 import javax.management.StandardMBean;
 
-public class RegistrationStandardMBean extends StandardMBean {
+public class RegistrationStandardMBean /*extends StandardMBean*/ {
 
-    public <T> RegistrationStandardMBean(T implementation, Class<T> mbeanInterface)

-        throws NotCompliantMBeanException {
-        super(implementation, mbeanInterface);
-    }
-
-    @Override
-    public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception {
-        name = super.preRegister(server, name);
-        Object impl = getImplementation();
-        if (impl instanceof MBeanRegistration) {
-            return ((MBeanRegistration) impl).preRegister(server, name);
-        }
-        return name;
-    }
-
-    @Override
-    public void postRegister(Boolean registrationDone) {
-        super.postRegister(registrationDone);
-        Object impl = getImplementation();
-        if (impl instanceof MBeanRegistration) {
-            ((MBeanRegistration) impl).postRegister(registrationDone);
-        }
-    }
-
-    @Override
-    public void preDeregister() throws Exception {
-        super.preDeregister();
-        Object impl = getImplementation();
-        if (impl instanceof MBeanRegistration) {
-            ((MBeanRegistration) impl).preDeregister();
-        }
-    }
-
-    @Override
-    public void postDeregister() {
-        super.postDeregister();
-        Object impl = getImplementation();
-        if (impl instanceof MBeanRegistration) {
-            ((MBeanRegistration) impl).postDeregister();
-        }
-    }
+//    public <T> RegistrationStandardMBean(T implementation, Class<T> mbeanInterface)

+//        throws NotCompliantMBeanException {
+//        super(implementation, mbeanInterface);
+//    }
+//
+//    @Override
+//    public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
{
+//        name = super.preRegister(server, name);
+//        Object impl = getImplementation();
+//        if (impl instanceof MBeanRegistration) {
+//            return ((MBeanRegistration) impl).preRegister(server, name);
+//        }
+//        return name;
+//    }
+//
+//    @Override
+//    public void postRegister(Boolean registrationDone) {
+//        super.postRegister(registrationDone);
+//        Object impl = getImplementation();
+//        if (impl instanceof MBeanRegistration) {
+//            ((MBeanRegistration) impl).postRegister(registrationDone);
+//        }
+//    }
+//
+//    @Override
+//    public void preDeregister() throws Exception {
+//        super.preDeregister();
+//        Object impl = getImplementation();
+//        if (impl instanceof MBeanRegistration) {
+//            ((MBeanRegistration) impl).preDeregister();
+//        }
+//    }
+//
+//    @Override
+//    public void postDeregister() {
+//        super.postDeregister();
+//        Object impl = getImplementation();
+//        if (impl instanceof MBeanRegistration) {
+//            ((MBeanRegistration) impl).postDeregister();
+//        }
+//    }
     
 }

Modified: geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/codec/BPComponentMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/codec/BPComponentMetadata.java?rev=885366&r1=885365&r2=885366&view=diff
==============================================================================
--- geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/codec/BPComponentMetadata.java
(original)
+++ geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/codec/BPComponentMetadata.java
Mon Nov 30 09:49:16 2009
@@ -24,7 +24,7 @@
 
     protected BPComponentMetadata(ComponentMetadata component) {
         activation = component.getActivation();
-        dependsOn =  component.getDependsOn().toArray(new String[0]);
+        dependsOn =  (String[])component.getDependsOn().toArray(new String[0]);
         id = (String) component.getId();
     }
 

Modified: geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/codec/BPServiceMetadata.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/codec/BPServiceMetadata.java?rev=885366&r1=885365&r2=885366&view=diff
==============================================================================
--- geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/codec/BPServiceMetadata.java
(original)
+++ geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx.impl/src/main/java/org/apache/geronimo/blueprint/jmx/impl/codec/BPServiceMetadata.java
Mon Nov 30 09:49:16 2009
@@ -50,7 +50,7 @@
     public BPServiceMetadata(ServiceMetadata service) {
         super(service);
         autoExport = service.getAutoExport();
-        interfaces = service.getInterfaces().toArray(new String[0]);
+        interfaces = (String[])service.getInterfaces().toArray(new String[0]);
         ranking = service.getRanking();
 
         listeners = new BPRegistrationListener[service.getRegistrationListeners().size()];

Modified: geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/BlueprintMetadataMBean.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/BlueprintMetadataMBean.java?rev=885366&r1=885365&r2=885366&view=diff
==============================================================================
--- geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/BlueprintMetadataMBean.java
(original)
+++ geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/BlueprintMetadataMBean.java
Mon Nov 30 09:49:16 2009
@@ -2,7 +2,7 @@
 
 import java.io.IOException;
 
-import javax.lang.model.type.ArrayType;
+import javax.management.openmbean.ArrayType;
 import javax.management.openmbean.CompositeData;
 import javax.management.openmbean.CompositeType;
 import javax.management.openmbean.SimpleType;
@@ -168,7 +168,7 @@
     Item            KEY_ITEM                = new Item(
                                                     KEY,
                                                     "The key of an entry",
-                                                    JmxConstants.PRIMITIVE_BYTE_ARRAY_TYPE);
+                                                    JmxConstants.BYTE_ARRAY_TYPE);
     
     /**
     * The key VALUE, used in {@link #VALUE_ITEM}.
@@ -183,7 +183,7 @@
     Item            VALUE_ITEM              = new Item(
                                                    VALUE, 
                                                    "A value", 
-                                                   JmxConstants.PRIMITIVE_BYTE_ARRAY_TYPE);
 
+                                                   JmxConstants.BYTE_ARRAY_TYPE);  
 
     /**
      * The name of CompositeType for MapEntry objects, used in {@link #MAP_ENTRY_TYPE}.
@@ -321,7 +321,7 @@
     Item            VALUES_ITEM             = new Item(
                                                     VALUES,
                                                     "All the values",
-                                                    Item.arrayType(1, JmxConstants.PRIMITIVE_BYTE_ARRAY_TYPE));
+                                                    Item.arrayType(1, JmxConstants.BYTE_ARRAY_TYPE));
     
 
     /**
@@ -562,7 +562,7 @@
     Item            FACTORY_COMPONENT_ITEM  = new Item(
                                                     FACTORY_COMPONENT, 
                                                     "The factory component on which to invoke
the factory method for the bean", 
-                                                    JmxConstants.PRIMITIVE_BYTE_ARRAY_TYPE);
+                                                    JmxConstants.BYTE_ARRAY_TYPE);
     
     /**
      * The key SCOPE, used in {@link #SCOPE_ITEM}.
@@ -654,7 +654,7 @@
     Item            LISTENER_COMPONENT_ITEM = new Item(
                                                     LISTENER_COMPONENT, 
                                                     "The listener component", 
-                                                    JmxConstants.PRIMITIVE_BYTE_ARRAY_TYPE);
+                                                    JmxConstants.BYTE_ARRAY_TYPE);
     
     /**
      * The key REGISTRATION_METHOD, used in {@link #REGISTRATION_METHOD_ITEM}.
@@ -762,7 +762,7 @@
     Item            SERVICE_COMPONENT_ITEM  = new Item(
                                                     SERVICE_COMPONENT, 
                                                     "The component to be exported as a service",

-                                                    JmxConstants.PRIMITIVE_BYTE_ARRAY_TYPE);
+                                                    JmxConstants.BYTE_ARRAY_TYPE);
     
     /**
      * The key SERVICE_PROPERTIES, used in {@link #SERVICE_PROPERTIES_ITEM}.

Modified: geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/Item.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/Item.java?rev=885366&r1=885365&r2=885366&view=diff
==============================================================================
--- geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/Item.java
(original)
+++ geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/Item.java
Mon Nov 30 09:49:16 2009
@@ -39,7 +39,7 @@
     /**
      * The type of this item.
      */
-    private final OpenType<?> type;
+    private final OpenType/*<?>*/ type;
 
     /**
      * Create a triple of name, description, and type. This triplet is used in the creation
of a Composite Type.
@@ -53,7 +53,7 @@
      * @param restrictions
      *            Ignored, contains list of restrictions
      */
-    public Item(String name, String description, OpenType<?> type, String... restrictions)
{
+    public Item(String name, String description, OpenType/*<?>*/ type, String... restrictions)
{
         this.name = name;
         this.description = description;
         this.type = type;
@@ -128,7 +128,7 @@
 
         String names[] = new String[all.size()];
         String descriptions[] = new String[all.size()];
-        OpenType<?> types[] = new OpenType<?>[all.size()];
+        OpenType types[] = new OpenType[all.size()];
 
         int n = 0;
         for (Item item : all) {
@@ -154,7 +154,7 @@
      *            The element type
      * @return A new Array Type
      */
-    public static ArrayType<?> arrayType(int dim, OpenType<?> elementType) {
+    public static ArrayType/*<?>*/ arrayType(int dim, OpenType/*<?>*/ elementType)
{
         try {
             return new ArrayType(dim, elementType);
         } catch (OpenDataException e) {
@@ -162,6 +162,7 @@
         }
     }
     
+    
     /**
      * Return a new primaArray Type.
      * 
@@ -169,11 +170,15 @@
      *            The element type
      * @return A new Array Type
      */
-    public static ArrayType<?> primitiveArrayType(SimpleType<?> elementType)
{
+    /*
+     * For the compatibility  with java 5, we have to cancel this method temporarily.
+     * 
+     * public static ArrayType<?> primitiveArrayType(SimpleType<?> elementType)
{
         try {
             return new ArrayType(elementType, true);
         } catch (OpenDataException e) {
             throw new RuntimeException(e);
         }
     }
+    */
 }

Modified: geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/JmxConstants.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/JmxConstants.java?rev=885366&r1=885365&r2=885366&view=diff
==============================================================================
--- geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/JmxConstants.java
(original)
+++ geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/JmxConstants.java
Mon Nov 30 09:49:16 2009
@@ -40,21 +40,26 @@
     /**
      * The MBean Open type for an array of longs
      */
-    public static final ArrayType<?>    PRIMITIVE_BYTE_ARRAY_TYPE   = Item
+    //For the compatibility  with java 5, we missed the efficient way.
+    /*public static final ArrayType<?>    PRIMITIVE_BYTE_ARRAY_TYPE   = Item
                                                                     .primitiveArrayType(
+                                                                            SimpleType.BYTE);*/
+    public static final ArrayType/*<Byte>*/    BYTE_ARRAY_TYPE   = Item
+                                                                    .arrayType(
+                                                                            1,
                                                                             SimpleType.BYTE);
     
     /**
      * The MBean Open type for an array of strings
      */
-    public static final ArrayType<?>    STRING_ARRAY_TYPE   = Item
+    public static final ArrayType/*<String>*/    STRING_ARRAY_TYPE   = Item
                                                                     .arrayType(
                                                                             1,
                                                                             SimpleType.STRING);
     /**
      * The MBean Open type for an array of longs
      */
-    public static final ArrayType<?>    LONG_ARRAY_TYPE     = Item
+    public static final ArrayType/*<Long>*/    LONG_ARRAY_TYPE     = Item
                                                                     .arrayType(
                                                                             1,
                                                                             SimpleType.LONG);



Mime
View raw message