geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwo...@apache.org
Subject svn commit: r883987 - in /geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx: ./ src/main/java/org/apache/geronimo/blueprint/jmx/
Date Wed, 25 Nov 2009 06:22:56 GMT
Author: rwonly
Date: Wed Nov 25 06:22:55 2009
New Revision: 883987

URL: http://svn.apache.org/viewvc?rev=883987&view=rev
Log:
Blueprint MBeans api updates and remove the dependency on private osgi-jmx api

Added:
    geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/Item.java   (with props)
    geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/JmxConstants.java   (with props)
Modified:
    geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/pom.xml
    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/BlueprintStateMBean.java

Modified: geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/pom.xml?rev=883987&r1=883986&r2=883987&view=diff
==============================================================================
--- geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/pom.xml (original)
+++ geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/pom.xml Wed Nov 25 06:22:55 2009
@@ -9,10 +9,5 @@
   <name>org.apache.geronimo.blueprint.jmx</name>
   
   <dependencies>
-    <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>org.osgi.jmx</artifactId>
-      <version>1.0</version>
-    </dependency>
   </dependencies>
 </project>

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=883987&r1=883986&r2=883987&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 Wed Nov 25 06:22:55 2009
@@ -2,12 +2,10 @@
 
 import java.io.IOException;
 
-import javax.management.openmbean.CompositeData;
+import javax.lang.model.type.ArrayType;
 import javax.management.openmbean.CompositeType;
 import javax.management.openmbean.SimpleType;
 
-import org.osgi.jmx.Item;
-import org.osgi.jmx.JmxConstants;
 
 public interface BlueprintMetadataMBean {
 
@@ -32,7 +30,7 @@
      */
     Item            STRING_VALUE_ITEM       = new Item(
                                                     STRING_VALUE, 
-                                                    "", 
+                                                    "The un-converted string representation of a value", 
                                                     SimpleType.STRING);
     
     /**
@@ -46,19 +44,25 @@
      */
     Item            TYPE_ITEM               = new Item(
                                                     TYPE, 
-                                                    "", 
+                                                    "The type of a value", 
                                                     SimpleType.STRING);
     
     /**
-     * The CompositeType for a ValueMetadata object. It contains the following items:
+     * The name of CompositeType for ValueMetadata objects, used in {@link #VALUE_METADATA_TYPE}.
+     */
+    String          VALUE_METADATA          = "ValueMetadata";
+    
+    
+    /**
+     * The CompositeType encapsulates ValueMetadata objects. It contains the following items:
      * <ul>
      * <li>{@link #STRING_VALUE}</li>
      * <li>{@link #TYPE}</li>
      * </ul>
      */
     CompositeType   VALUE_METADATA_TYPE     = Item.compositeType(
-                                                    "ValueMetadata", 
-                                                    "", 
+                                                    VALUE_METADATA, 
+                                                    "This type encapsulates ValueMetadata objects", 
                                                     STRING_VALUE_ITEM, 
                                                     TYPE_ITEM);                  
     
@@ -67,9 +71,31 @@
     ///////////////////////////////////////////////////////////////  
     
     /**
-     * The CompositeType for a NullMetadata object.
+     * The key PLACEHOLDER, used in {@link #PLACEHOLDER_ITEM}.
+     */ 
+    String          PLACEHOLDER             = "Placeholder";
+    
+    /**
+     * The item is a placeholder in the null metadata type.
+     * The key is {@link #PLACEHOLDER}, and the type is {@link SimpleType#STRING}.
+     */
+    Item            PLACEHOLDER_ITEM        = new Item(
+                                                    PLACEHOLDER, 
+                                                    "This is a placeholder", 
+                                                    SimpleType.VOID);
+    
+    /**
+     * The name of CompositeType for NullMetadata objects, used in {@link #NULL_METADATA_TYPE}.
+     */
+    String          NULL_METADATA          = "NullMetadata";
+    
+    /**
+     * The CompositeType for NullMetadata objects. A composite type requires at least one item, so we add a placeholder item.
      */
-    CompositeType   NULL_METADATA_TYPE      = Item.compositeType("NullMetadata", "", new Item[0]);
+    CompositeType   NULL_METADATA_TYPE      = Item.compositeType(
+                                                    NULL_METADATA, 
+                                                    "This type encapsulates NullMetadata objects", 
+                                                    PLACEHOLDER_ITEM);
     
     ///////////////////////////////////////////////////////////////
     // Define <ref>'s CompositeType
@@ -86,8 +112,12 @@
      */
     Item            COMPONENT_ID_ITEM       = new Item(
                                                     COMPONENT_ID,
-                                                    "",
+                                                    "The component id",
                                                     SimpleType.STRING);
+    /**
+     * The name of CompositeType for RefMetadata objects, used in {@link #REF_METADATA_TYPE}.
+     */
+    String          REF_METADATA          = "RefMetadata";
     
     /**
      * The CompositeType for a RefMetadata object. It contains the following items:
@@ -96,14 +126,18 @@
      * </ul>
      */
     CompositeType   REF_METADATA_TYPE       = Item.compositeType(
-                                                    "RefMetadata", 
-                                                    "", 
+                                                    REF_METADATA, 
+                                                    "This type encapsulates RefMetadata objects", 
                                                     COMPONENT_ID_ITEM);
 
     ///////////////////////////////////////////////////////////////
     // Define <idref>'s CompositeType
     // COMPONENT_ID_ITEM defined in <ref>'s definition
     ///////////////////////////////////////////////////////////////  
+    /**
+     * The name of CompositeType for IdRefMetadata objects, used in {@link #ID_REF_METADATA_TYPE}.
+     */
+    String          ID_REF_METADATA          = "IdRefMetadata";
     
     /**
      * The CompositeType for an IdRefMetadata object. It contains the following items:
@@ -112,8 +146,8 @@
      * </ul>
      */
     CompositeType   ID_REF_METADATA_TYPE    = Item.compositeType(
-                                                    "IdRefMetadata", 
-                                                    "", 
+                                                    ID_REF_METADATA, 
+                                                    "This type encapsulates IdRefMetadata objects", 
                                                     COMPONENT_ID_ITEM);
     
     ///////////////////////////////////////////////////////////////
@@ -132,8 +166,8 @@
      */
     Item            KEY_ITEM                = new Item(
                                                     KEY,
-                                                    "",
-                                                    Item.arrayType(1, SimpleType.BYTE));
+                                                    "The key of an entry",
+                                                    JmxConstants.P_BYTE_ARRAY_TYPE);
     
     /**
     * The key VALUE, used in {@link #VALUE_ITEM}.
@@ -143,14 +177,19 @@
     /**
     * The item containing a value and this will be used by 
     * BeanArgument, BeanProperty, MapEntry and CollectionMetadata.
-    * The key is {@link #VALUE}, and the type is {@link ArrayType}.
+    * The key is {@link #VALUE}, and the type is {@link JmxConstants#P_BYTE_ARRAY_TYPE}.
     */
     Item            VALUE_ITEM              = new Item(
                                                    VALUE, 
-                                                   "", 
-                                                   Item.arrayType(1, SimpleType.BYTE));  
+                                                   "A value", 
+                                                   JmxConstants.P_BYTE_ARRAY_TYPE);  
 
     /**
+     * The name of CompositeType for MapEntry objects, used in {@link #MAP_ENTRY_TYPE}.
+     */
+    String          MAP_ENTRY          = "MapEntry";
+    
+    /**
      * The CompositeType for a MapEntry object. It contains the following items:
      * <ul>
      * <li>{@link #KEY}</li>
@@ -158,8 +197,8 @@
      * </ul>
      */
     CompositeType   MAP_ENTRY_TYPE          = Item.compositeType(
-                                                   "MapEntry", 
-                                                   "", 
+                                                   MAP_ENTRY, 
+                                                   "This type encapsulates MapEntry objects",
                                                    KEY_ITEM,
                                                    VALUE_ITEM);
     
@@ -178,7 +217,7 @@
      */
     Item            ENTRIES_ITEM            = new Item(
                                                     ENTRIES,
-                                                    "",
+                                                    "An array of entries",
                                                     Item.arrayType(1, MAP_ENTRY_TYPE));
     
     /**
@@ -192,7 +231,7 @@
      */
     Item            KEY_TYPE_ITEM           = new Item(
                                                     KEY_TYPE,
-                                                    "",
+                                                    "The key type of the entries",
                                                     SimpleType.STRING);
     
     /**
@@ -206,10 +245,15 @@
      */
     Item            VALUE_TYPE_ITEM         = new Item(
                                                     VALUE_TYPE, 
-                                                    "", 
+                                                    "The value type", 
                                                     SimpleType.STRING);
     
     /**
+     * The name of CompositeType for MapMetadata objects, used in {@link #MAP_METADATA_TYPE}.
+     */
+    String          MAP_METADATA          = "MapMetadata";
+    
+    /**
      * The CompositeType for a MapMetadata object. It contains the following items:
      * <ul>
      * <li>{@link #ENTRIES}</li>
@@ -218,8 +262,8 @@
      * </ul>
      */
     CompositeType   MAP_METADATA_TYPE       = Item.compositeType(
-                                                    "MapMetadata", 
-                                                    "", 
+                                                    MAP_METADATA, 
+                                                    "This type encapsulates MapMetadata objects",
                                                     ENTRIES_ITEM,
                                                     KEY_TYPE_ITEM,
                                                     VALUE_TYPE_ITEM);
@@ -230,14 +274,19 @@
     ///////////////////////////////////////////////////////////////
 
     /**
+     * The name of CompositeType for PropsMetadata objects, used in {@link #PROPS_METADATA_TYPE}.
+     */
+    String          PROPS_METADATA          = "PropsMetadata";    
+    
+    /**
      * The CompositeType for a PropsMetadata object. It contains the following items:
      * <ul>
      * <li>{@link #ENTRIES}</li>
      * </ul>
      */
     CompositeType   PROPS_METADATA_TYPE     = Item.compositeType(
-                                                    "PropsMetadata", 
-                                                    "", 
+                                                    PROPS_METADATA, 
+                                                    "This type encapsulates PropsMetadata objects",
                                                     ENTRIES_ITEM);
     
     ///////////////////////////////////////////////////////////////
@@ -256,7 +305,7 @@
      */
     Item            COLLECTION_CLASS_ITEM   = new Item(
                                                     COLLECTION_CLASS,
-                                                    "",
+                                                    "The type of this collection",
                                                     SimpleType.STRING);
     
     /**
@@ -270,8 +319,14 @@
      */
     Item            VALUES_ITEM             = new Item(
                                                     VALUES,
-                                                    "",
-                                                    Item.arrayType(1, Item.arrayType(1, SimpleType.BYTE)));
+                                                    "All the values",
+                                                    Item.arrayType(1, JmxConstants.P_BYTE_ARRAY_TYPE));
+    
+
+    /**
+     * The name of CompositeType for CollectionMetadata objects, used in {@link #COLLECTION_METADATA_TYPE}.
+     */
+    String          COLLECTION_METADATA          = "CollectionMetadata";    
     
     /**
      * The CompositeType for a CollectionMetadata object. It contains the following items:
@@ -282,8 +337,8 @@
      * </ul>
      */
     CompositeType   COLLECTION_METADATA_TYPE= Item.compositeType(
-                                                    "CollectionMetadata", 
-                                                    "", 
+                                                    COLLECTION_METADATA, 
+                                                    "This type encapsulates CollectionMetadata objects",
                                                     COLLECTION_CLASS_ITEM,
                                                     VALUES_ITEM,
                                                     VALUE_TYPE_ITEM);
@@ -305,10 +360,16 @@
      */
     Item            INDEX_ITEM              = new Item(
                                                     INDEX, 
-                                                    "", 
+                                                    "The zero-based index", 
                                                     SimpleType.INTEGER);
 
     /**
+     * The name of CompositeType for BeanArgument objects, used in {@link #BEAN_ARGUMENT_TYPE}.
+     */
+    String          BEAN_ARGUMENT               = "BeanArgument";    
+
+    
+    /**
      * The CompositeType for a Argument object. It contains the following items:
      * <ul>
      * <li>{@link #INDEX}</li>
@@ -316,9 +377,9 @@
      * <li>{@link #VALUE}</li>
      * </ul>
      */
-    CompositeType   BEAN_ARGUMENT_TYPE           = Item.compositeType(
-                                                    "BeanArgument",
-                                                    "",
+    CompositeType   BEAN_ARGUMENT_TYPE          = Item.compositeType(
+                                                    BEAN_ARGUMENT,
+                                                    "This type encapsulates BeanArgument objects",
                                                     INDEX_ITEM,
                                                     VALUE_TYPE_ITEM,
                                                     VALUE_ITEM);
@@ -338,10 +399,15 @@
      */
     Item            NAME_ITEM               = new Item(
                                                     NAME,
-                                                    "",
+                                                    "The name of the property",
                                                     SimpleType.STRING);
     
     /**
+     * The name of CompositeType for BeanProperty objects, used in {@link #BEAN_PROPERTY_TYPE}.
+     */
+    String          BEAN_PROPERTY               = "BeanProperty";    
+    
+    /**
      * The CompositeType for property type. It contains the following items:
      * <ul>
      * <li>{@link #NAME}</li>
@@ -349,8 +415,8 @@
      * </ul>
      */
     CompositeType   BEAN_PROPERTY_TYPE           = Item.compositeType(
-                                                    "BeanProperty", 
-                                                    "", 
+                                                    BEAN_PROPERTY, 
+                                                    "This type encapsulates BeanProperty objects",
                                                     NAME_ITEM,
                                                     VALUE_ITEM);
         
@@ -384,7 +450,7 @@
      */
     Item            ACTIVATION_ITEM         = new Item(
                                                     ACTIVATION,
-                                                    "",
+                                                    "The activation strategy for a component",
                                                     SimpleType.INTEGER);
     
     /**
@@ -398,10 +464,15 @@
      */
     Item            DEPENDS_ON_ITEM         = new Item(
                                                     DEPENDS_ON,
-                                                    "",
+                                                    "The ids of any components listed in a depends-on attribute",
                                                     JmxConstants.STRING_ARRAY_TYPE);
     
     /**
+     * The name of CompositeType for ComponentMetadata objects, used in {@link #COMPONENT_METADATA_TYPE}.
+     */
+    String          COMPONENT_METADATA               = "ComponentMetadata";    
+    
+    /**
      * The CompositeType for a ComponentMetadata object, it contains 
      * the following items:
      * <ul>
@@ -410,9 +481,9 @@
      * <li>{@link #DEPENDS_ON}</li>
      * </ul>
      */
-    CompositeType   COMPONENT_METADATA_TYPE = Item.compositeType(
-                                                    "ComponentMetadata",
-                                                    "",
+    CompositeType   COMPONENT_METADATA_TYPE     = Item.compositeType(
+                                                    COMPONENT_METADATA,
+                                                    "This type encapsulates ComponentMetadata objects",
                                                     ID_ITEM,
                                                     ACTIVATION_ITEM,
                                                     DEPENDS_ON_ITEM);
@@ -432,7 +503,7 @@
      */
     Item            CLASS_NAME_ITEM         = new Item(
                                                     CLASS_NAME,
-                                                    "",
+                                                    "The name of the class specified for the bean",
                                                     SimpleType.STRING
                                                     );
     
@@ -447,7 +518,7 @@
      */
     Item            INIT_METHOD_ITEM        = new Item(
                                                     INIT_METHOD, 
-                                                    "", 
+                                                    "The name of the init method specified for the bean", 
                                                     SimpleType.STRING);
     
     /**
@@ -461,7 +532,7 @@
      */
     Item            DESTROY_METHOD_ITEM     = new Item(
                                                     DESTROY_METHOD, 
-                                                    "", 
+                                                    "The name of the destroy method specified for the bean", 
                                                     SimpleType.STRING);
 
     /**
@@ -475,7 +546,7 @@
      */
     Item            FACTORY_METHOD_ITEM     = new Item(
                                                     FACTORY_METHOD, 
-                                                    "", 
+                                                    "The name of the factory method specified for the bean", 
                                                     SimpleType.STRING);
     
     /**
@@ -489,7 +560,7 @@
      */
     Item            FACTORY_COMPONENT_ITEM  = new Item(
                                                     FACTORY_COMPONENT, 
-                                                    "", 
+                                                    "The id of the factory component on which to invoke the factory method for the bean", 
                                                     SimpleType.STRING);
     
     /**
@@ -503,7 +574,7 @@
      */
     Item            SCOPE_ITEM              = new Item(
                                                     SCOPE, 
-                                                    "", 
+                                                    "The scope for the bean", 
                                                     SimpleType.STRING);
 
     /**
@@ -517,7 +588,7 @@
      */
     Item           ARGUMENTS_ITEM     = new Item(
                                                     ARGUMENTS, 
-                                                    "", 
+                                                    "The bean argument", 
                                                     Item.arrayType(1, BEAN_ARGUMENT_TYPE));
     
     /**
@@ -531,10 +602,15 @@
      */
     Item            PROPERTIES_ITEM    = new Item(
                                                     PROPERTIES, 
-                                                    "", 
+                                                    "The bean property", 
                                                     Item.arrayType(1, BEAN_PROPERTY_TYPE));
     
     /**
+     * The name of CompositeType for BeanMetadata objects, used in {@link #BEAN_METADATA_TYPE}.
+     */
+    String          BEAN_METADATA               = "BeanMetadata";    
+    
+    /**
      * The CompositeType for a BeanMetadata object, it extends {@link #COMPONENT_METADATA_TYPE} 
      * and adds the following items:
      * <ul>
@@ -550,8 +626,8 @@
      */
     CompositeType   BEAN_METADATA_TYPE      = Item.extend(
                                                     COMPONENT_METADATA_TYPE, 
-                                                    "BeanMetadata", 
-                                                    "",
+                                                    BEAN_METADATA, 
+                                                    "This type encapsulates BeanMetadata objects",
                                                     CLASS_NAME_ITEM,
                                                     INIT_METHOD_ITEM,
                                                     DESTROY_METHOD_ITEM, 
@@ -572,12 +648,12 @@
     
     /**
      * The item containing the listener component.
-     * The key is {@link #LISTENER_COMPONENT}, and the type is {@link ArrayType}.
+     * The key is {@link #LISTENER_COMPONENT}, and the type is {@link JmxConstants#P_BYTE_ARRAY_TYPE}.
      */
     Item            LISTENER_COMPONENT_ITEM = new Item(
                                                     LISTENER_COMPONENT, 
-                                                    "", 
-                                                    Item.arrayType(1, SimpleType.BYTE)); ;
+                                                    "The listener component", 
+                                                    JmxConstants.P_BYTE_ARRAY_TYPE);
     
     /**
      * The key REGISTRATION_METHOD, used in {@link #REGISTRATION_METHOD_ITEM}.
@@ -590,7 +666,7 @@
      */
     Item            REGISTRATION_METHOD_ITEM    = new Item(
                                                     REGISTRATION_METHOD, 
-                                                    "", 
+                                                    "The name of the registration method", 
                                                     SimpleType.STRING);
     
     /**
@@ -604,10 +680,15 @@
      */
     Item            UNREGISTRATION_METHOD_ITEM  = new Item(
                                                     UNREGISTRATION_METHOD, 
-                                                    "", 
+                                                    "The name of the unregistration method", 
                                                     SimpleType.STRING);
     
     /**
+     * The name of CompositeType for RegistrationListener objects, used in {@link #REGISTRATION_LISTENER_TYPE}.
+     */
+    String          REGISTRATION_LISTENER               = "RegistrationListener";    
+    
+    /**
      * The CompositeType for a registration listener, and it contains the following items:
      * <ul>
      * <li>{@link #LISTENER_COMPONENT}</li>
@@ -616,8 +697,8 @@
      * </ul>
      */
     CompositeType   REGISTRATION_LISTENER_TYPE  = Item.compositeType(
-                                                    "RegistrationListener", 
-                                                    "", 
+                                                    REGISTRATION_LISTENER, 
+                                                    "This type encapsulates RegistrationListener objects",
                                                     LISTENER_COMPONENT_ITEM,
                                                     REGISTRATION_METHOD_ITEM,
                                                     UNREGISTRATION_METHOD_ITEM);
@@ -638,7 +719,7 @@
      */
     Item            INTERFACES_ITEM         = new Item(
                                                     INTERFACES, 
-                                                    "", 
+                                                    "The type names of the interfaces", 
                                                     JmxConstants.STRING_ARRAY_TYPE);
     /**
      * The key AUTO_EXPORT, used in {@link #AUTO_EXPORT_ITEM}.
@@ -651,7 +732,7 @@
      */
     Item            AUTO_EXPORT_ITEM        = new Item(
                                                     AUTO_EXPORT, 
-                                                    "", 
+                                                    "The auto-export mode for the service", 
                                                     SimpleType.INTEGER);
 
     /**
@@ -665,7 +746,7 @@
      */
     Item            RANKING_ITEM            = new Item(
                                                     RANKING, 
-                                                    "", 
+                                                    "The ranking value when advertising the service", 
                                                     SimpleType.INTEGER);
 
     /**
@@ -679,7 +760,7 @@
      */
     Item            SERVICE_COMPONENT_ITEM  = new Item(
                                                     SERVICE_COMPONENT, 
-                                                    "", 
+                                                    "The id of the component to be exported as a service", 
                                                     SimpleType.STRING);
     
     /**
@@ -688,12 +769,12 @@
     String          SERVICE_PROPERTIES      = "ServiceProperties";
     
     /**
-     * The item containing the id of the component to be exported as a service.
+     * The item containing the user declared properties to be advertised with the service.
      * The key is {@link #SERVICE_COMPONENT}, and the type is {@link SimpleType#STRING}.
      */
     Item            SERVICE_PROPERTIES_ITEM = new Item(
                                                     SERVICE_PROPERTIES,
-                                                    "",
+                                                    "The user declared properties to be advertised with the service",
                                                     Item.arrayType(1, MAP_ENTRY_TYPE));
     
     /**
@@ -707,10 +788,15 @@
      */
     Item            REGISTRATION_LISTENERS_ITEM = new Item(
                                                     REGISTRATION_LISTENERS,
-                                                    "",
+                                                    "All the registration listeners",
                                                     Item.arrayType(1, REGISTRATION_LISTENER_TYPE));
     
     /**
+     * The name of CompositeType for ServiceMetadata objects, used in {@link #SERVICE_MATADATA_TYPE}.
+     */
+    String          SERVICE_MATADATA               = "ServiceMetadata";    
+    
+    /**
      * The CompositeType for a ServiceMetadata object, it extends {@link #COMPONENT_METADATA_TYPE}
      * and adds the following items:
      * <ul>
@@ -724,8 +810,8 @@
      */
     CompositeType   SERVICE_MATADATA_TYPE   = Item.extend(
                                                     COMPONENT_METADATA_TYPE, 
-                                                    "ServiceMetadata", 
-                                                    "", 
+                                                    SERVICE_MATADATA, 
+                                                    "This type encapsulates ServiceMetadata objects",
                                                     INTERFACES_ITEM,
                                                     AUTO_EXPORT_ITEM,
                                                     RANKING_ITEM,
@@ -749,7 +835,7 @@
      */
     Item            BIND_METHOD_ITEM            = new Item(
                                                     BIND_METHOD, 
-                                                    "", 
+                                                    "The name of the bind method", 
                                                     SimpleType.STRING);
     
     /**
@@ -763,10 +849,15 @@
      */
     Item            UNBIND_METHOD_ITEM          = new Item(
                                                     UNBIND_METHOD, 
-                                                    "", 
+                                                    "The name of the unbind method", 
                                                     SimpleType.STRING);
     
     /**
+     * The name of CompositeType for ReferenceListener objects, used in {@link #REFERENCE_LISTENER_TYPE}.
+     */
+    String          REFERENCE_LISTENER               = "ReferenceListener"; 
+    
+    /**
      * The CompositeType for a reference listener, and it contains the following items:
      * <ul>
      * <li>{@link #LISTENER_COMPONENT}</li>
@@ -775,8 +866,8 @@
      * </ul>
      */
     CompositeType   REFERENCE_LISTENER_TYPE  = Item.compositeType(
-                                                    "ReferenceListener", 
-                                                    "", 
+                                                    REFERENCE_LISTENER, 
+                                                    "This type encapsulates ReferenceListener objects",
                                                     LISTENER_COMPONENT_ITEM,
                                                     BIND_METHOD_ITEM,
                                                     UNBIND_METHOD_ITEM);
@@ -793,12 +884,12 @@
     String          AVAILABILITY            = "Availability";
     
     /**
-     * The item containing whether or not a matching service is required at all times.
+     * The item specify whether or not a matching service is required at all times.
      * The key is {@link #AVAILABILITY}, and the type is {@link SimpleType#INTEGER}.
      */
     Item            AVAILABILITY_ITEM       = new Item(
                                                     AVAILABILITY, 
-                                                    "", 
+                                                    "To specify whether or not a matching service is required at all times", 
                                                     SimpleType.INTEGER);
     
     /**
@@ -812,7 +903,7 @@
      */
     Item            INTERFACE_ITEM          = new Item(
                                                     INTERFACE, 
-                                                    "", 
+                                                    "the name of the interface type", 
                                                     SimpleType.STRING);
     
     /**
@@ -826,7 +917,7 @@
      */
     Item            COMPONENT_NAME_ITEM     = new Item(
                                                     COMPONENT_NAME, 
-                                                    "", 
+                                                    "The value of the component-name attribute of the service reference", 
                                                     SimpleType.STRING);
     /**
      * The key FILTER, used in {@link #FILTER_ITEM}.
@@ -839,7 +930,7 @@
      */
     Item            FILTER_ITEM             = new Item(
                                                     FILTER, 
-                                                    "", 
+                                                    "The filter expression that a matching service must match", 
                                                     SimpleType.STRING);
     
     /**
@@ -853,9 +944,13 @@
      */
     Item            REFERENCE_LISTENERS_ITEM= new Item(
                                                     REFERENCE_LISTENERS,
-                                                    "",
+                                                    "All the reference listeners",
                                                     Item.arrayType(1, REFERENCE_LISTENER_TYPE));
     
+    /**
+     * The name of CompositeType for ServiceReferenceMetadata objects, used in {@link #SERVICE_REFERENCE_METADATA_TYPE}.
+     */
+    String          SERVICE_REFERENCE_METADATA               = "ServiceReferenceMetadata"; 
     
     /**
      * The CompositeType for a ServiceReferenceMetadata object, it extends 
@@ -870,8 +965,8 @@
      */
     CompositeType   SERVICE_REFERENCE_METADATA_TYPE  = Item.extend(
                                                     COMPONENT_METADATA_TYPE, 
-                                                    "ServiceReferenceMetadata", 
-                                                    "", 
+                                                    SERVICE_REFERENCE_METADATA, 
+                                                    "This type encapsulates ServiceReferenceMetadata objects",
                                                     AVAILABILITY_ITEM,
                                                     INTERFACE_ITEM,
                                                     COMPONENT_NAME_ITEM,
@@ -893,8 +988,14 @@
      */
     Item            TIMEOUT_ITEM           = new Item(
                                                     TIMEOUT, 
-                                                    "", 
+                                                    "The timeout for service invocations when a backing service is is unavailable", 
                                                     SimpleType.LONG);
+    
+    /**
+     * The name of CompositeType for ReferenceMetadata objects, used in {@link #REFERENCE_METADATA_TYPE}.
+     */
+    String          REFERENCE_METADATA        = "ReferenceMetadata"; 
+    
     /**
      * The CompositeType for a ReferenceMetadata object, it extends 
      * {@link #SERVICE_REFERENCE_METADATA_TYPE} and adds the following items:
@@ -904,8 +1005,8 @@
      */
     CompositeType   REFERENCE_METADATA_TYPE = Item.extend(
                                                     SERVICE_REFERENCE_METADATA_TYPE, 
-                                                    "ReferenceMetadata", 
-                                                    "", 
+                                                    REFERENCE_METADATA, 
+                                                    "This type encapsulates ReferenceMetadata objects",
                                                     TIMEOUT_ITEM);
     
     ///////////////////////////////////////////////////////////////
@@ -918,15 +1019,20 @@
     String          MEMBER_TYPE             = "MemberType";
     
     /**
-     * The item containing whether the List will contain service object proxies or ServiceReference objects.
+     * The item specify whether the List will contain service object proxies or ServiceReference objects.
      * The key is {@link #MEMBER_TYPE}, and the type is {@link SimpleType#INTEGER}.
      */
     Item            MEMBER_TYPE_ITEM        = new Item(
                                                     MEMBER_TYPE, 
-                                                    "", 
+                                                    "To specify whether the List will contain service object proxies or ServiceReference objects", 
                                                     SimpleType.INTEGER);
     
     /**
+     * The name of CompositeType for ReferenceListMetadata objects, used in {@link #REFERENCE_LIST_METADATA_TYPE}.
+     */
+    String          REFERENCE_LIST_METADATA        = "ReferenceListMetadata"; 
+    
+    /**
      * The CompositeType for a ReferenceListMetadata object, it extends 
      * {@link #SERVICE_REFERENCE_METADATA_TYPE} and adds the following items:
      * <ul>
@@ -935,8 +1041,8 @@
      */
     CompositeType   REFERENCE_LIST_METADATA_TYPE = Item.extend(
                                                     SERVICE_REFERENCE_METADATA_TYPE, 
-                                                    "ReferenceListMetadata", 
-                                                    "", 
+                                                    REFERENCE_LIST_METADATA, 
+                                                    "This type encapsulates ReferenceListMetadata objects",
                                                     MEMBER_TYPE_ITEM);
 
 
@@ -946,7 +1052,7 @@
      * @param containerServiceId The blueprint container service id
      * @return the array of component id
      */
-    String[] getComponentIds(long containerServiceId);
+    public String[] getComponentIds(long containerServiceId);
     
     /**
      * Returns all component ids of the specified component type
@@ -955,47 +1061,59 @@
      * @param type The string used to specify the type of component
      * @return the array of component id
      */
-    String[] getComponentIdsByType(long containerServiceId, String type);
-    
-    /**
-     * Returns the BeanMetadata according to the its component id.
-     * The returned Composite Data is typed by {@link #BEAN_METADATA_TYPE}.
-     * 
-     * @param containerServiceId The blueprint container service id
-     * @param componentId The component id
-     * @return the BeanMetadata, see {@link #BEAN_METADATA_TYPE}
-     */
-    CompositeData getBeanMetadata(long containerServiceId, String componentId);
+    public String[] getComponentIdsByType(long containerServiceId, String type);
     
     /**
-     * Returns the ServiceMetadata according to the its component id.
-     * The returned Composite Data is typed by {@link #SERVICE_MATADATA_TYPE}.
+     * Returns the ComponentMetadata according to the its component id.
+     * The returned Composite Data is serialized and stored in a byte array, 
+     * typed by {@link JmxConstants#P_BYTE_ARRAY_TYPE}.
      * 
      * @param containerServiceId The blueprint container service id
      * @param componentId The component id
-     * @return the ServiceMetadata, see {@link #SERVICE_MATADATA_TYPE} 
+     * @return the serialized ComponentMetadata, see {@link JmxConstants#P_BYTE_ARRAY_TYPE}
      */
-    CompositeData getServiceMetadata(long containerServiceId, String componentId);
+    public byte [] getComponentMetadata(long containerServiceId, String componentId);
     
-    /**
-     * Returns the ReferenceMetadata according to the its component id.
-     * The returned Composite Data is typed by {@link #REFERENCE_METADATA_TYPE}.
-     * 
-     * @param containerServiceId The blueprint container service id
-     * @param componentId The component id
-     * @return the ReferenceMetadata, see {@link #REFERENCE_METADATA_TYPE}
-     */
-    CompositeData getReferenceMetadata(long containerServiceId, String componentId);
-    
-    /**
-     * Returns the ReferenceListMetadata according to the its component id.
-     * The returned Composite Data is typed by {@link #REFERENCE_LIST_METADATA_TYPE}.
-     * 
-     * @param containerServiceId The blueprint container service id
-     * @param componentId The component id
-     * @return the ReferenceListMetadata, see {@link #REFERENCE_LIST_METADATA_TYPE} 
-     */
-    CompositeData getReferenceListMetadata(long containerServiceId, String componentId);
+//    
+//    /**
+//     * Returns the BeanMetadata according to the its component id.
+//     * The returned Composite Data is typed by {@link #BEAN_METADATA_TYPE}.
+//     * 
+//     * @param containerServiceId The blueprint container service id
+//     * @param componentId The component id
+//     * @return the BeanMetadata, see {@link #BEAN_METADATA_TYPE}
+//     */
+//    CompositeData getBeanMetadata(long containerServiceId, String componentId);
+//    
+//    /**
+//     * Returns the ServiceMetadata according to the its component id.
+//     * The returned Composite Data is typed by {@link #SERVICE_MATADATA_TYPE}.
+//     * 
+//     * @param containerServiceId The blueprint container service id
+//     * @param componentId The component id
+//     * @return the ServiceMetadata, see {@link #SERVICE_MATADATA_TYPE} 
+//     */
+//    CompositeData getServiceMetadata(long containerServiceId, String componentId);
+//    
+//    /**
+//     * Returns the ReferenceMetadata according to the its component id.
+//     * The returned Composite Data is typed by {@link #REFERENCE_METADATA_TYPE}.
+//     * 
+//     * @param containerServiceId The blueprint container service id
+//     * @param componentId The component id
+//     * @return the ReferenceMetadata, see {@link #REFERENCE_METADATA_TYPE}
+//     */
+//    CompositeData getReferenceMetadata(long containerServiceId, String componentId);
+//    
+//    /**
+//     * Returns the ReferenceListMetadata according to the its component id.
+//     * The returned Composite Data is typed by {@link #REFERENCE_LIST_METADATA_TYPE}.
+//     * 
+//     * @param containerServiceId The blueprint container service id
+//     * @param componentId The component id
+//     * @return the ReferenceListMetadata, see {@link #REFERENCE_LIST_METADATA_TYPE} 
+//     */
+//    CompositeData getReferenceListMetadata(long containerServiceId, String componentId);
     
     /**
      * Returns all the blueprint containers' service IDs, which successfully
@@ -1004,7 +1122,7 @@
      * @return the list of all the service IDs of the blueprint containers created by current extender 
      * @throws IOException if the operation fails
      */
-    long[] getBlueprintContainerServiceIds() throws IOException;
+    public long[] getBlueprintContainerServiceIds() throws IOException;
     
     /**
      * Returns the blueprint container's service id if the bundle specified 
@@ -1015,5 +1133,5 @@
      * @throws IOException if the operation fails
      * @throws IllegalArgumentException if the bundle is not a blueprint bundle
      */
-    long getBlueprintContainerServiceId(long bundleId) throws IOException;
+    public long getBlueprintContainerServiceId(long bundleId) throws IOException;
 }

Modified: geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/BlueprintStateMBean.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/BlueprintStateMBean.java?rev=883987&r1=883986&r2=883987&view=diff
==============================================================================
--- geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/BlueprintStateMBean.java (original)
+++ geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/BlueprintStateMBean.java Wed Nov 25 06:22:55 2009
@@ -6,9 +6,8 @@
 import javax.management.openmbean.CompositeType;
 import javax.management.openmbean.SimpleType;
 import javax.management.openmbean.TabularData;
+import javax.management.openmbean.TabularType;
 
-import org.osgi.jmx.Item;
-import org.osgi.jmx.JmxConstants;
 /**
  * This MBean provides the management interface to the OSGi Blueprint Service.
  * 
@@ -25,94 +24,64 @@
     ///////////////////////////////////////////////////////////////
     
     /**
-     * The key BUNDLE, used in {@link #BUNDLE_ITEM}.
+     * The key BUNDLE_ID, used in {@link #BUNDLE_ID_ITEM}.
      */
-    String          BUNDLE                  = "Bundle";
+    String          BUNDLE_ID                  = "BundleId";
     
     /**
      * The item containing the Blueprint bundle id associated with this event.
-     * The key is {@link #BUNDLE}, and the type is {@link SimpleType#LONG}.
+     * The key is {@link #BUNDLE_ID}, and the type is {@link SimpleType#LONG}.
      */
-    Item            BUNDLE_ITEM             = new Item(
-                                                    BUNDLE,
+    Item            BUNDLE_ID_ITEM             = new Item(
+                                                    BUNDLE_ID,
                                                     "",
                                                     SimpleType.LONG);
     
     /**
-     * The key EXTENDER_BUNDLE, used in {@link #EXTENDER_BUNDLE_ITEM}.
+     * The key EXTENDER_BUNDLE_ID, used in {@link #EXTENDER_BUNDLE_ID_ITEM}.
      */
-    String          EXTENDER_BUNDLE   = "ExtenderBundle";
+    String          EXTENDER_BUNDLE_ID   = "ExtenderBundleId";
     
     /**
      * The item containing the Blueprint extender bundle id that is generating this event.
-     * The key is {@link #EXTENDER_BUNDLE}, and the type is {@link SimpleType#LONG}.
+     * The key is {@link #EXTENDER_BUNDLE_ID}, and the type is {@link SimpleType#LONG}.
      */
-    Item            EXTENDER_BUNDLE_ITEM    = new Item(
-                                                    EXTENDER_BUNDLE,
+    Item            EXTENDER_BUNDLE_ID_ITEM    = new Item(
+                                                    EXTENDER_BUNDLE_ID,
                                                     "",
                                                     SimpleType.LONG);
 
     /**
-     * The key IS_REPLAY, used in {@link #IS_REPLAY_ITEM}.
+     * The key REPLAY, used in {@link #REPLAY_ITEM}.
      */ 
-    String          IS_REPLAY               = "IsReplay";
+    String          REPLAY               = "Replay";
     
     /**
      * The item containing the flag that represents whether this event is a replay event.
-     * The key is {@link #IS_REPLAY}, and the type is {@link SimpleType#BOOLEAN}.
+     * The key is {@link #REPLAY}, and the type is {@link SimpleType#BOOLEAN}.
      */
-    Item            IS_REPLAY_ITEM          = new Item(
-                                                    IS_REPLAY,
+    Item            REPLAY_ITEM          = new Item(
+                                                    REPLAY,
                                                     "",
                                                     SimpleType.BOOLEAN);
     
     
     /**
-     * The key TYPE, used in {@link #TYPE_ITEM}.
+     * The key EVENT_TYPE, used in {@link #EVENT_TYPE_ITEM}.
      */
-    String          TYPE                    = "Type";
-    
-    /**
-     * Constant CREATED for the {@link #TYPE}
-     */
-    String          CREATED                 = "CREATED";
-    /**
-     * Constant CREATING for the {@link #TYPE}
-     */
-    String          CREATING                = "CREATING";
-    /**
-     * Constant DESTROYED for the {@link #TYPE}
-     */
-    String          DESTROYED               = "DESTROYED";
-    /**
-     * Constant DESTROYING for the {@link #TYPE}
-     */
-    String          DESTROYING              = "DESTROYING";
-    /**
-     * Constant FAILURE for the {@link #TYPE}
-     */
-    String          FAILURE                 = "FAILURE";
-    /**
-     * Constant GRACE_PERIOD for the {@link #TYPE}
-     */
-    String          GRACE_PERIOD            = "GRACE_PERIOD";
-    /**
-     * Constant WAITING for the {@link #TYPE}
-     */
-    String          WAITING                 = "WAITING";
-    
+    String          EVENT_TYPE                    = "EventType";
+ 
     /**
      * The item containing the type of this event.
-     * The key is {@link #TYPE}, and the type is {@link SimpleType#STRING}.
+     * The key is {@link #EVENT_TYPE}, and the type is {@link SimpleType#STRING}.
      */
-    Item            TYPE_ITEM               = new Item(
-                                                    TYPE,
-                                                    "",
-                                                    SimpleType.STRING,
-                                                    CREATED, CREATING, DESTROYED, DESTROYING, FAILURE, GRACE_PERIOD, WAITING);    
+    Item            EVENT_TYPE_ITEM              = new Item(
+                                                    EVENT_TYPE,
+                                                    "The type of the event: {CREATING=1, CREATED=2, DESTROYING=3, DESTROYED=4, FAILURE=5, GRACE_PERIOD=6, WAITING=7}",
+                                                    SimpleType.INTEGER);
     
     /**
-     * The key TIMESTAMP, used in {@link #TYPE_ITEM}.
+     * The key TIMESTAMP, used in {@link #TIMESTAMP_ITEM}.
      */    
     String          TIMESTAMP               = "Timestamp";
     
@@ -141,61 +110,72 @@
                                                     JmxConstants.STRING_ARRAY_TYPE);
         
     /**
-     * The key CAUSE, used in {@link #CAUSE_ITEM}.
+     * The key EXCEPTION_MESSAGE, used in {@link #ERROR_MESSAGE_ITEM}.
      */    
-    String          CAUSE                   = "ErrorMessage";
+    String          EXCEPTION_MESSAGE       = "ExceptionMessage";
     
     /**
      * The item containing the error message for this FAILURE event.
-     * The key is {@link #Cause}, and the type is {@link SimpleType#STRING}.
+     * The key is {@link #EXCEPTION_MESSAGE}, and the type is {@link SimpleType#STRING}.
      */
-    Item            CAUSE_ITEM              = new Item(
-                                                    CAUSE,
+    Item            EXCEPTION_MESSAGE_ITEM  = new Item(
+                                                    EXCEPTION_MESSAGE,
                                                     "",
                                                     SimpleType.STRING);
     
     /**
      * The CompositeType for a blueprint event. It contains the following items:
      * <ul>
-     * <li>{@link #BUNDLE}</li>
-     * <li>{@link #EXTENDER_BUNDLE}</li>
-     * <li>{@link #TYPE}</li>
-     * <li>{@link #IS_REPLAY}</li>
+     * <li>{@link #BUNDLE_ID}</li>
+     * <li>{@link #EXTENDER_BUNDLE_ID}</li>
+     * <li>{@link #EVENT_TYPE}</li>
+     * <li>{@link #REPLAY}</li>
      * <li>{@link #TIMESTAMP}</li>
      * <li>{@link #DEPENDENCIES}</li>
-     * <li>{@link #Cause}</li>
+     * <li>{@link #EXCEPTION_MESSAGE}</li>
      * </ul>
      */
-    CompositeType   BLUEPRINT_EVENT_TYPE    = Item.compositeType(
-                                                    "BLUEPRINT_EVENT", 
+    CompositeType   OSGI_BLUEPRINT_EVENT_TYPE   = Item.compositeType(
+                                                    "OSGI_BLUEPRINT_EVENT", 
                                                     "", 
-                                                    BUNDLE_ITEM,
-                                                    EXTENDER_BUNDLE_ITEM,
-                                                    TYPE_ITEM,
-                                                    IS_REPLAY_ITEM,
+                                                    BUNDLE_ID_ITEM,
+                                                    EXTENDER_BUNDLE_ID_ITEM,
+                                                    EVENT_TYPE_ITEM,
+                                                    REPLAY_ITEM,
                                                     TIMESTAMP_ITEM,
                                                     DEPENDENCIES_ITEM,
-                                                    CAUSE_ITEM);
-        
+                                                    EXCEPTION_MESSAGE_ITEM);
+    
+    
+    /**
+     * The Tabular Type for A list of blueprint events. The row type is
+     * {@link #OSGI_BLUEPRINT_EVENT_TYPE}.
+     */
+    TabularType     OSGI_BLUEPRINT_EVENTS_TYPE  = Item.tabularType(
+                                                    "BUNDLES", 
+                                                    "A list of blueprint events",
+                                                    OSGI_BLUEPRINT_EVENT_TYPE, 
+                                                    new String[] { BUNDLE_ID });
+    
     /**
      * Returns the BlueprintEvent associated with this blueprint container.
-     * The returned Composite Data is typed by {@link #BLUEPRINT_EVENT_TYPE}.
+     * The returned Composite Data is typed by {@link #OSGI_BLUEPRINT_EVENT_TYPE}.
      * 
      * @param bundleId The bundle id of a blueprint bundle
-     * @return the last event associated with the blueprint bundle, see {@link #BLUEPRINT_EVENT_TYPE} 
+     * @return the last event associated with the blueprint bundle, see {@link #OSGI_BLUEPRINT_EVENT_TYPE} 
      * @throws IOException if the operation fails
      * @throws IllegalArgumentException if the bundle is not a blueprint bundle
      */
-    CompositeData getLastEvent(long bundleId) throws IOException;
+    public CompositeData getLastEvent(long bundleId) throws IOException;
     
     /**
      * Returns all the last events associated with the blueprint bundles.
      * 
      * @param bundleId The bundle id of a blueprint bundle
-     * @return the tabular representation of all the last events associated with the blueprint bundles
+     * @return the tabular representation of all the last events associated with the blueprint bundles see {@link #OSGI_BLUEPRINT_EVENTS_TYPE} 
      * @throws IOException if the operation fails
      */ 
-    TabularData getLastEvents() throws IOException;
+    public TabularData getLastEvents() throws IOException;
     
     /**
      * Returns all the blueprint bundles' IDs, which are either 
@@ -204,6 +184,6 @@
      * @return the list of all the blueprint bundles's IDs (either successfully created or not by current extender)
      * @throws IOException if the operation fails
      */
-    long[] getBlueprintBundleIds() throws IOException;
+    public long[] getBlueprintBundleIds() throws IOException;
     
 }

Added: 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=883987&view=auto
==============================================================================
--- geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/Item.java (added)
+++ geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/Item.java Wed Nov 25 06:22:55 2009
@@ -0,0 +1,178 @@
+package org.apache.geronimo.blueprint.jmx;
+
+import java.util.Arrays;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import javax.management.openmbean.ArrayType;
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.OpenDataException;
+import javax.management.openmbean.OpenType;
+import javax.management.openmbean.SimpleType;
+import javax.management.openmbean.TabularType;
+
+/**
+ * The item class enables the definition of open types in the appropriate
+ * interfaces.
+ * 
+ * This class contains a number of methods that make it possible to create open
+ * types for {@link CompositeType}, {@link TabularType}, and {@link ArrayType}.
+ * The normal creation throws a checked exception, making it impossible to use
+ * them in a static initializer. They constructors are also not very suitable
+ * for static construction.
+ * 
+ * 
+ * An Item instance describes an item in a Composite Type. It groups the triplet
+ * of name, description, and Open Type. These Item instances allows the
+ * definitions of an item to stay together.
+ * 
+ * @version $Revision: 8214 $
+ * @Immutable
+ */
+public class Item {
+
+    /**
+     * The name of this item.
+     */
+    private final String    name;
+
+    /**
+     * The description of this item.
+     */
+    private final String    description;
+
+    /**
+     * The type of this item.
+     */
+    private final OpenType  type;
+
+    /**
+     * Create a triple of name, description, and type. This triplet is used in
+     * the creation of a Composite Type.
+     * 
+     * @param name The name of the item.
+     * @param description The description of the item.
+     * @param type The Open Type of this item.
+     * @param restrictions Ignored, contains list of restrictions
+     */
+    public Item(String name, String description, OpenType type,
+            String... restrictions) {
+        this.name = name;
+        this.description = description;
+        this.type = type;
+    }
+
+    /**
+     * 
+     */
+
+    /**
+     * Create a Tabular Type.
+     * 
+     * @param name The name of the Tabular Type.
+     * @param description The description of the Tabular Type.
+     * @param rowType The Open Type for a row
+     * @param index The names of the items that form the index .
+     * @return A new Tabular Type composed from the parameters.
+     * @throws RuntimeException when the Tabular Type throws an
+     *         OpenDataException
+     */
+    static public TabularType tabularType(String name, String description,
+            CompositeType rowType, String... index) {
+        try {
+            return new TabularType(name, description, rowType, index);
+        }
+        catch (OpenDataException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * Create a Composite Type
+     * 
+     * @param name The name of the Tabular Type.
+     * @param description The description of the Tabular Type.
+     * @param items The items that describe the composite type.
+     * @return a new Composite Type
+     * @throws RuntimeException when the Tabular Type throws an
+     *         OpenDataException
+     */
+    static public CompositeType compositeType(String name, String description,
+            Item... items) {
+        return extend(null, name, description, items);
+    }
+
+    /**
+     * Return a new Array Type.
+     * 
+     * @param dim The dimension
+     * @param elementType The element type
+     * @return A new Array Type
+     */
+    public static ArrayType arrayType(int dim, OpenType elementType) {
+        try {
+            return new ArrayType(dim, elementType);
+        }
+        catch (OpenDataException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * Extend a Composite Type by adding new items. Items can override items in
+     * the parent type.
+     * 
+     * @param parent The parent type, can be <code>null</code>
+     * @param name The name of the type
+     * @param description The description of the type
+     * @param items The items that should be added/override to the parent type
+     * @return A new Composite Type that extends the parent type
+     * @throws RuntimeException when an OpenDataException is thrown
+     */
+    public static CompositeType extend(CompositeType parent, String name,
+            String description, Item... items) {
+        Set<Item> all = new LinkedHashSet<Item>();
+
+        if (parent != null) {
+            for (Object nm : parent.keySet()) {
+                String key = (String) nm;
+                all.add(new Item((String) nm, parent.getDescription(key),
+                        parent.getType(key)));
+            }
+        }
+
+        all.addAll(Arrays.asList(items));
+
+        String names[] = new String[all.size()];
+        String descriptions[] = new String[all.size()];
+        OpenType types[] = new OpenType[all.size()];
+
+        for (int n = 0; n < types.length; n++) {
+            names[n] = items[n].name;
+            descriptions[n] = items[n].description;
+            types[n] = items[n].type;
+        }
+
+        try {
+            return new CompositeType(name, description, names, descriptions,
+                    types);
+        }
+        catch (OpenDataException e) {
+            throw new RuntimeException(e);
+        }
+    }
+    /**
+     * Return a new primaArray Type.
+     * 
+     * @param elementType The element type
+     * @return A new Array Type
+     */
+    public static ArrayType primitiveArrayType(SimpleType elementType) {
+        try {
+            return new ArrayType(elementType, true);
+        }
+        catch (OpenDataException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}

Propchange: geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/Item.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=883987&view=auto
==============================================================================
--- geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/JmxConstants.java (added)
+++ geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/JmxConstants.java Wed Nov 25 06:22:55 2009
@@ -0,0 +1,324 @@
+/*
+ * 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
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.blueprint.jmx;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.management.openmbean.ArrayType;
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.SimpleType;
+import javax.management.openmbean.TabularType;
+
+/**
+ * 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 $Revision: 8214 $
+ * @Immutable
+ */
+public class JmxConstants {
+
+    /*
+     * Empty constructor to make sure this is not used as an object.
+     */
+    private JmxConstants() {
+        // empty
+    }
+
+    /**
+     * The MBean Open type for an array of longs
+     */
+    public static final ArrayType       P_BYTE_ARRAY_TYPE   = Item
+                                                                    .primitiveArrayType(
+                                                                            SimpleType.BYTE);
+    
+    /**
+     * The MBean Open type for an array of strings
+     */
+    public static final ArrayType       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
+                                                                    .arrayType(
+                                                                            1,
+                                                                            SimpleType.LONG);
+
+    /**
+     * 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 ";
+
+    /**
+     * For an encoded vector we need to start with ARRAY_OF. This must be
+     * followed by one of the names in {@link #SCALAR}.
+     */
+    public final static String          VECTOR_OF           = "Vector of ";
+
+    /**
+     * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+     * {@link java.lang.String}
+     */
+    public static final String          STRING              = "String";
+    /**
+     * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+     * {@link java.lang.Integer}
+     */
+    public static final String          INTEGER             = "Integer";
+    /**
+     * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+     * {@link java.lang.Long}
+     */
+    public static final String          LONG                = "Long";
+    /**
+     * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+     * {@link java.lang.Float}
+     */
+    public static final String          FLOAT               = "Float";
+    /**
+     * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+     * {@link java.lang.Double}
+     */
+    public static final String          DOUBLE              = "Double";
+    /**
+     * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+     * {@link java.lang.Byte}
+     */
+    public static final String          BYTE                = "Byte";
+    /**
+     * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+     * {@link java.lang.Short}
+     */
+    public static final String          SHORT               = "Short";
+    /**
+     * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+     * {@link java.lang.Character}
+     */
+    public static final String          CHARACTER           = "Character";
+    /**
+     * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+     * {@link java.lang.Boolean}
+     */
+    public static final String          BOOLEAN             = "Boolean";
+    /**
+     * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+     * {@link java.math.BigDecimal}
+     */
+    public static final String          BIGDECIMAL          = "BigDecimal";
+    /**
+     * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+     * {@link java.math.BigInteger}
+     */
+    public static final String          BIGINTEGER          = "BigInteger";
+    /**
+     * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+     * the <code>double</code> primitive type.
+     */
+    public static final String          P_DOUBLE            = "double";
+    /**
+     * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+     * the <code>float</code> primitive type.
+     */
+    public static final String          P_FLOAT             = "float";
+    /**
+     * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+     * the <code>long</code> primitive type.
+     */
+    public static final String          P_LONG              = "long";
+    /**
+     * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+     * the <code>int</code> primitive type.
+     */
+    public static final String          P_INT               = "int";
+    /**
+     * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+     * the <code>short</code> primitive type.
+     */
+    public static final String          P_SHORT             = "short";
+    /**
+     * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+     * the <code>byte</code> primitive type.
+     */
+    public static final String          P_BYTE              = "byte";
+    /**
+     * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+     * the <code>char</code> primitive type.
+     */
+    public static final String          P_CHAR              = "char";
+    /**
+     * Value for {@link #PROPERTY_TYPE} <code>Type</code> value in the case of
+     * the <code>boolean</code> primitive type.
+     */
+    public static final String          P_BOOLEAN           = "boolean";
+
+    /**
+     * A set of all scalars that can be used in the {@link #TYPE} property of a
+     * {@link #PROPERTIES_TYPE}. This contains the following names:
+     * <ul>
+     * <li>{@link #BIGDECIMAL}</li>
+     * <li>{@link #BIGINTEGER}</li>
+     * <li>{@link #BOOLEAN}</li>
+     * <li>{@link #BYTE}</li>
+     * <li>{@link #CHARACTER}</li>
+     * <li>{@link #DOUBLE}</li>
+     * <li>{@link #FLOAT}</li>
+     * <li>{@link #INTEGER}</li>
+     * <li>{@link #LONG}</li>
+     * <li>{@link #SHORT}</li>
+     * <li>{@link #STRING}</li>
+     * <li>{@link #P_BYTE}</li>
+     * <li>{@link #P_CHAR}</li>
+     * <li>{@link #P_DOUBLE}</li>
+     * <li>{@link #P_FLOAT}</li>
+     * <li>{@link #P_INT}</li>
+     * <li>{@link #P_LONG}</li>
+     * <li>{@link #P_SHORT}</li>
+     */
+    public final static Set<String>     SCALAR              = new HashSet<String>(
+                                                                    Arrays
+                                                                            .asList(
+                                                                                    STRING,
+                                                                                    INTEGER,
+                                                                                    LONG,
+                                                                                    FLOAT,
+                                                                                    DOUBLE,
+                                                                                    BYTE,
+                                                                                    SHORT,
+                                                                                    CHARACTER,
+                                                                                    BOOLEAN,
+                                                                                    BIGDECIMAL,
+                                                                                    BIGINTEGER,
+                                                                                    P_BYTE,
+                                                                                    P_CHAR,
+                                                                                    P_SHORT,
+                                                                                    P_INT,
+                                                                                    P_LONG,
+                                                                                    P_DOUBLE,
+                                                                                    P_FLOAT));
+    /**
+     * The key KEY.
+     */
+    public static final String          KEY                 = "Key";
+    /**
+     * The key of a property. The key is {@link #KEY} and the type is
+     * {@link SimpleType#STRING}.
+     */
+    public static final Item            KEY_ITEM            = new Item(
+                                                                    KEY,
+                                                                    "The key of the property",
+                                                                    SimpleType.STRING);
+
+    /**
+     * The key VALUE.
+     */
+    public static final String          VALUE               = "Value";
+
+    /**
+     * The value of a property. The key is {@link #VALUE} and the type is
+     * {@link SimpleType#STRING}. A value will be encoded by the string given in
+     * {@link #TYPE}. The syntax for this type is given in {@link #TYPE_ITEM}.
+     */
+    public static final Item            VALUE_ITEM          = new Item(
+                                                                    VALUE,
+                                                                    "The value of the property",
+                                                                    SimpleType.STRING);
+
+    /**
+     * The key PROPERTY_TYPE.
+     * 
+     * ### can we call this value PropertyType and service type ServiceType?
+     */
+    public static final String          TYPE                = "Type";
+
+    /**
+     * 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(
+                                                                    TYPE,
+                                                                    "The type of the property",
+                                                                    SimpleType.STRING, //
+                                                                    STRING,
+                                                                    INTEGER,
+                                                                    LONG,
+                                                                    FLOAT,
+                                                                    DOUBLE,
+                                                                    BYTE,
+                                                                    SHORT,
+                                                                    CHARACTER,
+                                                                    BOOLEAN,
+                                                                    BIGDECIMAL,
+                                                                    BIGINTEGER,
+                                                                    P_DOUBLE,
+                                                                    P_FLOAT,
+                                                                    P_LONG,
+                                                                    P_INT,
+                                                                    P_SHORT,
+                                                                    P_CHAR,
+                                                                    P_BYTE,
+                                                                    P_BOOLEAN);
+
+    /**
+     * A Composite Type describing a a single property. A property consists of
+     * the following items {@link #KEY_ITEM}, {@link #VALUE_ITEM}, and
+     * {@link #TYPE_ITEM}.
+     */
+    public static final CompositeType   PROPERTY_TYPE       = Item
+                                                                    .compositeType(
+                                                                            "PROPERTY",
+                                                                            "This type encapsulates a key/value pair",
+                                                                            KEY_ITEM,
+                                                                            VALUE_ITEM,
+                                                                            TYPE_ITEM);
+
+    /**
+     * Describes a map with properties. The row type is {@link #PROPERTY_TYPE}.
+     * The index is defined to the {@link #KEY} of the property.
+     */
+    public static final TabularType     PROPERTIES_TYPE     = Item
+                                                                    .tabularType(
+                                                                            "PROPERTIES",
+                                                                            "A table of PROPERTY",
+                                                                            PROPERTY_TYPE,
+                                                                            KEY);
+
+    /**
+     * The domain name of the core OSGi MBeans
+     */
+    public static final String          OSGI_CORE           = "osgi.core";
+
+    /**
+     * The domain name of the selected OSGi compendium MBeans
+     */
+    public static final String          OSGI_COMPENDIUM     = "osgi.compendium";
+}

Propchange: geronimo/sandbox/rex/org.apache.geronimo.blueprint.jmx/src/main/java/org/apache/geronimo/blueprint/jmx/JmxConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message