You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by zo...@apache.org on 2011/02/27 18:58:23 UTC
svn commit: r1075096 [3/13] - in /aries/tags/jmx-0.1-incubating: ./ jmx-api/
jmx-api/src/ jmx-api/src/main/ jmx-api/src/main/appended-resources/
jmx-api/src/main/appended-resources/META-INF/ jmx-api/src/main/java/
jmx-api/src/main/java/org/ jmx-api/src...
Added: aries/tags/jmx-0.1-incubating/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/BlueprintMetadataMBean.java
URL: http://svn.apache.org/viewvc/aries/tags/jmx-0.1-incubating/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/BlueprintMetadataMBean.java?rev=1075096&view=auto
==============================================================================
--- aries/tags/jmx-0.1-incubating/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/BlueprintMetadataMBean.java (added)
+++ aries/tags/jmx-0.1-incubating/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/BlueprintMetadataMBean.java Sun Feb 27 17:58:16 2011
@@ -0,0 +1,1120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.aries.jmx.blueprint;
+
+import java.io.IOException;
+
+import javax.management.openmbean.ArrayType;
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.SimpleType;
+
+
+public interface BlueprintMetadataMBean {
+
+ /**
+ * The object name for this MBean.
+ */
+ String OBJECTNAME = JmxConstants.ARIES_BLUEPRINT+":service=blueprintMetadata,version=1.0";
+
+
+ ///////////////////////////////////////////////////////////////
+ // Define <value>'s CompositeType
+ ///////////////////////////////////////////////////////////////
+
+ /**
+ * The key STRING_VALUE, used in {@link #STRING_VALUE_ITEM}.
+ */
+ String STRING_VALUE = "StringValue";
+
+ /**
+ * The item containing the un-converted string representation of the value.
+ * The key is {@link #STRING_VALUE}, and the type is {@link SimpleType#STRING}.
+ */
+ Item STRING_VALUE_ITEM = new Item(
+ STRING_VALUE,
+ "The un-converted string representation of a value",
+ SimpleType.STRING);
+
+ /**
+ * The key TYPE, used in {@link #TYPE_ITEM}.
+ */
+ String TYPE = "Type";
+
+ /**
+ * The item containing the name of the type to which the value should be converted.
+ * The key is {@link #TYPE}, and the type is {@link SimpleType#STRING}.
+ */
+ Item TYPE_ITEM = new Item(
+ TYPE,
+ "The type of a value",
+ SimpleType.STRING);
+
+ /**
+ * 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(
+ VALUE_METADATA,
+ "This type encapsulates ValueMetadata objects",
+ STRING_VALUE_ITEM,
+ TYPE_ITEM);
+
+ ///////////////////////////////////////////////////////////////
+ // Define <null>'s CompositeType
+ ///////////////////////////////////////////////////////////////
+
+ /**
+ * 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(
+ NULL_METADATA,
+ "This type encapsulates NullMetadata objects",
+ PLACEHOLDER_ITEM);
+
+ ///////////////////////////////////////////////////////////////
+ // Define <ref>'s CompositeType
+ ///////////////////////////////////////////////////////////////
+
+ /**
+ * The key COMPONENT_ID, used in {@link #COMPONENT_ID_ITEM}.
+ */
+ String COMPONENT_ID = "ComponentId";
+
+ /**
+ * The item containing the component id to which the "ref" associates.
+ * The key is {@link #COMPONENT_ID}, and the type is {@link SimpleType#STRING}.
+ */
+ 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:
+ * <ul>
+ * <li>{@link #COMPONENT_ID}</li>
+ * </ul>
+ */
+ CompositeType REF_METADATA_TYPE = Item.compositeType(
+ 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:
+ * <ul>
+ * <li>{@link #COMPONENT_ID}</li>
+ * </ul>
+ */
+ CompositeType ID_REF_METADATA_TYPE = Item.compositeType(
+ ID_REF_METADATA,
+ "This type encapsulates IdRefMetadata objects",
+ COMPONENT_ID_ITEM);
+
+ ///////////////////////////////////////////////////////////////
+ // Define <entry>'s CompositeType,
+ // used by MapMetadata, PropsMetadata, and Service properties
+ ///////////////////////////////////////////////////////////////
+
+ /**
+ * The key KEY, used in {@link #KEY_ITEM}.
+ */
+ String KEY = "Key";
+
+ /**
+ * The item containing the key of an entry.
+ * The key is {@link #KEY}, and the type is {@link SimpleType#STRING}.
+ */
+ Item KEY_ITEM = new Item(
+ KEY,
+ "The key of an entry",
+ JmxConstants.BYTE_ARRAY_TYPE);
+
+ /**
+ * The key VALUE, used in {@link #VALUE_ITEM}.
+ */
+ String VALUE = "Value";
+
+ /**
+ * 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 JmxConstants#PRIMITIVE_BYTE_ARRAY_TYPE}.
+ */
+ Item VALUE_ITEM = new Item(
+ VALUE,
+ "A value",
+ JmxConstants.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>
+ * <li>{@link #VALUE}</li>
+ * </ul>
+ */
+ CompositeType MAP_ENTRY_TYPE = Item.compositeType(
+ MAP_ENTRY,
+ "This type encapsulates MapEntry objects",
+ KEY_ITEM,
+ VALUE_ITEM);
+
+ ///////////////////////////////////////////////////////////////
+ // Define <map>'s CompositeType
+ ///////////////////////////////////////////////////////////////
+
+ /**
+ * The key ENTRIES, used in {@link #ENTRIES_ITEM}.
+ */
+ String ENTRIES = "Entries";
+
+ /**
+ * The item containing an array of entries
+ * The key is {@link #ENTRIES}, and the type is {@link ArrayType}.
+ */
+ Item ENTRIES_ITEM = new Item(
+ ENTRIES,
+ "An array of entries",
+ Item.arrayType(1, MAP_ENTRY_TYPE));
+
+ /**
+ * The key KEY_TYPE, used in {@link #KEY_TYPE_ITEM}.
+ */
+ String KEY_TYPE = "KeyType";
+
+ /**
+ * The item containing the key type of the entries.
+ * The key is {@link #KEY_TYPE}, and the type is {@link SimpleType#STRING}.
+ */
+ Item KEY_TYPE_ITEM = new Item(
+ KEY_TYPE,
+ "The key type of the entries",
+ SimpleType.STRING);
+
+ /**
+ * The key VALUE_TYPE, used in {@link #VALUE_TYPE_ITEM}.
+ */
+ String VALUE_TYPE = "ValueType";
+
+ /**
+ * The item containing the value type that the value should be
+ * The key is {@link #VALUE_TYPE}, and the type is {@link SimpleType#STRING}.
+ */
+ 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>
+ * <li>{@link #KEY_TYPE}</li>
+ * <li>{@link #VALUE_TYPE}</li>
+ * </ul>
+ */
+ CompositeType MAP_METADATA_TYPE = Item.compositeType(
+ MAP_METADATA,
+ "This type encapsulates MapMetadata objects",
+ ENTRIES_ITEM,
+ KEY_TYPE_ITEM,
+ VALUE_TYPE_ITEM);
+
+ ///////////////////////////////////////////////////////////////
+ // Define <props>'s CompositeType
+ // ENTRIES_ITEM defined in <map>'s definition
+ ///////////////////////////////////////////////////////////////
+
+ /**
+ * 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(
+ PROPS_METADATA,
+ "This type encapsulates PropsMetadata objects",
+ ENTRIES_ITEM);
+
+ ///////////////////////////////////////////////////////////////
+ // Define <collection>'s CompositeType
+ // VALUE_TYPE_ITEM defined in <map>'s definition
+ ///////////////////////////////////////////////////////////////
+
+ /**
+ * The key COLLECTION_CLASS, used in {@link #KEY_TYPE_ITEM}.
+ */
+ String COLLECTION_CLASS = "CollectionClass";
+
+ /**
+ * The item containing the type of this collection
+ * The key is {@link #COLLECTION_CLASS}, and the type is {@link SimpleType#STRING}.
+ */
+ Item COLLECTION_CLASS_ITEM = new Item(
+ COLLECTION_CLASS,
+ "The type of this collection",
+ SimpleType.STRING);
+
+ /**
+ * The key VALUES, used in {@link #VALUES_ITEM}.
+ */
+ String VALUES = "Values";
+
+ /**
+ * The item containing all the values
+ * The key is {@link #VALUES}, and the type is {@link ArrayType}.
+ */
+ Item VALUES_ITEM = new Item(
+ VALUES,
+ "All the values",
+ Item.arrayType(2, SimpleType.BYTE));
+
+
+ /**
+ * 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:
+ * <ul>
+ * <li>{@link #COLLECTION_CLASS}</li>
+ * <li>{@link #VALUES}</li>
+ * <li>{@link #VALUE_TYPE}</li>
+ * </ul>
+ */
+ CompositeType COLLECTION_METADATA_TYPE= Item.compositeType(
+ COLLECTION_METADATA,
+ "This type encapsulates CollectionMetadata objects",
+ COLLECTION_CLASS_ITEM,
+ VALUES_ITEM,
+ VALUE_TYPE_ITEM);
+
+ ///////////////////////////////////////////////////////////////
+ // Define <argument>'s CompositeType
+ // VALUE_TYPE_ITEM defined in <map>'s definition
+ ///////////////////////////////////////////////////////////////
+
+ /**
+ * The key INDEX, used in {@link #INDEX_ITEM}.
+ */
+ String INDEX = "Index";
+
+ /**
+ * The item containing the zero-based index into the parameter list of
+ * the factory method or constructor to be invoked for this argument.
+ * The key is {@link #INDEX}, and the type is {@link SimpleType#INTEGER}.
+ */
+ 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>
+ * <li>{@link #VALUE_TYPE}</li>
+ * <li>{@link #VALUE}</li>
+ * </ul>
+ */
+ CompositeType BEAN_ARGUMENT_TYPE = Item.compositeType(
+ BEAN_ARGUMENT,
+ "This type encapsulates BeanArgument objects",
+ INDEX_ITEM,
+ VALUE_TYPE_ITEM,
+ VALUE_ITEM);
+
+ ///////////////////////////////////////////////////////////////
+ // Define <property>'s CompositeType
+ ///////////////////////////////////////////////////////////////
+
+ /**
+ * The key NAME, used in {@link #NAME_ITEM}.
+ */
+ String NAME = "Name";
+
+ /**
+ * The item containing the name of the property to be injected.
+ * The key is {@link #NAME}, and the type is {@link SimpleType#STRING}.
+ */
+ 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>
+ * <li>{@link #VALUE}</li>
+ * </ul>
+ */
+ CompositeType BEAN_PROPERTY_TYPE = Item.compositeType(
+ BEAN_PROPERTY,
+ "This type encapsulates BeanProperty objects",
+ NAME_ITEM,
+ VALUE_ITEM);
+
+ ///////////////////////////////////////////////////////////////
+ // Define Component's CompositeType
+ // <bean>, <service> & Service Reference's CompositeType will
+ // extend this.
+ ///////////////////////////////////////////////////////////////
+
+ /**
+ * The key ID, used in {@link #ID_ITEM}.
+ */
+ String ID = "Id";
+
+ /**
+ * The item containing the component id of a component.
+ * The key is {@link #ID}, and the type is {@link SimpleType#STRING}.
+ */
+ Item ID_ITEM = new Item(
+ ID,
+ "The id of the component",
+ SimpleType.STRING);
+ /**
+ * The key ACTIVATION, used in {@link #ACTIVATION_ITEM}.
+ */
+ String ACTIVATION = "Activation";
+
+ /**
+ * The item containing the activation strategy for a component.
+ * The key is {@link #ACTIVATION}, and the type is {@link SimpleType#INTEGER}.
+ */
+ Item ACTIVATION_ITEM = new Item(
+ ACTIVATION,
+ "The activation strategy for a component",
+ SimpleType.INTEGER);
+
+ /**
+ * The key DEPENDS_ON, used in {@link #DEPENDS_ON_ITEM}.
+ */
+ String DEPENDS_ON = "DependsOn";
+
+ /**
+ * The item containing the ids of any components listed in a <code>depends-on</code> attribute for the component.
+ * The key is {@link #DEPENDS_ON}, and the type is {@link JmxConstants#STRING_ARRAY_TYPE}.
+ */
+ 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>
+ * <li>{@link #ID}</li>
+ * <li>{@link #ACTIVATION}</li>
+ * <li>{@link #DEPENDS_ON}</li>
+ * </ul>
+ */
+ CompositeType COMPONENT_METADATA_TYPE = Item.compositeType(
+ COMPONENT_METADATA,
+ "This type encapsulates ComponentMetadata objects",
+ ID_ITEM,
+ ACTIVATION_ITEM,
+ DEPENDS_ON_ITEM);
+
+ ///////////////////////////////////////////////////////////////
+ // Define <bean>'s CompositeType
+ ///////////////////////////////////////////////////////////////
+
+ /**
+ * The key CLASS_NAME, used in {@link #CLASS_NAME_ITEM}.
+ */
+ String CLASS_NAME = "ClassName";
+
+ /**
+ * The item containing the name of the class specified for the bean.
+ * The key is {@link #CLASS_NAME}, and the type is {@link SimpleType#STRING}.
+ */
+ Item CLASS_NAME_ITEM = new Item(
+ CLASS_NAME,
+ "The name of the class specified for the bean",
+ SimpleType.STRING
+ );
+
+ /**
+ * The key INIT_METHOD, used in {@link #INIT_METHOD_ITEM}.
+ */
+ String INIT_METHOD = "InitMethod";
+
+ /**
+ * The item containing the name of the init method specified for the bean.
+ * The key is {@link #INIT_METHOD}, and the type is {@link SimpleType#STRING}.
+ */
+ Item INIT_METHOD_ITEM = new Item(
+ INIT_METHOD,
+ "The name of the init method specified for the bean",
+ SimpleType.STRING);
+
+ /**
+ * The key DESTROY_METHOD, used in {@link #DESTROY_METHOD_ITEM}.
+ */
+ String DESTROY_METHOD = "DestroyMethod";
+
+ /**
+ * The item containing the name of the destroy method specified for the bean.
+ * The key is {@link #DESTROY_METHOD}, and the type is {@link SimpleType#STRING}.
+ */
+ Item DESTROY_METHOD_ITEM = new Item(
+ DESTROY_METHOD,
+ "The name of the destroy method specified for the bean",
+ SimpleType.STRING);
+
+ /**
+ * The key FACTORY_METHOD, used in {@link #FACTORY_METHOD_ITEM}.
+ */
+ String FACTORY_METHOD = "FactoryMethod";
+
+ /**
+ * The item containing the name of the factory method specified for the bean.
+ * The key is {@link #FACTORY_METHOD}, and the type is {@link SimpleType#STRING}.
+ */
+ Item FACTORY_METHOD_ITEM = new Item(
+ FACTORY_METHOD,
+ "The name of the factory method specified for the bean",
+ SimpleType.STRING);
+
+ /**
+ * The key FACTORY_COMPONENT, used in {@link #FACTORY_COMPONENT_ITEM}.
+ */
+ String FACTORY_COMPONENT = "FactoryComponent";
+
+ /**
+ * The item containing the id of the factory component on which to invoke the factory method for the bean.
+ * The key is {@link #FACTORY_COMPONENT}, and the type is {@link JmxConstants#PRIMITIVE_BYTE_ARRAY_TYPE}.
+ */
+ Item FACTORY_COMPONENT_ITEM = new Item(
+ FACTORY_COMPONENT,
+ "The factory component on which to invoke the factory method for the bean",
+ JmxConstants.BYTE_ARRAY_TYPE);
+
+ /**
+ * The key SCOPE, used in {@link #SCOPE_ITEM}.
+ */
+ String SCOPE = "Scope";
+
+ /**
+ * The item containing the scope for the bean.
+ * The key is {@link #SCOPE}, and the type is {@link SimpleType#STRING}.
+ */
+ Item SCOPE_ITEM = new Item(
+ SCOPE,
+ "The scope for the bean",
+ SimpleType.STRING);
+
+ /**
+ * The key ARGUMENT, used in {@link #ARGUMENTS_ITEM}.
+ */
+ String ARGUMENTS = "Arguments";
+
+ /**
+ * The item containing the bean argument for the bean's compositeType.
+ * The key is {@link #ARGUMENTS}, and the type is {@link ARGUMENT_TYPE}.
+ */
+ Item ARGUMENTS_ITEM = new Item(
+ ARGUMENTS,
+ "The bean argument",
+ Item.arrayType(1, BEAN_ARGUMENT_TYPE));
+
+ /**
+ * The key PROPERTY, used in {@link #PROPERTIES_ITEM}.
+ */
+ String PROPERTIES = "Properties";
+
+ /**
+ * The item containing the bean property for the bean's compositeType.
+ * The key is {@link #PROPERTIES}, and the type is {@link PROPERTY_TYPE}.
+ */
+ 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>
+ * <li>{@link #CLASS_NAME}</li>
+ * <li>{@link #INIT_METHOD}</li>
+ * <li>{@link #DESTROY_METHOD}</li>
+ * <li>{@link #FACTORY_METHOD}</li>
+ * <li>{@link #FACTORY_COMPONENT}</li>
+ * <li>{@link #SCOPE}</li>
+ * <li>{@link #ARGUMENTS}</li>
+ * <li>{@link #PROPERTIES}</li>
+ * </ul>
+ */
+ CompositeType BEAN_METADATA_TYPE = Item.extend(
+ COMPONENT_METADATA_TYPE,
+ BEAN_METADATA,
+ "This type encapsulates BeanMetadata objects",
+ CLASS_NAME_ITEM,
+ INIT_METHOD_ITEM,
+ DESTROY_METHOD_ITEM,
+ FACTORY_METHOD_ITEM,
+ FACTORY_COMPONENT_ITEM,
+ SCOPE_ITEM,
+ ARGUMENTS_ITEM,
+ PROPERTIES_ITEM);
+
+ ///////////////////////////////////////////////////////////////
+ // Define <registration-listener>'s CompositeType
+ ///////////////////////////////////////////////////////////////
+
+ /**
+ * The key LISTENER_COMPONENT, used in {@link #LISTENER_COMPONENT_ITEM}.
+ */
+ String LISTENER_COMPONENT = "ListenerComponent";
+
+ /**
+ * The item containing the listener component.
+ * The key is {@link #LISTENER_COMPONENT}, and the type is {@link JmxConstants#PRIMITIVE_BYTE_ARRAY_TYPE}.
+ */
+ Item LISTENER_COMPONENT_ITEM = new Item(
+ LISTENER_COMPONENT,
+ "The listener component",
+ JmxConstants.BYTE_ARRAY_TYPE);
+
+ /**
+ * The key REGISTRATION_METHOD, used in {@link #REGISTRATION_METHOD_ITEM}.
+ */
+ String REGISTRATION_METHOD = "RegistrationMethod";
+
+ /**
+ * The item containing the name of the registration method.
+ * The key is {@link #REGISTRATION_METHOD}, and the type is {@link SimpleType#STRING}.
+ */
+ Item REGISTRATION_METHOD_ITEM = new Item(
+ REGISTRATION_METHOD,
+ "The name of the registration method",
+ SimpleType.STRING);
+
+ /**
+ * The key UNREGISTRATION_METHOD, used in {@link #UNREGISTRATION_METHOD_ITEM}.
+ */
+ String UNREGISTRATION_METHOD = "UnregistrationMethod";
+
+ /**
+ * The item containing the name of the unregistration method.
+ * The key is {@link #UNREGISTRATION_METHOD}, and the type is {@link SimpleType#STRING}.
+ */
+ 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>
+ * <li>{@link #REGISTRATION_METHOD}</li>
+ * <li>{@link #UNREGISTRATION_METHOD}</li>
+ * </ul>
+ */
+ CompositeType REGISTRATION_LISTENER_TYPE = Item.compositeType(
+ REGISTRATION_LISTENER,
+ "This type encapsulates RegistrationListener objects",
+ LISTENER_COMPONENT_ITEM,
+ REGISTRATION_METHOD_ITEM,
+ UNREGISTRATION_METHOD_ITEM);
+
+
+ ///////////////////////////////////////////////////////////////
+ // Define <service>'s CompositeType
+ ///////////////////////////////////////////////////////////////
+
+ /**
+ * The key INTERFACES, used in {@link #INTERFACES_ITEM}.
+ */
+ String INTERFACES = "Interfaces";
+
+ /**
+ * The item containing the type names of the interfaces that the service should be advertised as supporting.
+ * The key is {@link #INTERFACES}, and the type is {@link JmxConstants#STRING_ARRAY_TYPE}.
+ */
+ 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}.
+ */
+ String AUTO_EXPORT = "AutoExport";
+
+ /**
+ * The item containing the auto-export mode for the service.
+ * The key is {@link #AUTO_EXPORT}, and the type is {@link SimpleType#INTEGER}.
+ */
+ //TODO describe integer
+ Item AUTO_EXPORT_ITEM = new Item(
+ AUTO_EXPORT,
+ "The auto-export mode for the service",
+ SimpleType.INTEGER);
+
+ /**
+ * The key RANKING, used in {@link #RANKING_ITEM}.
+ */
+ String RANKING = "Ranking";
+
+ /**
+ * The item containing the ranking value to use when advertising the service.
+ * The key is {@link #RANKING}, and the type is {@link SimpleType#INTEGER}.
+ */
+ Item RANKING_ITEM = new Item(
+ RANKING,
+ "The ranking value when advertising the service",
+ SimpleType.INTEGER);
+
+ /**
+ * The key SERVICE_COMPONENT, used in {@link #SERVICE_COMPONENT_ITEM}.
+ */
+ String SERVICE_COMPONENT = "ServiceComponent";
+
+ /**
+ * The item containing the id of the component to be exported as a service.
+ * The key is {@link #SERVICE_COMPONENT}, and the type is {@link JmxConstants#PRIMITIVE_BYTE_ARRAY_TYPE}.
+ */
+ Item SERVICE_COMPONENT_ITEM = new Item(
+ SERVICE_COMPONENT,
+ "The component to be exported as a service",
+ JmxConstants.BYTE_ARRAY_TYPE);
+
+ /**
+ * The key SERVICE_PROPERTIES, used in {@link #SERVICE_PROPERTIES_ITEM}.
+ */
+ String SERVICE_PROPERTIES = "ServiceProperties";
+
+ /**
+ * 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));
+
+ /**
+ * The key REGISTRATION_LISTENERS, used in {@link #SERVICE_LISTENERS_ITEM}.
+ */
+ String REGISTRATION_LISTENERS = "RegistrationListeners";
+
+ /**
+ * The item containing all the registration listeners.
+ * The key is {@link #REGISTRATION_LISTENERS}, and the type is {@link ArrayType}.
+ */
+ 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_METADATA_TYPE}.
+ */
+ String SERVICE_METADATA = "ServiceMetadata";
+
+ /**
+ * The CompositeType for a ServiceMetadata object, it extends {@link #COMPONENT_METADATA_TYPE}
+ * and adds the following items:
+ * <ul>
+ * <li>{@link #INTERFACES}</li>
+ * <li>{@link #AUTO_EXPORT}</li>
+ * <li>{@link #RANKING}</li>
+ * <li>{@link #SERVICE_COMPONENT}</li>
+ * <li>{@link #SERVICE_PROPERTIES}</li>
+ * <li>{@link #REGISTRATION_LISTENERS}</li>
+ * </ul>
+ */
+ CompositeType SERVICE_METADATA_TYPE = Item.extend(
+ COMPONENT_METADATA_TYPE,
+ SERVICE_METADATA,
+ "This type encapsulates ServiceMetadata objects",
+ INTERFACES_ITEM,
+ AUTO_EXPORT_ITEM,
+ RANKING_ITEM,
+ SERVICE_COMPONENT_ITEM,
+ SERVICE_PROPERTIES_ITEM,
+ REGISTRATION_LISTENERS_ITEM);
+
+ ///////////////////////////////////////////////////////////////
+ // Define <reference-listener>'s CompositeType
+ // LISTENER_COMPONENT_ITEM defined in the <registration-listener>
+ ///////////////////////////////////////////////////////////////
+
+ /**
+ * The key BIND_METHOD, used in {@link #BIND_METHOD_ITEM}.
+ */
+ String BIND_METHOD = "BindMethod";
+
+ /**
+ * The item containing the name of the bind method.
+ * The key is {@link #BIND_METHOD}, and the type is {@link SimpleType#STRING}.
+ */
+ Item BIND_METHOD_ITEM = new Item(
+ BIND_METHOD,
+ "The name of the bind method",
+ SimpleType.STRING);
+
+ /**
+ * The key UNBIND_METHOD, used in {@link #UNBIND_METHOD_ITEM}.
+ */
+ String UNBIND_METHOD = "UnbindMethod";
+
+ /**
+ * The item containing the name of the unbind method.
+ * The key is {@link #UNBIND_METHOD}, and the type is {@link SimpleType#STRING}.
+ */
+ 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>
+ * <li>{@link #BIND_METHOD}</li>
+ * <li>{@link #UNBIND_METHOD}</li>
+ * </ul>
+ */
+ CompositeType REFERENCE_LISTENER_TYPE = Item.compositeType(
+ REFERENCE_LISTENER,
+ "This type encapsulates ReferenceListener objects",
+ LISTENER_COMPONENT_ITEM,
+ BIND_METHOD_ITEM,
+ UNBIND_METHOD_ITEM);
+
+
+ ///////////////////////////////////////////////////////////////
+ // Define Service Reference's CompositeType,
+ // <reference> & <reference-list> will extend this
+ ///////////////////////////////////////////////////////////////
+
+ /**
+ * The key AVAILABILITY, used in {@link #AVAILABILITY_ITEM}.
+ */
+ String AVAILABILITY = "Availability";
+
+ /**
+ * 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}.
+ *
+ */
+ //TODO add description for each int
+ Item AVAILABILITY_ITEM = new Item(
+ AVAILABILITY,
+ "To specify whether or not a matching service is required at all times",
+ SimpleType.INTEGER);
+
+ /**
+ * The key INTERFACE, used in {@link #INTERFACE_ITEM}.
+ */
+ String INTERFACE = "Interface";
+
+ /**
+ * The item containing the name of the interface type that a matching service must support.
+ * The key is {@link #INTERFACE}, and the type is {@link SimpleType#STRING}.
+ */
+ Item INTERFACE_ITEM = new Item(
+ INTERFACE,
+ "the name of the interface type",
+ SimpleType.STRING);
+
+ /**
+ * The key COMPONENT_NAME, used in {@link #COMPONENT_NAME_ITEM}.
+ */
+ String COMPONENT_NAME = "ComponentName";
+
+ /**
+ * The item containing the value of the <code>component-name</code> attribute of the service reference.
+ * The key is {@link #INTERFACE}, and the type is {@link SimpleType#STRING}.
+ */
+ 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}.
+ */
+ String FILTER = "Filter";
+
+ /**
+ * The item containing the filter expression that a matching service must match.
+ * The key is {@link #FILTER}, and the type is {@link SimpleType#STRING}.
+ */
+ Item FILTER_ITEM = new Item(
+ FILTER,
+ "The filter expression that a matching service must match",
+ SimpleType.STRING);
+
+ /**
+ * The key REFERENCE_LISTENERS, used in {@link #SERVICE_LISTENERS_ITEM}.
+ */
+ String REFERENCE_LISTENERS = "RegistrationListeners";
+
+ /**
+ * The item containing all the reference listeners.
+ * The key is {@link #REFERENCE_LISTENERS}, and the type is {@link ArrayType}.
+ */
+ 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
+ * {@link #COMPONENT_METADATA_TYPE} and adds the following items:
+ * <ul>
+ * <li>{@link #AVAILABILITY}</li>
+ * <li>{@link #INTERFACE}</li>
+ * <li>{@link #COMPONENT_NAME}</li>
+ * <li>{@link #FILTER}</li>
+ * <li>{@link #REFERENCE_LISTENERS}</li>
+ * </ul>
+ */
+ CompositeType SERVICE_REFERENCE_METADATA_TYPE = Item.extend(
+ COMPONENT_METADATA_TYPE,
+ SERVICE_REFERENCE_METADATA,
+ "This type encapsulates ServiceReferenceMetadata objects",
+ AVAILABILITY_ITEM,
+ INTERFACE_ITEM,
+ COMPONENT_NAME_ITEM,
+ FILTER_ITEM,
+ REFERENCE_LISTENERS_ITEM);
+
+ ///////////////////////////////////////////////////////////////
+ // Define <reference>'s CompositeType
+ ///////////////////////////////////////////////////////////////
+
+ /**
+ * The key TIME_OUT, used in {@link #TIMEOUT_ITEM}.
+ */
+ String TIMEOUT = "TimeOut";
+
+ /**
+ * The item containing the timeout for service invocations when a backing service is is unavailable.
+ * The key is {@link #TIMEOUT}, and the type is {@link SimpleType#LONG}.
+ */
+ 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:
+ * <ul>
+ * <li>{@link #TIMEOUT}</li>
+ * </ul>
+ */
+ CompositeType REFERENCE_METADATA_TYPE = Item.extend(
+ SERVICE_REFERENCE_METADATA_TYPE,
+ REFERENCE_METADATA,
+ "This type encapsulates ReferenceMetadata objects",
+ TIMEOUT_ITEM);
+
+ ///////////////////////////////////////////////////////////////
+ // Define <reference-list>'s CompositeType
+ ///////////////////////////////////////////////////////////////
+
+ /**
+ * The key MEMBER_TYPE, used in {@link #MEMBER_TYPE_ITEM}.
+ */
+ String MEMBER_TYPE = "MemberType";
+
+ /**
+ * 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>
+ * <li>{@link #MEMBER_TYPE}</li>
+ * </ul>
+ */
+ CompositeType REFERENCE_LIST_METADATA_TYPE = Item.extend(
+ SERVICE_REFERENCE_METADATA_TYPE,
+ REFERENCE_LIST_METADATA,
+ "This type encapsulates ReferenceListMetadata objects",
+ MEMBER_TYPE_ITEM);
+
+
+ /**
+ * Returns the list of component id.
+ *
+ * @param containerServiceId The blueprint container service id
+ * @return the array of component id
+ */
+ public String[] getComponentIds(long containerServiceId);
+
+ /**
+ * Returns all component ids of the specified component type
+ *
+ * @param containerServiceId The blueprint container service id
+ * @param type The string used to specify the type of component
+ * @return the array of component id
+ */
+ //TODO add description for type
+ public String[] getComponentIdsByType(long containerServiceId, String type);
+
+ /**
+ * Returns the ComponentMetadata according to the its component id.
+ * The returned Composite Data's type is actually one of {@link #BEAN_METADATA_TYPE},
+ * {@link #SERVICE_METADATA_TYPE}, {@link #REFERENCE_METADATA_TYPE}, REFERENCE_LIST_METADATA_TYPE.
+ *
+ * @param containerServiceId The blueprint container service id
+ * @param componentId The component id
+ * @return the ComponentMetadata
+ */
+ public CompositeData getComponentMetadata(long containerServiceId, String componentId);
+
+ /**
+ * Returns all the blueprint containers' service IDs, which successfully
+ * created from blueprint bundles.
+ *
+ * @return the list of all the service IDs of the blueprint containers created by current extender
+ * @throws IOException if the operation fails
+ */
+ public long[] getBlueprintContainerServiceIds() throws IOException;
+
+ /**
+ * Returns the blueprint container's service id if the bundle specified
+ * by the bundle id is a blueprint bundle.
+ *
+ * @param bundleId The bundle id of a blueprint bundle
+ * @return the blueprint container's service id, or null if the blueprint bundle initialed failed.
+ * @throws IOException if the operation fails
+ * @throws IllegalArgumentException if the bundle is not a blueprint bundle
+ */
+ public long getBlueprintContainerServiceId(long bundleId) throws IOException;
+}
Added: aries/tags/jmx-0.1-incubating/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/BlueprintStateMBean.java
URL: http://svn.apache.org/viewvc/aries/tags/jmx-0.1-incubating/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/BlueprintStateMBean.java?rev=1075096&view=auto
==============================================================================
--- aries/tags/jmx-0.1-incubating/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/BlueprintStateMBean.java (added)
+++ aries/tags/jmx-0.1-incubating/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/BlueprintStateMBean.java Sun Feb 27 17:58:16 2011
@@ -0,0 +1,208 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.aries.jmx.blueprint;
+
+import java.io.IOException;
+
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.SimpleType;
+import javax.management.openmbean.TabularData;
+import javax.management.openmbean.TabularType;
+
+/**
+ * This MBean provides the management interface to the OSGi Blueprint Service.
+ *
+ * @version $Revision: 896239 $
+ */
+public interface BlueprintStateMBean {
+ /**
+ * The object name for this MBean.
+ */
+ String OBJECTNAME = JmxConstants.ARIES_BLUEPRINT+":service=blueprintState,version=1.0";
+
+ ///////////////////////////////////////////////////////////////
+ // Define Event's CompositeType
+ ///////////////////////////////////////////////////////////////
+
+ /**
+ * The key BUNDLE_ID, used in {@link #BUNDLE_ID_ITEM}.
+ */
+ String BUNDLE_ID = "BundleId";
+
+ /**
+ * The item containing the Blueprint bundle id associated with this event.
+ * The key is {@link #BUNDLE_ID}, and the type is {@link SimpleType#LONG}.
+ */
+ Item BUNDLE_ID_ITEM = new Item(
+ BUNDLE_ID,
+ "the Blueprint bundle id associated with this event.",
+ SimpleType.LONG);
+
+ /**
+ * The key EXTENDER_BUNDLE_ID, used in {@link #EXTENDER_BUNDLE_ID_ITEM}.
+ */
+ String EXTENDER_BUNDLE_ID = "ExtenderBundleId";
+
+ /**
+ * The item containing the Blueprint extender bundle id that is generating this event.
+ * The key is {@link #EXTENDER_BUNDLE_ID}, and the type is {@link SimpleType#LONG}.
+ */
+ Item EXTENDER_BUNDLE_ID_ITEM = new Item(
+ EXTENDER_BUNDLE_ID,
+ "the Blueprint extender bundle id that is generating this event.",
+ SimpleType.LONG);
+
+ /**
+ * The key REPLAY, used in {@link #REPLAY_ITEM}.
+ */
+ String REPLAY = "Replay";
+
+ /**
+ * The item containing the flag that represents whether this event is a replay event.
+ * The key is {@link #REPLAY}, and the type is {@link SimpleType#BOOLEAN}.
+ */
+ Item REPLAY_ITEM = new Item(
+ REPLAY,
+ "the flag that represents whether this event is a replay event.",
+ SimpleType.BOOLEAN);
+
+
+ /**
+ * The key EVENT_TYPE, used in {@link #EVENT_TYPE_ITEM}.
+ */
+ String EVENT_TYPE = "EventType";
+
+ /**
+ * The item containing the type of this event.
+ * The key is {@link #EVENT_TYPE}, and the type is {@link SimpleType#STRING}.
+ */
+ 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 #TIMESTAMP_ITEM}.
+ */
+ String TIMESTAMP = "Timestamp";
+
+ /**
+ * The item containing the time at which this event was created.
+ * The key is {@link #TIMESTAMP}, and the type is {@link SimpleType#LONG}.
+ */
+ Item TIMESTAMP_ITEM = new Item(
+ TIMESTAMP,
+ "the time at which this event was created.",
+ SimpleType.LONG);
+
+
+ /**
+ * The key DEPENDENCIES, used in {@link #DEPENDENCIES_ITEM}.
+ */
+ String DEPENDENCIES = "Dependencies";
+
+ /**
+ * The item containing the filters identifying the missing dependencies that caused the WAITING, GRACE_PERIOD or FAILURE event.
+ * The key is {@link #DEPENDENCIES}, and the type is {@link JmxConstants#STRING_ARRAY_TYPE}.
+ */
+ Item DEPENDENCIES_ITEM = new Item(
+ DEPENDENCIES,
+ "the filters identifying the missing dependencies that caused the WAITING, GRACE_PERIOD or FAILURE event.",
+ JmxConstants.STRING_ARRAY_TYPE);
+
+ /**
+ * The key EXCEPTION_MESSAGE, used in {@link #ERROR_MESSAGE_ITEM}.
+ */
+ String EXCEPTION_MESSAGE = "ExceptionMessage";
+
+ /**
+ * The item containing the exception message that cause this FAILURE event.
+ * The key is {@link #EXCEPTION_MESSAGE}, and the type is {@link SimpleType#STRING}.
+ */
+ Item EXCEPTION_MESSAGE_ITEM = new Item(
+ EXCEPTION_MESSAGE,
+ "the exception message that cause this FAILURE event.",
+ SimpleType.STRING);
+
+ /**
+ * The CompositeType for a blueprint event. It contains the following items:
+ * <ul>
+ * <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 #EXCEPTION_MESSAGE}</li>
+ * </ul>
+ */
+ CompositeType OSGI_BLUEPRINT_EVENT_TYPE = Item.compositeType(
+ "OSGI_BLUEPRINT_EVENT",
+ "Blueprint event",
+ BUNDLE_ID_ITEM,
+ EXTENDER_BUNDLE_ID_ITEM,
+ EVENT_TYPE_ITEM,
+ REPLAY_ITEM,
+ TIMESTAMP_ITEM,
+ DEPENDENCIES_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 #OSGI_BLUEPRINT_EVENT_TYPE}.
+ *
+ * @param bundleId The bundle id of a blueprint bundle
+ * @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
+ */
+ 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 see {@link #OSGI_BLUEPRINT_EVENTS_TYPE}
+ * @throws IOException if the operation fails
+ */
+ public TabularData getLastEvents() throws IOException;
+
+ /**
+ * Returns all the blueprint bundles' IDs, which are either
+ * successfully created or not by current extender.
+ *
+ * @return the list of all the blueprint bundles's IDs (either successfully created or not by current extender)
+ * @throws IOException if the operation fails
+ */
+ public long[] getBlueprintBundleIds() throws IOException;
+
+}
Added: aries/tags/jmx-0.1-incubating/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/Item.java
URL: http://svn.apache.org/viewvc/aries/tags/jmx-0.1-incubating/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/Item.java?rev=1075096&view=auto
==============================================================================
--- aries/tags/jmx-0.1-incubating/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/Item.java (added)
+++ aries/tags/jmx-0.1-incubating/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/Item.java Sun Feb 27 17:58:16 2011
@@ -0,0 +1,203 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.aries.jmx.blueprint;
+
+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.
+ *
+ * @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);
+ }
+
+ /**
+ * 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()];
+
+ int n = 0;
+ for (Item item : all) {
+ names[n] = item.name;
+ descriptions[n] = item.description;
+ types[n] = item.type;
+ n++;
+ }
+
+ try {
+ return new CompositeType(name, description, names, descriptions, types);
+ } catch (OpenDataException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * 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);
+ }
+ }
+
+
+ /**
+ * Return a new primaArray Type.
+ *
+ * @param elementType
+ * The element type
+ * @return A new Array Type
+ */
+ /*
+ * 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);
+ }
+ }
+ */
+}
Added: aries/tags/jmx-0.1-incubating/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/JmxConstants.java
URL: http://svn.apache.org/viewvc/aries/tags/jmx-0.1-incubating/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/JmxConstants.java?rev=1075096&view=auto
==============================================================================
--- aries/tags/jmx-0.1-incubating/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/JmxConstants.java (added)
+++ aries/tags/jmx-0.1-incubating/jmx-blueprint-api/src/main/java/org/apache/aries/jmx/blueprint/JmxConstants.java Sun Feb 27 17:58:16 2011
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.aries.jmx.blueprint;
+
+import javax.management.openmbean.ArrayType;
+import javax.management.openmbean.SimpleType;
+
+/**
+ * Constants.
+ *
+ * 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 #PRIMITIVE_BYTE_ARRAY_TYPE}.
+ *
+ * @Immutable
+ */
+public class JmxConstants {
+
+ /*
+ * Empty constructor to make sure this is not used as an object.
+ */
+ private JmxConstants() {
+ // empty
+ }
+
+
+ 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>*/ STRING_ARRAY_TYPE = Item
+ .arrayType(
+ 1,
+ SimpleType.STRING);
+
+
+ /**
+ * The domain name of the Blueprint MBeans
+ */
+ public static final String ARIES_BLUEPRINT = "org.apache.aries.blueprint";
+}
Added: aries/tags/jmx-0.1-incubating/jmx-blueprint-bundle/pom.xml
URL: http://svn.apache.org/viewvc/aries/tags/jmx-0.1-incubating/jmx-blueprint-bundle/pom.xml?rev=1075096&view=auto
==============================================================================
--- aries/tags/jmx-0.1-incubating/jmx-blueprint-bundle/pom.xml (added)
+++ aries/tags/jmx-0.1-incubating/jmx-blueprint-bundle/pom.xml Sun Feb 27 17:58:16 2011
@@ -0,0 +1,184 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.aries.jmx</groupId>
+ <artifactId>jmx</artifactId>
+ <version>0.1-incubating</version>
+ </parent>
+
+ <artifactId>org.apache.aries.jmx.blueprint</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Aries JMX Blueprint Bundle</name>
+ <description>
+ This bundle contains the standalone implementation of the along with the API.
+ </description>
+
+ <properties>
+ <aries.osgi.activator>
+ org.apache.aries.jmx.blueprint.impl.Activator
+ </aries.osgi.activator>
+ <aries.osgi.export.pkg>
+ org.apache.aries.jmx.blueprint;
+ org.apache.aries.jmx.blueprint.codec
+ </aries.osgi.export.pkg>
+ <aries.osgi.import>
+ !org.apache.aries.jmx*,
+ javax.management,
+ javax.management.openmbean,
+ org.osgi.framework;version="1.5.0",
+ org.osgi.service.blueprint.container;version="1.0",
+ org.osgi.service.blueprint.reflect;version="1.0",
+ org.osgi.util.tracker;version="1.4",
+ *
+ </aries.osgi.import>
+ <aries.osgi.private.pkg>
+ org.apache.aries.jmx.blueprint.impl*
+ </aries.osgi.private.pkg>
+ <aries.osgi.import.service>
+ javax.management.MBeanServer
+ </aries.osgi.import.service>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.aries.jmx</groupId>
+ <artifactId>org.apache.aries.jmx.blueprint.api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.aries.jmx</groupId>
+ <artifactId>org.apache.aries.jmx.blueprint.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <!--
+ Use the shade plugin with the dependency plugin to unjar the two jars (api & core)
+ so that the associated sources and javadocs jars are complete. To build the main
+ jar, the maven-bundle-plugin is used, that's why everything is exluded
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <artifactSet>
+ <includes>
+ <include>org.apache.aries.jmx:org.apache.aries.jmx.blueprint.api</include>
+ <include>org.apache.aries.jmx:org.apache.aries.jmx.blueprint.core</include>
+ </includes>
+ </artifactSet>
+ <createSourcesJar>${createSourcesJar}</createSourcesJar>
+ <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
+ <createDependencyReducedPom>true</createDependencyReducedPom>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>deploy</id>
+ <properties>
+ <createSourcesJar>true</createSourcesJar>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack-sources</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.aries.jmx</groupId>
+ <artifactId>org.apache.aries.jmx.blueprint.api</artifactId>
+ <classifier>sources</classifier>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.aries.jmx</groupId>
+ <artifactId>org.apache.aries.jmx.blueprint.core</artifactId>
+ <classifier>sources</classifier>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/sources</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <minmemory>128m</minmemory>
+ <maxmemory>512m</maxmemory>
+ <sourcepath>${project.build.directory}/sources</sourcepath>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
Added: aries/tags/jmx-0.1-incubating/jmx-blueprint-core/pom.xml
URL: http://svn.apache.org/viewvc/aries/tags/jmx-0.1-incubating/jmx-blueprint-core/pom.xml?rev=1075096&view=auto
==============================================================================
--- aries/tags/jmx-0.1-incubating/jmx-blueprint-core/pom.xml (added)
+++ aries/tags/jmx-0.1-incubating/jmx-blueprint-core/pom.xml Sun Feb 27 17:58:16 2011
@@ -0,0 +1,88 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.aries.jmx</groupId>
+ <artifactId>jmx</artifactId>
+ <version>0.1-incubating</version>
+ </parent>
+
+ <artifactId>org.apache.aries.jmx.blueprint.core</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Aries JMX Blueprint Core</name>
+ <description>
+ This bundle contains the core implementation of the JMX Blueprint API
+ </description>
+
+ <properties>
+ <aries.osgi.activator>
+ org.apache.aries.jmx.blueprint.impl.Activator
+ </aries.osgi.activator>
+ <aries.osgi.export.pkg>
+ org.apache.aries.jmx.blueprint.codec
+ </aries.osgi.export.pkg>
+ <aries.osgi.private.pkg>
+ org.apache.aries.jmx.blueprint.impl*
+ </aries.osgi.private.pkg>
+ <aries.osgi.import.service>
+ javax.management.MBeanServer
+ </aries.osgi.import.service>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.aries.jmx</groupId>
+ <artifactId>org.apache.aries.jmx.blueprint.api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jmock</groupId>
+ <artifactId>jmock-junit4</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jmock</groupId>
+ <artifactId>jmock-legacy</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Added: aries/tags/jmx-0.1-incubating/jmx-blueprint-core/src/main/java/org/apache/aries/jmx/blueprint/codec/BPBeanArgument.java
URL: http://svn.apache.org/viewvc/aries/tags/jmx-0.1-incubating/jmx-blueprint-core/src/main/java/org/apache/aries/jmx/blueprint/codec/BPBeanArgument.java?rev=1075096&view=auto
==============================================================================
--- aries/tags/jmx-0.1-incubating/jmx-blueprint-core/src/main/java/org/apache/aries/jmx/blueprint/codec/BPBeanArgument.java (added)
+++ aries/tags/jmx-0.1-incubating/jmx-blueprint-core/src/main/java/org/apache/aries/jmx/blueprint/codec/BPBeanArgument.java Sun Feb 27 17:58:16 2011
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.jmx.blueprint.codec;
+
+import java.util.HashMap;
+
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeDataSupport;
+import javax.management.openmbean.OpenDataException;
+
+import org.apache.aries.jmx.blueprint.BlueprintMetadataMBean;
+import org.osgi.service.blueprint.reflect.BeanArgument;
+
+public class BPBeanArgument implements TransferObject {
+ private int index;
+
+ private BPMetadata value;
+
+ private String valueType;
+
+ public BPBeanArgument(CompositeData argument) {
+ index = (Integer) argument.get(BlueprintMetadataMBean.INDEX);
+ Byte[] buf = (Byte[]) argument.get(BlueprintMetadataMBean.VALUE);
+ value = Util.boxedBinary2BPMetadata(buf);
+ valueType = (String) argument.get(BlueprintMetadataMBean.VALUE_TYPE);
+ }
+
+ public BPBeanArgument(BeanArgument argument) {
+ index = argument.getIndex();
+
+ value = Util.metadata2BPMetadata(argument.getValue());
+
+ valueType = argument.getValueType();
+ }
+
+ public CompositeData asCompositeData() {
+ HashMap<String, Object> items = new HashMap<String, Object>();
+ items.put(BlueprintMetadataMBean.INDEX, index);
+ items.put(BlueprintMetadataMBean.VALUE, Util.bpMetadata2BoxedBinary(value));
+ items.put(BlueprintMetadataMBean.VALUE_TYPE, valueType);
+
+ try {
+ return new CompositeDataSupport(BlueprintMetadataMBean.BEAN_ARGUMENT_TYPE, items);
+ } catch (OpenDataException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public int getIndex() {
+ return index;
+ }
+
+ public BPMetadata getValue() {
+ return value;
+ }
+
+ public String getValueType() {
+ return valueType;
+ }
+}