[jboss-cvs] JBossAS SVN: r84399 - in projects/jboss-man/branches/Branch_2_1: managed/src/main/java/org/jboss/managed/plugins and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Feb 18 12:23:38 EST 2009
Author: scott.stark at jboss.org
Date: 2009-02-18 12:23:37 -0500 (Wed, 18 Feb 2009)
New Revision: 84399
Added:
projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/ManagedOperationMatcher.java
projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/
projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/ClassLoadingMXBeanMO.java
projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/GarbageCollectorMXBeanMO.java
projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/ManagementFactoryUtils.java
projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryMXBeanMO.java
projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryManagerMXBeanMO.java
projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryPoolMXBeanMO.java
projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/OperatingSystemMXBeanMO.java
projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/RuntimeMXBeanMO.java
projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/ThreadMXBeanMO.java
projects/jboss-man/branches/Branch_2_1/managed/src/test/java/org/jboss/test/managed/factory/test/PlatformMBeanUnitTestCase.java
Removed:
projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/ClassLoadingMXBeanMO.java
projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/GarbageCollectorMXBeanMO.java
projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/ManagementFactoryUtils.java
projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryMXBeanMO.java
projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryManagerMXBeanMO.java
projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryPoolMXBeanMO.java
projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/OperatingSystemMXBeanMO.java
projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/RuntimeMXBeanMO.java
projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/ThreadMXBeanMO.java
Modified:
projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/api/annotation/ManagementObject.java
projects/jboss-man/branches/Branch_2_1/managed/src/test/java/org/jboss/test/managed/factory/support/beans/ABeanMetaData.java
projects/jboss-man/branches/Branch_2_1/managed/src/test/java/org/jboss/test/managed/factory/support/beans/BeanMetaDataICF.java
projects/jboss-man/branches/Branch_2_1/managed/src/test/java/org/jboss/test/managed/factory/test/AbstractManagedObjectFactoryUnitTestCase.java
projects/jboss-man/branches/Branch_2_1/metatype/src/main/java/org/jboss/metatype/api/types/EnumMetaType.java
Log:
JBMAN-53, support for exposing platform mbeans as managed objects
Modified: projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/api/annotation/ManagementObject.java
===================================================================
--- projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/api/annotation/ManagementObject.java 2009-02-18 17:15:17 UTC (rev 84398)
+++ projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/api/annotation/ManagementObject.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -80,13 +80,9 @@
*/
ManagementOperation[] operations() default {};
-/*
- // The class to use for the ManagedProperty implementation
- Class<? extends ManagedProperty> propertyFactory() default NULL_PROPERTY_FACTORY.class;
- // The class to use for the ManagedProperty Fields implementation
- Class<? extends Fields> fieldsFactory() default NULL_FIELDS_FACTORY.class;
- // The constraints, allowed values populator factory
- Class<? extends ManagedPropertyConstraintsPopulatorFactory> constraintsFactory()
- default NULL_CONSTRAINTS.class;
-*/
+ /**
+ * An interface to use for reflection when determining properties/operations
+ * of the managed object.
+ */
+ Class<?> targetInterface() default Object.class;
}
Copied: projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/ManagedOperationMatcher.java (from rev 84365, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/ManagedOperationMatcher.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/ManagedOperationMatcher.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/ManagedOperationMatcher.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.managed.plugins;
+
+import java.util.Set;
+
+import org.jboss.managed.api.ManagedOperation;
+import org.jboss.managed.api.ManagedParameter;
+import org.jboss.metatype.api.types.MetaType;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class ManagedOperationMatcher
+{
+ public static ManagedOperation findOperation(Set<ManagedOperation> ops, String name,
+ MetaType... signature)
+ {
+ ManagedOperation match = null;
+ for(ManagedOperation op : ops)
+ {
+ if(op.getName().equals(name))
+ {
+ // Validate parameters
+ ManagedParameter[] params = op.getParameters();
+ if(params != null)
+ {
+ int paramLength = params.length;
+ int sigLength = signature.length;
+ if(paramLength != sigLength)
+ continue;
+
+ boolean sigMatches = true;
+ for(int n = 0; n < sigLength; n ++)
+ {
+ ManagedParameter mp = params[n];
+ MetaType mps = mp.getMetaType();
+ MetaType sig = signature[n];
+ if(mps.equals(sig) == false)
+ {
+ sigMatches = false;
+ break;
+ }
+ }
+ if(sigMatches)
+ {
+ // We have a match
+ match = op;
+ break;
+ }
+ }
+ else if(signature == null || signature.length == 0)
+ {
+ match = op;
+ break;
+ }
+ }
+ }
+ return match;
+ }
+}
Copied: projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx (from rev 84365, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/jmx)
Deleted: projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/ClassLoadingMXBeanMO.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/jmx/ClassLoadingMXBeanMO.java 2009-02-18 07:13:09 UTC (rev 84365)
+++ projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/ClassLoadingMXBeanMO.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.managed.plugins.jmx;
-
-import java.lang.management.ClassLoadingMXBean;
-import java.lang.management.ManagementFactory;
-
-import org.jboss.managed.api.annotation.ManagementComponent;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementProperty;
-
-/**
- * Stub class for the ClassLoadingMXBean interface that is marked up with
- * management annotations.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
- at ManagementObject(name=ManagementFactory.CLASS_LOADING_MXBEAN_NAME,
- componentType=@ManagementComponent(type="MBean", subtype="Platform"),
- targetInterface=ClassLoadingMXBean.class)
-public class ClassLoadingMXBeanMO implements ClassLoadingMXBean
-{
- @ManagementProperty(description="the number of currently loaded classes.")
- public int getLoadedClassCount()
- {
- return 0;
- }
-
- @ManagementProperty(description="the total number of classes loaded.")
- public long getTotalLoadedClassCount()
- {
- return 0;
- }
-
- @ManagementProperty(description="the total number of unloaded classes.")
- public long getUnloadedClassCount()
- {
- return 0;
- }
-
- @ManagementProperty(description="the verbose output flag for the class loading system.")
- public boolean isVerbose()
- {
- return false;
- }
-
- public void setVerbose(boolean value)
- {
- }
-}
Copied: projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/ClassLoadingMXBeanMO.java (from rev 84365, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/jmx/ClassLoadingMXBeanMO.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/ClassLoadingMXBeanMO.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/ClassLoadingMXBeanMO.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.managed.plugins.jmx;
+
+import java.lang.management.ClassLoadingMXBean;
+import java.lang.management.ManagementFactory;
+
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * Stub class for the ClassLoadingMXBean interface that is marked up with
+ * management annotations.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+ at ManagementObject(name=ManagementFactory.CLASS_LOADING_MXBEAN_NAME,
+ componentType=@ManagementComponent(type="MBean", subtype="Platform"),
+ targetInterface=ClassLoadingMXBean.class)
+public class ClassLoadingMXBeanMO implements ClassLoadingMXBean
+{
+ @ManagementProperty(description="the number of currently loaded classes.")
+ public int getLoadedClassCount()
+ {
+ return 0;
+ }
+
+ @ManagementProperty(description="the total number of classes loaded.")
+ public long getTotalLoadedClassCount()
+ {
+ return 0;
+ }
+
+ @ManagementProperty(description="the total number of unloaded classes.")
+ public long getUnloadedClassCount()
+ {
+ return 0;
+ }
+
+ @ManagementProperty(description="the verbose output flag for the class loading system.")
+ public boolean isVerbose()
+ {
+ return false;
+ }
+
+ public void setVerbose(boolean value)
+ {
+ }
+}
Deleted: projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/GarbageCollectorMXBeanMO.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/jmx/GarbageCollectorMXBeanMO.java 2009-02-18 07:13:09 UTC (rev 84365)
+++ projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/GarbageCollectorMXBeanMO.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -1,78 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.managed.plugins.jmx;
-
-import java.lang.management.GarbageCollectorMXBean;
-import java.lang.management.ManagementFactory;
-import java.lang.management.MemoryManagerMXBean;
-import java.lang.management.RuntimeMXBean;
-
-import org.jboss.managed.api.annotation.ManagementComponent;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementObjectID;
-import org.jboss.managed.api.annotation.ManagementProperty;
-
-/**
- * Stub class for the RuntimeMXBean interface that is marked up with
- * management annotations.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision$
- */
- at ManagementObject(
- componentType=@ManagementComponent(type="MBean", subtype="Platform"),
- targetInterface=GarbageCollectorMXBean.class)
-public class GarbageCollectorMXBeanMO implements GarbageCollectorMXBean
-{
-
- @ManagementProperty
- public long getCollectionCount()
- {
- return 0;
- }
-
- @ManagementProperty
- public long getCollectionTime()
- {
- return 0;
- }
-
- @ManagementProperty
- public String[] getMemoryPoolNames()
- {
- return null;
- }
-
- @ManagementProperty
- @ManagementObjectID(prefix=ManagementFactory.GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE)
- public String getName()
- {
- return null;
- }
-
- @ManagementProperty
- public boolean isValid()
- {
- return false;
- }
-
-}
Copied: projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/GarbageCollectorMXBeanMO.java (from rev 84365, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/jmx/GarbageCollectorMXBeanMO.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/GarbageCollectorMXBeanMO.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/GarbageCollectorMXBeanMO.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.managed.plugins.jmx;
+
+import java.lang.management.GarbageCollectorMXBean;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryManagerMXBean;
+import java.lang.management.RuntimeMXBean;
+
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * Stub class for the RuntimeMXBean interface that is marked up with
+ * management annotations.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+ at ManagementObject(
+ componentType=@ManagementComponent(type="MBean", subtype="Platform"),
+ targetInterface=GarbageCollectorMXBean.class)
+public class GarbageCollectorMXBeanMO implements GarbageCollectorMXBean
+{
+
+ @ManagementProperty
+ public long getCollectionCount()
+ {
+ return 0;
+ }
+
+ @ManagementProperty
+ public long getCollectionTime()
+ {
+ return 0;
+ }
+
+ @ManagementProperty
+ public String[] getMemoryPoolNames()
+ {
+ return null;
+ }
+
+ @ManagementProperty
+ @ManagementObjectID(prefix=ManagementFactory.GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE)
+ public String getName()
+ {
+ return null;
+ }
+
+ @ManagementProperty
+ public boolean isValid()
+ {
+ return false;
+ }
+
+}
Deleted: projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/ManagementFactoryUtils.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/jmx/ManagementFactoryUtils.java 2009-02-18 07:13:09 UTC (rev 84365)
+++ projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/ManagementFactoryUtils.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -1,303 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.managed.plugins.jmx;
-
-import java.lang.management.ClassLoadingMXBean;
-import java.lang.management.GarbageCollectorMXBean;
-import java.lang.management.ManagementFactory;
-import java.lang.management.MemoryMXBean;
-import java.lang.management.MemoryManagerMXBean;
-import java.lang.management.MemoryPoolMXBean;
-import java.lang.management.MemoryUsage;
-import java.lang.management.OperatingSystemMXBean;
-import java.lang.management.RuntimeMXBean;
-import java.lang.management.ThreadInfo;
-import java.lang.management.ThreadMXBean;
-import java.lang.reflect.AnnotatedElement;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import javax.management.openmbean.ArrayType;
-import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.CompositeDataSupport;
-import javax.management.openmbean.CompositeType;
-import javax.management.openmbean.OpenDataException;
-import javax.management.openmbean.OpenType;
-import javax.management.openmbean.SimpleType;
-
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.managed.api.factory.ManagedObjectFactory;
-import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
-import org.jboss.managed.plugins.factory.DefaultInstanceClassFactory;
-import org.jboss.managed.spi.factory.InstanceClassFactory;
-import org.jboss.metadata.plugins.loader.reflection.AnnotatedElementMetaDataLoader;
-import org.jboss.metadata.spi.MetaData;
-import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge;
-import org.jboss.metatype.api.types.ArrayMetaType;
-import org.jboss.metatype.api.types.CompositeMetaType;
-import org.jboss.metatype.api.types.EnumMetaType;
-import org.jboss.metatype.api.types.MetaType;
-import org.jboss.metatype.api.types.SimpleMetaType;
-import org.jboss.metatype.api.values.ArrayValue;
-import org.jboss.metatype.api.values.CompositeValue;
-import org.jboss.metatype.api.values.EnumValue;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.SimpleValue;
-
-/**
- * A utility class that created ManagedObjects for the jmx platform mbeans
- * returned by {@link java.lang.management.ManagementFactory}
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
-public class ManagementFactoryUtils
-{
- /**
- *
- * @param mof
- * @return
- */
- public static ManagedObject getClassLoadingMO(ManagedObjectFactory mof)
- {
- ClassLoadingMXBean mbean = ManagementFactory.getClassLoadingMXBean();
- ManagedObject mo = getMO(mbean, ClassLoadingMXBeanMO.class, mof);
- return mo;
- }
-
- public static ManagedObject getMemoryMXBean(ManagedObjectFactory mof)
- {
- MemoryMXBean mbean = ManagementFactory.getMemoryMXBean();
- ManagedObject mo = getMO(mbean, MemoryMXBeanMO.class, mof);
- return mo;
- }
-
- public static ManagedObject getOperatingSystemMXBean(ManagedObjectFactory mof)
- {
- OperatingSystemMXBean mbean = ManagementFactory.getOperatingSystemMXBean();
- ManagedObject mo = getMO(mbean, MemoryMXBeanMO.class, mof);
- return mo;
- }
-
- public static ManagedObject getThreadMXBean(ManagedObjectFactory mof)
- {
- ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
- ManagedObject mo = getMO(mbean, ThreadMXBeanMO.class, mof);
- return mo;
- }
-
- public static ManagedObject getRuntimeMXBean(ManagedObjectFactory mof)
- {
- RuntimeMXBean mbean = ManagementFactory.getRuntimeMXBean();
- ManagedObject mo = getMO(mbean, RuntimeMXBeanMO.class, mof);
- return mo;
- }
-
- public static List<ManagedObject> getMemoryManagerMXBeans(ManagedObjectFactory mof)
- {
- List<MemoryManagerMXBean> mbeans = ManagementFactory.getMemoryManagerMXBeans();
- ArrayList<ManagedObject> mos = new ArrayList<ManagedObject>();
- for(MemoryManagerMXBean mbean : mbeans)
- {
- ManagedObject mo = getMO(mbean, MemoryManagerMXBeanMO.class, mof);
- mos.add(mo);
- }
- return mos;
- }
-
- public static List<ManagedObject> getGarbageCollectorMXBeans(ManagedObjectFactory mof)
- {
- List<GarbageCollectorMXBean> mbeans = ManagementFactory.getGarbageCollectorMXBeans();
- ArrayList<ManagedObject> mos = new ArrayList<ManagedObject>();
- for(GarbageCollectorMXBean mbean : mbeans)
- {
- ManagedObject mo = getMO(mbean, GarbageCollectorMXBeanMO.class, mof);
- mos.add(mo);
- }
- return mos;
- }
-
- public static List<ManagedObject> getMemoryPoolMXBeans(ManagedObjectFactory mof)
- {
- List<MemoryPoolMXBean> mbeans = ManagementFactory.getMemoryPoolMXBeans();
- ArrayList<ManagedObject> mos = new ArrayList<ManagedObject>();
- for(MemoryPoolMXBean mbean : mbeans)
- {
- ManagedObject mo = getMO(mbean, MemoryPoolMXBeanMO.class, mof);
- mos.add(mo);
- }
- return mos;
- }
-
- /**
- * Unwrap a CompositeValue for a MemoryUsage instance into the MemoryUsage.
- *
- * @param mv - the CompositeValue meta value
- * @return the corresponding MemoryUsage instance
- */
- public static MemoryUsage unwrapMemoryUsage(CompositeValue mv)
- {
- SimpleValue committedSV = SimpleValue.class.cast(mv.get("committed"));
- SimpleValue initSV = SimpleValue.class.cast(mv.get("init"));
- SimpleValue maxSV = SimpleValue.class.cast(mv.get("max"));
- SimpleValue usedSV = SimpleValue.class.cast(mv.get("used"));
- long committed = (Long) committedSV.getValue();
- long init = (Long) initSV.getValue();
- long max = (Long) maxSV.getValue();
- long used = (Long) usedSV.getValue();
- MemoryUsage mu = new MemoryUsage(init, used, committed, max);
- return mu;
- }
-
- public static <I> ManagedObject getMO(I mbean, final Class<? extends I> c, ManagedObjectFactory mof)
- {
- AnnotatedElement mbeanClass = c;
- AnnotatedElementMetaDataLoader retrieval = new AnnotatedElementMetaDataLoader(mbeanClass);
- MetaData metaData = new MetaDataRetrievalToMetaDataBridge(retrieval);
- ManagedObject mo = mof.initManagedObject(mbean, c, metaData, null, null);
- return mo;
- }
-
- public static ThreadInfo unwrapThreadInfo(CompositeValue mv)
- throws OpenDataException, ClassNotFoundException
- {
- CompositeData cd = (CompositeData) getOpenValue(mv);
- ThreadInfo ti = ThreadInfo.from(cd);
- return ti;
- }
-
- private static OpenType getOpenType(MetaType type) throws OpenDataException
- {
- OpenType openType = null;
- if(type instanceof SimpleMetaType)
- openType = getOpenType(SimpleMetaType.class.cast(type));
- else if(type instanceof CompositeMetaType)
- openType = getOpenType(CompositeMetaType.class.cast(type));
- else if(type instanceof ArrayMetaType)
- openType = getOpenType(ArrayMetaType.class.cast(type));
- else if(type instanceof EnumMetaType)
- openType = SimpleType.STRING;
- else
- throw new OpenDataException("Unhandled MetaType: "+type);
- return openType;
- }
-
- private static OpenType getOpenType(SimpleMetaType type)
- {
- OpenType openType = null;
- if(type == SimpleMetaType.BOOLEAN)
- openType = SimpleType.BOOLEAN;
- else if(type == SimpleMetaType.LONG)
- openType = SimpleType.LONG;
- else if(type == SimpleMetaType.INTEGER)
- openType = SimpleType.INTEGER;
- else if(type == SimpleMetaType.SHORT)
- openType = SimpleType.SHORT;
- else if(type == SimpleMetaType.STRING)
- openType = SimpleType.STRING;
- return openType;
- }
- private static ArrayType getOpenType(ArrayMetaType type) throws OpenDataException
- {
- int dimension = type.getDimension();
- OpenType elementType = getOpenType(type.getElementType());
- ArrayType openType = new ArrayType(dimension, elementType);
- return openType;
- }
- private static CompositeType getOpenType(CompositeMetaType type)
- throws OpenDataException
- {
- String[] items = new String[type.itemSet().size()];
- type.itemSet().toArray(items);
- String[] descriptions = new String[type.itemSet().size()];
- OpenType[] itemTypes = new OpenType[items.length];
- for(int n = 0; n < items.length; n ++)
- {
- String item = items[n];
- descriptions[n] = type.getDescription(item);
- MetaType mt = type.getType(item);
- itemTypes[n] = getOpenType(mt);
- }
-
- CompositeType ct = new CompositeType(type.getTypeName(),
- type.getDescription(), items, descriptions, itemTypes);
- return ct;
- }
-
- private static Object getOpenValue(MetaValue mv) throws OpenDataException
- {
- Object openValue = null;
- if(mv instanceof SimpleValue)
- {
- SimpleValue sv = SimpleValue.class.cast(mv);
- openValue = sv.getValue();
- }
- else if(mv instanceof CompositeValue)
- {
- CompositeValue cv = CompositeValue.class.cast(mv);
- HashMap<String, Object> itemsMap = new HashMap<String, Object>();
- CompositeMetaType cmt = cv.getMetaType();
- String[] items = new String[cmt.itemSet().size()];
- Object[] itemValues = new Object[items.length];
- cmt.itemSet().toArray(items);
- for(int n = 0; n < items.length; n ++)
- {
- String item = items[n];
- MetaValue itemMV = cv.get(item);
- Object itemValue = null;
- if(itemMV != null )
- itemValue = getOpenValue(itemMV);
- itemValues[n] = itemValue;
- }
-
- CompositeType ct = getOpenType(cmt);
- CompositeDataSupport cd = new CompositeDataSupport(ct, items, itemValues);
- openValue = cd;
- }
- else if(mv instanceof ArrayValue)
- {
- ArrayValue av = ArrayValue.class.cast(mv);
- if(av.getMetaType().isPrimitiveArray() || av.getMetaType().isSimple())
- openValue = av.getValue();
- else if(av.getMetaType().getElementType().isComposite())
- {
- CompositeData[] cd = new CompositeData[av.getLength()];
- for(int n = 0; n < av.getLength(); n ++)
- {
- cd[n] = (CompositeData) getOpenValue(CompositeValue.class.cast(av.getValue(n)));
- }
- openValue = cd;
- }
- }
- else if(mv instanceof EnumValue)
- {
- EnumValue ev = EnumValue.class.cast(mv);
- openValue = ev.getValue();
- }
- else
- {
- throw new OpenDataException("Unhandled MetaValue: "+mv);
- }
- return openValue;
- }
-}
Copied: projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/ManagementFactoryUtils.java (from rev 84365, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/jmx/ManagementFactoryUtils.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/ManagementFactoryUtils.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/ManagementFactoryUtils.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -0,0 +1,303 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.managed.plugins.jmx;
+
+import java.lang.management.ClassLoadingMXBean;
+import java.lang.management.GarbageCollectorMXBean;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryMXBean;
+import java.lang.management.MemoryManagerMXBean;
+import java.lang.management.MemoryPoolMXBean;
+import java.lang.management.MemoryUsage;
+import java.lang.management.OperatingSystemMXBean;
+import java.lang.management.RuntimeMXBean;
+import java.lang.management.ThreadInfo;
+import java.lang.management.ThreadMXBean;
+import java.lang.reflect.AnnotatedElement;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.management.openmbean.ArrayType;
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeDataSupport;
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.OpenDataException;
+import javax.management.openmbean.OpenType;
+import javax.management.openmbean.SimpleType;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.plugins.factory.AbstractInstanceClassFactory;
+import org.jboss.managed.plugins.factory.DefaultInstanceClassFactory;
+import org.jboss.managed.spi.factory.InstanceClassFactory;
+import org.jboss.metadata.plugins.loader.reflection.AnnotatedElementMetaDataLoader;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge;
+import org.jboss.metatype.api.types.ArrayMetaType;
+import org.jboss.metatype.api.types.CompositeMetaType;
+import org.jboss.metatype.api.types.EnumMetaType;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.ArrayValue;
+import org.jboss.metatype.api.values.CompositeValue;
+import org.jboss.metatype.api.values.EnumValue;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValue;
+
+/**
+ * A utility class that created ManagedObjects for the jmx platform mbeans
+ * returned by {@link java.lang.management.ManagementFactory}
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class ManagementFactoryUtils
+{
+ /**
+ *
+ * @param mof
+ * @return
+ */
+ public static ManagedObject getClassLoadingMO(ManagedObjectFactory mof)
+ {
+ ClassLoadingMXBean mbean = ManagementFactory.getClassLoadingMXBean();
+ ManagedObject mo = getMO(mbean, ClassLoadingMXBeanMO.class, mof);
+ return mo;
+ }
+
+ public static ManagedObject getMemoryMXBean(ManagedObjectFactory mof)
+ {
+ MemoryMXBean mbean = ManagementFactory.getMemoryMXBean();
+ ManagedObject mo = getMO(mbean, MemoryMXBeanMO.class, mof);
+ return mo;
+ }
+
+ public static ManagedObject getOperatingSystemMXBean(ManagedObjectFactory mof)
+ {
+ OperatingSystemMXBean mbean = ManagementFactory.getOperatingSystemMXBean();
+ ManagedObject mo = getMO(mbean, MemoryMXBeanMO.class, mof);
+ return mo;
+ }
+
+ public static ManagedObject getThreadMXBean(ManagedObjectFactory mof)
+ {
+ ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
+ ManagedObject mo = getMO(mbean, ThreadMXBeanMO.class, mof);
+ return mo;
+ }
+
+ public static ManagedObject getRuntimeMXBean(ManagedObjectFactory mof)
+ {
+ RuntimeMXBean mbean = ManagementFactory.getRuntimeMXBean();
+ ManagedObject mo = getMO(mbean, RuntimeMXBeanMO.class, mof);
+ return mo;
+ }
+
+ public static List<ManagedObject> getMemoryManagerMXBeans(ManagedObjectFactory mof)
+ {
+ List<MemoryManagerMXBean> mbeans = ManagementFactory.getMemoryManagerMXBeans();
+ ArrayList<ManagedObject> mos = new ArrayList<ManagedObject>();
+ for(MemoryManagerMXBean mbean : mbeans)
+ {
+ ManagedObject mo = getMO(mbean, MemoryManagerMXBeanMO.class, mof);
+ mos.add(mo);
+ }
+ return mos;
+ }
+
+ public static List<ManagedObject> getGarbageCollectorMXBeans(ManagedObjectFactory mof)
+ {
+ List<GarbageCollectorMXBean> mbeans = ManagementFactory.getGarbageCollectorMXBeans();
+ ArrayList<ManagedObject> mos = new ArrayList<ManagedObject>();
+ for(GarbageCollectorMXBean mbean : mbeans)
+ {
+ ManagedObject mo = getMO(mbean, GarbageCollectorMXBeanMO.class, mof);
+ mos.add(mo);
+ }
+ return mos;
+ }
+
+ public static List<ManagedObject> getMemoryPoolMXBeans(ManagedObjectFactory mof)
+ {
+ List<MemoryPoolMXBean> mbeans = ManagementFactory.getMemoryPoolMXBeans();
+ ArrayList<ManagedObject> mos = new ArrayList<ManagedObject>();
+ for(MemoryPoolMXBean mbean : mbeans)
+ {
+ ManagedObject mo = getMO(mbean, MemoryPoolMXBeanMO.class, mof);
+ mos.add(mo);
+ }
+ return mos;
+ }
+
+ /**
+ * Unwrap a CompositeValue for a MemoryUsage instance into the MemoryUsage.
+ *
+ * @param mv - the CompositeValue meta value
+ * @return the corresponding MemoryUsage instance
+ */
+ public static MemoryUsage unwrapMemoryUsage(CompositeValue mv)
+ {
+ SimpleValue committedSV = SimpleValue.class.cast(mv.get("committed"));
+ SimpleValue initSV = SimpleValue.class.cast(mv.get("init"));
+ SimpleValue maxSV = SimpleValue.class.cast(mv.get("max"));
+ SimpleValue usedSV = SimpleValue.class.cast(mv.get("used"));
+ long committed = (Long) committedSV.getValue();
+ long init = (Long) initSV.getValue();
+ long max = (Long) maxSV.getValue();
+ long used = (Long) usedSV.getValue();
+ MemoryUsage mu = new MemoryUsage(init, used, committed, max);
+ return mu;
+ }
+
+ public static <I> ManagedObject getMO(I mbean, final Class<? extends I> c, ManagedObjectFactory mof)
+ {
+ AnnotatedElement mbeanClass = c;
+ AnnotatedElementMetaDataLoader retrieval = new AnnotatedElementMetaDataLoader(mbeanClass);
+ MetaData metaData = new MetaDataRetrievalToMetaDataBridge(retrieval);
+ ManagedObject mo = mof.initManagedObject(mbean, c, metaData, null, null);
+ return mo;
+ }
+
+ public static ThreadInfo unwrapThreadInfo(CompositeValue mv)
+ throws OpenDataException, ClassNotFoundException
+ {
+ CompositeData cd = (CompositeData) getOpenValue(mv);
+ ThreadInfo ti = ThreadInfo.from(cd);
+ return ti;
+ }
+
+ private static OpenType getOpenType(MetaType type) throws OpenDataException
+ {
+ OpenType openType = null;
+ if(type instanceof SimpleMetaType)
+ openType = getOpenType(SimpleMetaType.class.cast(type));
+ else if(type instanceof CompositeMetaType)
+ openType = getOpenType(CompositeMetaType.class.cast(type));
+ else if(type instanceof ArrayMetaType)
+ openType = getOpenType(ArrayMetaType.class.cast(type));
+ else if(type instanceof EnumMetaType)
+ openType = SimpleType.STRING;
+ else
+ throw new OpenDataException("Unhandled MetaType: "+type);
+ return openType;
+ }
+
+ private static OpenType getOpenType(SimpleMetaType type)
+ {
+ OpenType openType = null;
+ if(type == SimpleMetaType.BOOLEAN)
+ openType = SimpleType.BOOLEAN;
+ else if(type == SimpleMetaType.LONG)
+ openType = SimpleType.LONG;
+ else if(type == SimpleMetaType.INTEGER)
+ openType = SimpleType.INTEGER;
+ else if(type == SimpleMetaType.SHORT)
+ openType = SimpleType.SHORT;
+ else if(type == SimpleMetaType.STRING)
+ openType = SimpleType.STRING;
+ return openType;
+ }
+ private static ArrayType getOpenType(ArrayMetaType type) throws OpenDataException
+ {
+ int dimension = type.getDimension();
+ OpenType elementType = getOpenType(type.getElementType());
+ ArrayType openType = new ArrayType(dimension, elementType);
+ return openType;
+ }
+ private static CompositeType getOpenType(CompositeMetaType type)
+ throws OpenDataException
+ {
+ String[] items = new String[type.itemSet().size()];
+ type.itemSet().toArray(items);
+ String[] descriptions = new String[type.itemSet().size()];
+ OpenType[] itemTypes = new OpenType[items.length];
+ for(int n = 0; n < items.length; n ++)
+ {
+ String item = items[n];
+ descriptions[n] = type.getDescription(item);
+ MetaType mt = type.getType(item);
+ itemTypes[n] = getOpenType(mt);
+ }
+
+ CompositeType ct = new CompositeType(type.getTypeName(),
+ type.getDescription(), items, descriptions, itemTypes);
+ return ct;
+ }
+
+ private static Object getOpenValue(MetaValue mv) throws OpenDataException
+ {
+ Object openValue = null;
+ if(mv instanceof SimpleValue)
+ {
+ SimpleValue sv = SimpleValue.class.cast(mv);
+ openValue = sv.getValue();
+ }
+ else if(mv instanceof CompositeValue)
+ {
+ CompositeValue cv = CompositeValue.class.cast(mv);
+ HashMap<String, Object> itemsMap = new HashMap<String, Object>();
+ CompositeMetaType cmt = cv.getMetaType();
+ String[] items = new String[cmt.itemSet().size()];
+ Object[] itemValues = new Object[items.length];
+ cmt.itemSet().toArray(items);
+ for(int n = 0; n < items.length; n ++)
+ {
+ String item = items[n];
+ MetaValue itemMV = cv.get(item);
+ Object itemValue = null;
+ if(itemMV != null )
+ itemValue = getOpenValue(itemMV);
+ itemValues[n] = itemValue;
+ }
+
+ CompositeType ct = getOpenType(cmt);
+ CompositeDataSupport cd = new CompositeDataSupport(ct, items, itemValues);
+ openValue = cd;
+ }
+ else if(mv instanceof ArrayValue)
+ {
+ ArrayValue av = ArrayValue.class.cast(mv);
+ if(av.getMetaType().isPrimitiveArray() || av.getMetaType().isSimple())
+ openValue = av.getValue();
+ else if(av.getMetaType().getElementType().isComposite())
+ {
+ CompositeData[] cd = new CompositeData[av.getLength()];
+ for(int n = 0; n < av.getLength(); n ++)
+ {
+ cd[n] = (CompositeData) getOpenValue(CompositeValue.class.cast(av.getValue(n)));
+ }
+ openValue = cd;
+ }
+ }
+ else if(mv instanceof EnumValue)
+ {
+ EnumValue ev = EnumValue.class.cast(mv);
+ openValue = ev.getValue();
+ }
+ else
+ {
+ throw new OpenDataException("Unhandled MetaValue: "+mv);
+ }
+ return openValue;
+ }
+}
Deleted: projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryMXBeanMO.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryMXBeanMO.java 2009-02-18 07:13:09 UTC (rev 84365)
+++ projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryMXBeanMO.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -1,79 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.managed.plugins.jmx;
-
-import java.lang.management.ManagementFactory;
-import java.lang.management.MemoryMXBean;
-import java.lang.management.MemoryUsage;
-
-import org.jboss.managed.api.annotation.ManagementComponent;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementOperation;
-import org.jboss.managed.api.annotation.ManagementProperty;
-
-/**
- * Stub class for the MemoryMXBean interface that is marked up with
- * management annotations.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
- at ManagementObject(name=ManagementFactory.MEMORY_MXBEAN_NAME,
- componentType=@ManagementComponent(type="MBean", subtype="Platform"),
- targetInterface=MemoryMXBean.class)
-public class MemoryMXBeanMO implements MemoryMXBean
-{
-
- @ManagementOperation(description="Runs the garbage collector")
- public void gc()
- {
- }
-
- @ManagementProperty(description="object representing the heap memory usage.")
- public MemoryUsage getHeapMemoryUsage()
- {
- return null;
- }
-
- @ManagementProperty(description="object representing the non-heap memory usage.")
- public MemoryUsage getNonHeapMemoryUsage()
- {
- return null;
- }
-
- @ManagementProperty(description="the approximate number objects for which finalization is pending.")
- public int getObjectPendingFinalizationCount()
- {
- return 0;
- }
-
- @ManagementProperty(description="the verbose output flag for the memory system.")
- public boolean isVerbose()
- {
- return false;
- }
-
- public void setVerbose(boolean value)
- {
- }
-
-}
Copied: projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryMXBeanMO.java (from rev 84365, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryMXBeanMO.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryMXBeanMO.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryMXBeanMO.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.managed.plugins.jmx;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryMXBean;
+import java.lang.management.MemoryUsage;
+
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementOperation;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * Stub class for the MemoryMXBean interface that is marked up with
+ * management annotations.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+ at ManagementObject(name=ManagementFactory.MEMORY_MXBEAN_NAME,
+ componentType=@ManagementComponent(type="MBean", subtype="Platform"),
+ targetInterface=MemoryMXBean.class)
+public class MemoryMXBeanMO implements MemoryMXBean
+{
+
+ @ManagementOperation(description="Runs the garbage collector")
+ public void gc()
+ {
+ }
+
+ @ManagementProperty(description="object representing the heap memory usage.")
+ public MemoryUsage getHeapMemoryUsage()
+ {
+ return null;
+ }
+
+ @ManagementProperty(description="object representing the non-heap memory usage.")
+ public MemoryUsage getNonHeapMemoryUsage()
+ {
+ return null;
+ }
+
+ @ManagementProperty(description="the approximate number objects for which finalization is pending.")
+ public int getObjectPendingFinalizationCount()
+ {
+ return 0;
+ }
+
+ @ManagementProperty(description="the verbose output flag for the memory system.")
+ public boolean isVerbose()
+ {
+ return false;
+ }
+
+ public void setVerbose(boolean value)
+ {
+ }
+
+}
Deleted: projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryManagerMXBeanMO.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryManagerMXBeanMO.java 2009-02-18 07:13:09 UTC (rev 84365)
+++ projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryManagerMXBeanMO.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -1,64 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.managed.plugins.jmx;
-
-import java.lang.management.ManagementFactory;
-import java.lang.management.MemoryManagerMXBean;
-
-import org.jboss.managed.api.annotation.ManagementComponent;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementProperty;
-import org.jboss.managed.api.annotation.ManagementObjectID;
-
-/**
- * Stub class for the MemoryManagerMXBean interface that is marked up with
- * management annotations.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
- at ManagementObject(
- componentType=@ManagementComponent(type="MBean", subtype="Platform"),
- targetInterface=MemoryManagerMXBean.class)
-public class MemoryManagerMXBeanMO implements MemoryManagerMXBean
-{
-
- @ManagementProperty
- public String[] getMemoryPoolNames()
- {
- return null;
- }
-
- @ManagementProperty
- @ManagementObjectID(prefix=ManagementFactory.MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE)
- public String getName()
- {
- return null;
- }
-
- @ManagementProperty
- public boolean isValid()
- {
- return false;
- }
-
-}
Copied: projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryManagerMXBeanMO.java (from rev 84365, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryManagerMXBeanMO.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryManagerMXBeanMO.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryManagerMXBeanMO.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.managed.plugins.jmx;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryManagerMXBean;
+
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+
+/**
+ * Stub class for the MemoryManagerMXBean interface that is marked up with
+ * management annotations.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+ at ManagementObject(
+ componentType=@ManagementComponent(type="MBean", subtype="Platform"),
+ targetInterface=MemoryManagerMXBean.class)
+public class MemoryManagerMXBeanMO implements MemoryManagerMXBean
+{
+
+ @ManagementProperty
+ public String[] getMemoryPoolNames()
+ {
+ return null;
+ }
+
+ @ManagementProperty
+ @ManagementObjectID(prefix=ManagementFactory.MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE)
+ public String getName()
+ {
+ return null;
+ }
+
+ @ManagementProperty
+ public boolean isValid()
+ {
+ return false;
+ }
+
+}
Deleted: projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryPoolMXBeanMO.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryPoolMXBeanMO.java 2009-02-18 07:13:09 UTC (rev 84365)
+++ projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryPoolMXBeanMO.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -1,174 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.managed.plugins.jmx;
-
-import java.lang.management.ManagementFactory;
-import java.lang.management.MemoryPoolMXBean;
-import java.lang.management.MemoryType;
-import java.lang.management.MemoryUsage;
-
-import org.jboss.managed.api.annotation.ManagementComponent;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementObjectID;
-import org.jboss.managed.api.annotation.ManagementOperation;
-import org.jboss.managed.api.annotation.ManagementProperty;
-
-/**
- * Stub class for the MemoryPoolMXBean interface that is marked up with
- * management annotations.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
- at ManagementObject(
- componentType=@ManagementComponent(type="MBean", subtype="Platform"),
- targetInterface=MemoryPoolMXBean.class)
-public class MemoryPoolMXBeanMO implements MemoryPoolMXBean
-{
-
- @ManagementProperty
- public MemoryUsage getCollectionUsage()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @ManagementProperty
- public long getCollectionUsageThreshold()
- {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @ManagementProperty
- public long getCollectionUsageThresholdCount()
- {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @ManagementProperty
- public String[] getMemoryManagerNames()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @ManagementProperty
- @ManagementObjectID(prefix=ManagementFactory.MEMORY_POOL_MXBEAN_DOMAIN_TYPE)
- public String getName()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @ManagementProperty
- public MemoryUsage getPeakUsage()
- {
- return null;
- }
-
- @ManagementProperty
- public MemoryType getType()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @ManagementProperty
- public MemoryUsage getUsage()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @ManagementProperty
- public long getUsageThreshold()
- {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @ManagementProperty
- public long getUsageThresholdCount()
- {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @ManagementProperty
- public boolean isCollectionUsageThresholdExceeded()
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- @ManagementProperty
- public boolean isCollectionUsageThresholdSupported()
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- @ManagementProperty
- public boolean isUsageThresholdExceeded()
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- @ManagementProperty
- public boolean isUsageThresholdSupported()
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- @ManagementProperty
- public boolean isValid()
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- @ManagementOperation
- public void resetPeakUsage()
- {
- // TODO Auto-generated method stub
-
- }
-
- @ManagementProperty
- public void setCollectionUsageThreshold(long threhsold)
- {
- // TODO Auto-generated method stub
-
- }
-
- @ManagementProperty
- public void setUsageThreshold(long threshold)
- {
- // TODO Auto-generated method stub
-
- }
-
-}
Copied: projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryPoolMXBeanMO.java (from rev 84365, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryPoolMXBeanMO.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryPoolMXBeanMO.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/MemoryPoolMXBeanMO.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -0,0 +1,174 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.managed.plugins.jmx;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryPoolMXBean;
+import java.lang.management.MemoryType;
+import java.lang.management.MemoryUsage;
+
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementObjectID;
+import org.jboss.managed.api.annotation.ManagementOperation;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * Stub class for the MemoryPoolMXBean interface that is marked up with
+ * management annotations.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+ at ManagementObject(
+ componentType=@ManagementComponent(type="MBean", subtype="Platform"),
+ targetInterface=MemoryPoolMXBean.class)
+public class MemoryPoolMXBeanMO implements MemoryPoolMXBean
+{
+
+ @ManagementProperty
+ public MemoryUsage getCollectionUsage()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @ManagementProperty
+ public long getCollectionUsageThreshold()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @ManagementProperty
+ public long getCollectionUsageThresholdCount()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @ManagementProperty
+ public String[] getMemoryManagerNames()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @ManagementProperty
+ @ManagementObjectID(prefix=ManagementFactory.MEMORY_POOL_MXBEAN_DOMAIN_TYPE)
+ public String getName()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @ManagementProperty
+ public MemoryUsage getPeakUsage()
+ {
+ return null;
+ }
+
+ @ManagementProperty
+ public MemoryType getType()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @ManagementProperty
+ public MemoryUsage getUsage()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @ManagementProperty
+ public long getUsageThreshold()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @ManagementProperty
+ public long getUsageThresholdCount()
+ {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @ManagementProperty
+ public boolean isCollectionUsageThresholdExceeded()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @ManagementProperty
+ public boolean isCollectionUsageThresholdSupported()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @ManagementProperty
+ public boolean isUsageThresholdExceeded()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @ManagementProperty
+ public boolean isUsageThresholdSupported()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @ManagementProperty
+ public boolean isValid()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @ManagementOperation
+ public void resetPeakUsage()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @ManagementProperty
+ public void setCollectionUsageThreshold(long threhsold)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @ManagementProperty
+ public void setUsageThreshold(long threshold)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Deleted: projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/OperatingSystemMXBeanMO.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/jmx/OperatingSystemMXBeanMO.java 2009-02-18 07:13:09 UTC (rev 84365)
+++ projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/OperatingSystemMXBeanMO.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.managed.plugins.jmx;
-
-import java.lang.management.ManagementFactory;
-import java.lang.management.OperatingSystemMXBean;
-
-import org.jboss.managed.api.annotation.ManagementComponent;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementProperty;
-
-/**
- * Stub class for the OperatingSystemMXBean interface that is marked up with
- * management annotations.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
- at ManagementObject(name=ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME,
- componentType=@ManagementComponent(type="MBean", subtype="Platform"),
- targetInterface=OperatingSystemMXBean.class)
-public class OperatingSystemMXBeanMO implements OperatingSystemMXBean
-{
- @ManagementProperty(description="the operating system architecture.")
- public String getArch()
- {
- return null;
- }
-
- @ManagementProperty(description="the number of processors available to the virtual machine; never smaller than one.")
- public int getAvailableProcessors()
- {
- return 0;
- }
-
- @ManagementProperty(description="the operating system name.")
- public String getName()
- {
- return null;
- }
-
- @ManagementProperty(description="the operating system version.")
- public String getVersion()
- {
- return null;
- }
-
-}
Copied: projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/OperatingSystemMXBeanMO.java (from rev 84365, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/jmx/OperatingSystemMXBeanMO.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/OperatingSystemMXBeanMO.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/OperatingSystemMXBeanMO.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.managed.plugins.jmx;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.OperatingSystemMXBean;
+
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * Stub class for the OperatingSystemMXBean interface that is marked up with
+ * management annotations.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+ at ManagementObject(name=ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME,
+ componentType=@ManagementComponent(type="MBean", subtype="Platform"),
+ targetInterface=OperatingSystemMXBean.class)
+public class OperatingSystemMXBeanMO implements OperatingSystemMXBean
+{
+ @ManagementProperty(description="the operating system architecture.")
+ public String getArch()
+ {
+ return null;
+ }
+
+ @ManagementProperty(description="the number of processors available to the virtual machine; never smaller than one.")
+ public int getAvailableProcessors()
+ {
+ return 0;
+ }
+
+ @ManagementProperty(description="the operating system name.")
+ public String getName()
+ {
+ return null;
+ }
+
+ @ManagementProperty(description="the operating system version.")
+ public String getVersion()
+ {
+ return null;
+ }
+
+}
Deleted: projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/RuntimeMXBeanMO.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/jmx/RuntimeMXBeanMO.java 2009-02-18 07:13:09 UTC (rev 84365)
+++ projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/RuntimeMXBeanMO.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -1,141 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.managed.plugins.jmx;
-
-import java.lang.management.ManagementFactory;
-import java.lang.management.RuntimeMXBean;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.managed.api.annotation.ManagementComponent;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementProperty;
-
-/**
- * Stub class for the RuntimeMXBean interface that is marked up with
- * management annotations.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
- at ManagementObject(name=ManagementFactory.RUNTIME_MXBEAN_NAME,
- componentType=@ManagementComponent(type="MBean", subtype="Platform"),
- targetInterface=RuntimeMXBean.class)
-public class RuntimeMXBeanMO implements RuntimeMXBean
-{
- @ManagementProperty
- public String getBootClassPath()
- {
- return null;
- }
-
- @ManagementProperty
- public String getClassPath()
- {
- return null;
- }
-
- @ManagementProperty
- public List<String> getInputArguments()
- {
- return null;
- }
-
- @ManagementProperty
- public String getLibraryPath()
- {
- return null;
- }
-
- @ManagementProperty
- public String getManagementSpecVersion()
- {
- return null;
- }
-
- @ManagementProperty
- public String getName()
- {
- return null;
- }
-
- @ManagementProperty
- public String getSpecName()
- {
- return null;
- }
-
- @ManagementProperty
- public String getSpecVendor()
- {
- return null;
- }
-
- @ManagementProperty
- public String getSpecVersion()
- {
- return null;
- }
-
- @ManagementProperty
- public long getStartTime()
- {
- return 0;
- }
-
- @ManagementProperty
- public Map<String, String> getSystemProperties()
- {
- return null;
- }
-
- @ManagementProperty
- public long getUptime()
- {
- return 0;
- }
-
- @ManagementProperty
- public String getVmName()
- {
- return null;
- }
-
- @ManagementProperty
- public String getVmVendor()
- {
- return null;
- }
-
- @ManagementProperty
- public String getVmVersion()
- {
- return null;
- }
-
- @ManagementProperty
- public boolean isBootClassPathSupported()
- {
- return false;
- }
-
-}
Copied: projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/RuntimeMXBeanMO.java (from rev 84365, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/jmx/RuntimeMXBeanMO.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/RuntimeMXBeanMO.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/RuntimeMXBeanMO.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -0,0 +1,141 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.managed.plugins.jmx;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.RuntimeMXBean;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * Stub class for the RuntimeMXBean interface that is marked up with
+ * management annotations.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+ at ManagementObject(name=ManagementFactory.RUNTIME_MXBEAN_NAME,
+ componentType=@ManagementComponent(type="MBean", subtype="Platform"),
+ targetInterface=RuntimeMXBean.class)
+public class RuntimeMXBeanMO implements RuntimeMXBean
+{
+ @ManagementProperty
+ public String getBootClassPath()
+ {
+ return null;
+ }
+
+ @ManagementProperty
+ public String getClassPath()
+ {
+ return null;
+ }
+
+ @ManagementProperty
+ public List<String> getInputArguments()
+ {
+ return null;
+ }
+
+ @ManagementProperty
+ public String getLibraryPath()
+ {
+ return null;
+ }
+
+ @ManagementProperty
+ public String getManagementSpecVersion()
+ {
+ return null;
+ }
+
+ @ManagementProperty
+ public String getName()
+ {
+ return null;
+ }
+
+ @ManagementProperty
+ public String getSpecName()
+ {
+ return null;
+ }
+
+ @ManagementProperty
+ public String getSpecVendor()
+ {
+ return null;
+ }
+
+ @ManagementProperty
+ public String getSpecVersion()
+ {
+ return null;
+ }
+
+ @ManagementProperty
+ public long getStartTime()
+ {
+ return 0;
+ }
+
+ @ManagementProperty
+ public Map<String, String> getSystemProperties()
+ {
+ return null;
+ }
+
+ @ManagementProperty
+ public long getUptime()
+ {
+ return 0;
+ }
+
+ @ManagementProperty
+ public String getVmName()
+ {
+ return null;
+ }
+
+ @ManagementProperty
+ public String getVmVendor()
+ {
+ return null;
+ }
+
+ @ManagementProperty
+ public String getVmVersion()
+ {
+ return null;
+ }
+
+ @ManagementProperty
+ public boolean isBootClassPathSupported()
+ {
+ return false;
+ }
+
+}
Deleted: projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/ThreadMXBeanMO.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/jmx/ThreadMXBeanMO.java 2009-02-18 07:13:09 UTC (rev 84365)
+++ projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/ThreadMXBeanMO.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -1,185 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.managed.plugins.jmx;
-
-import java.lang.management.ManagementFactory;
-import java.lang.management.ThreadInfo;
-import java.lang.management.ThreadMXBean;
-
-import org.jboss.managed.api.annotation.ManagementComponent;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementOperation;
-import org.jboss.managed.api.annotation.ManagementProperty;
-
-/**
- * Stub class for the ThreadMXBean interface that is marked up with
- * management annotations.
- *
- * @author Scott.Stark at jboss.org
- * @version $Revision:$
- */
- at ManagementObject(name=ManagementFactory.THREAD_MXBEAN_NAME,
- componentType=@ManagementComponent(type="MBean", subtype="Platform"),
- targetInterface=ThreadMXBean.class)
-public class ThreadMXBeanMO implements ThreadMXBean
-{
-
- @ManagementOperation(description="an array of IDs of the threads that are monitor deadlocked, if any; null otherwise.")
- public long[] findMonitorDeadlockedThreads()
- {
- return null;
- }
-
- @ManagementProperty(description="an array of long, each is a thread ID.")
- public long[] getAllThreadIds()
- {
- return null;
- }
-
- @ManagementProperty(description="the user-level CPU time for the current thread if CPU time measurement is enabled; -1 otherwise")
- public long getCurrentThreadCpuTime()
- {
- return 0;
- }
-
- @ManagementProperty(description="the total CPU time for the current thread if CPU time measurement is enabled; -1 otherwise")
- public long getCurrentThreadUserTime()
- {
- return 0;
- }
-
- @ManagementProperty(description="the current number of live daemon threads.")
- public int getDaemonThreadCount()
- {
- return 0;
- }
-
- @ManagementProperty(description="the peak live thread count.")
- public int getPeakThreadCount()
- {
- return 0;
- }
-
- @ManagementProperty(description="the current number of live threads.")
- public int getThreadCount()
- {
- return 0;
- }
-
- @ManagementOperation(description="the total CPU time for a thread of the"
- + "specified ID if the thread of the specified ID exists, the thread is "
- + " alive, and CPU time measurement is enabled; -1</tt> otherwise.")
- public long getThreadCpuTime(long id)
- {
- return 0;
- }
-
- @ManagementOperation(description="a ThreadInfo object for the thread "
- + "of the given ID with no stack trace; null</tt> if the thread of the "
- + "given ID is not alive or it does not exist.")
- public ThreadInfo getThreadInfo(long id)
- {
- return null;
- }
-
- @ManagementOperation(description="an array of the ThreadInfo objects, "
- + "each containing information about a thread whose ID is in the "
- + "corresponding element of the input array of IDs.")
- public ThreadInfo[] getThreadInfo(long[] ids)
- {
- return null;
- }
-
- @ManagementOperation(description="a ThreadInfo of the thread of the given ID. "
- + "null if the thread of the given ID is not alive or it does not exist.")
- public ThreadInfo getThreadInfo(long id, int maxDepth)
- {
- return null;
- }
-
- @ManagementOperation(description="an array of the ThreadInfo objects, each "
- +"containing information about a thread whose ID is in the corresponding"
- +"element of the input array of IDs.")
- public ThreadInfo[] getThreadInfo(long[] ids, int maxDepth)
- {
- return null;
- }
-
- @ManagementOperation(description="the user-level CPU time for a thread of the "
- +"specified ID if the thread of the specified ID exists, the thread is "
- +"alive, and CPU time measurement is enabled; -1</tt> otherwise.")
- public long getThreadUserTime(long id)
- {
- return 0;
- }
-
- @ManagementProperty(description="the total number of threads started.")
- public long getTotalStartedThreadCount()
- {
- return 0;
- }
-
- @ManagementProperty(description="true if the Java virtual machine supports "
- +"CPU time measurement for current thread; false</tt> otherwise.")
- public boolean isCurrentThreadCpuTimeSupported()
- {
- return false;
- }
-
- @ManagementProperty(description="true if thread contention monitoring is enabled; false</tt> otherwise.")
- public boolean isThreadContentionMonitoringEnabled()
- {
- return false;
- }
-
- @ManagementProperty(description="true if the Java virtual machine supports thread contention monitoring; false</tt> otherwise.")
- public boolean isThreadContentionMonitoringSupported()
- {
- return false;
- }
-
- @ManagementProperty(description="true if thread CPU time measurement is enabled; false</tt> otherwise.")
- public boolean isThreadCpuTimeEnabled()
- {
- return false;
- }
-
- @ManagementProperty(description="true if the Java virtual machine supports CPU time measurement for any thread;; false</tt> otherwise.")
- public boolean isThreadCpuTimeSupported()
- {
- return false;
- }
-
- @ManagementOperation(description="Resets the peak thread count to the current number of live threads.")
- public void resetPeakThreadCount()
- {
- }
-
- public void setThreadContentionMonitoringEnabled(boolean enable)
- {
- }
-
- public void setThreadCpuTimeEnabled(boolean enable)
- {
- }
-
-}
Copied: projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/ThreadMXBeanMO.java (from rev 84365, projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/plugins/jmx/ThreadMXBeanMO.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/ThreadMXBeanMO.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_1/managed/src/main/java/org/jboss/managed/plugins/jmx/ThreadMXBeanMO.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -0,0 +1,185 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.managed.plugins.jmx;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.ThreadInfo;
+import java.lang.management.ThreadMXBean;
+
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementOperation;
+import org.jboss.managed.api.annotation.ManagementProperty;
+
+/**
+ * Stub class for the ThreadMXBean interface that is marked up with
+ * management annotations.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+ at ManagementObject(name=ManagementFactory.THREAD_MXBEAN_NAME,
+ componentType=@ManagementComponent(type="MBean", subtype="Platform"),
+ targetInterface=ThreadMXBean.class)
+public class ThreadMXBeanMO implements ThreadMXBean
+{
+
+ @ManagementOperation(description="an array of IDs of the threads that are monitor deadlocked, if any; null otherwise.")
+ public long[] findMonitorDeadlockedThreads()
+ {
+ return null;
+ }
+
+ @ManagementProperty(description="an array of long, each is a thread ID.")
+ public long[] getAllThreadIds()
+ {
+ return null;
+ }
+
+ @ManagementProperty(description="the user-level CPU time for the current thread if CPU time measurement is enabled; -1 otherwise")
+ public long getCurrentThreadCpuTime()
+ {
+ return 0;
+ }
+
+ @ManagementProperty(description="the total CPU time for the current thread if CPU time measurement is enabled; -1 otherwise")
+ public long getCurrentThreadUserTime()
+ {
+ return 0;
+ }
+
+ @ManagementProperty(description="the current number of live daemon threads.")
+ public int getDaemonThreadCount()
+ {
+ return 0;
+ }
+
+ @ManagementProperty(description="the peak live thread count.")
+ public int getPeakThreadCount()
+ {
+ return 0;
+ }
+
+ @ManagementProperty(description="the current number of live threads.")
+ public int getThreadCount()
+ {
+ return 0;
+ }
+
+ @ManagementOperation(description="the total CPU time for a thread of the"
+ + "specified ID if the thread of the specified ID exists, the thread is "
+ + " alive, and CPU time measurement is enabled; -1</tt> otherwise.")
+ public long getThreadCpuTime(long id)
+ {
+ return 0;
+ }
+
+ @ManagementOperation(description="a ThreadInfo object for the thread "
+ + "of the given ID with no stack trace; null</tt> if the thread of the "
+ + "given ID is not alive or it does not exist.")
+ public ThreadInfo getThreadInfo(long id)
+ {
+ return null;
+ }
+
+ @ManagementOperation(description="an array of the ThreadInfo objects, "
+ + "each containing information about a thread whose ID is in the "
+ + "corresponding element of the input array of IDs.")
+ public ThreadInfo[] getThreadInfo(long[] ids)
+ {
+ return null;
+ }
+
+ @ManagementOperation(description="a ThreadInfo of the thread of the given ID. "
+ + "null if the thread of the given ID is not alive or it does not exist.")
+ public ThreadInfo getThreadInfo(long id, int maxDepth)
+ {
+ return null;
+ }
+
+ @ManagementOperation(description="an array of the ThreadInfo objects, each "
+ +"containing information about a thread whose ID is in the corresponding"
+ +"element of the input array of IDs.")
+ public ThreadInfo[] getThreadInfo(long[] ids, int maxDepth)
+ {
+ return null;
+ }
+
+ @ManagementOperation(description="the user-level CPU time for a thread of the "
+ +"specified ID if the thread of the specified ID exists, the thread is "
+ +"alive, and CPU time measurement is enabled; -1</tt> otherwise.")
+ public long getThreadUserTime(long id)
+ {
+ return 0;
+ }
+
+ @ManagementProperty(description="the total number of threads started.")
+ public long getTotalStartedThreadCount()
+ {
+ return 0;
+ }
+
+ @ManagementProperty(description="true if the Java virtual machine supports "
+ +"CPU time measurement for current thread; false</tt> otherwise.")
+ public boolean isCurrentThreadCpuTimeSupported()
+ {
+ return false;
+ }
+
+ @ManagementProperty(description="true if thread contention monitoring is enabled; false</tt> otherwise.")
+ public boolean isThreadContentionMonitoringEnabled()
+ {
+ return false;
+ }
+
+ @ManagementProperty(description="true if the Java virtual machine supports thread contention monitoring; false</tt> otherwise.")
+ public boolean isThreadContentionMonitoringSupported()
+ {
+ return false;
+ }
+
+ @ManagementProperty(description="true if thread CPU time measurement is enabled; false</tt> otherwise.")
+ public boolean isThreadCpuTimeEnabled()
+ {
+ return false;
+ }
+
+ @ManagementProperty(description="true if the Java virtual machine supports CPU time measurement for any thread;; false</tt> otherwise.")
+ public boolean isThreadCpuTimeSupported()
+ {
+ return false;
+ }
+
+ @ManagementOperation(description="Resets the peak thread count to the current number of live threads.")
+ public void resetPeakThreadCount()
+ {
+ }
+
+ public void setThreadContentionMonitoringEnabled(boolean enable)
+ {
+ }
+
+ public void setThreadCpuTimeEnabled(boolean enable)
+ {
+ }
+
+}
Modified: projects/jboss-man/branches/Branch_2_1/managed/src/test/java/org/jboss/test/managed/factory/support/beans/ABeanMetaData.java
===================================================================
--- projects/jboss-man/branches/Branch_2_1/managed/src/test/java/org/jboss/test/managed/factory/support/beans/ABeanMetaData.java 2009-02-18 17:15:17 UTC (rev 84398)
+++ projects/jboss-man/branches/Branch_2_1/managed/src/test/java/org/jboss/test/managed/factory/support/beans/ABeanMetaData.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -47,7 +47,7 @@
private static final long serialVersionUID = 1;
private String bean;
private String name;
- /** The properties configuration Set<PropertyMetaData> */
+ /** The properties configuration Set<IPropertyMetaData> */
private Set<IPropertyMetaData> properties;
public String getBean()
@@ -102,6 +102,11 @@
properties.add(property);
}
+ public Set<IPropertyMetaData> getProperties()
+ {
+ return properties;
+ }
+
/**
* Set the propertiess.
*
@@ -119,4 +124,9 @@
beans.add(this);
return beans;
}
+
+ public String toString()
+ {
+ return "ABeanMetaData("+bean+";"+name+")";
+ }
}
Modified: projects/jboss-man/branches/Branch_2_1/managed/src/test/java/org/jboss/test/managed/factory/support/beans/BeanMetaDataICF.java
===================================================================
--- projects/jboss-man/branches/Branch_2_1/managed/src/test/java/org/jboss/test/managed/factory/support/beans/BeanMetaDataICF.java 2009-02-18 17:15:17 UTC (rev 84398)
+++ projects/jboss-man/branches/Branch_2_1/managed/src/test/java/org/jboss/test/managed/factory/support/beans/BeanMetaDataICF.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -30,6 +30,7 @@
import org.jboss.beans.info.spi.PropertyInfo;
import org.jboss.logging.Logger;
import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.annotation.ManagementObject;
import org.jboss.managed.api.annotation.ManagementObjectClass;
import org.jboss.managed.api.annotation.ManagementProperty;
import org.jboss.managed.api.annotation.ViewUse;
@@ -51,6 +52,7 @@
/** The meta value factory */
private MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
private static HashMap<String, Object> beanMap = new HashMap<String, Object>();
+ private InstanceClassFactory delegateICF;
public MetaValueFactory getMetaValueFactory()
{
@@ -70,6 +72,16 @@
beanMap.put(name, bean);
}
+
+ public InstanceClassFactory getDelegateICF()
+ {
+ return delegateICF;
+ }
+ public void setDelegateICF(InstanceClassFactory delegateICF)
+ {
+ this.delegateICF = delegateICF;
+ }
+
public Object locateBean(String beanName)
{
return beanMap.get(beanName);
@@ -115,6 +127,14 @@
// TODO: TCL may not be correct
ClassLoader loader = getClassLoader(attachment);
mocClass = loader.loadClass(beanClassName);
+ // Make sure it has an ManagementObject annotation
+ ManagementObject moAnn = mocClass.getAnnotation(ManagementObject.class);
+ if(moAnn == null)
+ {
+ // Revert back to the BeanMetaData class
+ mocClass = attachment.getClass();
+ }
+ log.debug("Using bean class:, "+mocClass+" for bean: "+attachment);
}
}
return mocClass;
@@ -132,11 +152,20 @@
Object bean = locateBean(attachment.getName());
Object value = null;
MetaValue mvalue = null;
+ if(propertyInfo.isReadable() == false)
+ {
+ if(log.isTraceEnabled())
+ log.trace("Skipping get of non-readable property: "+propertyInfo);
+ return null;
+ }
try
{
- value = propertyInfo.get(bean);
- mvalue = metaValueFactory.create(value, propertyInfo.getType());
+ String getterClassName = propertyInfo.getGetter().getDeclaringClass().getName();
+ if(getterClassName.equals(attachment.getClass().getName()))
+ mvalue = delegateICF.getValue(beanInfo, property, metaData, attachment);
+ else
+ mvalue = delegateICF.getValue(beanInfo, property, metaData, bean);
}
catch(Throwable e)
{
Modified: projects/jboss-man/branches/Branch_2_1/managed/src/test/java/org/jboss/test/managed/factory/test/AbstractManagedObjectFactoryUnitTestCase.java
===================================================================
--- projects/jboss-man/branches/Branch_2_1/managed/src/test/java/org/jboss/test/managed/factory/test/AbstractManagedObjectFactoryUnitTestCase.java 2009-02-18 17:15:17 UTC (rev 84398)
+++ projects/jboss-man/branches/Branch_2_1/managed/src/test/java/org/jboss/test/managed/factory/test/AbstractManagedObjectFactoryUnitTestCase.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -68,6 +68,7 @@
import org.jboss.test.managed.factory.support.amof.TestSimpleICF;
import org.jboss.test.managed.factory.support.beans.ABeanMetaData;
import org.jboss.test.managed.factory.support.beans.AKernelDeployment;
+import org.jboss.test.managed.factory.support.beans.APropertyMetaData;
import org.jboss.test.managed.factory.support.beans.BeanMetaDataICF;
import org.jboss.test.managed.factory.support.beans.IBeanMetaData;
import org.jboss.test.managed.factory.support.beans.IBeanMetaDataFactory;
@@ -357,7 +358,9 @@
public void testKernelDeployment()
{
AbstractManagedObjectFactory mof = new AbstractManagedObjectFactory();
- mof.setInstanceClassFactory(IBeanMetaData.class, new BeanMetaDataICF());
+ BeanMetaDataICF icf = new BeanMetaDataICF();
+ icf.setDelegateICF(new DefaultInstanceClassFactory(mof));
+ mof.setInstanceClassFactory(IBeanMetaData.class, icf);
testMOF = mof;
AKernelDeployment ad = new AKernelDeployment();
@@ -367,16 +370,29 @@
ABeanMetaData bean2 = new ABeanMetaData();
bean2.setBean(Simple.class.getName());
bean2.setName("SimpleBean#2");
+ ABeanMetaData bean3 = new ABeanMetaData();
+ bean3.setBean(SimpleUnannotated.class.getName());
+ bean3.setName("SimpleUnannotated#3");
+ APropertyMetaData bean3P1 = new APropertyMetaData();
+ bean3P1.setName("properties");
+ bean3P1.setDescription("The bean properties");
+ bean3P1.setPropertyType("java.util.Set<IPropertyMetaData>");
+ bean3.addProperty(bean3P1);
Simple simple1 = new Simple();
simple1.setBigDecimalValue(new BigDecimal(123456));
Simple simple2 = new Simple();
simple2.setBigDecimalValue(new BigDecimal(222222));
+ SimpleUnannotated simple3 = new SimpleUnannotated();
+ simple3.setBigDecimalValue(new BigDecimal(333333));
+ // Setup the bean name mappings
BeanMetaDataICF.setBean("SimpleBean#1", simple1);
BeanMetaDataICF.setBean("SimpleBean#2", simple2);
+ BeanMetaDataICF.setBean("SimpleUnannotated#3", simple3);
List<IBeanMetaDataFactory> beanFactories = new ArrayList<IBeanMetaDataFactory>();
beanFactories.add(bean1);
beanFactories.add(bean2);
+ beanFactories.add(bean3);
ad.setBeanFactories(beanFactories);
ManagedObject mo = mof.initManagedObject(ad, "KernelDeployment", null);
@@ -385,34 +401,65 @@
Object beanFactoriesMPValue = beanFactoriesMP.getValue();
getLog().debug("beanFactories MP value: "+beanFactoriesMPValue);
assertTrue(beanFactoriesMPValue instanceof CollectionValue);
+ // The beanFactories
CollectionValue cv = CollectionValue.class.cast(beanFactoriesMPValue);
MetaValue[] cvs = cv.getElements();
- assertEquals(2, cv.getSize());
+
+ assertEquals(3, cv.getSize());
+ // ABeanMetaData ManagedObject for SimpleBean#1
MetaValue mv0 = cvs[0];
assertTrue(mv0 instanceof GenericValue);
GenericValue gv0 = GenericValue.class.cast(mv0);
Object gv0Value = gv0.getValue();
assertTrue(gv0Value instanceof ManagedObject);
ManagedObject mo0 = ManagedObject.class.cast(gv0Value);
+ assertEquals(bean1, mo0.getAttachment());
ManagedProperty bigDecimalValueMP = mo0.getProperty("bigDecimalValue");
assertNotNull(bigDecimalValueMP);
assertEquals(SimpleValueSupport.wrap(new BigDecimal(123456)), bigDecimalValueMP.getValue());
bigDecimalValueMP.setValue(SimpleValueSupport.wrap(new BigDecimal(987654)));
assertEquals(new BigDecimal(987654), simple1.getBigDecimalValue());
+ // ABeanMetaData ManagedObject for SimpleBean#2
MetaValue mv1 = cvs[1];
assertTrue(mv1 instanceof GenericValue);
GenericValue gv1 = GenericValue.class.cast(mv1);
Object gv1Value = gv1.getValue();
assertTrue(gv1Value instanceof ManagedObject);
ManagedObject mo1 = ManagedObject.class.cast(gv1Value);
- ManagedProperty bigDecimalValueMP2 = mo1.getProperty("bigDecimalValue");
- assertNotNull(bigDecimalValueMP2);
- assertEquals(SimpleValueSupport.wrap(new BigDecimal(222222)), bigDecimalValueMP2.getValue());
- bigDecimalValueMP2.setValue(SimpleValueSupport.wrap(new BigDecimal(12222221)));
+ ManagedProperty bigDecimalValueMP1 = mo1.getProperty("bigDecimalValue");
+ assertNotNull(bigDecimalValueMP1);
+ assertEquals(SimpleValueSupport.wrap(new BigDecimal(222222)), bigDecimalValueMP1.getValue());
+ bigDecimalValueMP1.setValue(SimpleValueSupport.wrap(new BigDecimal(12222221)));
assertEquals(new BigDecimal(12222221), simple2.getBigDecimalValue());
+ // ABeanMetaData ManagedObject for SimpleUnannotated#3
+ MetaValue mv2 = cvs[2];
+ assertTrue(mv2 instanceof GenericValue);
+ GenericValue gv2 = GenericValue.class.cast(mv2);
+ Object gv2Value = gv2.getValue();
+ assertTrue(gv2Value instanceof ManagedObject);
+ ManagedObject mo2 = ManagedObject.class.cast(gv2Value);
+ ManagedProperty properties = mo2.getProperty("properties");
+ assertNotNull(properties);
+ assertTrue(properties.getMetaType().isCollection());
+ CollectionMetaType amt = (CollectionMetaType) properties.getMetaType();
+ MetaType etype = amt.getElementType();
+ if (etype == AbstractManagedObjectFactory.MANAGED_OBJECT_META_TYPE)
+ {
+ CollectionValue avalue = (CollectionValue) properties.getValue();
+ assertNotNull(avalue);
+ MetaValue[] elements = avalue.getElements();
+ for(int n = 0; n < avalue.getSize(); n ++)
+ {
+ GenericValue gv = (GenericValue) elements[n];
+ ManagedObject propMO = (ManagedObject) gv.getValue();
+ //...
+ }
+ }
+
+
}
/**
Copied: projects/jboss-man/branches/Branch_2_1/managed/src/test/java/org/jboss/test/managed/factory/test/PlatformMBeanUnitTestCase.java (from rev 84365, projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/test/PlatformMBeanUnitTestCase.java)
===================================================================
--- projects/jboss-man/branches/Branch_2_1/managed/src/test/java/org/jboss/test/managed/factory/test/PlatformMBeanUnitTestCase.java (rev 0)
+++ projects/jboss-man/branches/Branch_2_1/managed/src/test/java/org/jboss/test/managed/factory/test/PlatformMBeanUnitTestCase.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -0,0 +1,428 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2007, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.managed.factory.test;
+
+import java.lang.annotation.Annotation;
+import java.lang.management.ClassLoadingMXBean;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryMXBean;
+import java.lang.management.MemoryPoolMXBean;
+import java.lang.management.MemoryUsage;
+import java.lang.management.OperatingSystemMXBean;
+import java.lang.management.RuntimeMXBean;
+import java.lang.management.ThreadInfo;
+import java.lang.management.ThreadMXBean;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import junit.framework.Test;
+
+import org.jboss.managed.api.ManagedObject;
+import org.jboss.managed.api.ManagedOperation;
+import org.jboss.managed.api.ManagedProperty;
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementOperation;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.managed.api.factory.ManagedObjectFactory;
+import org.jboss.managed.plugins.ManagedOperationMatcher;
+import org.jboss.managed.plugins.jmx.ManagementFactoryUtils;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.CompositeValue;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.metatype.api.values.SimpleValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.test.managed.factory.AbstractManagedObjectFactoryTest;
+import org.jboss.test.managed.factory.support.ManagementObjectChangedName;
+import org.jboss.test.managed.factory.support.amof.CustomName;
+import org.jboss.test.managed.factory.support.amof.ManagementObjectWithRuntimeRef;
+
+/**
+ * Tests of creating ManagedObjects for the jvm platform mbeans
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 1.1 $
+ */
+public class PlatformMBeanUnitTestCase extends AbstractManagedObjectFactoryTest
+{
+ /**
+ * Create a testsuite for this test
+ *
+ * @return the testsuite
+ */
+ public static Test suite()
+ {
+ return suite(PlatformMBeanUnitTestCase.class);
+ }
+
+ /**
+ * Create a new ManagementObjectUnitTestCase.
+ *
+ * @param name the test name
+ */
+ public PlatformMBeanUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ /**
+ * Test the transformer value of the annotation
+ */
+ public void testClassLoadingMXBean()
+ {
+ super.enableTrace("org.jboss.managed.plugins.factory");
+ ManagedObjectFactory mof = getMOF();
+ ManagedObject mo = ManagementFactoryUtils.getClassLoadingMO(mof);
+ assertNotNull(mo);
+ assertEquals(ManagementFactory.CLASS_LOADING_MXBEAN_NAME, mo.getName());
+ validateComponentType(mo);
+
+ Map<String, ManagedProperty> props = mo.getProperties();
+ assertNotNull(props);
+ // totalLoadedClassCount
+ ManagedProperty totalLoadedClassCount = props.get("totalLoadedClassCount");
+ assertNotNull(totalLoadedClassCount);
+ assertEquals(SimpleMetaType.LONG, totalLoadedClassCount.getMetaType());
+ assertEquals("the total number of classes loaded.", totalLoadedClassCount.getDescription());
+ SimpleValue totalLoadedClassCountSV = SimpleValue.class.cast(totalLoadedClassCount.getValue());
+ assertNotNull(totalLoadedClassCountSV);
+ getLog().debug("totalLoadedClassCountSV"+totalLoadedClassCountSV);
+ SimpleValue sv1 = SimpleValueSupport.wrap(new Long(100));
+ assertTrue("> 100 classes loaded", sv1.compareTo(totalLoadedClassCountSV) < 0);
+ // loadedClassCount
+ ManagedProperty loadedClassCount = props.get("loadedClassCount");
+ assertNotNull(loadedClassCount);
+ assertEquals(SimpleMetaType.INTEGER, loadedClassCount.getMetaType());
+ assertEquals("the number of currently loaded classes.", loadedClassCount.getDescription());
+ SimpleValue loadedClassCountSV = SimpleValue.class.cast(loadedClassCount.getValue());
+ assertNotNull(loadedClassCountSV);
+ getLog().debug("loadedClassCountSV"+loadedClassCountSV);
+ assertTrue("> 100 classes loaded", sv1.compareTo(loadedClassCountSV) < 0);
+ // unloadedClassCount
+ ManagedProperty unloadedClassCount = props.get("unloadedClassCount");
+ assertNotNull(unloadedClassCount);
+ assertEquals(SimpleMetaType.LONG, unloadedClassCount.getMetaType());
+ assertEquals("the total number of unloaded classes.", unloadedClassCount.getDescription());
+ SimpleValue unloadedClassCountSV = SimpleValue.class.cast(unloadedClassCount.getValue());
+ assertNotNull(unloadedClassCountSV);
+ getLog().debug("unloadedClassCountSV"+unloadedClassCountSV);
+ // verbose
+ ManagedProperty verbose = props.get("verbose");
+ assertNotNull(verbose);
+ assertEquals(SimpleMetaType.BOOLEAN, verbose.getMetaType());
+ assertEquals("the verbose output flag for the class loading system.", verbose.getDescription());
+ SimpleValue verboseSV = SimpleValue.class.cast(verbose.getValue());
+ assertNotNull(verboseSV);
+ getLog().debug("verboseSV"+verboseSV);
+
+ }
+
+ public void testMemoryMXBean()
+ {
+ ManagedObjectFactory mof = getMOF();
+ ManagedObject mo = ManagementFactoryUtils.getMemoryMXBean(mof);
+ assertNotNull(mo);
+ assertEquals(ManagementFactory.MEMORY_MXBEAN_NAME, mo.getName());
+ validateComponentType(mo);
+
+ Map<String, ManagedProperty> props = mo.getProperties();
+ assertNotNull(props);
+
+ // heapMemoryUsage
+ ManagedProperty heapMemoryUsage = props.get("heapMemoryUsage");
+ assertNotNull(heapMemoryUsage);
+ assertEquals("object representing the heap memory usage.", heapMemoryUsage.getDescription());
+ CompositeValue heapMemoryUsageMV = CompositeValue.class.cast(heapMemoryUsage.getValue());
+ assertNotNull(heapMemoryUsageMV);
+ getLog().debug("heapMemoryUsageMV; "+heapMemoryUsageMV);
+ MemoryUsage heapMemoryUsageMU = ManagementFactoryUtils.unwrapMemoryUsage(heapMemoryUsageMV);
+ assertTrue(heapMemoryUsageMU.getInit() >= 0);
+ assertTrue(heapMemoryUsageMU.getUsed() >= 1000);
+ assertTrue(heapMemoryUsageMU.getMax() >= heapMemoryUsageMU.getCommitted());
+ assertTrue(heapMemoryUsageMU.getCommitted() >= heapMemoryUsageMU.getUsed());
+
+ // nonHeapMemoryUsage
+ ManagedProperty nonHeapMemoryUsage = props.get("nonHeapMemoryUsage");
+ assertNotNull(nonHeapMemoryUsage);
+ assertEquals("object representing the non-heap memory usage.", nonHeapMemoryUsage.getDescription());
+ CompositeValue nonHeapMemoryUsageMV = CompositeValue.class.cast(nonHeapMemoryUsage.getValue());
+ assertNotNull(nonHeapMemoryUsageMV);
+ getLog().debug("nonHeapMemoryUsageMV; "+nonHeapMemoryUsageMV);
+ MemoryUsage nonHeapMemoryUsageMU = ManagementFactoryUtils.unwrapMemoryUsage(nonHeapMemoryUsageMV);
+ assertTrue(nonHeapMemoryUsageMU.getInit() >= 0);
+ assertTrue(nonHeapMemoryUsageMU.getUsed() >= 1000);
+ assertTrue(nonHeapMemoryUsageMU.getMax() >= nonHeapMemoryUsageMU.getCommitted());
+ assertTrue(nonHeapMemoryUsageMU.getCommitted() >= nonHeapMemoryUsageMU.getUsed());
+ // objectPendingFinalizationCount
+ ManagedProperty objectPendingFinalizationCount = props.get("objectPendingFinalizationCount");
+ assertNotNull(objectPendingFinalizationCount);
+ assertEquals("the approximate number objects for which finalization is pending.", objectPendingFinalizationCount.getDescription());
+ MetaValue objectPendingFinalizationCountMV = objectPendingFinalizationCount.getValue();
+ assertNotNull(objectPendingFinalizationCountMV);
+ getLog().debug("objectPendingFinalizationCountMV; "+objectPendingFinalizationCountMV);
+
+ // verbose
+ ManagedProperty verbose = props.get("verbose");
+ assertNotNull(verbose);
+ assertEquals(SimpleMetaType.BOOLEAN, verbose.getMetaType());
+ assertEquals("the verbose output flag for the memory system.", verbose.getDescription());
+ SimpleValue verboseSV = SimpleValue.class.cast(verbose.getValue());
+ assertNotNull(verboseSV);
+ getLog().debug("verboseSV; "+verboseSV);
+
+ // The gc op
+ Set<ManagedOperation> ops = mo.getOperations();
+ assertNotNull(ops);
+ assertEquals("There is 1 op", 1, ops.size());
+ ManagedOperation gc = ops.iterator().next();
+ assertEquals("gc", gc.getName());
+ assertEquals("Runs the garbage collector", gc.getDescription());
+ gc.invoke(null);
+ }
+
+ public void testThreadMXBean()
+ throws Exception
+ {
+ ManagedObjectFactory mof = getMOF();
+ ManagedObject mo = ManagementFactoryUtils.getThreadMXBean(mof);
+ assertNotNull(mo);
+ assertEquals(ManagementFactory.THREAD_MXBEAN_NAME, mo.getName());
+ validateComponentType(mo);
+
+ ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
+ long threadID = Thread.currentThread().getId();
+ ThreadInfo threadInfo = mbean.getThreadInfo(threadID, 3);
+
+ // Test ThreadInfo MetaValue wrap/unwrap
+ MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
+ MetaValue threadInfoMV = metaValueFactory.create(threadInfo);
+ assertTrue(threadInfoMV instanceof CompositeValue);
+ CompositeValue tiCV = CompositeValue.class.cast(threadInfoMV);
+ ThreadInfo threadInfo2 = ManagementFactoryUtils.unwrapThreadInfo(tiCV);
+ assertEquals(threadInfo.getLockOwnerName(), threadInfo2.getLockOwnerName());
+ assertEquals(threadInfo.getThreadName(), threadInfo2.getThreadName());
+ assertEquals(threadInfo.isInNative(), threadInfo2.isInNative());
+ assertEquals(threadInfo.getBlockedCount(), threadInfo2.getBlockedCount());
+ assertEquals(threadInfo.getBlockedTime(), threadInfo2.getBlockedTime());
+ assertEquals(threadInfo.getLockOwnerId(), threadInfo2.getLockOwnerId());
+ assertEquals(threadInfo.getThreadId(), threadInfo2.getThreadId());
+ assertEquals(threadInfo.getThreadState(), threadInfo2.getThreadState());
+ assertEquals(threadInfo.getWaitedCount(), threadInfo2.getWaitedCount());
+ assertEquals(threadInfo.getWaitedTime(), threadInfo2.getWaitedTime());
+ StackTraceElement[] st = threadInfo.getStackTrace();
+ StackTraceElement[] st2 = threadInfo2.getStackTrace();
+ for(int n = 0; n < st.length; n ++)
+ {
+ assertEquals(st[n], st2[n]);
+ }
+
+ // Properties
+ ManagedProperty allThreadIds = mo.getProperty("allThreadIds");
+ assertNotNull(allThreadIds);
+ ManagedProperty currentThreadCpuTime = mo.getProperty("currentThreadCpuTime");
+ assertNotNull(currentThreadCpuTime);
+ long x = (Long) metaValueFactory.unwrap(currentThreadCpuTime.getValue());
+ assertTrue(x > 1000);
+ ManagedProperty currentThreadUserTime = mo.getProperty("currentThreadUserTime");
+ assertNotNull(currentThreadUserTime);
+ ManagedProperty daemonThreadCount = mo.getProperty("daemonThreadCount");
+ assertNotNull(daemonThreadCount);
+ x = (Integer) metaValueFactory.unwrap(daemonThreadCount.getValue());
+ assertEquals(mbean.getDaemonThreadCount(), x);
+ ManagedProperty peakThreadCount = mo.getProperty("peakThreadCount");
+ assertNotNull(peakThreadCount);
+ x = (Integer) metaValueFactory.unwrap(peakThreadCount.getValue());
+ assertEquals(mbean.getPeakThreadCount(), x);
+ ManagedProperty threadCount = mo.getProperty("threadCount");
+ assertNotNull(threadCount);
+ x = (Integer) metaValueFactory.unwrap(threadCount.getValue());
+ assertEquals(mbean.getThreadCount(), x);
+ ManagedProperty totalStartedThreadCount = mo.getProperty("totalStartedThreadCount");
+ assertNotNull(totalStartedThreadCount);
+ x = (Long) metaValueFactory.unwrap(totalStartedThreadCount.getValue());
+ assertEquals(mbean.getTotalStartedThreadCount(), x);
+ ManagedProperty currentThreadCpuTimeSupported = mo.getProperty("currentThreadCpuTimeSupported");
+ assertNotNull(currentThreadCpuTimeSupported);
+ boolean flag = (Boolean) metaValueFactory.unwrap(currentThreadCpuTimeSupported.getValue());
+ assertEquals(mbean.isCurrentThreadCpuTimeSupported(), flag);
+ ManagedProperty threadContentionMonitoringEnabled = mo.getProperty("threadContentionMonitoringEnabled");
+ assertNotNull(threadContentionMonitoringEnabled);
+ flag = (Boolean) metaValueFactory.unwrap(threadContentionMonitoringEnabled.getValue());
+ assertEquals(mbean.isThreadContentionMonitoringEnabled(), flag);
+ ManagedProperty threadContentionMonitoringSupported = mo.getProperty("threadContentionMonitoringSupported");
+ assertNotNull(threadContentionMonitoringSupported);
+ flag = (Boolean) metaValueFactory.unwrap(threadContentionMonitoringSupported.getValue());
+ assertEquals(mbean.isThreadContentionMonitoringSupported(), flag);
+ ManagedProperty threadCpuTimeEnabled = mo.getProperty("threadCpuTimeEnabled");
+ assertNotNull(threadCpuTimeEnabled);
+ flag = (Boolean) metaValueFactory.unwrap(threadCpuTimeEnabled.getValue());
+ assertEquals(mbean.isThreadCpuTimeEnabled(), flag);
+ ManagedProperty threadCpuTimeSupported = mo.getProperty("threadCpuTimeSupported");
+ assertNotNull(threadCpuTimeSupported);
+ flag = (Boolean) metaValueFactory.unwrap(threadCpuTimeSupported.getValue());
+ assertEquals(mbean.isThreadCpuTimeSupported(), flag);
+
+ // Ops
+ Set<ManagedOperation> ops = mo.getOperations();
+ log.debug(ops);
+
+ assertEquals("Ops count is 8", 8, ops.size());
+ ManagedOperation getThreadInfo = ManagedOperationMatcher.findOperation(ops,
+ "getThreadInfo", SimpleMetaType.LONG, SimpleMetaType.INTEGER);
+ assertNotNull("getThreadInfo", getThreadInfo);
+ log.debug(getThreadInfo);
+
+
+ }
+
+ public void testRuntimeMXBean()
+ {
+ ManagedObjectFactory mof = getMOF();
+ ManagedObject mo = ManagementFactoryUtils.getRuntimeMXBean(mof);
+ assertNotNull(mo);
+ assertEquals(ManagementFactory.RUNTIME_MXBEAN_NAME, mo.getName());
+ validateComponentType(mo);
+
+ RuntimeMXBean mbean = ManagementFactory.getRuntimeMXBean();
+ MetaValueFactory metaValueFactory = MetaValueFactory.getInstance();
+
+ ManagedProperty bootClassPath = mo.getProperty("bootClassPath");
+ String x = (String) metaValueFactory.unwrap(bootClassPath.getValue());
+ assertEquals(mbean.getBootClassPath(), x);
+ ManagedProperty classPath = mo.getProperty("classPath");
+ x = (String) metaValueFactory.unwrap(classPath.getValue());
+ assertEquals(mbean.getClassPath(), x);
+ ManagedProperty libraryPath = mo.getProperty("libraryPath");
+ x = (String) metaValueFactory.unwrap(libraryPath.getValue());
+ assertEquals(mbean.getLibraryPath(), x);
+ ManagedProperty managementSpecVersion = mo.getProperty("managementSpecVersion");
+ x = (String) metaValueFactory.unwrap(managementSpecVersion.getValue());
+ assertEquals(mbean.getManagementSpecVersion(), x);
+ ManagedProperty specName = mo.getProperty("specName");
+ x = (String) metaValueFactory.unwrap(specName.getValue());
+ assertEquals(mbean.getSpecName(), x);
+ ManagedProperty specVendor = mo.getProperty("specVendor");
+ x = (String) metaValueFactory.unwrap(specVendor.getValue());
+ assertEquals(mbean.getSpecVendor(), x);
+ ManagedProperty specVersion = mo.getProperty("specVersion");
+ x = (String) metaValueFactory.unwrap(specVersion.getValue());
+ assertEquals(mbean.getSpecVersion(), x);
+ ManagedProperty vmName = mo.getProperty("vmName");
+ x = (String) metaValueFactory.unwrap(vmName.getValue());
+ assertEquals(mbean.getVmName(), x);
+ ManagedProperty vmVendor = mo.getProperty("vmVendor");
+ x = (String) metaValueFactory.unwrap(vmVendor.getValue());
+ assertEquals(mbean.getVmVendor(), x);
+ ManagedProperty vmVersion = mo.getProperty("vmVersion");
+ x = (String) metaValueFactory.unwrap(vmVersion.getValue());
+ assertEquals(mbean.getVmVersion(), x);
+ ManagedProperty startTime = mo.getProperty("startTime");
+ long time = (Long) metaValueFactory.unwrap(startTime.getValue());
+ assertEquals(mbean.getStartTime(), time);
+ ManagedProperty uptime = mo.getProperty("uptime");
+ time = (Long) metaValueFactory.unwrap(uptime.getValue());
+ ManagedProperty inputArguments = mo.getProperty("inputArguments");
+ List<String> ls = (List<String>) metaValueFactory.unwrap(inputArguments.getValue());
+ List<String> args = mbean.getInputArguments();
+ assertEquals(args, ls);
+ ManagedProperty systemProperties = mo.getProperty("systemProperties");
+ Map<String, String> map = (Map<String, String>) metaValueFactory.unwrap(systemProperties.getValue());
+ log.info("sun.io.unicode.encoding: "+map.get("sun.io.unicode.encoding"));
+ Map<String, String> sysProps = mbean.getSystemProperties();
+ for(String key : sysProps.keySet())
+ {
+ String p1 = sysProps.get(key);
+ String p2 = map.get(key);
+ // TODO: some properties are missing?
+ // assertEquals(key, p1, p2);
+ }
+ }
+ public void testOperatingSystemMXBean()
+ {
+ ManagedObjectFactory mof = getMOF();
+ ManagedObject mo = ManagementFactoryUtils.getOperatingSystemMXBean(mof);
+ assertNotNull(mo);
+ assertEquals(ManagementFactory.MEMORY_MXBEAN_NAME, mo.getName());
+ validateComponentType(mo);
+ }
+ public void testMemoryManagerMXBeans()
+ {
+ ManagedObjectFactory mof = getMOF();
+ List<ManagedObject> mos = ManagementFactoryUtils.getMemoryManagerMXBeans(mof);
+ assertTrue(mos.size() > 0);
+ for(ManagedObject mo : mos)
+ {
+ ManagedProperty nameMP = mo.getProperty("name");
+ SimpleValue nameSV = SimpleValue.class.cast(nameMP.getValue());
+ String nameString = nameSV.getValue().toString();
+ String name = ManagementFactory.MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE + nameString;
+ assertEquals(name, mo.getName());
+ validateComponentType(mo);
+ }
+ }
+ public void testMemoryPoolMXBeans()
+ {
+ ManagedObjectFactory mof = getMOF();
+ List<ManagedObject> mos = ManagementFactoryUtils.getMemoryPoolMXBeans(mof);
+ assertTrue(mos.size() > 0);
+ for(ManagedObject mo : mos)
+ {
+ ManagedProperty nameMP = mo.getProperty("name");
+ SimpleValue nameSV = SimpleValue.class.cast(nameMP.getValue());
+ String nameString = nameSV.getValue().toString();
+ String name = ManagementFactory.MEMORY_POOL_MXBEAN_DOMAIN_TYPE + nameString;
+ assertEquals(name, mo.getName());
+ validateComponentType(mo);
+ }
+ }
+ public void testGarbageCollectorMXBeans()
+ {
+ ManagedObjectFactory mof = getMOF();
+ List<ManagedObject> mos = ManagementFactoryUtils.getGarbageCollectorMXBeans(mof);
+ assertTrue(mos.size() > 0);
+ for(ManagedObject mo : mos)
+ {
+ log.debug("GC.MO.props: "+mo.getPropertyNames());
+ ManagedProperty nameMP = mo.getProperty("name");
+ SimpleValue nameSV = SimpleValue.class.cast(nameMP.getValue());
+ String nameString = nameSV.getValue().toString();
+ String name = ManagementFactory.GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE + nameString;
+ assertEquals(name, mo.getName());
+ validateComponentType(mo);
+ }
+ }
+
+ protected void validateComponentType(ManagedObject mo)
+ {
+ Map<String, Annotation> moAnns = mo.getAnnotations();
+ assertNotNull(moAnns);
+ ManagementComponent mc = (ManagementComponent) moAnns.get(ManagementComponent.class.getName());
+ assertNotNull(mc);
+ assertEquals("MBean", mc.type());
+ assertEquals("Platform", mc.subtype());
+ }
+
+}
Modified: projects/jboss-man/branches/Branch_2_1/metatype/src/main/java/org/jboss/metatype/api/types/EnumMetaType.java
===================================================================
--- projects/jboss-man/branches/Branch_2_1/metatype/src/main/java/org/jboss/metatype/api/types/EnumMetaType.java 2009-02-18 17:15:17 UTC (rev 84398)
+++ projects/jboss-man/branches/Branch_2_1/metatype/src/main/java/org/jboss/metatype/api/types/EnumMetaType.java 2009-02-18 17:23:37 UTC (rev 84399)
@@ -25,6 +25,7 @@
import java.util.Collections;
import java.util.List;
+import org.jboss.metatype.api.values.EnumValue;
import org.jboss.metatype.api.values.SimpleValue;
/**
More information about the jboss-cvs-commits
mailing list