[Mc4j-cvs] SF.net SVN: mc4j:[620] trunk/mc4j/modules/ems
Brought to you by:
ghinkl
From: <ian...@us...> - 2010-08-02 19:03:12
|
Revision: 620 http://mc4j.svn.sourceforge.net/mc4j/?rev=620&view=rev Author: ianpspringer Date: 2010-08-02 19:03:05 +0000 (Mon, 02 Aug 2010) Log Message: ----------- always compile w/ source and target of 1.5, so generics will be understood when EMS classes are used by a project compiled using JDK 1.7; improve some javadocs; upgrade version to 1.2.14 Modified Paths: -------------- trunk/mc4j/modules/ems/build.xml trunk/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/EmsBean.java trunk/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/EmsBeanName.java trunk/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/attribute/EmsAttribute.java trunk/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/notification/EmsNotification.java trunk/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/operation/EmsOperation.java trunk/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/parameter/EmsParameter.java trunk/mc4j/modules/ems/src/ems-impl/org/mc4j/ems/impl/jmx/connection/DConnection.java trunk/mc4j/modules/ems/src/ems-impl/org/mc4j/ems/impl/jmx/connection/bean/DBeanName.java trunk/mc4j/modules/ems/src/ems-impl/org/mc4j/ems/impl/jmx/connection/bean/DMBean.java trunk/mc4j/modules/ems/src/ems-impl/org/mc4j/ems/impl/jmx/connection/bean/attribute/DAttribute.java Modified: trunk/mc4j/modules/ems/build.xml =================================================================== --- trunk/mc4j/modules/ems/build.xml 2010-07-31 15:21:22 UTC (rev 619) +++ trunk/mc4j/modules/ems/build.xml 2010-08-02 19:03:05 UTC (rev 620) @@ -2,11 +2,10 @@ <!-- - Author: Greg Hinkle - Copyright 2002-2009 Greg Hinkle + Copyright 2002-2010 Greg Hinkle Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -30,7 +29,7 @@ <property name="module.jar" value="org-mc4j-ems.jar"/> - <property name="release.version" value="1.2.13"/> + <property name="release.version" value="1.2.14"/> <target @@ -67,11 +66,11 @@ property="installed.netbeans"/> -<!-- + <fail unless="jre15Available" message="JDK 1.5 or later is required to compile EMS."/> <property name="compile.target" value="1.5"/> <property name="compile.source" value="1.5"/> ---> +<!-- <condition property="compile.target" value="jsr14"> <isset property="jre15Available"/> </condition> @@ -89,7 +88,7 @@ <condition property="compile.source" value="1.5"> <isset property="jre15Available"/> </condition> - +--> <echo message="Will compile with target [${compile.target}] and source [${compile.source}]"/> </target> @@ -204,6 +203,31 @@ <target name="dist" depends="jars" description="Build the EMS distribution"/> + <target name="install" depends="jars" description="Deploys the EMS JAR Files to the Local Maven Repo"> + <property name="maven.repo.local" location="${user.home}/.m2/repository"/> + <property name="ems.artifact.dir" location="${maven.repo.local}/mc4j/org-mc4j-ems/${release.version}"/> + <mkdir dir="${ems.artifact.dir}"/> + <property name="ems-impl.artifact.dir" location="${maven.repo.local}/mc4j/org-mc4j-ems-impl/${release.version}"/> + <mkdir dir="${ems-impl.artifact.dir}"/> + + <copy todir="${ems.artifact.dir}"> + <fileset dir="dist"> + <include name="org-mc4j-ems-${release.version}.jar"/> + <include name="org-mc4j-ems-${release.version}-sources.jar"/> + <include name="org-mc4j-ems-${release.version}-javadoc.jar"/> + </fileset> + </copy> + + <copy todir="${ems-impl.artifact.dir}"> + <fileset dir="dist"> + <include name="org-mc4j-ems-impl-${release.version}.jar"/> + <include name="org-mc4j-ems-impl-${release.version}-sources.jar"/> + <include name="org-mc4j-ems-impl-${release.version}-javadoc.jar"/> + </fileset> + </copy> + </target> + + <target name="test-classloader" depends="dist"> <java classname="org.mc4j.ems.connection.support.classloader.NestedJarClassLoader" fork="yes"> <classpath> Modified: trunk/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/EmsBean.java =================================================================== --- trunk/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/EmsBean.java 2010-07-31 15:21:22 UTC (rev 619) +++ trunk/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/EmsBean.java 2010-08-02 19:03:05 UTC (rev 620) @@ -1,5 +1,5 @@ /* - * Copyright 2002-2004 Greg Hinkle + * Copyright 2002-2010 Greg Hinkle * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.mc4j.ems.connection.bean; import org.mc4j.ems.connection.bean.attribute.EmsAttribute; @@ -25,27 +24,54 @@ import java.util.SortedSet; /** + * An MBean. + * * @author Greg Hinkle (gh...@us...), Apr 4, 2005 * @version $Revision$($Author$ / $Date$) */ public interface EmsBean extends Comparable { + /** + * Returns the name of this MBean as an EmsBeanName (analogous to <tt>javax.management.ObjectName</tt>; never null. + * + * @return the name of this MBean as an EmsBeanName (analogous to <tt>javax.management.ObjectName</tt>; never null + */ EmsBeanName getBeanName(); + /** + * Returns the connection provider that was used to load this MBean; never null. + * + * @return the connection provider that was used to load this MBean; never null + */ ConnectionProvider getConnectionProvider(); + /** + * Returns a proxy for this MBean, typed to the specified interface (typically its MBean interface); never null. + * Example Usage: + * <code> + * FooMBean fooMBean = getProxy(FooMBean.class); + * </code> + * + * @param beanInterface the interface class that the proxy should implement + * @param <T> the interface that the proxy should implement + * + * @return a proxy for this MBean, typed to the specified interface (typically its MBean interface); never null + */ <T> T getProxy(Class<T> beanInterface); void loadSynchronous() ; - EmsAttribute getAttribute(String name); - + /** + * Returns the set of all attributes for this MBean; never null. + * + * @return the set of all attributes for this MBean; never null + */ SortedSet<EmsAttribute> getAttributes(); - /** - * Refresh, from the server, all attribute values for an MBean - * @return the List<EmsAttribute> attribute list + * Refresh, from the server, all attribute values for this MBean and return the set of attributes; never null. + * + * @return the list of all attributes, with updated values from the server; never null */ List<EmsAttribute> refreshAttributes(); @@ -54,36 +80,113 @@ * the requested list of attributes by name. * This method can be used to load a group of attributes with a single * server call. Attributes updated in this fashion do update their - * internal representation and do fire events on the changes. - * @param attributeNames the names of attributes to load. - * @return the list of requested attribute objects updated + * internal representation and do fire events on the changes. Never null. + * + * @param names the names of attributes to load + * + * @return the list of requested attributes, with updated values from the server; never null */ - List<EmsAttribute> refreshAttributes(List<String> attributeNames); + List<EmsAttribute> refreshAttributes(List<String> names); + /** + * Returns the attribute with the specified name, or null if this MBean has no such attribute. + * + * @param name the attribute name + * + * @return the attribute with the specified name, or null if this MBean has no such attribute + */ + EmsAttribute getAttribute(String name); + + /** + * The fully qualified class name of this MBean's interface (e.g. "com.example.FooMBean"), as defined in its + * MBeanInfo. + * + * @return the name of this MBean's Java interface (e.g. "com.example.FooMBean"), as defined in its MBeanInfo + */ String getClassTypeName(); + /** + * This MBean's interface class (e.g. com.example.FooMBean), as defined in its MBeanInfo. + * + * @return this MBean's interface class (e.g. com.example.FooMBean), as defined in its MBeanInfo + * + * @throws ClassNotFoundException if the MBean's interface class could not be found in our class loader + */ Class getClassType() throws ClassNotFoundException; + /** + * Returns the set of all operations for this MBean; never null. + * + * @return the set of all operations for this MBean; never null + */ + SortedSet<EmsOperation> getOperations(); + + /** + * Returns an operation with the specified name, or null if this MBean has no such operations. + * <b>NOTE: </b> If the MBean has more than one operation defined with the specified name, the operation that is + * returned is indeterminate, which is why this method has been deprecated in favor of + * {@link #getOperation(String, Class[])}. + * + * @param name the operation name + * + * @return an operation with the specified name, or null if this MBean has no such operations + * + * @deprecated {@link #getOperation(String, Class[])} should be used instead + */ EmsOperation getOperation(String name); - SortedSet<EmsOperation> getOperations(); + /** + * Returns the operation with the specified name and parameter types, or null if this MBean has no such operation. + * + * @param name the operation name + * @param parameterTypes the operation parameter types + * + * @return the operation with the specified name and parameter types, or null if this MBean has no such operation + */ + EmsOperation getOperation(String name, Class... parameterTypes); + /** + * Returns the set of all notifications for this MBean; never null. + * + * @return the set of all notifications for this MBean; never null + */ + SortedSet<EmsNotification> getNotifications(); + + /** + * Returns the notification with the specified name, or null if this MBean has no such notification. + * + * @param name the notification name + * + * @return the notification with the specified name, or null if this MBean has no such notification + */ EmsNotification getNotification(String name); - SortedSet<EmsNotification> getNotifications(); - + /** + * Unregisters this MBean from the server. + */ void unregister(); /** - * This runs an live mbean server request to check that the - * MBean represented by this bean is still registered. + * This sends a request to the server to check that this + * MBean is still registered on the server. + * * @return true if the MBean is still registered in the MBeanServer */ boolean isRegistered(); + /** + * Returns true if this MBean defines one or more notifications, otherwise returns false. + * + * @return true if this MBean defines one or more notifications, otherwise returns false + */ boolean isNotificationEmiter(); + /** + * Returns true if this MBean has one or more attributes or operations with unsupported types, otherwise returns + * false. + * + * @return true if this MBean has one or more attributes or operations with unsupported types, otherwise returns + * false + */ boolean isHasUnsupportedType(); - - EmsOperation getOperation(String operationName, Class... parameterTypes); } Modified: trunk/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/EmsBeanName.java =================================================================== --- trunk/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/EmsBeanName.java 2010-07-31 15:21:22 UTC (rev 619) +++ trunk/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/EmsBeanName.java 2010-08-02 19:03:05 UTC (rev 620) @@ -3,22 +3,57 @@ import java.util.Map; /** - * Created by IntelliJ IDEA. - * User: ghinkle - * Date: Oct 25, 2005 - * Time: 1:13:12 AM - * To change this template use File | Settings | File Templates. + * An MBean name. */ public interface EmsBeanName extends Comparable { - - + /** + * Returns the domain of this name. + * + * @return the domain of this name + */ String getDomain(); + /** + * Returns the canonical form of the name as defined by {@link ObjectName#getCanonicalName()}. + * + * @return the canonical form of the name as defined by {@link ObjectName#getCanonicalName()} + */ String getCanonicalName(); - Map<String,String> getKeyProperties(); + /** + * Returns a Map of this name's key properties. The keys of the Map are the key property names, and the values are + * the values of the corresponding key properties. + * + * @return a Map of this name's key properties + */ + Map<String, String> getKeyProperties(); + /** + * Returns the value for the key property with the specified name. + * + * @param name the key property name + * + * @return the value of the key property, or null if there is no such + * key property in this DBeanName. + * + * @throws NullPointerException If <code>name</code> is null + */ String getKeyProperty(String key); - boolean apply(String objectName); + /** + * Tests whether this name, which may be a pattern, + * matches another MBean name. If <code>name</code> is a pattern, + * the result is false. If this EmsBeanName is a pattern, the + * result is true if and only if <code>name</code> matches the + * pattern. If neither this EmsBeanName nor <code>name</code> is + * a pattern, the result is true if and only if the two + * EmsBeanNames have canonical String forms that are equal. + * + * @param name the MBean name to compare to + * + * @return true if <code>name</code> matches this EmsBeanName + * + * @throws NullPointerException if <code>name</code> is null + */ + boolean apply(String name); } Modified: trunk/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/attribute/EmsAttribute.java =================================================================== --- trunk/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/attribute/EmsAttribute.java 2010-07-31 15:21:22 UTC (rev 619) +++ trunk/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/attribute/EmsAttribute.java 2010-08-02 19:03:05 UTC (rev 620) @@ -13,12 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.mc4j.ems.connection.bean.attribute; import org.mc4j.ems.store.ValueHistory; /** + * An MBean attribute. + * * @author Greg Hinkle (gh...@us...), Apr 4, 2005 * @version $Revision$($Author$ / $Date$) */ @@ -32,47 +33,97 @@ void registerAttributeChangeListener(AttributeChangeListener listener); + + /** + * Returns the locally stored value of this attribute. Does not ask the server for the current value. + * + * @return the locally stored value of this attribute + */ Object getValue(); /** - * Set the attribute on the server - * @param newValue The value to be set - * @throws Exception + * Set the attribute's value on the server. + * + * @param newValue the value to be set + * + * @throws Exception if there was a failure to set the attribute */ void setValue(Object newValue) throws Exception; + /** * Alters the internally stored value of this attribute. Does not update the - * server value. Is intended for mass load of attribute data via the MBean. - * @param newValue + * server value. Is intended for mass updates of attribute data via the MBean. + * + * @param newValue the value to be set */ void alterValue(Object newValue); - /** - * Updates the local value of this mbean from the server + * Updates the local value of this attribute from the server. */ Object refresh(); + /** + * + * @return + */ ValueHistory getValueHistory(); + /** + * + * @return + */ String getName(); + + /** + * + * @return + */ String getType(); + /** + * + * @return + */ Class getTypeClass(); + /** + * + * @return + */ boolean isNumericType(); String getDescription() ; + /** + * Returns true if this attribute is readable, or false if it is not. + * + * @return true if this attribute is readable, or false if it is not + */ + boolean isReadable(); - boolean isReadable(); + /** + * Returns true if this attribute is writable, or false if it is not. + * + * @return true if this attribute is writable, or false if it is not + */ boolean isWritable(); - + /** + * + * @return + */ boolean isSupportedType(); + /** + * + * @param supportedType + */ void setSupportedType(boolean supportedType); - + /** + * + * @return + */ int getValueSize(); } Modified: trunk/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/notification/EmsNotification.java =================================================================== --- trunk/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/notification/EmsNotification.java 2010-07-31 15:21:22 UTC (rev 619) +++ trunk/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/notification/EmsNotification.java 2010-08-02 19:03:05 UTC (rev 620) @@ -19,19 +19,19 @@ import java.util.List; /** + * An MBean notification. + * * @author Greg Hinkle (gh...@us...), Apr 4, 2005 * @version $Revision$($Author$ / $Date$) */ public interface EmsNotification extends Comparable { - String getName(); String getDescription(); String[] getTypes(); - void addNotificationListener(EmsNotificationListener listener); boolean removeNotificationListener(EmsNotificationListener listener); Modified: trunk/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/operation/EmsOperation.java =================================================================== --- trunk/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/operation/EmsOperation.java 2010-07-31 15:21:22 UTC (rev 619) +++ trunk/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/operation/EmsOperation.java 2010-08-02 19:03:05 UTC (rev 620) @@ -26,6 +26,8 @@ import java.io.ObjectStreamException; /** + * An MBean operation. + * * @author Greg Hinkle (gh...@us...), Apr 4, 2005 * @version $Revision$($Author$ / $Date$) */ Modified: trunk/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/parameter/EmsParameter.java =================================================================== --- trunk/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/parameter/EmsParameter.java 2010-07-31 15:21:22 UTC (rev 619) +++ trunk/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/parameter/EmsParameter.java 2010-08-02 19:03:05 UTC (rev 620) @@ -1,15 +1,30 @@ package org.mc4j.ems.connection.bean.parameter; /** - * Created: Jul 20, 2005 1:16:45 AM + * An MBean operation parameter. * * @author Greg Hinkle (gh...@us...) * @version $Revision$($Author$ / $Date$) */ public interface EmsParameter extends Comparable { + /** + * Returns the name of this parameter. + * + * @return the name of this parameter + */ String getName(); + /** + * Returns a human readable description of this parameter; may be null. + * + * @return a human readable description of this parameter; may be null + */ String getDescription(); + /** + * Returns the type (i.e. fully qualified class name as defined by {@link Class#getName()}) of this parameter. + * + * @return the type (i.e. fully qualified class name as defined by {@link Class#getName()}) of this parameter + */ String getType(); } Modified: trunk/mc4j/modules/ems/src/ems-impl/org/mc4j/ems/impl/jmx/connection/DConnection.java =================================================================== --- trunk/mc4j/modules/ems/src/ems-impl/org/mc4j/ems/impl/jmx/connection/DConnection.java 2010-07-31 15:21:22 UTC (rev 619) +++ trunk/mc4j/modules/ems/src/ems-impl/org/mc4j/ems/impl/jmx/connection/DConnection.java 2010-08-02 19:03:05 UTC (rev 620) @@ -254,6 +254,7 @@ } catch (Exception e) { throw new EmsException("Could not create MBean", e); } + // TODO: Shouldn't we add the MBean to our map too? } public void removeMBean(String objectName) throws EmsException { @@ -265,6 +266,7 @@ } catch (Exception e) { throw new EmsException("Could not remove MBean", e); } + // TODO: Shouldn't we remove the MBean from our map too? } public synchronized SortedSet<EmsBean> getBeans() { Modified: trunk/mc4j/modules/ems/src/ems-impl/org/mc4j/ems/impl/jmx/connection/bean/DBeanName.java =================================================================== --- trunk/mc4j/modules/ems/src/ems-impl/org/mc4j/ems/impl/jmx/connection/bean/DBeanName.java 2010-07-31 15:21:22 UTC (rev 619) +++ trunk/mc4j/modules/ems/src/ems-impl/org/mc4j/ems/impl/jmx/connection/bean/DBeanName.java 2010-08-02 19:03:05 UTC (rev 620) @@ -26,7 +26,6 @@ return objectName; } - public String getDomain() { return objectName.getDomain(); } @@ -41,10 +40,11 @@ return (Map<String, String>) objectName.getKeyPropertyList(); } - public String getKeyProperty(String key) { - return objectName.getKeyProperty(key); + public String getKeyProperty(String name) { + return objectName.getKeyProperty(name); } + public boolean apply(String objectNameFilterString) { try { return this.objectName.apply(new ObjectName(objectNameFilterString)); @@ -54,8 +54,9 @@ } /** - * Output the generalized objectname string in input format - * @return + * <p>Returns a string representation of this name.</p> + * + * @return a string representation of this name */ public String toString() { return this.objectName.toString(); @@ -67,7 +68,6 @@ return toString().compareTo(((EmsBeanName) o).toString()); } - public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Modified: trunk/mc4j/modules/ems/src/ems-impl/org/mc4j/ems/impl/jmx/connection/bean/DMBean.java =================================================================== --- trunk/mc4j/modules/ems/src/ems-impl/org/mc4j/ems/impl/jmx/connection/bean/DMBean.java 2010-07-31 15:21:22 UTC (rev 619) +++ trunk/mc4j/modules/ems/src/ems-impl/org/mc4j/ems/impl/jmx/connection/bean/DMBean.java 2010-08-02 19:03:05 UTC (rev 620) @@ -1,5 +1,5 @@ /* - * Copyright 2002-2004 Greg Hinkle + * Copyright 2002-2010 Greg Hinkle * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.mc4j.ems.impl.jmx.connection.bean; import org.apache.commons.logging.Log; @@ -44,7 +43,6 @@ import javax.management.ObjectName; import java.util.*; - /** * @author Greg Hinkle (gh...@us...), Apr 4, 2005 * @version $Revision$($Author$ / $Date$) @@ -388,6 +386,8 @@ } catch (InstanceNotFoundException e) { throw new EmsBeanNotFoundException("Could not unregister bean, instance not found [" + getObjectName().getCanonicalName() + "]", e); } + // TODO: Shouldn't we remove the MBean from our map too? + //connectionProvider.getExistingConnection().removeMBean(getObjectName().toString()); } protected MBeanInfo getMBeanInfo() { Modified: trunk/mc4j/modules/ems/src/ems-impl/org/mc4j/ems/impl/jmx/connection/bean/attribute/DAttribute.java =================================================================== --- trunk/mc4j/modules/ems/src/ems-impl/org/mc4j/ems/impl/jmx/connection/bean/attribute/DAttribute.java 2010-07-31 15:21:22 UTC (rev 619) +++ trunk/mc4j/modules/ems/src/ems-impl/org/mc4j/ems/impl/jmx/connection/bean/attribute/DAttribute.java 2010-08-02 19:03:05 UTC (rev 620) @@ -51,6 +51,8 @@ /** * @author Greg Hinkle (gh...@us...), Apr 4, 2005 * @version $Revision$($Author$ / $Date$) + * + * TODO: Implement Comparable. */ public class DAttribute implements EmsAttribute { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |