--- "Clifton C. Craig" <[EMAIL PROTECTED]> wrote:
> The Ant tasks are giving me trouble. The
> XJavaDocFilter, for example 
> looks like a cool way to filter for just the classes
> you need. However, 
> it's forcing me to understand it's inner workings.
> It's not as simple as 
> it seems. It apparently considers files that are
> referenced by the file 
> given in its isSelected method. In my case, I have
> an Address session 
> bean that somehow indirectly references a Tester
> inner class in a 
> lockking object. I extended the filter so I can add
> some logging to see 
> what was going on. This is my butchered
> re-implementation:
>     public boolean isSelected(File basedir, String
> filename, File file)
>             throws BuildException
>     {
> 
>         if( !filename.endsWith( ".java" ) )
>         {
>             log(filename + " does not end with
> .java.");
>             return false;
>         }
> 
>         _xJavaDoc.reset( true );
>         log("considering " + filename);
>         try
>         {
>             //validateOptions();
> 
>             _xJavaDoc.addSourceSet( new
> FileSourceSet( basedir, new 
> String[]{filename} ) );
> 
>             for( ClassIterator i =
> XCollections.classIterator( 
> _xJavaDoc.getSourceClasses() ); i.hasNext();  )
>             {
>                 XClass clazz = i.next();
>                 Parameter[] params =
> getParameters();
> 
>                 for( int j = 0; j < params.length;
> j++ )
>                 {
>                     Parameter param = params[j];
> 
>                     if( param.getName().equals(
> "implements" ) )
>                     {
>                         String mandatoryClass =
> param.getValue();
> 
>                         if( !clazz.isA(
> mandatoryClass ) )
>                         {
>                             log(clazz + " is not a "
> + mandatoryClass);
>                             return false;
>                         }
>                         else
>                             log(clazz + " does
> implement " + 
> mandatoryClass);
>                     }
>                     else if( param.getName().equals(
> "contains-tag" ) )
>                     {
>                         String mandatoryTag =
> param.getValue();
> 
>                         if( !clazz.getDoc().hasTag(
> mandatoryTag ) )
>                         {
>                             log(clazz + " does not
> have tag " + 
> mandatoryTag);
>                             return false;
>                         }
>                     }
>                 }
>             }
>         }
>         catch( OutOfMemoryError e )
>         {
>             System.err.println( e.getMessage() );
>             XJavaDoc.printMemoryStatus();
>             System.err.println( "Try to increase
> heap size. Can be done 
> by defining ANT_OPTS=-Xmx640m" );
>             System.err.println( "See the JDK
> tooldocs." );
>             throw new BuildException(
> e.getMessage(), e );
>         }
>         catch( Throwable t )
>         {
>             t.printStackTrace();
>             throw new BuildException( "Unexpected
> error", t );
>         }
>         finally
>         {
>             //XJavaDoc.printMemoryStatus();
> 
>             _xJavaDoc.printLogMessages( System.out, 
> XJavaDoc.NO_IMPORTED_PACKAGES );
>             _xJavaDoc.printLogMessages( System.out, 
> XJavaDoc.ONE_OR_MORE_IMPORTED_PACKAGES );
>             _xJavaDoc.reset( true );
>             System.gc();
>         }
>         log(filename + " is selected.");
>         return true;
>     }
> 
> Here's my build.xml:
> <?xml version="1.0"?>
> <project default="test" basedir="." name="Test">
>     <description>
>     This is a test script for experimental use.
>     </description>
>     <!-- 
>
===================================================================
> -->
>     <!-- Basic build targets for the 
> project                                 -->
>     <!-- 
>
===================================================================
> -->
>     <property name="project.base"
> location="../../"/>
> 
>     <import file="includes/main-init.xml"/>
> 
>     <target name="init" depends="main-init" 
> unless="init.already.called">
>         <property name="init.already.called"
> value="true"/>
>         <property name="xdoclet.base.folder"
> value="xdoclet-1.2"/>
>         <property name="xdoclet.home" 
> location="${tools.dir}/${xdoclet.base.folder}"/>
>         <path id="xdoclet.jars">
>             <fileset dir="${xdoclet.home}"
> includes="*.jar"/>
>         </path>
>         <path id="ics.task.path">
>             <pathelement
> location="${ant.ext.dir}/icstasks.jar"/>
>             <pathelement
> location="${appserver.jarfile}"/>
>             <path refid="xdoclet.jars"/>
>         </path>
>         <taskdef 
>
resource="com/icsaward/award/ant/tasks/taskdef.properties"
> 
> classpathref="ics.task.path" />
>     </target>
> 
>     <target name="test" depends="init">
>         <typedef name="ejbfilter" 
> classname="xjavadoc.ant.XJavadocFilter"
> classpathref="xdoclet.jars"/>
>         <xjavadocupdate destdir="d:/misc"
>             failonerror="no"
> deploydesc="ejb-jar.xml,jonas-ejb-jar.xml">
>             <fileset dir="${project.src}" 
>
includes="${neware.path}/server/sb/em/address/*.java">
>                 <or>
> <!--                    <custom
> classname="xjavadoc.ant.XJavadocFilter" 
> classpathref="xdoclet.jars">-->
> <!--                        <param name="implements"
> 
> value="javax.ejb.EntityBean"/>-->
> <!--                    </custom>-->
>                     <custom 
>
classname="com.icsaward.award.ant.tasks.XJavaDocSelector"
> 
> classpathref="ics.task.path">
>                         <param name="implements" 
> value="javax.ejb.SessionBean"/>
>                     </custom>
>                     <custom 
>
classname="com.icsaward.award.ant.tasks.XJavaDocSelector"
> 
> classpathref="ics.task.path">
>                         <param name="implements" 
>
value="com.icsaward.award.server.sb.common.EntityManagerBean"/>
>                     </custom>
>                 </or>
>             </fileset>
>         </xjavadocupdate>
>     </target>
> 
> </project>
> 
> When it goes into the isselected method for my
> AddressEMBean java file 
> it is not selected and I get the following output:
> 
> considering
>
com\icsaward\award\server\sb\em\address\AddressEMBean.java
>
com.icsaward.award.server.sb.em.address.AddressEMBean
> does implement 
> javax.ejb.SessionBean
> com.icsaward.award.server.common.Tester is not a
> javax.ejb.SessionBean
> 
> The com.icsaward.award.server.common.Tester object
> is an inner class 
> defined in a totally irrelevant Java file located
> elsewhere in my 
> filesystem. It is not even part of the fileset that
> I pass to the 
> filter. However, it is causing a rejection of the
> file that I do want to 
> go through. I'll have to look at this more to see
> what the issue is. If 
> anyone has any clues why it behaves this way feel
> free to chime in.


you are really really sure, that you use either
full-qualified class name in your extends, or
SessionBean / EntityBean ( from javax.ejb ) are
available on xjavadoc classpath?


regards,

=====
----[ Konstantin Pribluda ( ko5tik ) ]----------------
Zu Verstärkung meines Teams suche ich ab Sofort einen
Softwareentwickler[In] für die Festanstellung. 
Arbeitsort: Mainz 
Skills:  Programieren, Kentnisse in OpenSource-Bereich
----[ http://www.pribluda.de ]------------------------

__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to