User: juha
Date: 00/10/15 13:52:28
Modified: src/main/org/jboss/verifier/event VerificationEvent.java
Log:
Verifier verbose mode implemented. On by default, edit jboss.jcml to turn it off.
Revision Changes Path
1.4 +69 -15 jboss/src/main/org/jboss/verifier/event/VerificationEvent.java
Index: VerificationEvent.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/verifier/event/VerificationEvent.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- VerificationEvent.java 2000/08/20 20:48:08 1.3
+++ VerificationEvent.java 2000/10/15 20:52:28 1.4
@@ -18,31 +18,25 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * This package and its source code is available at www.gjt.org
- * $Id: VerificationEvent.java,v 1.3 2000/08/20 20:48:08 juha Exp $
- *
- * You can reach the author by sending email to [EMAIL PROTECTED] or
- * directly to [EMAIL PROTECTED]
+ * This package and its source code is available at www.jboss.org
+ * $Id: VerificationEvent.java,v 1.4 2000/10/15 20:52:28 juha Exp $
*/
// standard imports
import java.util.EventObject;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
// non-standard class dependencies
+import org.jboss.verifier.Section;
/**
- * << DESCRIBE THE CLASS HERE >>
- *
- * For more detailed documentation, refer to the
- * <a href="" << INSERT DOC LINK HERE >> </a>
- *
- * @see << OTHER RELATED CLASSES >>
*
- * @author Juha Lindfors
- * @version $Revision: 1.3 $
+ * @author Juha Lindfors ([EMAIL PROTECTED])
+ * @version $Revision: 1.4 $
* @since JDK 1.3
*/
public class VerificationEvent extends EventObject {
@@ -66,6 +60,9 @@
private String beanName = "<unnamed>";
+ private Method method = null;
+
+ private String section = null;
/*
*************************************************************************
@@ -124,12 +121,69 @@
this.beanName = name;
}
+ public void setSection(Section section) {
+ this.section = section.getSection();
+ }
+
+ public void setMethod(Method method) {
+ if (method == null)
+ return;
+
+ this.method = method;
+ }
+
public String getMessage() {
- return message;
+ return beanName + ": " + message;
}
public String getVerbose() {
- return verbose;
+
+ StringBuffer buf = new StringBuffer();
+ String linebreak = System.getProperty("line.separator");
+
+ buf.append(linebreak + "Class : " + beanName + linebreak);
+
+ if (method != null) {
+ String returnClassName = method.getReturnType().getName();
+ int len = returnClassName.length();
+ int roffset = returnClassName.lastIndexOf(".");
+
+ if (roffset == -1)
+ roffset = 0;
+
+ String returnType = returnClassName.substring(roffset+1, len);
+
+ Class[] exceptions = method.getExceptionTypes();
+ StringBuffer excbuf = new StringBuffer(100);
+
+ for (int i = 0; i < exceptions.length; ++i) {
+ String exceptionClassName = exceptions[i].getName();
+ int elen = exceptionClassName.length();
+ int eoffset = exceptionClassName.lastIndexOf(".");
+
+ if (eoffset == -1)
+ eoffset = 0;
+
+ excbuf.append(exceptionClassName.substring(eoffset+1, elen))
+ .append(", ");
+ }
+ excbuf.delete(excbuf.length()-2, excbuf.length());
+
+ buf.append("Method : " + Modifier.toString(method.getModifiers()) + " "
+
+ returnType + " " +
+ method.getName() + "() throws " +
+ excbuf.toString() +
+ linebreak);
+ }
+
+ int offset = section.lastIndexOf(".");
+ if (!Character.isDigit(section.charAt(offset+1)))
+ buf.append("Section: " + section.substring(0, offset) + linebreak);
+ else buf.append("Section: " + section + linebreak);
+
+ buf.append("Warning: " + message + linebreak);
+
+ return buf.toString();
}
public String getName() {