Konstantin,

Yes it is obvious from the output that the AddressEMBean xClass is being considered as a SessionBean. It is also obvious from the output that the Tester xClass is being considered in the context of the evaluation of the AddressEMBean.java file. This is the problem that's kinda hard to explain. It's like the getSourceClasses method returns not just the SourceClassses in the sourceset given to XJavadoc but all classes referenced by the files in the source set. So in this way it cannot narrow the scope to a single file as the filter is attempting to do. In other words a line like this:

_xJavaDoc.addSourceSet( new FileSourceSet( basedir, new String[]{filename} ) );

should add one file to the source set and a line like this:

for( ClassIterator i = XCollections.classIterator( _xJavaDoc.getSourceClasses() ); i.hasNext(); )

Should return only the classes defined in that one file. In my case this is not true. The ClassIterator appears to reference classes outside of the source file. The output shows that immediately after evaluating whether or not the AddressEMBean is a SessionBean the Tester class was being considered. This is all done in the for(ClassIterator) loop before moving onto the next file in the fileset and emitting another considering... message. To confirm this I used beanshell. I scripted the same logic creating a source set pointing to only the AddressEMBean.java file interactively and called the getSourceCalsses method. This return displayed was a collection of 5 classes one of which was actually the AddressEMBean. I have been able to achieve my desired results using Predicates to do the selection instead of FileSets. My implementation is rather crude and not nearly as extensible as fileset selectors would be but it works for now. At this point I am considering this a bug until I see more conclusive information that I've done something wrong. I will look into it again and revisit the discussion prior to submitting anything once I get a minute. Thanks for all of your help.

Clifton C. Craig, Software Engineer
Intelligent Computer Systems -  A Division of GBG
2101 Embassy Drive
Lancaster, PA  17603

Phone: 717-295-7977 ext. 621
Fax: 717-295-7683
[EMAIL PROTECTED]
[EMAIL PROTECTED]




Konstantin Priblouda wrote:

--- "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






-------------------------------------------------------
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