[jboss-cvs] JBossAS SVN: r90198 - in projects/jboss-man/trunk: managed/src/main/java/org/jboss/managed/api/annotation and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jun 15 11:39:37 EDT 2009
Author: emuckenhuber
Date: 2009-06-15 11:39:37 -0400 (Mon, 15 Jun 2009)
New Revision: 90198
Modified:
projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/ManagedCommon.java
projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/ManagedComponent.java
projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/ManagedDeployment.java
projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/ManagedObject.java
projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/ManagedProperty.java
projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperties.java
projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/test/PlatformMBeanUnitTestCase.java
projects/jboss-man/trunk/metatype/src/main/java/org/jboss/metatype/api/values/CompositeValueSupport.java
Log:
merge Rev: 90104, 90164, 90197 from branch 2_1
Modified: projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/ManagedCommon.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/ManagedCommon.java 2009-06-15 15:33:21 UTC (rev 90197)
+++ projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/ManagedCommon.java 2009-06-15 15:39:37 UTC (rev 90198)
@@ -30,9 +30,8 @@
import org.jboss.managed.api.annotation.ManagementRuntimeRef;
/**
- * ManagedCommon is used to hold common
- * properties that both, server side and client side,
- * object can see .
+ * ManagedCommon is used to hold common properties of managed
+ * objects that both server side and client side can see. .
*
* @author <a href="ales.justin at jboss.com">Ales Justin</a>
* @author Scott.Stark at jboss.org
Modified: projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/ManagedComponent.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/ManagedComponent.java 2009-06-15 15:33:21 UTC (rev 90197)
+++ projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/ManagedComponent.java 2009-06-15 15:39:37 UTC (rev 90198)
@@ -25,7 +25,7 @@
import java.util.Map;
/**
- * A runtime component associated with a deployment.
+ * A manageable entity - the client side view of a {@link ManagedObject}.
*
* @author Scott.Stark at jboss.org
* @version $Revision$
@@ -52,6 +52,9 @@
/**
* Get the annotations associated with the managed component
+ *
+ * <b>NOTE:</b> Clients should not use this method - it is intended for server-side use only.
+ *
* @return the annotations associated with the managed component
*/
public Map<String, Annotation> getAnnotations();
Modified: projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/ManagedDeployment.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/ManagedDeployment.java 2009-06-15 15:33:21 UTC (rev 90197)
+++ projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/ManagedDeployment.java 2009-06-15 15:39:37 UTC (rev 90198)
@@ -25,8 +25,6 @@
import java.util.Map;
import java.util.Set;
-import org.jboss.managed.api.ManagedProperty;
-
/**
* A collection of ManagedComponent and structural information
* about a deployment.
@@ -52,36 +50,44 @@
};
/**
- * Get the full name of the associated DeploymentUnit.
- * @return full name of the DeploymentUnit
+ * Get the full name of the associated DeploymentUnit
+ * (e.g. vfsfile:/C:/opt/jboss-eap-5.0.0-SNAPSHOT/server/default/deploy/foo.ear/).
+ * @return the full name of the DeploymentUnit
+ * (e.g. vfsfile:/C:/opt/jboss-eap-5.0.0-SNAPSHOT/server/default/deploy/foo.ear/)
*/
public String getName();
+
/**
- * Get the simple name (x.ear) for the deployment
- * @return simple name of the deployment
+ * Get the simple name (e.g. foo.ear) for the deployment
+ * @return the simple name (e.g. foo.ear) of the deployment
*/
public String getSimpleName();
+
/**
* Get the phase this deployment is associated with
* @return the phase
*/
public DeploymentPhase getDeploymentPhase();
+
/**
* Get the deployment state of the deployment.
* @return the deployment state
*/
public DeploymentState getDeploymentState();
+
/**
* Add a deployment/module type
* @param type
* @return true if the type was added, false if it already exists
*/
public boolean addType(String type);
+
/**
* Get the deployment/module types.
* @return deployment types
*/
public Set<String> getTypes();
+
/**
* Get the deployment/module types.
* @param types
@@ -94,6 +100,7 @@
* @return the property names
*/
public Set<String> getPropertyNames();
+
/**
* Get a property
*
@@ -110,12 +117,33 @@
public Map<String, ManagedProperty> getProperties();
/**
- * Get the managed object names
- *
- * @return the property names
+ * Get the names of the child managed objects.
+ *
+ * <b>NOTE:</b> Clients should not use this method - it is intended for server-side use only.
+ *
+ * @return the names of the child managed objects
*/
public Set<String> getManagedObjectNames();
+
+ /**
+ * Gets the child managed objects.
+ *
+ * <b>NOTE:</b> Clients should not use this method - it is intended for server-side use only.
+ *
+ * @return the child managed objects
+ */
public Map<String, ManagedObject> getManagedObjects();
+
+ /**
+ * Gets the child managed object with the specified name. Returns null if there is no child managed object with that
+ * name.
+ *
+ * <b>NOTE:</b> Clients should not use this method - it is intended for server-side use only.
+ *
+ * @param name the managed object name
+ * @return the child managed object with the specified name, or null if there is no child managed object with that
+ * name
+ */
public ManagedObject getManagedObject(String name);
/**
@@ -124,13 +152,19 @@
*/
public ManagedDeployment getParent();
+ /**
+ * Gets the nested ManagedComponent with the specified name.
+ * @param name the child component's name
+ * @return the child ManagedComponent with the specified name
+ */
public ManagedComponent getComponent(String name);
/**
- * Get the ManagedComponents for the deployment module.
- * @return ManagedComponents for the deployment module.
+ * Get the nested ManagedComponents for the deployment module.
+ * @return the nested ManagedComponents for the deployment module.
*/
public Map<String, ManagedComponent> getComponents();
+
/**
* Get the nested deployment modules.
* @return nested deployment modules.
@@ -150,6 +184,7 @@
* @param comp the component
*/
public void addComponent(String name, ManagedComponent comp);
+
/**
*
* @param name the name
@@ -163,16 +198,19 @@
* @return the template names
*/
public Set<String> getDeploymentTemplateNames();
+
/**
* Add a deployment
- * @param deplymentBaseName
+ * @param deploymentBaseName
* @param info
* @return the deployment
*/
- public ManagedDeployment addModule(String deplymentBaseName, DeploymentTemplateInfo info);
+ public ManagedDeployment addModule(String deploymentBaseName, DeploymentTemplateInfo info);
/**
* Get an attachment from the deployment.
+ *
+ * <b>NOTE:</b> Clients should not use this method - it is intended for server-side use only.
*
* @see #setAttachment(String, Object)
*
@@ -185,6 +223,8 @@
* Get an attachment from the deployment,
* uses the expected type as both the name
* and to cast the resulting object.
+ *
+ * <b>NOTE:</b> Clients should not use this method - it is intended for server-side use only.
*
* @param <T> the expected type
* @param expectedType the expected type
@@ -198,6 +238,8 @@
* are serialized to external clients like admin tools, so the attachment
* type should be restricted to jdk types and commonly provided management
* related classes.
+ *
+ * <b>NOTE:</b> Clients should not use this method - it is intended for server-side use only.
*
* @param name the name
* @param attachment the attachment, pass null to remove an attachment
Modified: projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/ManagedObject.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/ManagedObject.java 2009-06-15 15:33:21 UTC (rev 90197)
+++ projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/ManagedObject.java 2009-06-15 15:39:37 UTC (rev 90198)
@@ -24,19 +24,19 @@
import java.lang.annotation.Annotation;
import java.util.Map;
-import org.jboss.managed.api.annotation.ManagementRuntimeRef;
-
/**
- * ManagedObject is an interface for a manageable element. It
+ * ManagedObject is an interface for a manageable entity. It
* consists of:
* - a name/name type for a registry/references
* - an attachment name to associate the ManagedObject with a
* deployment attachment
* - annotations from the metadata making up the ManagedObject
* - the attachment instance
- * - the ManagedPropertys for the interface
- * - the ManagedOperations for the interface
- *
+ * - the {@link ManagedProperty}s for the entity
+ * - the {@link ManagedOperation}s for the entity
+ *
+ * <b>NOTE:</b> Clients should not use this class - it is intended for server-side use only.
+ *
* @author <a href="adrian at jboss.com">Adrian Brock</a>
* @author Scott.Stark at jboss.org
* @version $Revision$
Modified: projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/ManagedProperty.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/ManagedProperty.java 2009-06-15 15:33:21 UTC (rev 90197)
+++ projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/ManagedProperty.java 2009-06-15 15:39:37 UTC (rev 90198)
@@ -34,7 +34,9 @@
import org.jboss.metatype.api.values.MetaValue;
/**
- * ManagedProperty.
+ * A property associated with a {@link ManagedDeployment}, {@link ManagedObject}, or {@link ManagedComponent}. The
+ * property's name is a String and its value is a {@link MetaValue}. A property also has additional metadata associated
+ * with it, such as constraints on its value, a mandatory flag, a read-only flag, etc.
*
* @author <a href="adrian at jboss.com">Adrian Brock</a>
* @author Scott.Stark at jboss.org
@@ -44,19 +46,40 @@
{
/**
* Get the managed object the property is associated with.
- *
+ *
+ * <b>NOTE:</b> Clients should not use this method - it is intended for server-side use only.
+ *
* @return the managed object
*/
ManagedObject getManagedObject();
+
+ /**
+ * Set the managed object the property is associated with.
+ *
+ * <b>NOTE:</b> Clients should not use this method - it is intended for server-side use only.
+ *
+ * @param managedObject the managed object
+ */
void setManagedObject(ManagedObject managedObject);
/**
- * Get the ManagedObject
+ * Get the target ManagedObject.
+ *
+ * <b>NOTE:</b> Clients should not use this method - it is intended for server-side use only.
+ *
* @see {@linkplain ManagementObjectRef}
* @return the ManagedObject the property references, null
* if there is no reference or its unresolved.
*/
ManagedObject getTargetManagedObject();
+
+ /**
+ * Set the target ManagedObject.
+ *
+ * <b>NOTE:</b> Clients should not use this method - it is intended for server-side use only.
+ *
+ * @param target the target ManagedObject
+ */
void setTargetManagedObject(ManagedObject target);
/**
@@ -125,12 +148,18 @@
/**
* Get the annotations associated with the property
+ *
+ * <b>NOTE:</b> Clients should not use this method - it is intended for server-side use only.
+ *
* @return the annotations associated with the property
*/
Map<String, Annotation> getAnnotations();
/**
* Does the property have the annotation referenced by key.
+ *
+ * <b>NOTE:</b> Clients should not use this method - it is intended for server-side use only.
+ *
* @param key the key into {@link #getAnnotations()}
* @return true if the annotation exists, false otherwise.
*/
@@ -237,10 +266,10 @@
* @return true is the property has been removed.
*/
boolean isRemoved();
+
/**
* Set whether a property has been marked as removed from its ManagedObject.
* @param flag - true is the property has been removed, false if not.
*/
void setRemoved(boolean flag);
-
}
Modified: projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperties.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperties.java 2009-06-15 15:33:21 UTC (rev 90197)
+++ projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/annotation/ManagementProperties.java 2009-06-15 15:39:37 UTC (rev 90198)
@@ -22,7 +22,7 @@
package org.jboss.managed.api.annotation;
/**
- * ManagementProperities.
+ * ManagementProperties.
*
* @author <a href="adrian at jboss.com">Adrian Brock</a>
* @author Scott.Stark at jboss.org
Modified: projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/test/PlatformMBeanUnitTestCase.java
===================================================================
--- projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/test/PlatformMBeanUnitTestCase.java 2009-06-15 15:33:21 UTC (rev 90197)
+++ projects/jboss-man/trunk/managed/src/test/java/org/jboss/test/managed/factory/test/PlatformMBeanUnitTestCase.java 2009-06-15 15:39:37 UTC (rev 90198)
@@ -31,6 +31,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+
import javax.management.MBeanInfo;
import javax.management.MBeanOperationInfo;
import javax.management.MBeanParameterInfo;
@@ -40,6 +41,7 @@
import javax.management.openmbean.CompositeDataSupport;
import junit.framework.Test;
+
import org.jboss.managed.api.ManagedObject;
import org.jboss.managed.api.ManagedOperation;
import org.jboss.managed.api.ManagedProperty;
@@ -55,7 +57,6 @@
import org.jboss.metatype.api.values.SimpleValue;
import org.jboss.metatype.api.values.SimpleValueSupport;
import org.jboss.test.managed.factory.AbstractManagedObjectFactoryTest;
-import org.jboss.util.platform.Java;
/**
* Tests of creating ManagedObjects for the jvm platform mbeans
@@ -198,7 +199,7 @@
ManagedOperation gc = ops.iterator().next();
assertEquals("gc", gc.getName());
assertEquals("Runs the garbage collector", gc.getDescription());
- gc.invoke(null);
+ gc.invoke();
}
public void testThreadMXBean()
@@ -293,10 +294,12 @@
Set<ManagedOperation> ops = mo.getOperations();
log.debug(ops);
- boolean isJDK16 = Java.isCompatible(Java.VERSION_1_6);
- int opsSize = isJDK16 ? 11 : 8;
-
- assertEquals("Ops count is " + opsSize, opsSize, ops.size());
+ String javaSpecVersion = System.getProperty("java.specification.version");
+ if (javaSpecVersion.equals("1.5") || javaSpecVersion.equals("5.0"))
+ assertEquals(mo + " has wrong number of ManagedOperations.", 8, ops.size());
+ else if (javaSpecVersion.equals("1.6") || javaSpecVersion.equals("6.0"))
+ assertEquals(mo + " has wrong number of ManagedOperations.", 11, ops.size());
+
ManagedOperation getThreadInfo = ManagedOperationMatcher.findOperation(ops,
"getThreadInfo", SimpleMetaType.LONG_PRIMITIVE, SimpleMetaType.INTEGER_PRIMITIVE);
assertNotNull("getThreadInfo", getThreadInfo);
@@ -313,7 +316,10 @@
ObjectName tname = new ObjectName(ManagementFactory.THREAD_MXBEAN_NAME);
MBeanInfo tinfo = server.getMBeanInfo(tname);
MBeanOperationInfo[] tops = tinfo.getOperations();
- assertEquals(opsSize, tops.length);
+ if (javaSpecVersion.equals("1.5") || javaSpecVersion.equals("5.0"))
+ assertEquals(8, tops.length);
+ else if (javaSpecVersion.equals("1.6") || javaSpecVersion.equals("6.0"))
+ assertEquals(11, tops.length);
for(MBeanOperationInfo op : tops)
{
MBeanParameterInfo[] params = op.getSignature();
Modified: projects/jboss-man/trunk/metatype/src/main/java/org/jboss/metatype/api/values/CompositeValueSupport.java
===================================================================
--- projects/jboss-man/trunk/metatype/src/main/java/org/jboss/metatype/api/values/CompositeValueSupport.java 2009-06-15 15:33:21 UTC (rev 90197)
+++ projects/jboss-man/trunk/metatype/src/main/java/org/jboss/metatype/api/values/CompositeValueSupport.java 2009-06-15 15:39:37 UTC (rev 90198)
@@ -83,12 +83,14 @@
if (itemValues == null)
itemValues = new MetaValue[0];
if (itemNames.length != itemValues.length)
- throw new IllegalArgumentException("itemNames has size " + itemNames.length + " but itemValues has size " + itemValues.length);
+ throw new IllegalArgumentException("for " + this.metaType + ", itemNames has size " + itemNames.length
+ + ", but itemValues has size " + itemValues.length);
Set<String> compositeNames = metaType.itemSet();
int compositeNameSize = compositeNames.size();
if (itemNames.length > compositeNameSize)
- throw new IllegalArgumentException("itemNames has size " + itemNames.length + " but composite type has size " + compositeNameSize);
+ throw new IllegalArgumentException("for " + this.metaType + ", itemNames has size " + itemNames.length
+ + ", but composite type names has size " + compositeNameSize);
this.metaType = metaType;
contents = new TreeMap<String, MetaValue>();
@@ -96,14 +98,15 @@
for (int i = 0; i < itemNames.length; i++)
{
if (itemNames[i] == null || itemNames[i].length() == 0)
- throw new IllegalArgumentException("Item name " + i + " is null or empty");
+ throw new IllegalArgumentException("for " + this.metaType + ", item name " + i + " is null or empty");
if (contents.get(itemNames[i]) != null)
- throw new IllegalArgumentException("duplicate item name " + itemNames[i]);
+ throw new IllegalArgumentException("for " + this.metaType + ", duplicate item name: " + itemNames[i]);
MetaType itemType = metaType.getType(itemNames[i]);
if (itemType == null)
- throw new IllegalArgumentException("item name not in composite type: " + itemNames[i]);
+ throw new IllegalArgumentException("for " + this.metaType + ", item name not in composite type: " + itemNames[i]);
if (itemValues[i] != null && itemType.isValue(itemValues[i]) == false)
- throw new IllegalArgumentException("item value " + itemValues[i] + " for item name " + itemNames[i] + " is not a " + itemType);
+ throw new IllegalArgumentException("for " + this.metaType + ", item value " + itemValues[i]
+ + " for item name " + itemNames[i] + " is not a " + itemType);
contents.put(itemNames[i], itemValues[i]);
}
More information about the jboss-cvs-commits
mailing list