User: rinkrank
  Date: 02/04/21 13:40:14

  Modified:    core/src/xdoclet DocletTask.java XDocletMain.java
                        XDocletTagSupport.java
  Log:
  -handled classloading issues in xjavadoc in stead of xdoclet
  -some loader/module bugfixes
  
  Revision  Changes    Path
  1.39      +17 -180   xdoclet/core/src/xdoclet/DocletTask.java
  
  Index: DocletTask.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/DocletTask.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -w -r1.38 -r1.39
  --- DocletTask.java   18 Apr 2002 06:16:02 -0000      1.38
  +++ DocletTask.java   21 Apr 2002 20:40:14 -0000      1.39
  @@ -6,12 +6,7 @@
   
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.DirectoryScanner;
  -import org.apache.tools.ant.Task;
  -import org.apache.tools.ant.AntClassLoader;
   import org.apache.tools.ant.Project;
  -import org.apache.tools.ant.types.FileSet;
  -import org.apache.tools.ant.types.Path;
  -import org.apache.tools.ant.types.Reference;
   import org.apache.log4j.Category;
   
   import xdoclet.util.Translator;
  @@ -21,6 +16,7 @@
   
   import xjavadoc.SourceSet;
   import xjavadoc.XJavaDoc;
  +import xjavadoc.ant.XJavadocTask;
   
   import java.io.*;
   import java.util.HashMap;
  @@ -36,9 +32,9 @@
    * @author    Ara Abrahamian ([EMAIL PROTECTED])
    * @author    <a href="mailto:[EMAIL PROTECTED]";>Aslak Hellesøy</a>
    * @created   June 19, 2001
  - * @version   $Revision: 1.38 $
  + * @version   $Revision: 1.39 $
    */
  -public class DocletTask extends Task
  +public class DocletTask extends XJavadocTask
   {
        // ant will replace the tag with the version propperty specified in build.xml
        /**
  @@ -46,73 +42,25 @@
         */
        public final static String XDOCLET_VERSION = "@VERSION@";
   
  +     private final static String _fileName = "xdoclet." + System.getProperty( 
"user.name" ) + ".ser";
        /**
         * @todo-javadoc   Describe the field
         */
  -     protected transient DocletContext context = null;
  -
  -     /**
  -      * @todo-javadoc   Describe the field
  -      */
  -     private final Vector filesets = new Vector();
  -
  -     /**
  -      * @todo-javadoc   Describe the field
  -      */
  -     private Path       classpath;
  -     /**
  -      * @todo-javadoc   Describe the field
  -      */
  -     private Reference  classpathRef;
  +     private final static File DEFAULT_TMP_FILE = new File( System.getProperty( 
"java.io.tmpdir" ), _fileName );
   
  -     /**
  -      * @todo-javadoc   Describe the field
  -      */
  +     private static File _tmpFile = DEFAULT_TMP_FILE;
  +     protected transient DocletContext context = null;
        private File       destDir;
  -     /**
  -      * @todo-javadoc   Describe the field
  -      */
        private File       mergeDir;
  -
  -     /**
  -      * @todo-javadoc   Describe the field
  -      */
        private String     excludedTags = null;
  -
  -     /**
  -      * @todo-javadoc   Describe the field
  -      */
        private boolean    force = false;
  -
        private String     addedTags;
  -
  -     /**
  -      * @todo-javadoc   Describe the field
  -      */
        private ArrayList  templates = new ArrayList();
  -     /**
  -      * @todo-javadoc   Describe the field
  -      */
        private ArrayList  configParams = new ArrayList();
   
  -     /**
  -      * Gets the Classpath attribute of the DocletTask object
  -      *
  -      * @return   The Classpath value
  -      */
  -     public Path getClasspath()
  -     {
  -             return classpath;
  -     }
  -
  -     /**
  -      * Gets the ClasspathRef attribute of the DocletTask object
  -      *
  -      * @return   The ClasspathRef value
  -      */
  -     public Reference getClasspathRef()
  +     public DocletTask()
        {
  -             return classpathRef;
  +             setClassname( "xdoclet.XDocletMain" );
        }
   
        /**
  @@ -180,48 +128,9 @@
                return addedTags;
        }
   
  -     /**
  -      * Sets the Classpath attribute of the DocletTask object
  -      *
  -      * @param src  The new Classpath value
  -      */
  -     public void setClasspath( Path src )
  -     {
  -             if( classpath == null )
  -             {
  -                     classpath = src;
  -             }
  -             else
  -             {
  -                     classpath.append( src );
  -             }
  -     }
  -
  -     /**
  -      * Sets the ClasspathRef attribute of the DocletTask object
  -      *
  -      * @param ref  The new ClasspathRef value
  -      */
  -     public void setClasspathRef( org.apache.tools.ant.types.Reference ref )
  -     {
  -             this.classpathRef = ref;
  -             createClasspath().setRefid( ref );
  -     }
  -
  -     /**
  -      * Sets the Sourcepath attribute of the DocletTask object
  -      *
  -      * @param path  The new Sourcepath value
  -      */
  -     public void setSourcepath( Path path )
  +     public void setXdoclettempfile( File tmpFile )
        {
  -             log( "sourcepath is deprecated. The preferred way to design sources is 
via nested <fileset>", Project.MSG_WARN );
  -
  -             String dir = path.toString();
  -             FileSet fileSet = new FileSet();
  -
  -             fileSet.setDir( new File( dir ) );
  -             fileSet.setIncludes( "**/*.java" );
  +             _tmpFile = tmpFile;
        }
   
        /**
  @@ -290,35 +199,6 @@
        }
   
        /**
  -      * Describe what the method does
  -      *
  -      * @return         Describe the return value
  -      * @todo-javadoc   Write javadocs for method
  -      * @todo-javadoc   Write javadocs for return value
  -      */
  -     public Path createClasspath()
  -     {
  -             if( classpath == null )
  -             {
  -                     classpath = new Path( project );
  -             }
  -
  -             return classpath.createPath();
  -     }
  -
  -     /**
  -      * Describe the method
  -      *
  -      * @param set      Describe the method parameter
  -      * @todo-javadoc   Describe the method
  -      * @todo-javadoc   Describe the method parameter
  -      */
  -     public void addFileset( FileSet set )
  -     {
  -             filesets.addElement( set );
  -     }
  -
  -     /**
         * Describe the method
         *
         * @param subtask  Describe the method parameter
  @@ -354,49 +234,16 @@
                configParams.add( config_param );
        }
   
  -     /**
  -      * Describe what the method does
  -      *
  -      * @exception BuildException  Describe the exception
  -      * @todo-javadoc              Write javadocs for method
  -      * @todo-javadoc              Write javadocs for exception
  -      */
        public void execute() throws BuildException
        {
                try
                {
  -                     AntClassLoader loader = new AntClassLoader( project, classpath 
);
  -
  -                     XJavaDoc.getInstance().reset();
  -                     XJavaDoc.getInstance().setClassLoader( loader );
  -                     XmlValidator.setInstance( new XmlValidator( loader ) );
  -
                        // save the context and pass its filename as an arg to the main
  -                     SourceSet[] sourceSets = new SourceSet[filesets.size()];
  -
  -                     for( int i = 0; i < filesets.size(); i++ )
  -                     {
  -                             FileSet fs = ( FileSet ) filesets.elementAt( i );
  -                             File dir = fs.getDir( project );
  -
  -                             DirectoryScanner ds = fs.getDirectoryScanner( project 
);
  -                             String[] files = ds.getIncludedFiles();
  -
  -                             for( int j = 0; j < files.length; j++ )
  -                             {
  -                                     log( "Adding " + dir + " " + files[j], 
Project.MSG_VERBOSE );
  -                             }
  -                             sourceSets[i] = new SourceSet( dir, files );
  -                     }
  -
  -                     for( int i = 0; i < sourceSets.length; i++ )
  -                     {
  -                             XJavaDoc.getInstance().addSourceSet( sourceSets[i] );
  -                     }
  -
  -                     executeSubTasks();
  +                     save( getContext(), _tmpFile );
  +                     createArg().setValue( _tmpFile.getAbsolutePath() );
  +                     super.execute();
                }
  -             catch( Exception e )
  +             catch( IOException e )
                {
                        e.printStackTrace();
                        throw new BuildException( e );
  @@ -545,21 +392,11 @@
         */
        protected void validateOptions() throws BuildException
        {
  -             if( filesets.size() == 0 )
  -             {
  -                     throw new BuildException( "At least one fileset must be 
specified", location );
  -             }
  -
  +             super.validateOptions();
                if( destDir == null )
                {
                        throw new BuildException( Translator.getString( 
"attribute_not_present_error", new String[]{"destDir"} ), location );
                }
  -
  -             if( classpath == null )
  -             {
  -                     classpath = org.apache.tools.ant.types.Path.systemClasspath;
  -             }
  -
                validateSubTasks();
        }
   
  @@ -598,7 +435,7 @@
         *
         * @todo-javadoc   Write javadocs for method
         */
  -     private void executeSubTasks()
  +     private void executeSubTasksOLD()
        {
                Category cat = Log.getCategory( DocletTask.class, "executeSubTasks" );
   
  
  
  
  1.7       +19 -9     xdoclet/core/src/xdoclet/XDocletMain.java
  
  Index: XDocletMain.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/XDocletMain.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -w -r1.6 -r1.7
  --- XDocletMain.java  11 Apr 2002 20:53:01 -0000      1.6
  +++ XDocletMain.java  21 Apr 2002 20:40:14 -0000      1.7
  @@ -14,8 +14,13 @@
   import org.apache.log4j.Category;
   
   /**
  + * This class serves as an entry-point for starting XDoclet. Whether or not
  + * XDoclet is run in forked mode, the start method will be called from our
  + * superclass' main method.
  + *
    * @author    Ara Abrahamian ([EMAIL PROTECTED])
    * @author    <a href="mailto:[EMAIL PROTECTED]";>Aslak Hellesøy</a>
  + * @author    <a href="mailto:[EMAIL PROTECTED]";>Aslak Hellesøy</a>
    * @created   April 30, 2001
    */
   public class XDocletMain extends XJavaDocMain
  @@ -23,13 +28,13 @@
        /**
         * Describe what the method does
         *
  -      * @param docletContextFileName  Describe what the parameter does
  +      * @param args
         * @exception Exception          Describe the exception
         * @todo-javadoc                 Write javadocs for method
         * @todo-javadoc                 Write javadocs for method parameter
         * @todo-javadoc                 Write javadocs for exception
         */
  -     public void start( String docletContextFileName ) throws Exception
  +     protected void start( String[] args ) throws Exception
        {
                // registers templates
                new ModuleFinder().findModules();
  @@ -39,7 +44,7 @@
   
                try
                {
  -                     DocletContext dc = ( DocletContext ) loadAndDelete( 
docletContextFileName );
  +                     DocletContext dc = ( DocletContext ) loadAndDelete( args[0] );
   
                        DocletContext.setSingleInstance( dc );
   
  @@ -80,8 +85,13 @@
                }
                catch( XDocletException e )
                {
  -                     System.out.println( "Running XDoclet failed" );
  -                     System.out.println( "<<" + e.getMessage() + ">>" );
  +                     cat.error( Translator.getString( "running_failed" ) );
  +                     cat.error( "<<" + e.getMessage() + ">>" );
  +
  +                     if( e.getNestedException() != null )
  +                     {
  +                             e.getNestedException().printStackTrace();
  +                     }
   
                        if( e.getNestedException() instanceof TemplateException )
                        {
  
  
  
  1.41      +7 -8      xdoclet/core/src/xdoclet/XDocletTagSupport.java
  
  Index: XDocletTagSupport.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/XDocletTagSupport.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -w -r1.40 -r1.41
  --- XDocletTagSupport.java    19 Apr 2002 16:36:47 -0000      1.40
  +++ XDocletTagSupport.java    21 Apr 2002 20:40:14 -0000      1.41
  @@ -39,7 +39,7 @@
    *
    * @author    Dmitri Colebatch ([EMAIL PROTECTED])
    * @created   October 12, 2001
  - * @version   $Revision: 1.40 $
  + * @version   $Revision: 1.41 $
    */
   public abstract class XDocletTagSupport extends TemplateTagHandler
   {
  @@ -415,10 +415,11 @@
                boolean superclasses = TypeConversionUtil.stringToBoolean( 
attributes.getProperty( "superclasses" ), true );
                boolean is_mandatory = TypeConversionUtil.stringToBoolean( 
attributes.getProperty( "mandatory" ), false );
   
  +             String tagValue = null;
   
                if( for_type == FOR_METHOD && getCurrentMethodTag() != null && 
getCurrentMethodTag().name().equals( tag_name ) && Arrays.asList( 
getCurrentMethodTag().attributeValueNames() ).contains( param_name ) )
                {
  -                     return getCurrentMethodTag().attributeValue( param_name );
  +                     tagValue = getCurrentMethodTag().attributeValue( param_name );
                }
                else if( for_type == FOR_METHOD && getCurrentMethodTag() != null && 
getCurrentMethodTag().name().equals( tag_name ) && ( param_name == null || param_num 
== null ) )
                {
  @@ -428,7 +429,7 @@
                }
                else if( for_type == FOR_CLASS && getCurrentClassTag() != null )
                {
  -                     return getCurrentClassTag().attributeValue( param_name );
  +                     tagValue = getCurrentClassTag().attributeValue( param_name );
                }
                else
                {
  @@ -456,7 +457,6 @@
                        }
   
                        // Loop until we get a non-null tag/parameter or there aren't 
any more alternatives
  -                     String tagValue = null;
   
                        while( tagTokenizer.hasMoreTokens() && tagValue == null )
                        {
  @@ -510,13 +510,11 @@
                                {
                                        tagValue = tagValue.substring( 1, 
tagValue.length() - 1 );
                                }
  -
                        }
  -
  +             }
                        tagValue = delimit( tagValue, attributes );
                        return tagValue;
                }
  -     }
   
        /**
         * Gets the TagValue attribute of the XDocletTagSupport class
  @@ -783,6 +781,7 @@
                // Optional Parameter
                String delim = attributes.getProperty( "delimiter" );
                String tokenNumberStr = attributes.getProperty( "tokenNumber" );
  +
                int tokenNumber = 0;
   
                if( tokenNumberStr != null )
  
  
  

_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to