I'm spending some time on defaults, specifically classname as default
for ejbName, smart stateless/stateful guesses and so on.

Remember our debate on create-method and your problem with ejbCreateImpl
method in a base TopLink class?
I think we really can get rid of create-method! Here is a new algorithm
for finding out if current class is stateless or not:

        public boolean isStatelessSession( ClassDoc clazz )
        {
                if( isSession( clazz ) == false )
                {
                        return false;
                }

                String value = getParameterValue( DocletUtil.getText(
getCurrentClass(), "ejb:bean" ), "type", -1 );

                if( value != null )
      {
         if( value.equals( "Stateless" ) )
            return true;
         else
            return false;
                }
                else
                {
         //now try to guess

         //it's stateful if it implements SessionSynchronization
         if( TypeTagsHandler.isOfType( clazz,
"javax.ejb.SessionSynchronization", TypeTagsHandler.TYPE_HIERARCHY ) )
            return false;

         //it's stateful if it has create methods with parameters,
         //stateless if has a single ejbCreate() method with no args
           //and returning intf type and there's no other ejbCreate
method
         MethodDoc[] methods = clazz.methods();
         boolean has_empty_create_method = false;
         boolean has_other_create_methods = false;

         for( int i = 0; i < methods.length; i++ )
         {
            MethodDoc method = methods[i];

            //if an empty create method
            if( method.name().equals( "ejbCreate" ) &&
method.parameters().length==0 )
            {
               has_empty_create_method = true;
            }
            else if( method.name().startsWith( "ejbCreate" ) &&
                     method.parameters().length>0 &&
                     (InterfaceTagsHandler.getComponentInterface(
"remote", getCurrentClass(), getDocletContext()
).equals(method.returnType().qualifiedTypeName() ) ||
                     InterfaceTagsHandler.getComponentInterface(
"local", getCurrentClass(), getDocletContext()
).equals(method.returnType().qualifiedTypeName() ) )
                  )
            {
               has_other_create_methods = true;
            }
         }
         
         if( has_empty_create_method == true && has_other_create_methods
== false )
            return true;
         else
            return false;
                }
        }

The line that needs your approval is the for loop. Look at the comment
above it. I don't think it will break your code, will it? I'm planning
to move it to isCreateMethod().

Ara.


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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

Reply via email to