User: rinkrank
Date: 02/05/28 15:35:24
Modified: core/src/xdoclet/loader SubTaskDefinition.java
TagHandlerDefinition.java XDocletModule.java
XDocletXmlParser.java XDocletXmlParserTest.java
Log:
Merged MODULE_REFACTORING_BRANCH back to MAIN
Revision Changes Path
1.2 +12 -15 xdoclet/core/src/xdoclet/loader/SubTaskDefinition.java
Index: SubTaskDefinition.java
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/loader/SubTaskDefinition.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -r1.1 -r1.2
--- SubTaskDefinition.java 7 Apr 2002 21:12:33 -0000 1.1
+++ SubTaskDefinition.java 28 May 2002 22:35:24 -0000 1.2
@@ -3,23 +3,20 @@
* All rights reserved.
*/
package xdoclet.loader;
+
/**
* @created 7. april 2002
*/
-class SubTaskDefinition
+public class SubTaskDefinition
{
public final String name;
public final String implementationClass;
public final String parentTaskClass;
+
public SubTaskDefinition( String name, String implementationClass, String
parentTaskClass )
{
this.name = name;
this.implementationClass = implementationClass;
this.parentTaskClass = parentTaskClass;
}
-
- public String createMethodName()
- {
- return "create" + name.substring( 0, 1 ).toUpperCase() +
name.substring( 1 );
- }
}
1.3 +15 -38 xdoclet/core/src/xdoclet/loader/TagHandlerDefinition.java
Index: TagHandlerDefinition.java
===================================================================
RCS file:
/cvsroot/xdoclet/xdoclet/core/src/xdoclet/loader/TagHandlerDefinition.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -r1.2 -r1.3
--- TagHandlerDefinition.java 9 Apr 2002 00:07:16 -0000 1.2
+++ TagHandlerDefinition.java 28 May 2002 22:35:24 -0000 1.3
@@ -4,47 +4,24 @@
*/
package xdoclet.loader;
-import xdoclet.template.TemplateTagHandler;
-
/**
* @author Aslak Helles�y
* @created 7. april 2002
*/
-class TagHandlerDefinition
+public class TagHandlerDefinition
{
- /**
- * @todo-javadoc Describe the field
- */
public final String namespace;
- /**
- * @todo-javadoc Describe the field
- */
- private final String className;
+ public final String className;
/**
* Describe what the TagHandlerDefinition constructor does
*
* @param namespace Describe what the parameter does
* @param className Describe what the parameter does
- * @todo-javadoc Write javadocs for constructor
- * @todo-javadoc Write javadocs for method parameter
- * @todo-javadoc Write javadocs for method parameter
*/
public TagHandlerDefinition( String namespace, String className )
{
this.namespace = namespace;
this.className = className;
}
-
- /**
- * Gets the TagHandler attribute of the TagHandlerDefinition object
- *
- * @return The TagHandler value
- * @exception Exception Describe the exception
- * @todo-javadoc Write javadocs for exception
- */
- public TemplateTagHandler getTagHandler() throws Exception
- {
- return ( TemplateTagHandler ) Class.forName( className ).newInstance();
- }
}
1.6 +47 -46 xdoclet/core/src/xdoclet/loader/XDocletModule.java
Index: XDocletModule.java
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/loader/XDocletModule.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -r1.5 -r1.6
--- XDocletModule.java 21 Apr 2002 20:40:13 -0000 1.5
+++ XDocletModule.java 28 May 2002 22:35:24 -0000 1.6
@@ -4,22 +4,22 @@
*/
package xdoclet.loader;
-import java.util.List;
import java.util.ArrayList;
-import xdoclet.template.TemplateEngine;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+
import xdoclet.template.TemplateTagHandler;
-import xdoclet.template.TemplateException;
-import xdoclet.util.Log;
-import org.apache.log4j.Category;
+import xdoclet.util.LogUtil;
/**
* This is an object view of the data in xdoclet.xml
*
* @author <a href="mailto:[EMAIL PROTECTED]">Aslak Helles�y</a>
* @created 7. april 2002
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*/
-class XDocletModule
+public class XDocletModule
{
private ArrayList _tagHandlers = new ArrayList();
private ArrayList _subTasks = new ArrayList();
@@ -40,24 +40,25 @@
public void addTagHandler( String namespace, String clazz )
{
- Category cat = Log.getCategory( getClass(), "addTagHandler" );
+ Log log = LogUtil.getLog(getClass(), "addTagHandler");
- try
- {
- cat.debug( "registering tag tandler " + clazz + " to namespace
" + namespace + "." );
+ try {
+ log.debug("registering tag tandler " + clazz + " to namespace " +
namespace + '.');
- TemplateTagHandler handler = ( TemplateTagHandler )
Class.forName( clazz ).newInstance();
+ TagHandlerDefinition thd = new TagHandlerDefinition(namespace, clazz);
- TemplateEngine.getEngineInstance().setTagHandlerFor(
namespace, handler );
+ _tagHandlers.add(thd);
}
- catch( Throwable t )
- {
- System.err.println( "Couldn't register tag handler " + clazz +
":" + t.getMessage() );
+ catch (Throwable t) {
+ System.err.println("Couldn't register tag handler " + clazz + ':' +
t.getMessage());
}
}
public void addSubTask( String name, String implementationClass, String
parentTaskClass )
{
+ if (!name.equals(name.toLowerCase())) {
+ throw new IllegalStateException("Subtask names must be lowercase.
Please modify the name of the subtask (" + name + ')');
+ }
_subTasks.add( new SubTaskDefinition( name, implementationClass,
parentTaskClass ) );
}
}
1.4 +71 -76 xdoclet/core/src/xdoclet/loader/XDocletXmlParser.java
Index: XDocletXmlParser.java
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/loader/XDocletXmlParser.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -r1.3 -r1.4
--- XDocletXmlParser.java 11 Apr 2002 20:53:00 -0000 1.3
+++ XDocletXmlParser.java 28 May 2002 22:35:24 -0000 1.4
@@ -4,26 +4,28 @@
*/
package xdoclet.loader;
-import java.io.InputStream;
import java.io.IOException;
-import org.xml.sax.helpers.DefaultHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.Attributes;
+import java.io.InputStream;
+
+import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
-import javax.xml.parsers.ParserConfigurationException;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
/**
* Parses xdoclet.xml deployment descriptor
*
* @author <a href="mailto:[EMAIL PROTECTED]">Aslak Helles�y</a>
* @created 7. april 2002
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
*/
class XDocletXmlParser extends DefaultHandler
{
private final SAXParserFactory _factory;
- private XDocletModule _module;
+ private XDocletModule module;
public XDocletXmlParser()
{
@@ -38,54 +40,47 @@
*/
public XDocletModule parse( InputStream in )
{
- try
- {
+ try {
SAXParser parser = _factory.newSAXParser();
parser.parse( in, this );
}
- catch( IOException e )
- {
- _module = null;
+ catch (IOException e) {
+ module = null;
e.printStackTrace();
}
- catch( IllegalArgumentException e )
- {
- _module = null;
+ catch (IllegalArgumentException e) {
+ module = null;
e.printStackTrace();
}
- catch( ParserConfigurationException e )
- {
- _module = null;
+ catch (ParserConfigurationException e) {
+ module = null;
e.printStackTrace();
}
- catch( SAXException e )
- {
- _module = null;
+ catch (SAXException e) {
+ module = null;
e.printStackTrace();
}
- return _module;
+ return module;
}
public void startDocument()
{
- _module = new XDocletModule();
+ module = new XDocletModule();
}
public void startElement( String namespaceURI, String localName, String qName,
Attributes attributes )
{
- if( qName.equals( "taghandler" ) )
- {
- _module.addTagHandler(
+ if (qName.equals("taghandler")) {
+ module.addTagHandler(
attributes.getValue( "namespace" ),
attributes.getValue( "class" )
);
}
else
- if( qName.equals( "subtask" ) )
- {
- _module.addSubTask(
+ if (qName.equals("subtask")) {
+ module.addSubTask(
attributes.getValue( "name" ),
attributes.getValue( "implementation-class" ),
attributes.getValue( "parent-task-class" )
1.2 +16 -15 xdoclet/core/src/xdoclet/loader/XDocletXmlParserTest.java
Index: XDocletXmlParserTest.java
===================================================================
RCS file:
/cvsroot/xdoclet/xdoclet/core/src/xdoclet/loader/XDocletXmlParserTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -r1.1 -r1.2
--- XDocletXmlParserTest.java 7 Apr 2002 01:19:53 -0000 1.1
+++ XDocletXmlParserTest.java 28 May 2002 22:35:24 -0000 1.2
@@ -4,13 +4,14 @@
*/
package xdoclet.loader;
-import junit.framework.TestCase;
+import java.io.FileInputStream;
-import java.io.*;
+import junit.framework.TestCase;
/**
* @author <a href="mailto:[EMAIL PROTECTED]">Aslak Helles�y</a>
- * @version $Revision: 1.1 $
+ * @created 4 mei 2002
+ * @version $Revision: 1.2 $
*/
public class XDocletXmlParserTest extends TestCase
{
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel