yoavs 2003/07/28 17:59:39
Modified: modeler/src/java/org/apache/commons/modeler/modules
MbeansDescriptorsIntrospectionSource.java
Log:
- Added Apache license
- Added and fixed JavaDoc
Revision Changes Path
1.12 +92 -9
jakarta-commons/modeler/src/java/org/apache/commons/modeler/modules/MbeansDescriptorsIntrospectionSource.java
Index: MbeansDescriptorsIntrospectionSource.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/modeler/src/java/org/apache/commons/modeler/modules/MbeansDescriptorsIntrospectionSource.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- MbeansDescriptorsIntrospectionSource.java 22 Jul 2003 18:11:19 -0000 1.11
+++ MbeansDescriptorsIntrospectionSource.java 29 Jul 2003 00:59:39 -0000 1.12
@@ -1,3 +1,62 @@
+/*
+ * ====================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Commons", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ * [Additional notices, if required by prior licensing conditions]
+ *
+ */
+
package org.apache.commons.modeler.modules;
import org.apache.commons.logging.Log;
@@ -10,6 +69,7 @@
import org.apache.commons.modeler.ConstructorInfo;
import javax.management.ObjectName;
+
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Constructor;
@@ -20,7 +80,6 @@
import java.util.Hashtable;
import java.util.List;
-
public class MbeansDescriptorsIntrospectionSource extends ModelerSource
{
private static Log log =
LogFactory.getLog(MbeansDescriptorsIntrospectionSource.class);
@@ -119,8 +178,10 @@
/**
* Check if this class is one of the supported types.
- * @param ret
- * @return true if the class is a supported type.
+ * If the class is supported, returns true. Otherwise,
+ * returns false.
+ * @param ret The class to check
+ * @return boolean True if class is supported
*/
private boolean supportedType(Class ret) {
for (int i = 0; i < supportedTypes.length; i++) {
@@ -136,8 +197,10 @@
/**
* Check if this class conforms to JavaBeans specifications.
- * @param javaType
- * @return
+ * If the class is conformant, returns true.
+ *
+ * @param javaType The class to check
+ * @return boolean True if the class is compatible.
*/
protected boolean isBeanCompatible(Class javaType) {
// Must be a non-primitive and non array
@@ -171,9 +234,16 @@
return true;
}
- /** Process the methods and extract 'attributes', methods, etc
- *
- */
+ /**
+ * Process the methods and extract 'attributes', methods, etc
+ *
+ * @param realClass The class to process
+ * @param methods The methods to process
+ * @param attMap The attribute map (complete)
+ * @param getAttMap The readable attributess map
+ * @param setAttMap The settable attributes map
+ * @param invokeAttMap The invokable attributes map
+ */
private void initMethods(Class realClass,
Method methods[],
Hashtable attMap, Hashtable getAttMap,
@@ -254,6 +324,11 @@
* from source
* XXX Deal with constructors
*
+ * @param registry The Bean registry (not used)
+ * @param domain The bean domain (not used)
+ * @param realClass The class to analyze
+ * @param type The bean type
+ * @return ManagedBean The create MBean
*/
public ManagedBean createManagedBean(Registry registry, String domain,
Class realClass, String type)
@@ -362,7 +437,13 @@
// -------------------- Utils --------------------
-
+ /**
+ * Converts the first character of the given
+ * String into lower-case.
+ *
+ * @param name The string to convert
+ * @return String
+ */
private static String unCapitalize(String name) {
if (name == null || name.length() == 0) {
return name;
@@ -373,3 +454,5 @@
}
}
+
+// End of class: MbeanDescriptorsIntrospectionSource
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]