You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cl...@apache.org on 2008/08/08 10:01:02 UTC

svn commit: r683898 [1/2] - in /felix/trunk/ipojo/handler/jmx: ./ src/main/java/org/apache/felix/ipojo/handlers/jmx/ src/main/resources/

Author: clement
Date: Fri Aug  8 01:01:01 2008
New Revision: 683898

URL: http://svn.apache.org/viewvc?rev=683898&view=rev
Log:
Fix issue Felix-675
Improve the JMX handler to support the Platform MBean Server.
Use the latest iPOJO version

Added:
    felix/trunk/ipojo/handler/jmx/LICENSE
    felix/trunk/ipojo/handler/jmx/NOTICE
    felix/trunk/ipojo/handler/jmx/metadata.xml
    felix/trunk/ipojo/handler/jmx/obr.xml
    felix/trunk/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanWRegisterImpl.java
    felix/trunk/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXHandlerDescription.java
Removed:
    felix/trunk/ipojo/handler/jmx/src/main/resources/metadata.xml
Modified:
    felix/trunk/ipojo/handler/jmx/pom.xml
    felix/trunk/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanImpl.java
    felix/trunk/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/JmxConfigFieldMap.java
    felix/trunk/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/MBeanHandler.java
    felix/trunk/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/MethodField.java
    felix/trunk/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/NotificationField.java
    felix/trunk/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/PropertyField.java

Added: felix/trunk/ipojo/handler/jmx/LICENSE
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/handler/jmx/LICENSE?rev=683898&view=auto
==============================================================================
--- felix/trunk/ipojo/handler/jmx/LICENSE (added)
+++ felix/trunk/ipojo/handler/jmx/LICENSE Fri Aug  8 01:01:01 2008
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.

Added: felix/trunk/ipojo/handler/jmx/NOTICE
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/handler/jmx/NOTICE?rev=683898&view=auto
==============================================================================
--- felix/trunk/ipojo/handler/jmx/NOTICE (added)
+++ felix/trunk/ipojo/handler/jmx/NOTICE Fri Aug  8 01:01:01 2008
@@ -0,0 +1,18 @@
+Apache Felix iPOJO Event Admin Handler
+Copyright 2008 The Apache Software Foundation
+
+I. Included Software
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+Licensed under the Apache License 2.0.
+
+II. Used Software
+
+This product uses software developed at
+The OSGi Alliance (http://www.osgi.org/).
+Copyright 2006 The OSGi Alliance.
+Licensed under the Apache License 2.0.
+
+III. License Summary
+- Apache License 2.0

Added: felix/trunk/ipojo/handler/jmx/metadata.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/handler/jmx/metadata.xml?rev=683898&view=auto
==============================================================================
--- felix/trunk/ipojo/handler/jmx/metadata.xml (added)
+++ felix/trunk/ipojo/handler/jmx/metadata.xml Fri Aug  8 01:01:01 2008
@@ -0,0 +1,22 @@
+<!--
+	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.
+-->
+<ipojo>
+<handler classname="org.apache.felix.ipojo.handlers.jmx.MBeanHandler" name="config" namespace="org.apache.felix.ipojo.handlers.jmx.MBeanHandler">
+</handler>	
+</ipojo>
\ No newline at end of file

Added: felix/trunk/ipojo/handler/jmx/obr.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/handler/jmx/obr.xml?rev=683898&view=auto
==============================================================================
--- felix/trunk/ipojo/handler/jmx/obr.xml (added)
+++ felix/trunk/ipojo/handler/jmx/obr.xml Fri Aug  8 01:01:01 2008
@@ -0,0 +1,25 @@
+<!--
+	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.
+-->
+<obr>
+	<capability name="ipojo.handler">
+		<p n="name" v="config"/>
+		<p n="namespace" v="org.apache.felix.ipojo.handlers.jmx.MBeanHandler"/>
+		<p n="type" v="primitive"/>
+	</capability>
+</obr>
\ No newline at end of file

Modified: felix/trunk/ipojo/handler/jmx/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/handler/jmx/pom.xml?rev=683898&r1=683897&r2=683898&view=diff
==============================================================================
--- felix/trunk/ipojo/handler/jmx/pom.xml (original)
+++ felix/trunk/ipojo/handler/jmx/pom.xml Fri Aug  8 01:01:01 2008
@@ -1,95 +1,100 @@
-<!--
-	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>
-	<modelVersion>4.0.0</modelVersion>
-	<packaging>bundle</packaging>
-	<artifactId>org.apache.felix.ipojo.handler.jmx</artifactId>
-	<groupId>org.apache.felix</groupId>
-	<version>0.9.0-SNAPSHOT</version>
-	<name>Apache Felix iPOJO JMX Handler</name>
-
-	<dependencies>
-		<dependency>
-			<groupId>org.apache.felix</groupId>
-			<artifactId>org.osgi.core</artifactId>
-			<version>1.0.0</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.felix</groupId>
-			<artifactId>org.osgi.compendium</artifactId>
-			<version>1.0.0</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.felix</groupId>
-			<artifactId>org.apache.felix.ipojo.metadata</artifactId>
-			<version>0.9.0-SNAPSHOT</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.felix</groupId>
-			<artifactId>org.apache.felix.ipojo</artifactId>
-			<version>0.9.0-SNAPSHOT</version>
-		</dependency>
-	</dependencies>
-
-	<build>
-		<plugins>
-			<plugin>
-				<groupId>org.apache.felix</groupId>
-				<artifactId>maven-bundle-plugin</artifactId>
-				<version>1.4.0</version>
-				<extensions>true</extensions>
-				<configuration>
-					<instructions>
-						<Private-Package>
-							org.apache.felix.ipojo.handlers.jmx
-						</Private-Package>
-						<Bundle-Name>${pom.name}</Bundle-Name>
-						<Bundle-SymbolicName>
-							ipojo.jmx.handler
-						</Bundle-SymbolicName>
-            <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
-					</instructions>
-				</configuration>
-			</plugin>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-compiler-plugin</artifactId>
-				<configuration>
-					<source>1.5</source>
-					<target>1.5</target>
-				</configuration>
-			</plugin>
-			<plugin>
-				<groupId>org.apache.felix</groupId>
-				<artifactId>maven-ipojo-plugin</artifactId>
-				<version>0.9.0-SNAPSHOT</version>
-				<executions>
-					<execution>
-						<goals>
-							<goal>ipojo-bundle</goal>
-						</goals>
-						<configuration>
-							<metadata>metadata.xml</metadata>
-						</configuration>
-					</execution>
-				</executions>
-			</plugin>
-		</plugins>
-	</build>
-</project>
+<!--
+	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>
+	<modelVersion>4.0.0</modelVersion>
+	<packaging>bundle</packaging>
+	<name>Apache Felix iPOJO JMX Handler</name>
+	<artifactId>org.apache.felix.ipojo.handler.jmx</artifactId>
+	<groupId>org.apache.felix</groupId>
+	<version>0.9.0-SNAPSHOT</version>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.ipojo</artifactId>
+			<version>0.9.0-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.ipojo.metadata</artifactId>
+			<version>0.9.0-SNAPSHOT</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.osgi.core</artifactId>
+			<version>1.0.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.osgi.compendium</artifactId>
+			<version>1.0.0</version>
+		</dependency>
+	</dependencies>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.felix</groupId>
+				<artifactId>maven-bundle-plugin</artifactId>
+				<version>1.4.0</version>
+				<extensions>true</extensions>
+				<configuration>
+					<instructions>
+						<Private-Package>
+							org.apache.felix.ipojo.handlers.jmx
+						</Private-Package>
+						<Bundle-Name>${pom.name}</Bundle-Name>
+						<Bundle-SymbolicName>
+							org.apache.felix.ipojo.handler.jmx 
+						</Bundle-SymbolicName>
+						<Bundle-Vendor>The Apache Software 
+							Foundation</Bundle-Vendor>
+						<Include-Resource>
+							META-INF/LICENCE=LICENSE,
+							META-INF/NOTICE=NOTICE
+						</Include-Resource>
+					</instructions>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<configuration>
+					<source>1.5</source>
+					<target>1.5</target>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.felix</groupId>
+				<artifactId>maven-ipojo-plugin</artifactId>
+				<version>0.9.0-SNAPSHOT</version>
+				<executions>
+					<execution>
+						<goals>
+							<goal>ipojo-bundle</goal>
+						</goals>
+						<configuration>
+							<metadata>metadata.xml</metadata>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+</project>

Modified: felix/trunk/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanImpl.java?rev=683898&r1=683897&r2=683898&view=diff
==============================================================================
--- felix/trunk/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanImpl.java (original)
+++ felix/trunk/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanImpl.java Fri Aug  8 01:01:01 2008
@@ -1,374 +1,436 @@
-/* 
- * 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.felix.ipojo.handlers.jmx;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.management.Attribute;
-import javax.management.AttributeChangeNotification;
-import javax.management.AttributeList;
-import javax.management.AttributeNotFoundException;
-import javax.management.DynamicMBean;
-import javax.management.InvalidAttributeValueException;
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanException;
-import javax.management.MBeanInfo;
-import javax.management.MBeanNotificationInfo;
-import javax.management.MBeanOperationInfo;
-import javax.management.Notification;
-import javax.management.NotificationBroadcasterSupport;
-import javax.management.ReflectionException;
-import javax.management.RuntimeOperationsException;
-
-import org.apache.felix.ipojo.InstanceManager;
-import org.apache.felix.ipojo.parser.MethodMetadata;
-import org.apache.felix.ipojo.util.Callback;
-import org.apache.felix.ipojo.util.Logger;
-
-/** 
- * this class implements iPOJO DynamicMBean.
- * it builds the dynamic MBean 
- *  
- *  @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
- */
-public class DynamicMBeanImpl extends NotificationBroadcasterSupport implements DynamicMBean {
-    /** 
-     * JmxConfigDFieldMap : store the data extracted from metadata.xml.
-     */
-    private JmxConfigFieldMap m_configMap;
-
-    /** 
-     * InstanceManager: use to store the InstanceManager instance.
-     */
-    private InstanceManager m_instanceManager;
-
-    /** 
-     * MBeanInfo : class wich store the MBean Informations.
-     */
-    private MBeanInfo m_mBeanInfo;
-
-    /**
-     * String : constant which store the name of the class.
-     */
-    private String m_className = this.getClass().getName();
-
-    /** 
-     * sequenceNumber : use to calculate unique id to notification.
-     */
-    private int m_sequenceNumber = 0;
-
-    /** 
-     * DynamicMBeanImpl : constructor.
-     * @param properties : data extracted from metadat.xml file
-     * @param instanceManager : InstanceManager instance
-     */
-    public DynamicMBeanImpl(JmxConfigFieldMap properties, InstanceManager instanceManager) {
-        m_configMap = properties;
-        m_instanceManager = instanceManager;
-        this.buildMBeanInfo();
-    }
-
-    /** 
-     * getAttribute implements from JMX.
-     * get the value of the required attribute 
-     * @param arg0 name of required attribute
-     * @throws AttributeNotFoundException : if the attribute doesn't exist
-     * @throws MBeanException : 
-     * @throws ReflectionException : 
-     * @return  the object attribute
-     */
-    public Object getAttribute(String arg0) throws AttributeNotFoundException, MBeanException, ReflectionException {
-        PropertyField attribute = m_configMap.getPropertyFromName(arg0);
-
-        if (attribute == null) {
-            throw new AttributeNotFoundException(arg0 + " not found");
-        } else {
-            return attribute.getValue();
-        }
-    }
-
-    /** 
-     * getAttributes : implement from JMX.
-     * get values of reuqired attributes 
-     * @param attributeNames : names of the required attributes
-     * @return return the list of the attribute
-     */
-    public AttributeList getAttributes(String[] attributeNames) {
-
-        if (attributeNames == null) {
-            throw new IllegalArgumentException("attributeNames[] cannot be null");
-        }
-
-        AttributeList resultList = new AttributeList();
-        for (int i = 0; i < attributeNames.length; i++) {
-            PropertyField propertyField = (PropertyField) m_configMap.getPropertyFromField((String) attributeNames[i]);
-
-            if (propertyField != null) {
-                resultList.add(new Attribute(attributeNames[i], propertyField.getValue()));
-            }
-        }
-        return resultList;
-    }
-
-    /** 
-     * getMBeanInfo : return the MBean Class builded.
-     * @return  return MBeanInfo class constructed by buildMBeanInfo
-     */
-    public MBeanInfo getMBeanInfo() {
-        return m_mBeanInfo;
-    }
-
-    /** 
-     * invoke : invoke the required method on the targeted POJO.
-     * @param operationName : name of the method called
-     * @param params : parameters given to the method
-     * @param signature : determine which method called
-     * @return Object : the object return by the method
-     * @throws MBeanException :
-     * @throws ReflectionException : 
-     */
-    public Object invoke(String operationName, Object[] params, String[] signature) throws MBeanException, ReflectionException {
-
-        MethodField method = m_configMap.getMethodFromName(operationName, signature);
-        if (method != null) {
-            MethodMetadata methodCall = method.getMethod();
-            Callback mc = new Callback(methodCall, m_instanceManager);
-            try {
-                return mc.call(params);
-            } catch (NoSuchMethodException e) {
-                System.err.println("No such method!: " + operationName);
-                e.printStackTrace();
-            } catch (IllegalAccessException e) {
-                System.err.println("Illegal Access Exception");
-                e.printStackTrace();
-            } catch (InvocationTargetException e) {
-                System.err.println("Invocation Target Exception");
-                e.printStackTrace();
-            }
-        } else {
-            throw new ReflectionException(new NoSuchMethodException(operationName), "Cannot find the operation "
-                    + operationName
-                    + " in "
-                    + m_className);
-        }
-
-        return null;
-    }
-
-    /** 
-     * setAttribute : change specified attribute value.
-     * @param attribute : attribute with new value to be changed
-     * @throws AttributeNotFoundException : if the requiered attribute was not found
-     * @throws InvalidAttributeValueException : the value is inccorrect type
-     * @throws MBeanException :
-     * @throws ReflectionException :
-     */
-    public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException,
-            ReflectionException {
-
-        // Check attribute is not null to avoid NullPointerException later on
-        if (attribute == null) {
-            throw new RuntimeOperationsException(new IllegalArgumentException("Attribute cannot be null"), "Cannot invoke a setter of "
-                    + m_className
-                    + " with null attribute");
-        }
-        String name = attribute.getName();
-        Object value = attribute.getValue();
-
-        if (name == null) {
-            throw new RuntimeOperationsException(new IllegalArgumentException("Attribute name cannot be null"), "Cannot invoke the setter of "
-                    + m_className
-                    + " with null attribute name");
-        }
-        // Check for a recognized attribute name and call the corresponding
-        // setter
-        //
-
-        PropertyField propertyField = (PropertyField) m_configMap.getPropertyFromName(name);
-        if (propertyField == null) {
-            // unrecognized attribute name:
-            throw new AttributeNotFoundException("Attribute " + name + " not found in " + m_className);
-        }
-        if (!propertyField.isWritable()) {
-            throw new InvalidAttributeValueException("Attribute " + name + " can not be setted");
-        }
-
-        if (value == null) {
-            try {
-                m_instanceManager.onSet(null, propertyField.getField(), null);
-            } catch (Exception e) {
-                throw new InvalidAttributeValueException("Cannot set attribute " + name + " to null");
-            }
-        } else { // if non null value, make sure it is assignable to the attribute
-            if (true /* TODO type.class.isAssignableFrom(value.getClass())*/) {
-                //propertyField.setValue(value);
-                // setValue(attributeField.getField(),null);
-                m_instanceManager.onSet(null, propertyField.getField(), value);
-            } else {
-                throw new InvalidAttributeValueException("Cannot set attribute "
-                        + name
-                        + " to a "
-                        + value.getClass().getName()
-                        + " object, String expected");
-            }
-        }
-
-    }
-
-    /** 
-     * setAttributes : change all the attributes value.
-     * @param attributes : list of attribute value to be changed
-     * @return AttributeList : list of new attribute
-     */
-    public AttributeList setAttributes(AttributeList attributes) {
-
-        //       Check attributes is not null to avoid NullPointerException later on
-        if (attributes == null) {
-            throw new RuntimeOperationsException(new IllegalArgumentException("AttributeList attributes cannot be null"),
-                    "Cannot invoke a setter of " + m_className);
-        }
-        AttributeList resultList = new AttributeList();
-
-        // if attributeNames is empty, nothing more to do
-        if (attributes.isEmpty()) {
-            return resultList;
-        }
-
-        // for each attribute, try to set it and add to the result list if
-        // successfull
-        for (Iterator i = attributes.iterator(); i.hasNext();) {
-            Attribute attr = (Attribute) i.next();
-            try {
-                setAttribute(attr);
-                String name = attr.getName();
-                Object value = getAttribute(name);
-                resultList.add(new Attribute(name, value));
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
-        return resultList;
-    }
-
-    /** 
-     * buildMBeanInfo : build the MBean information on initialization.
-     * this value don't change after
-     */
-    private void buildMBeanInfo() {
-        String dDescription = m_configMap.getDecription();
-
-        // generate infos for attributes
-        MBeanAttributeInfo[] dAttributes = null;
-
-        if (m_configMap == null) {
-            return;
-        }
-
-        if (m_configMap.getProperties() != null) {
-            List<MBeanAttributeInfo> lAttributes = null;
-            lAttributes = new ArrayList<MBeanAttributeInfo>();
-
-            Iterator<PropertyField> iterator = m_configMap.getProperties().iterator();
-            while (iterator.hasNext()) {
-                PropertyField propertyField = (PropertyField) iterator.next();
-                lAttributes.add(new MBeanAttributeInfo(propertyField.getName(), propertyField.getType(), propertyField.getDescription(),
-                        propertyField.isReadable(), propertyField.isWritable(), false));
-            }
-            dAttributes = (MBeanAttributeInfo[]) lAttributes.toArray(new MBeanAttributeInfo[lAttributes.size()]);
-        }
-
-        MBeanOperationInfo[] dOperations = null;
-        if (m_configMap.getMethods() != null) {
-
-            List<MBeanOperationInfo> lOperations = new ArrayList<MBeanOperationInfo>();
-
-            Iterator<MethodField[]> iterator = m_configMap.getMethods().iterator();
-            while (iterator.hasNext()) {
-                MethodField[] method = (MethodField[]) iterator.next();
-                for (int i = 0; i < method.length; i++) {
-                    lOperations.add(new MBeanOperationInfo(method[i].getName(), method[i].getDescription(), method[i].getParams(), method[i]
-                            .getReturnType(), MBeanOperationInfo.UNKNOWN));
-                }
-                dOperations = (MBeanOperationInfo[]) lOperations.toArray(new MBeanOperationInfo[lOperations.size()]);
-            }
-        }
-
-        MBeanNotificationInfo[] dNotification = new MBeanNotificationInfo[0];
-        if (m_configMap.getMethods() != null) {
-
-            List<MBeanNotificationInfo> lNotifications = new ArrayList<MBeanNotificationInfo>();
-
-            Iterator<NotificationField> iterator = m_configMap.getNotifications().iterator();
-            while (iterator.hasNext()) {
-                NotificationField notification = (NotificationField) iterator.next();
-                lNotifications.add(notification.getNotificationInfo());
-            }
-            dNotification = (MBeanNotificationInfo[]) lNotifications.toArray(new MBeanNotificationInfo[lNotifications.size()]);
-        }
-
-        m_mBeanInfo = new MBeanInfo(this.m_className, dDescription, dAttributes, null, // No constructor 
-                dOperations, dNotification);
-    }
-
-    /** 
-     * getNotificationInfo : get the notification informations (use by JMX).
-     * @return MBeanNotificationInfo[] : structure which describe the notifications 
-     */
-    public MBeanNotificationInfo[] getNotificationInfo() {
-        MBeanNotificationInfo[] dNotification = new MBeanNotificationInfo[0];
-        if (m_configMap.getMethods() != null) {
-
-            List<MBeanNotificationInfo> lNotifications = new ArrayList<MBeanNotificationInfo>();
-
-            Iterator<NotificationField> iterator = m_configMap.getNotifications().iterator();
-            while (iterator.hasNext()) {
-                NotificationField notification = (NotificationField) iterator.next();
-                lNotifications.add(notification.getNotificationInfo());
-            }
-            dNotification = (MBeanNotificationInfo[]) lNotifications.toArray(new MBeanNotificationInfo[lNotifications.size()]);
-        }
-        return dNotification;
-    }
-
-    /** 
-     * sendNotification : send a notification to a subscriver.
-     * @param msg : msg to send
-     * @param attributeName : name of the attribute
-     * @param attributeType : type of the attribute
-     * @param oldValue : oldvalue of the attribute
-     * @param newValue : new value of the attribute
-     */
-    public void sendNotification(String msg, String attributeName, String attributeType, Object oldValue, Object newValue) {
-
-        long timeStamp = System.currentTimeMillis();
-
-        if (newValue.equals(oldValue)) {
-            return;
-        }
-        m_sequenceNumber++;
-        Notification notification =
-                new AttributeChangeNotification(this, m_sequenceNumber, timeStamp, msg, attributeName, attributeType, oldValue, newValue);
-        sendNotification(notification);
-        m_instanceManager.getFactory().getLogger().log(Logger.INFO, "Notification sent");
-    }
-}
+/* 
+ * 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.felix.ipojo.handlers.jmx;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.management.Attribute;
+import javax.management.AttributeChangeNotification;
+import javax.management.AttributeList;
+import javax.management.AttributeNotFoundException;
+import javax.management.DynamicMBean;
+import javax.management.InvalidAttributeValueException;
+import javax.management.MBeanAttributeInfo;
+import javax.management.MBeanException;
+import javax.management.MBeanInfo;
+import javax.management.MBeanNotificationInfo;
+import javax.management.MBeanOperationInfo;
+import javax.management.Notification;
+import javax.management.NotificationBroadcasterSupport;
+import javax.management.ReflectionException;
+import javax.management.RuntimeOperationsException;
+
+import org.apache.felix.ipojo.InstanceManager;
+import org.apache.felix.ipojo.parser.MethodMetadata;
+import org.apache.felix.ipojo.util.Callback;
+import org.apache.felix.ipojo.util.Logger;
+
+/**
+ * This class implements iPOJO DynamicMBean. it builds the dynamic MBean
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class DynamicMBeanImpl extends NotificationBroadcasterSupport implements
+        DynamicMBean {
+
+    /**
+     * InstanceManager: use to store the InstanceManager instance.
+     */
+    protected final InstanceManager m_instanceManager;
+
+    /**
+     * JmxConfigDFieldMap : store the data extracted from metadata.xml.
+     */
+    private JmxConfigFieldMap m_configMap;
+
+    /**
+     * MBeanInfo : class wich store the MBean Informations.
+     */
+    private MBeanInfo m_mBeanInfo;
+
+    /**
+     * String : constant which store the name of the class.
+     */
+    private String m_className = this.getClass().getName();
+
+    /**
+     * sequenceNumber : use to calculate unique id to notification.
+     */
+    private int m_sequenceNumber = 0;
+
+    /**
+     * DynamicMBeanImpl : constructor.
+     * 
+     * @param properties
+     *            : data extracted from metadat.xml file
+     * @param instanceManager
+     *            : InstanceManager instance
+     */
+    public DynamicMBeanImpl(JmxConfigFieldMap properties,
+            InstanceManager instanceManager) {
+        m_configMap = properties;
+        m_instanceManager = instanceManager;
+        this.buildMBeanInfo();
+    }
+
+    /**
+     * getAttribute implements from JMX. get the value of the required attribute
+     * 
+     * @param arg0
+     *            name of required attribute
+     * @throws AttributeNotFoundException
+     *             : if the attribute doesn't exist
+     * @throws MBeanException
+     *             :
+     * @throws ReflectionException
+     *             :
+     * @return the object attribute
+     */
+    public Object getAttribute(String arg0) throws AttributeNotFoundException,
+        MBeanException, ReflectionException {
+        PropertyField attribute = m_configMap.getPropertyFromName(arg0);
+
+        if (attribute == null) {
+            throw new AttributeNotFoundException(arg0 + " not found");
+        } else {
+            return attribute.getValue();
+        }
+    }
+
+    /**
+     * getAttributes : implement from JMX. get values of reuqired attributes
+     * 
+     * @param attributeNames
+     *            : names of the required attributes
+     * @return return the list of the attribute
+     */
+    public AttributeList getAttributes(String[] attributeNames) {
+
+        if (attributeNames == null) {
+            throw new IllegalArgumentException(
+                "attributeNames[] cannot be null");
+        }
+
+        AttributeList resultList = new AttributeList();
+        for (int i = 0; i < attributeNames.length; i++) {
+            PropertyField propertyField = (PropertyField) m_configMap
+                .getPropertyFromField((String) attributeNames[i]);
+
+            if (propertyField != null) {
+                resultList.add(new Attribute(attributeNames[i], propertyField
+                    .getValue()));
+            }
+        }
+        return resultList;
+    }
+
+    /**
+     * getMBeanInfo : return the MBean Class builded.
+     * 
+     * @return return MBeanInfo class constructed by buildMBeanInfo
+     */
+    public MBeanInfo getMBeanInfo() {
+        return m_mBeanInfo;
+    }
+
+    /**
+     * invoke : invoke the required method on the targeted POJO.
+     * 
+     * @param operationName
+     *            : name of the method called
+     * @param params
+     *            : parameters given to the method
+     * @param signature
+     *            : determine which method called
+     * @return Object : the object return by the method
+     * @throws MBeanException
+     *             :
+     * @throws ReflectionException
+     *             :
+     */
+    public Object invoke(String operationName, Object[] params,
+            String[] signature) throws MBeanException, ReflectionException {
+
+        MethodField method = m_configMap.getMethodFromName(operationName,
+            signature);
+        if (method != null) {
+            MethodMetadata methodCall = method.getMethod();
+            Callback mc = new Callback(methodCall, m_instanceManager);
+            try {
+                return mc.call(params);
+            } catch (NoSuchMethodException e) {
+                System.err.println("No such method!: " + operationName);
+                e.printStackTrace();
+            } catch (IllegalAccessException e) {
+                System.err.println("Illegal Access Exception");
+                e.printStackTrace();
+            } catch (InvocationTargetException e) {
+                System.err.println("Invocation Target Exception");
+                e.printStackTrace();
+            }
+        } else {
+            throw new ReflectionException(new NoSuchMethodException(
+                operationName), "Cannot find the operation " + operationName
+                    + " in " + m_className);
+        }
+
+        return null;
+    }
+
+    /**
+     * setAttribute : change specified attribute value.
+     * 
+     * @param attribute
+     *            : attribute with new value to be changed
+     * @throws AttributeNotFoundException
+     *             : if the requiered attribute was not found
+     * @throws InvalidAttributeValueException
+     *             : the value is inccorrect type
+     * @throws MBeanException
+     *             :
+     * @throws ReflectionException
+     *             :
+     */
+    public void setAttribute(Attribute attribute)
+        throws AttributeNotFoundException, InvalidAttributeValueException,
+        MBeanException, ReflectionException {
+
+        // Check attribute is not null to avoid NullPointerException later on
+        if (attribute == null) {
+            throw new RuntimeOperationsException(new IllegalArgumentException(
+                "Attribute cannot be null"), "Cannot invoke a setter of "
+                    + m_className + " with null attribute");
+        }
+        String name = attribute.getName();
+        Object value = attribute.getValue();
+
+        if (name == null) {
+            throw new RuntimeOperationsException(new IllegalArgumentException(
+                "Attribute name cannot be null"),
+                "Cannot invoke the setter of " + m_className
+                        + " with null attribute name");
+        }
+        // Check for a recognized attribute name and call the corresponding
+        // setter
+        //
+
+        PropertyField propertyField = (PropertyField) m_configMap
+            .getPropertyFromName(name);
+        if (propertyField == null) {
+            // unrecognized attribute name:
+            throw new AttributeNotFoundException("Attribute " + name
+                    + " not found in " + m_className);
+        }
+        if (!propertyField.isWritable()) {
+            throw new InvalidAttributeValueException("Attribute " + name
+                    + " can not be setted");
+        }
+
+        if (value == null) {
+            try {
+                m_instanceManager.onSet(null, propertyField.getField(), null);
+            } catch (Exception e) {
+                throw new InvalidAttributeValueException(
+                    "Cannot set attribute " + name + " to null");
+            }
+        } else { // if non null value, make sure it is assignable to the
+            // attribute
+            if (true /* TODO type.class.isAssignableFrom(value.getClass()) */) {
+                // propertyField.setValue(value);
+                // setValue(attributeField.getField(),null);
+                m_instanceManager.onSet(null, propertyField.getField(), value);
+            } else {
+                throw new InvalidAttributeValueException(
+                    "Cannot set attribute " + name + " to a "
+                            + value.getClass().getName()
+                            + " object, String expected");
+            }
+        }
+
+    }
+
+    /**
+     * setAttributes : change all the attributes value.
+     * 
+     * @param attributes
+     *            : list of attribute value to be changed
+     * @return AttributeList : list of new attribute
+     */
+    public AttributeList setAttributes(AttributeList attributes) {
+
+        // Check attributes is not null to avoid NullPointerException later on
+        if (attributes == null) {
+            throw new RuntimeOperationsException(new IllegalArgumentException(
+                "AttributeList attributes cannot be null"),
+                "Cannot invoke a setter of " + m_className);
+        }
+        AttributeList resultList = new AttributeList();
+
+        // if attributeNames is empty, nothing more to do
+        if (attributes.isEmpty()) {
+            return resultList;
+        }
+
+        // for each attribute, try to set it and add to the result list if
+        // successfull
+        for (Iterator i = attributes.iterator(); i.hasNext();) {
+            Attribute attr = (Attribute) i.next();
+            try {
+                setAttribute(attr);
+                String name = attr.getName();
+                Object value = getAttribute(name);
+                resultList.add(new Attribute(name, value));
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        return resultList;
+    }
+
+    /**
+     * buildMBeanInfo : build the MBean information on initialization. this
+     * value don't change after
+     */
+    private void buildMBeanInfo() {
+        String dDescription = m_configMap.getDecription();
+
+        // generate infos for attributes
+        MBeanAttributeInfo[] dAttributes = null;
+
+        if (m_configMap == null) {
+            return;
+        }
+
+        if (m_configMap.getProperties() != null) {
+            List < MBeanAttributeInfo > lAttributes = null;
+            lAttributes = new ArrayList < MBeanAttributeInfo >();
+
+            Iterator < PropertyField > iterator = m_configMap.getProperties()
+                .iterator();
+            while (iterator.hasNext()) {
+                PropertyField propertyField = (PropertyField) iterator.next();
+                lAttributes.add(new MBeanAttributeInfo(propertyField.getName(),
+                    propertyField.getType(), propertyField.getDescription(),
+                    propertyField.isReadable(), propertyField.isWritable(),
+                    false));
+            }
+            dAttributes = (MBeanAttributeInfo[]) lAttributes
+                .toArray(new MBeanAttributeInfo[lAttributes.size()]);
+        }
+
+        MBeanOperationInfo[] dOperations = null;
+        if (m_configMap.getMethods() != null) {
+
+            List < MBeanOperationInfo > lOperations = new ArrayList < MBeanOperationInfo >();
+
+            Iterator < MethodField[] > iterator = m_configMap.getMethods()
+                .iterator();
+            while (iterator.hasNext()) {
+                MethodField[] method = (MethodField[]) iterator.next();
+                for (int i = 0; i < method.length; i++) {
+                    lOperations.add(new MBeanOperationInfo(method[i].getName(),
+                        method[i].getDescription(), method[i].getParams(),
+                        method[i].getReturnType(), MBeanOperationInfo.UNKNOWN));
+                }
+                dOperations = (MBeanOperationInfo[]) lOperations
+                    .toArray(new MBeanOperationInfo[lOperations.size()]);
+            }
+        }
+
+        MBeanNotificationInfo[] dNotification = new MBeanNotificationInfo[0];
+        if (m_configMap.getMethods() != null) {
+
+            List < MBeanNotificationInfo > lNotifications = new ArrayList < MBeanNotificationInfo >();
+
+            Iterator < NotificationField > iterator = m_configMap
+                .getNotifications().iterator();
+            while (iterator.hasNext()) {
+                NotificationField notification = (NotificationField) iterator
+                    .next();
+                lNotifications.add(notification.getNotificationInfo());
+            }
+            dNotification = (MBeanNotificationInfo[]) lNotifications
+                .toArray(new MBeanNotificationInfo[lNotifications.size()]);
+        }
+
+        m_mBeanInfo = new MBeanInfo(this.m_className, dDescription,
+            dAttributes, null, // No constructor
+            dOperations, dNotification);
+    }
+
+    /**
+     * getNotificationInfo : get the notification informations (use by JMX).
+     * 
+     * @return MBeanNotificationInfo[] : structure which describe the
+     *         notifications
+     */
+    public MBeanNotificationInfo[] getNotificationInfo() {
+        MBeanNotificationInfo[] dNotification = new MBeanNotificationInfo[0];
+        if (m_configMap.getMethods() != null) {
+
+            List < MBeanNotificationInfo > lNotifications = new ArrayList < MBeanNotificationInfo >();
+
+            Iterator < NotificationField > iterator = m_configMap
+                .getNotifications().iterator();
+            while (iterator.hasNext()) {
+                NotificationField notification = (NotificationField) iterator
+                    .next();
+                lNotifications.add(notification.getNotificationInfo());
+            }
+            dNotification = (MBeanNotificationInfo[]) lNotifications
+                .toArray(new MBeanNotificationInfo[lNotifications.size()]);
+        }
+        return dNotification;
+    }
+
+    /**
+     * sendNotification : send a notification to a subscriver.
+     * 
+     * @param msg
+     *            : msg to send
+     * @param attributeName
+     *            : name of the attribute
+     * @param attributeType
+     *            : type of the attribute
+     * @param oldValue
+     *            : oldvalue of the attribute
+     * @param newValue
+     *            : new value of the attribute
+     */
+    public void sendNotification(String msg, String attributeName,
+            String attributeType, Object oldValue, Object newValue) {
+
+        long timeStamp = System.currentTimeMillis();
+
+        if (newValue.equals(oldValue)) {
+            return;
+        }
+        m_sequenceNumber++;
+        Notification notification = new AttributeChangeNotification(this,
+            m_sequenceNumber, timeStamp, msg, attributeName, attributeType,
+            oldValue, newValue);
+        sendNotification(notification);
+        m_instanceManager.getFactory().getLogger().log(Logger.INFO,
+            "Notification sent");
+    }
+}

Added: felix/trunk/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanWRegisterImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanWRegisterImpl.java?rev=683898&view=auto
==============================================================================
--- felix/trunk/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanWRegisterImpl.java (added)
+++ felix/trunk/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanWRegisterImpl.java Fri Aug  8 01:01:01 2008
@@ -0,0 +1,183 @@
+/* 
+ * 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.felix.ipojo.handlers.jmx;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.management.MBeanRegistration;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.apache.felix.ipojo.InstanceManager;
+import org.apache.felix.ipojo.parser.MethodMetadata;
+import org.apache.felix.ipojo.util.Callback;
+
+/**
+ * This class implements a 'wide' iPOJO DynamicMBean that can perform actions
+ * before and after its registration and deregistration.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class DynamicMBeanWRegisterImpl extends DynamicMBeanImpl implements
+        MBeanRegistration {
+
+    /**
+     * preRegister method of MBeanRegistration interface.
+     */
+    private MethodMetadata m_preRegisterMeth;
+    /**
+     * postRegister method of MBeanRegistration interface.
+     */
+    private MethodMetadata m_postRegisterMeth;
+    /**
+     * preDeregister method of MBeanRegistration interface.
+     */
+    private MethodMetadata m_preDeregisterMeth;
+    /**
+     * postDeregister method of MBeanRegistration interface.
+     */
+    private MethodMetadata m_postDeregisterMeth;
+    /**
+     * Effective name of the MBean.
+     */
+    private ObjectName m_objName;
+
+    /**
+     * Constructs a new DynamicMBeanWRegisterImpl.
+     * 
+     * @param properties
+     *            data extracted from the metadata.xml
+     * @param instanceManager
+     *            the instance manager
+     * @param preRegisterMeth
+     *            the method to call before MBean registration
+     * @param postRegisterMeth
+     *            the method to call after MBean registration
+     * @param preDeregisterMeth
+     *            the method to call before MBean deregistration
+     * @param postDeregisterMeth
+     *            the method to call after MBean registration
+     */
+    public DynamicMBeanWRegisterImpl(JmxConfigFieldMap properties,
+            InstanceManager instanceManager, MethodMetadata preRegisterMeth,
+            MethodMetadata postRegisterMeth, MethodMetadata preDeregisterMeth,
+            MethodMetadata postDeregisterMeth) {
+        super(properties, instanceManager);
+
+        m_preRegisterMeth = preRegisterMeth;
+        m_postRegisterMeth = postRegisterMeth;
+        m_preDeregisterMeth = preDeregisterMeth;
+        m_postDeregisterMeth = postDeregisterMeth;
+    }
+
+    /**
+     * Return the MBean name used to register it.
+     * 
+     * @return the MBean name used to register it.
+     */
+    public ObjectName getObjectName() {
+        return m_objName;
+    }
+
+    /**
+     * This method is executed before the MBean registration.
+     * 
+     * @param server
+     *            the server on which the MBean will be registered
+     * @param name
+     *            the name of the MBean to expose
+     * @throws Exception
+     *             This exception will be caught by the MBean server and
+     *             re-thrown as an MBeanRegistrationException.
+     * @return the name with which the MBean will be registered
+     */
+    public ObjectName preRegister(MBeanServer server, ObjectName name)
+        throws Exception {
+        m_objName = (ObjectName) callMethod(m_preRegisterMeth,
+            MBeanHandler.PRE_REGISTER_METH_NAME, new Object[] { server, name });
+        return m_objName;
+    }
+
+    /**
+     * This method is executed after the MBean registration.
+     * 
+     * @param registrationDone
+     *            Indicates whether or not the MBean has been successfully
+     *            registered in the MBean server.
+     */
+    public void postRegister(Boolean registrationDone) {
+        callMethod(m_postRegisterMeth, MBeanHandler.POST_REGISTER_METH_NAME,
+            new Object[] { registrationDone });
+    }
+
+    /**
+     * This method is before after the MBean deregistration.
+     * 
+     * @throws Exception
+     *             This exception will be caught by the MBean server and
+     *             re-thrown as an MBeanRegistrationException.
+     */
+    public void preDeregister() throws Exception {
+        callMethod(m_preDeregisterMeth, MBeanHandler.PRE_DEREGISTER_METH_NAME,
+            null);
+    }
+
+    /**
+     * This method is executed after the MBean deregistration.
+     */
+    public void postDeregister() {
+        callMethod(m_postDeregisterMeth,
+            MBeanHandler.POST_DEREGISTER_METH_NAME, null);
+    }
+
+    /**
+     * Private method used to execute a given callback.
+     * 
+     * @param methodMetadata
+     *            the metadata description of the callback
+     * @param methodName
+     *            the name of the callback
+     * @param params
+     *            the parameters of the callback
+     * @return the object eventually returned by the callback, or null if
+     *         nothing's returned
+     */
+    private Object callMethod(MethodMetadata methodMetadata, String methodName,
+            Object[] params) {
+        Callback mc = new Callback(methodMetadata, m_instanceManager);
+        try {
+            if ((params == null) || (params.length == 0)) {
+                return mc.call();
+            } else {
+                return mc.call(params);
+            }
+        } catch (NoSuchMethodException e) {
+            // should never happen : method exists
+            System.err.println("No such method!: " + methodName);
+            e.printStackTrace();
+        } catch (IllegalAccessException e) {
+            System.err.println("Illegal Access Exception");
+            e.printStackTrace();
+        } catch (InvocationTargetException e) {
+            System.err.println("Invocation Target Exception");
+            e.printStackTrace();
+        }
+        return null;
+    }
+}

Added: felix/trunk/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXHandlerDescription.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXHandlerDescription.java?rev=683898&view=auto
==============================================================================
--- felix/trunk/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXHandlerDescription.java (added)
+++ felix/trunk/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXHandlerDescription.java Fri Aug  8 01:01:01 2008
@@ -0,0 +1,72 @@
+/* 
+ * 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.felix.ipojo.handlers.jmx;
+
+import org.apache.felix.ipojo.architecture.HandlerDescription;
+import org.apache.felix.ipojo.metadata.Attribute;
+import org.apache.felix.ipojo.metadata.Element;
+
+/**
+ * Description of the JMX handler.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class JMXHandlerDescription extends HandlerDescription {
+
+    /**
+     * The referenced handler.
+     */
+    private MBeanHandler m_handler;
+
+    /**
+     * Construct a new handler description for the given handler.
+     * 
+     * @param handler
+     *            the handler to describe
+     */
+    public JMXHandlerDescription(MBeanHandler handler) {
+        super(handler);
+        m_handler = handler;
+    }
+
+    /**
+     * Get handler information.
+     * 
+     * @return the handler information.
+     */
+    public Element getHandlerInfo() {
+        Element elem = super.getHandlerInfo();
+        elem.addAttribute(new Attribute("registered", Boolean
+            .toString(m_handler.isRegistered())));
+        elem.addAttribute(new Attribute("objectName", m_handler
+            .getUsedObjectName()));
+        if (m_handler.isUsesMOSGi()) {
+            String foundStr = null;
+
+            if (m_handler.isMOSGiExists()) {
+                foundStr = "found";
+            } else {
+                foundStr = "not_found";
+            }
+            elem.addAttribute(new Attribute("mosgi", foundStr));
+        }
+
+        return elem;
+    }
+}

Modified: felix/trunk/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/JmxConfigFieldMap.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/JmxConfigFieldMap.java?rev=683898&r1=683897&r2=683898&view=diff
==============================================================================
--- felix/trunk/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/JmxConfigFieldMap.java (original)
+++ felix/trunk/ipojo/handler/jmx/src/main/java/org/apache/felix/ipojo/handlers/jmx/JmxConfigFieldMap.java Fri Aug  8 01:01:01 2008
@@ -1,282 +1,320 @@
-/* 
- * 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.felix.ipojo.handlers.jmx;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-/** 
- * JmxConfigFieldMap : use to store the informations needed to build the Dynamic MBean.
- *  
- *  @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
- */
-public class JmxConfigFieldMap {
-
-    /** 
-     * m_properties : use to store the attributes exposed.
-     */
-    private Map < String, PropertyField > m_properties = new HashMap < String, PropertyField >();
-    /** 
-     * m_methods : use to store the methods exposed.
-     */
-    private Map < String, MethodField[] > m_methods = new HashMap < String, MethodField[] >();
-    /** 
-     * m_notification : use to store the notification allowed.
-     */
-    private Map < String, NotificationField > m_notifications = new HashMap < String, NotificationField >();
-    /** 
-     * m_description : description of the Mbean.
-     */
-    private String m_description;
-    
-    
-    /** 
-     * JmxConfigFieldMap : constructor.
-     */
-    public JmxConfigFieldMap() {
-        
-    }
-    
-    /** 
-     * getDescription : get the descritpion of the MBean.
-     * @return String : Decription of the MBean
-     */
-    public String getDecription() {
-        return m_description;
-    }
-    
-    /** 
-     * setDescription : set the descritpion of the MBean.
-     * @param description : String which describe the Mbean
-     */
-    public void setDescription(String description) {
-        this.m_description = description;
-    }
-    
-    /** 
-     * addPropertyFromName : add a new attribute exposed in the Mbean.
-     * @param name : name of the new property
-     * @param propertyField : Field which describe the property
-     */
-    public void addPropertyFromName(String name, PropertyField propertyField) {
-        m_properties.put(name, propertyField);
-    }
-    
-    /** 
-     * getProperties : get all of the properties exposed.
-     * @return : collection of all properties
-     */
-    public Collection<PropertyField> getProperties() {
-        if (m_properties != null) {
-            return m_properties.values();
-        } else {
-            return null;
-        }     
-    }
-    
-    /** 
-     * getPropertyFromName : get the property by the name.
-     * @param name : name of the requiered property
-     * @return PropertyField : the field requiered or null if is not found
-     */
-    public PropertyField getPropertyFromName(String name) {
-        PropertyField prop = m_properties.get(name);
-        return prop;
-    }
-    
-    /** 
-     * getPropertyFromField : get the property by the field.
-     * @param field : the requiered field
-     * @return PropertyField : 
-     */
-    public PropertyField getPropertyFromField(String field) {
-        PropertyField property = null;
-        Iterator<PropertyField> it = m_properties.values().iterator();
-        while (it.hasNext()) {
-            PropertyField p = it.next();
-            if (p.getField().compareTo(field) == 0) {
-                if (property != null) {
-                    System.err.println("a field already exist");
-                } else {
-                    property = p;
-                }
-            }
-        }
-        return property;   
-    }
-    
-    
-    /** 
-     * addMethodFromName : add a new method descriptor from its name.
-     * @param name : name of the method
-     * @param methodField : descritpion of the method
-     */
-    public void addMethodFromName(String name, MethodField methodField) {
-        MethodField[] mf;
-        if (!m_methods.containsKey(name)) {
-            mf = new MethodField[1];
-            mf[0] = methodField;
-        } else {
-            MethodField[] temp = m_methods.get(name);
-            mf = new MethodField[temp.length + 1];
-            for (int i = 0; i < temp.length; i++) {
-                mf[i] = temp[i];
-            }
-            mf[temp.length] = methodField;
-        }
-        m_methods.put(name, mf);
-    }
-    
-    /** 
-     * addMethodFromName : add new methods descriptors from one name.
-     * (the method muste have the same name but different signature).
-     * @param name : name of the method
-     * @param methodsField : descritpion of the methods
-     */
-    public void addMethodFromName(String name, MethodField[] methodsField) {
-        MethodField[] mf;
-        if (!m_methods.containsKey(name)) {
-            mf = methodsField;
-        } else {
-            MethodField[] temp = m_methods.get(name);
-            mf = new MethodField[temp.length + methodsField.length];
-            for (int i = 0; i < temp.length; i++) {
-                mf[i] = temp[i];
-            }
-            for (int i = 0; i < methodsField.length; i++) {
-                mf[i + temp.length] = methodsField[i];
-            }
-        }
-        m_methods.put(name, mf);
-    }
-    
-    /** 
-     * DynamicMBeanImpl : add methods from name and erase the older if exist.
-     * @param name : name of the method
-     * @param methodField : method to be added
-     */
-    public void overrideMethodFromName(String name, MethodField methodField) {
-        MethodField[] mf = new MethodField[1];
-        mf[0] = methodField;
-        m_methods.put(name, mf);
-    }
-    
-    /** 
-     * DynamicMBeanImpl : add methods from name and erase the older if exist.
-     * @param name : name of the method
-     * @param methodsField : array of methods to be added
-     */
-    public void overrideMethodFromName(String name, MethodField[] methodsField) {
-        m_methods.put(name, methodsField);  
-    }
-    
-    /** 
-     * getMethodFromName : return the metod(s) which are similar.
-     * @param name : name of requiered method
-     * @return MethodField[] : list of returned methods
-     */
-    public MethodField[] getMethodFromName(String name) {
-        MethodField[] prop = m_methods.get(name);
-        return prop;
-    }
-    
-    /** 
-     * getMethodFromName : get the method which the good signature.
-     * @param operationName : name of the method requiered
-     * @param signature : signature requiered
-     * @return MethodField : the method which the same signature or null if not found
-     */
-    public MethodField getMethodFromName(String operationName, String[] signature) {
-        MethodField[] methods = m_methods.get(operationName);
-        for (int i = 0; i < methods.length; i++) {
-            if (isSameSignature(signature, methods[i].getSignature())) {
-                return methods[i];
-            }
-        }
-        return null;
-    }
-    
-    /** 
-     * isSameSignature : compare two method signature.
-     * @param sig1 : first signature
-     * @param sig2 : second signature
-     * @return boolean : return true if the signature are similar
-     *                   fale else
-     */
-    private boolean isSameSignature(String[] sig1, String[] sig2) {
-        if (sig1.length != sig2.length) {
-            return false;
-        } else {
-            for (int i = 0; i < sig1.length; i++) {
-                if (!sig1[i].equals(sig2[i])) {
-                    return false;
-                }
-            }
-            
-        }
-        return true;
-    }
-    
-    /** 
-     * getMethods : return all methods store.
-     * @return Collection : collection of methodField[]
-     */
-    public Collection<MethodField[]> getMethods() {
-        if (m_methods != null) {
-            return m_methods.values();
-        } else {
-            return null;
-        }
-    }   
-    
-    /** 
-     * addNotificationFromName : add a notification .
-     * @param name : 
-     * @param notificationField :
-     */
-    public void addNotificationFromName(String name, NotificationField notificationField) {
-        m_notifications.put(name, notificationField);
-    }
-    
-    /** 
-     * getNotificationFromName : return the notification with requiered name.
-     * @param name : name requiered
-     * @return NotificationField : return the notification if exist, null else
-     */
-    public NotificationField getNotificationFromName(String name) {
-        NotificationField prop = m_notifications.get(name);
-        return prop;
-    }
-    
-    /** 
-     * getNotification : get all notifications define.
-     * @return Collection : return collection of NotificationField
-     */
-    public Collection<NotificationField> getNotifications() {
-        if (m_notifications != null) {
-            return m_notifications.values();
-        } else {
-            return null;
-        }
-    }
-}
+/* 
+ * 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.felix.ipojo.handlers.jmx;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * JmxConfigFieldMap : use to store the informations needed to build the Dynamic
+ * MBean.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class JmxConfigFieldMap {
+
+    /**
+     * m_properties : use to store the attributes exposed.
+     */
+    private Map < String, PropertyField > m_properties = new HashMap < String, PropertyField >();
+    /**
+     * m_methods : use to store the methods exposed.
+     */
+    private Map < String, MethodField[] > m_methods = new HashMap < String, MethodField[] >();
+    /**
+     * m_notification : use to store the notification allowed.
+     */
+    private Map < String, NotificationField > m_notifications = new HashMap < String, NotificationField >();
+    /**
+     * m_description : description of the Mbean.
+     */
+    private String m_description;
+
+    /**
+     * JmxConfigFieldMap : constructor.
+     */
+    public JmxConfigFieldMap() {
+
+    }
+
+    /**
+     * getDescription : get the descritpion of the MBean.
+     * 
+     * @return String : Decription of the MBean
+     */
+    public String getDecription() {
+        return m_description;
+    }
+
+    /**
+     * setDescription : set the descritpion of the MBean.
+     * 
+     * @param description
+     *            : String which describe the Mbean
+     */
+    public void setDescription(String description) {
+        this.m_description = description;
+    }
+
+    /**
+     * addPropertyFromName : add a new attribute exposed in the Mbean.
+     * 
+     * @param name
+     *            : name of the new property
+     * @param propertyField
+     *            : Field which describe the property
+     */
+    public void addPropertyFromName(String name, PropertyField propertyField) {
+        m_properties.put(name, propertyField);
+    }
+
+    /**
+     * getProperties : get all of the properties exposed.
+     * 
+     * @return : collection of all properties
+     */
+    public Collection < PropertyField > getProperties() {
+        if (m_properties != null) {
+            return m_properties.values();
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * getPropertyFromName : get the property by the name.
+     * 
+     * @param name
+     *            : name of the requiered property
+     * @return PropertyField : the field requiered or null if is not found
+     */
+    public PropertyField getPropertyFromName(String name) {
+        PropertyField prop = m_properties.get(name);
+        return prop;
+    }
+
+    /**
+     * getPropertyFromField : get the property by the field.
+     * 
+     * @param field
+     *            : the requiered field
+     * @return PropertyField :
+     */
+    public PropertyField getPropertyFromField(String field) {
+        PropertyField property = null;
+        Iterator < PropertyField > it = m_properties.values().iterator();
+        while (it.hasNext()) {
+            PropertyField p = it.next();
+            if (p.getField().compareTo(field) == 0) {
+                if (property != null) {
+                    System.err.println("a field already exist");
+                } else {
+                    property = p;
+                }
+            }
+        }
+        return property;
+    }
+
+    /**
+     * addMethodFromName : add a new method descriptor from its name.
+     * 
+     * @param name
+     *            : name of the method
+     * @param methodField
+     *            : descritpion of the method
+     */
+    public void addMethodFromName(String name, MethodField methodField) {
+        MethodField[] mf;
+        if (!m_methods.containsKey(name)) {
+            mf = new MethodField[1];
+            mf[0] = methodField;
+        } else {
+            MethodField[] temp = m_methods.get(name);
+            mf = new MethodField[temp.length + 1];
+            for (int i = 0; i < temp.length; i++) {
+                mf[i] = temp[i];
+            }
+            mf[temp.length] = methodField;
+        }
+        m_methods.put(name, mf);
+    }
+
+    /**
+     * addMethodFromName : add new methods descriptors from one name. (the
+     * method muste have the same name but different signature).
+     * 
+     * @param name
+     *            : name of the method
+     * @param methodsField
+     *            : descritpion of the methods
+     */
+    public void addMethodFromName(String name, MethodField[] methodsField) {
+        MethodField[] mf;
+        if (!m_methods.containsKey(name)) {
+            mf = methodsField;
+        } else {
+            MethodField[] temp = m_methods.get(name);
+            mf = new MethodField[temp.length + methodsField.length];
+            for (int i = 0; i < temp.length; i++) {
+                mf[i] = temp[i];
+            }
+            for (int i = 0; i < methodsField.length; i++) {
+                mf[i + temp.length] = methodsField[i];
+            }
+        }
+        m_methods.put(name, mf);
+    }
+
+    /**
+     * DynamicMBeanImpl : add methods from name and erase the older if exist.
+     * 
+     * @param name
+     *            : name of the method
+     * @param methodField
+     *            : method to be added
+     */
+    public void overrideMethodFromName(String name, MethodField methodField) {
+        MethodField[] mf = new MethodField[1];
+        mf[0] = methodField;
+        m_methods.put(name, mf);
+    }
+
+    /**
+     * DynamicMBeanImpl : add methods from name and erase the older if exist.
+     * 
+     * @param name
+     *            : name of the method
+     * @param methodsField
+     *            : array of methods to be added
+     */
+    public void overrideMethodFromName(String name, MethodField[] methodsField) {
+        m_methods.put(name, methodsField);
+    }
+
+    /**
+     * getMethodFromName : return the metod(s) which are similar.
+     * 
+     * @param name
+     *            : name of requiered method
+     * @return MethodField[] : list of returned methods
+     */
+    public MethodField[] getMethodFromName(String name) {
+        MethodField[] prop = m_methods.get(name);
+        return prop;
+    }
+
+    /**
+     * getMethodFromName : get the method which the good signature.
+     * 
+     * @param operationName
+     *            : name of the method requiered
+     * @param signature
+     *            : signature requiered
+     * @return MethodField : the method which the same signature or null if not
+     *         found
+     */
+    public MethodField getMethodFromName(String operationName,
+            String[] signature) {
+        MethodField[] methods = m_methods.get(operationName);
+        for (int i = 0; i < methods.length; i++) {
+            if (isSameSignature(signature, methods[i].getSignature())) {
+                return methods[i];
+            }
+        }
+        return null;
+    }
+
+    /**
+     * isSameSignature : compare two method signature.
+     * 
+     * @param sig1
+     *            : first signature
+     * @param sig2
+     *            : second signature
+     * @return boolean : return true if the signature are similar fale else
+     */
+    private boolean isSameSignature(String[] sig1, String[] sig2) {
+        if (sig1.length != sig2.length) {
+            return false;
+        } else {
+            for (int i = 0; i < sig1.length; i++) {
+                if (!sig1[i].equals(sig2[i])) {
+                    return false;
+                }
+            }
+
+        }
+        return true;
+    }
+
+    /**
+     * getMethods : return all methods store.
+     * 
+     * @return Collection : collection of methodField[]
+     */
+    public Collection < MethodField[] > getMethods() {
+        if (m_methods != null) {
+            return m_methods.values();
+        } else {
+            return null;
+        }
+    }
+
+    /**
+     * addNotificationFromName : add a notification .
+     * 
+     * @param name
+     *            :
+     * @param notificationField
+     *            :
+     */
+    public void addNotificationFromName(String name,
+            NotificationField notificationField) {
+        m_notifications.put(name, notificationField);
+    }
+
+    /**
+     * getNotificationFromName : return the notification with requiered name.
+     * 
+     * @param name
+     *            : name requiered
+     * @return NotificationField : return the notification if exist, null else
+     */
+    public NotificationField getNotificationFromName(String name) {
+        NotificationField prop = m_notifications.get(name);
+        return prop;
+    }
+
+    /**
+     * getNotification : get all notifications define.
+     * 
+     * @return Collection : return collection of NotificationField
+     */
+    public Collection < NotificationField > getNotifications() {
+        if (m_notifications != null) {
+            return m_notifications.values();
+        } else {
+            return null;
+        }
+    }
+}