User: juha
Date: 00/07/19 14:27:44
Modified: src/main/org/jboss/verifier BeanVerifier.java Section.java
Log:
Using the Section class and properties for messaging.
Revision Changes Path
1.3 +15 -13 jboss/src/main/org/jboss/verifier/BeanVerifier.java
Index: BeanVerifier.java
===================================================================
RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/verifier/BeanVerifier.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BeanVerifier.java 2000/06/03 21:43:56 1.2
+++ BeanVerifier.java 2000/07/19 21:27:43 1.3
@@ -19,13 +19,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* This package and its source code is available at www.jboss.org
- * $Id: BeanVerifier.java,v 1.2 2000/06/03 21:43:56 juha Exp $
+ * $Id: BeanVerifier.java,v 1.3 2000/07/19 21:27:43 juha Exp $
*/
// standard imports
import java.util.Iterator;
-import java.io.File;
import java.net.URL;
import java.beans.beancontext.BeanContextServicesSupport;
@@ -38,9 +37,10 @@
import org.jboss.verifier.event.VerificationEvent;
import org.jboss.verifier.event.VerificationListener;
-import org.jboss.verifier.event.VerificationEventFactory;
import org.jboss.verifier.event.VerificationEventGeneratorSupport;
+import org.jboss.verifier.factory.VerificationEventFactory;
+import org.jboss.verifier.factory.DefaultEventFactory;
import com.dreambean.ejx.ejb.EnterpriseBeans;
import com.dreambean.ejx.xml.ProjectX;
@@ -60,10 +60,11 @@
* For more detailed documentation, refer to the
* <a href="" << INSERT DOC LINK HERE >> </a>
*
- * @see << OTHER RELATED CLASSES >>
+ * @see org.jboss.verifier.strategy.VerificationStrategy
+ * @see org.jboss.verifier.factory.VerificationEventFactory
*
* @author Juha Lindfors ([EMAIL PROTECTED])
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
* @since JDK 1.3
*/
public class BeanVerifier implements VerificationContext {
@@ -80,14 +81,13 @@
new VerificationEventGeneratorSupport();
/*
- * Will make this look like a real object factory later on. Specify the
- * interface and add an example factory implementation.
+ * Factory for creating the events. DefaultEventFactory produces
+ * plain string events.
*/
- private VerificationEventFactory eventFactory =
- new VerificationEventFactory();
+ private VerificationEventFactory eventFactory = new DefaultEventFactory();
- /*
+ /**
* Default constructor.
*/
public BeanVerifier() { }
@@ -95,11 +95,13 @@
- /*
+ /**
* Checks the Enterprise Java Beans found in this Jar for EJB spec
* compliance (EJB Spec. 1.1). Ensures that the given interfaces
* and implementation classes implement required methods and follow
* the contract given in the spec.
+ *
+ * @param url URL to the bean jar file
*/
public void verify(URL url) {
@@ -215,8 +217,8 @@
// [TODO] a generic exception is no good
- System.err.println(e);
- return null;
+ throw new IllegalArgumentException(e.toString());
+ //return null;
}
}
1.2 +16 -22 jboss/src/main/org/jboss/verifier/Section.java
Index: Section.java
===================================================================
RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/verifier/Section.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Section.java 2000/06/15 20:30:28 1.1
+++ Section.java 2000/07/19 21:27:44 1.2
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* This package and its source code is available at www.jboss.org
- * $Id: Section.java,v 1.1 2000/06/15 20:30:28 juha Exp $
+ * $Id: Section.java,v 1.2 2000/07/19 21:27:44 juha Exp $
*/
// standard imports
@@ -39,12 +39,12 @@
* @see << OTHER RELATED CLASSES >>
*
* @author Juha Lindfors
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
* @since JDK 1.3
*/
public class Section {
- private char[] section;
+ private String[] section;
/*
* Constructor
@@ -68,17 +68,11 @@
****************************************************************************
*/
- /*
- * Uses the hashcode of the id string
- */
- public int hashCode() {
- return getSection().hashCode();
- }
/*
* Returns the section number by index
*/
- public char getSectionToken(int index) {
+ public String getSectionToken(int index) {
if (section.length >= index)
throw new IndexOutOfBoundsException(GET_SECTION_INDEX_ERROR);
@@ -91,11 +85,6 @@
*/
public String getSection() {
- /*
- * [TODO] this can be done more efficiently by creating/storing the string
- * at construction time. We can do this cause at the moment we're
- * still immutable.
- */
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < section.length; ++i) {
@@ -108,6 +97,13 @@
return buffer.toString();
}
+ /*
+ * String representation of this object
+ */
+ public String toString() {
+ return getSection();
+ }
+
/*
@@ -119,22 +115,20 @@
*/
/*
- * parses the id string into char array
+ * parses the id string into section array
*/
- private char[] parseSection(String id) throws ParseException {
+ private String[] parseSection(String id) throws ParseException {
StringTokenizer tokenizer = new StringTokenizer(id, DELIMETER);
int count = tokenizer.countTokens();
- char[] token = new char[count];
+ String[] token = new String[count];
for (int i = 0; tokenizer.hasMoreTokens(); ++i) {
String str = tokenizer.nextToken();
- if (str.length() > 1)
- throw new ParseException(PARSE_SECTION_ERROR, i);
-
- token[i] = str.toCharArray()[0];
+
+ token[i] = str;
}
return token;