User: rinkrank
  Date: 02/04/07 14:12:34

  Modified:    core/src/xdoclet/ejb EjbDocletTask.java
  Log:
  Imported new classes for dynamic module loading
  
  Revision  Changes    Path
  1.39      +243 -371  xdoclet/core/src/xdoclet/ejb/EjbDocletTask.java
  
  Index: EjbDocletTask.java
  ===================================================================
  RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/ejb/EjbDocletTask.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -w -r1.38 -r1.39
  --- EjbDocletTask.java        4 Apr 2002 01:03:04 -0000       1.38
  +++ EjbDocletTask.java        7 Apr 2002 21:12:34 -0000       1.39
  @@ -9,6 +9,7 @@
   import xdoclet.SubTask;
   import xdoclet.tags.PackageTagsHandler;
   import xdoclet.ejb.vendor.*;
  +import xdoclet.util.Log;
   
   import java.util.HashMap;
   import java.util.List;
  @@ -16,15 +17,19 @@
   import java.io.Serializable;
   
   import org.apache.tools.ant.types.FileSet;
  +import org.apache.tools.ant.BuildException;
   
   /**
    * A task that executes various EJB-specific sub-tasks.
    *
    * @author Ara Abrahamian ([EMAIL PROTECTED])
    * @created April 30, 2001
  - * @version $Revision: 1.38 $
  + * @version   $Revision: 1.39 $
    */
  -public class EjbDocletTask extends DocletTask {
  +public class EjbDocletTask extends DocletTask
  +{
  +
  +     private final List _subTasks;
        //default is ejb2.0
        /**
         * @todo-javadoc Describe the field
  @@ -41,176 +46,77 @@
         */
        private ArrayList packageSubstitutions = new ArrayList();
   
  -     // Generic sub-tasks
  -     /**
  -      * @todo-javadoc Describe the field
  -      */
  -     private DataObjectSubTask dataObject = null;
  -     /**
  -      * @todo-javadoc Describe the field
  -      */
  -     private ValueObjectSubTask valueObject = null;
  -     /**
  -      * @todo-javadoc Describe the field
  -      */
  -     private DaoSubTask dao = null;
  -     /**
  -      * @todo-javadoc Describe the field
  -      */
  -     private EjbDotXmlSubTask deploymentDescriptor = null;
  -     /**
  -      * @todo-javadoc Describe the field
  -      */
  -     private EntityBmpSubTask entityBmp = null;
  -     /**
  -      * @todo-javadoc Describe the field
  -      */
  -     private EntityCmpSubTask entityCmp = null;
  -     /**
  -      * @todo-javadoc Describe the field
  -      */
  -     private EntityPkSubTask entityPk = null;
  -     /**
  -      * @todo-javadoc Describe the field
  -      */
  -     private HomeInterfaceSubTask homeInterface = null;
  -     /**
  -      * @todo-javadoc Describe the field
  -      */
  -     private LocalHomeInterfaceSubTask localHomeInterface = null;
  -     /**
  -      * @todo-javadoc Describe the field
  -      */
  -     private RemoteInterfaceSubTask remoteInterface = null;
  -     /**
  -      * @todo-javadoc Describe the field
  -      */
  -     private LocalInterfaceSubTask localInterface = null;
  -     /**
  -      * @todo-javadoc Describe the field
  -      */
  -     private SessionSubTask session = null;
  -     /**
  -      * @todo-javadoc Describe the field
  -      */
  -     private UtilObjectSubTask utilObject = null;
  +     public EjbDocletTask()
  +     {
  +             _subTasks = super.getSubTasks();
  +     }
   
  -     // Vendor-specific sub-tasks
  -     /**
  -      * @todo-javadoc Describe the field
  -      */
  -     private JBossSubTask jboss = null;
  -     /**
  -      * @todo-javadoc Describe the field
  -      */
  -     private WebSphereSubTask webSphere = null;
  -     /**
  -      * @todo-javadoc Describe the field
  -      */
  -     private OrionSubTask orion = null;
  -     /**
  -      * @todo-javadoc Describe the field
  -      */
  -     private WebLogicSubTask webLogic = null;
  -     /**
  -      * @todo-javadoc Describe the field
  -      */
  -     private MVCSoftSubTask mvcsoft = null;
        /**
  -      * @todo-javadoc Describe the field
  -      */
  -     private BluestoneSubTask bluestone = null;
  -     /**
  -      * @todo-javadoc Describe the field
  -      */
  -     private JRunSubTask jrun = null;
  -     /**
  -      * @todo-javadoc Describe the field
  +      * Gets the EjbSpec attribute of the EjbDocletTask object
  +      *
  +      * @return   The EjbSpec value
         */
  -     private PramatiSubTask pramati = null;
  +     public String getEjbSpec()
  +     {
  +             return ejbspec;
  +     }
   
  -     // SOAP sub-task, since it uses methods from AbstractEjbCodeGeneratorSubTask 
for EJB providers it should be here
        /**
  -      * @todo-javadoc Describe the field
  -      */
  -     private ApacheSoapSubTask apachesoap = null;
  -     // Struts Form sub-task
  -     /**
  -      * @todo-javadoc Describe the field
  +      * Gets the PackageSubstitutions attribute of the EjbDocletTask object
  +      *
  +      * @return   The PackageSubstitutions value
         */
  -     private StrutsFormSubTask strutsformsubtask = null;
  +     public ArrayList getPackageSubstitutions()
  +     {
  +             return packageSubstitutions;
  +     }
  +
        /**
  -      * @todo-javadoc Describe the field
  +      * Gets the EjbClassNameSuffix attribute of the EjbDocletTask object
  +      *
  +      * @return   The EjbClassNameSuffix value
         */
  -     private CastorSubTask mappingXmlSubTask = null;
  -
  +     public String getEjbClassNameSuffix()
  +     {
  +             return ejbClassNameSuffix;
  +     }
   
        /**
         * @param ejbspec
         */
  -     public void setEjbSpec(EjbSpecVersion ejbspec) {
  +     public void setEjbSpec( EjbSpecVersion ejbspec )
  +     {
                this.ejbspec = ejbspec.getValue();
        }
   
  -
        /**
         * @param ejbClassNameSuffix
         */
  -     public void setEjbClassNameSuffix(String ejbClassNameSuffix) {
  +     public void setEjbClassNameSuffix( String ejbClassNameSuffix )
  +     {
                this.ejbClassNameSuffix = ejbClassNameSuffix;
        }
   
  -
        /**
         * Sets the PackageSubstitutions attribute of the EjbDocletTask object
         *
         * @param packageSubstitutions The new PackageSubstitutions value
         */
  -     public void setPackageSubstitutions(ArrayList packageSubstitutions) {
  +     public void setPackageSubstitutions( ArrayList packageSubstitutions )
  +     {
                this.packageSubstitutions = packageSubstitutions;
        }
   
  -
  -     /**
  -      * Gets the EjbSpec attribute of the EjbDocletTask object
  -      *
  -      * @return The EjbSpec value
  -      */
  -     public String getEjbSpec() {
  -             return ejbspec;
  -     }
  -
  -
  -     /**
  -      * Gets the PackageSubstitutions attribute of the EjbDocletTask object
  -      *
  -      * @return The PackageSubstitutions value
  -      */
  -     public ArrayList getPackageSubstitutions() {
  -             return packageSubstitutions;
  -     }
  -
  -
  -     /**
  -      * Gets the EjbClassNameSuffix attribute of the EjbDocletTask object
  -      *
  -      * @return The EjbClassNameSuffix value
  -      */
  -     public String getEjbClassNameSuffix() {
  -             return ejbClassNameSuffix;
  -     }
  -
  -
        /**
         * Adds a set of files (nested fileset attribute).
         *
         * @param ps The feature to be added to the Fileset attribute
         */
  -     public void addPackageSubstitution(PackageTagsHandler.PackageSubstitution ps) {
  +     public void addPackageSubstitution( PackageTagsHandler.PackageSubstitution ps )
  +     {
                packageSubstitutions.add(ps);
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -218,12 +124,11 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public DataObjectSubTask createDataobject() {
  -             dataObject = new DataObjectSubTask();
  -             return dataObject;
  +     public DataObjectSubTask createDataobject()
  +     {
  +             return ( DataObjectSubTask ) _createSubTaskImpl( 
"xdoclet.ejb.DataObjectSubTask" );
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -231,12 +136,11 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public DaoSubTask createDao() {
  -             dao = new DaoSubTask();
  -             return dao;
  +     public DaoSubTask createDao()
  +     {
  +             return ( DaoSubTask ) _createSubTaskImpl( "xdoclet.ejb.DaoSubTask" );
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -244,12 +148,11 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public ValueObjectSubTask createValueobject() {
  -             valueObject = new ValueObjectSubTask();
  -             return valueObject;
  +     public ValueObjectSubTask createValueobject()
  +     {
  +             return ( ValueObjectSubTask ) _createSubTaskImpl( 
"xdoclet.ejb.ValueObjectSubTask" );
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -259,12 +162,11 @@
         * @todo-javadoc Write javadocs for return value
         * @todo-javadoc Write javadocs for exception
         */
  -     public EjbDotXmlSubTask createDeploymentdescriptor() throws 
xdoclet.XDocletException {
  -             deploymentDescriptor = new EjbDotXmlSubTask();
  -             return deploymentDescriptor;
  +     public EjbDotXmlSubTask createDeploymentdescriptor() throws 
xdoclet.XDocletException
  +     {
  +             return ( EjbDotXmlSubTask ) _createSubTaskImpl( 
"xdoclet.ejb.EjbDotXmlSubTask" );
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -272,12 +174,11 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public SessionSubTask createSession() {
  -             session = new SessionSubTask();
  -             return session;
  +     public SessionSubTask createSession()
  +     {
  +             return ( SessionSubTask ) _createSubTaskImpl( 
"xdoclet.ejb.SessionSubTask" );
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -285,12 +186,11 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public EntityBmpSubTask createEntitybmp() {
  -             entityBmp = new EntityBmpSubTask();
  -             return entityBmp;
  +     public EntityBmpSubTask createEntitybmp()
  +     {
  +             return ( EntityBmpSubTask ) _createSubTaskImpl( 
"xdoclet.ejb.EntityBmpSubTask" );
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -298,12 +198,11 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public EntityCmpSubTask createEntitycmp() {
  -             entityCmp = new EntityCmpSubTask();
  -             return entityCmp;
  +     public EntityCmpSubTask createEntitycmp()
  +     {
  +             return ( EntityCmpSubTask ) _createSubTaskImpl( 
"xdoclet.ejb.EntityCmpSubTask" );
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -311,12 +210,11 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public EntityPkSubTask createEntitypk() {
  -             entityPk = new EntityPkSubTask();
  -             return entityPk;
  +     public EntityPkSubTask createEntitypk()
  +     {
  +             return ( EntityPkSubTask ) _createSubTaskImpl( 
"xdoclet.ejb.EntityPkSubTask" );
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -324,12 +222,11 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public HomeInterfaceSubTask createHomeinterface() {
  -             homeInterface = new HomeInterfaceSubTask();
  -             return homeInterface;
  +     public HomeInterfaceSubTask createHomeinterface()
  +     {
  +             return ( HomeInterfaceSubTask ) _createSubTaskImpl( 
"xdoclet.ejb.HomeInterfaceSubTask" );
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -337,12 +234,11 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public LocalHomeInterfaceSubTask createLocalhomeinterface() {
  -             localHomeInterface = new LocalHomeInterfaceSubTask();
  -             return localHomeInterface;
  +     public LocalHomeInterfaceSubTask createLocalhomeinterface()
  +     {
  +             return ( LocalHomeInterfaceSubTask ) _createSubTaskImpl( 
"xdoclet.ejb.LocalHomeInterfaceSubTask" );
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -350,12 +246,11 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public RemoteInterfaceSubTask createRemoteinterface() {
  -             remoteInterface = new RemoteInterfaceSubTask();
  -             return remoteInterface;
  +     public RemoteInterfaceSubTask createRemoteinterface()
  +     {
  +             return ( RemoteInterfaceSubTask ) _createSubTaskImpl( 
"xdoclet.ejb.RemoteInterfaceSubTask" );
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -363,12 +258,11 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public LocalInterfaceSubTask createLocalinterface() {
  -             localInterface = new LocalInterfaceSubTask();
  -             return localInterface;
  +     public LocalInterfaceSubTask createLocalinterface()
  +     {
  +             return ( LocalInterfaceSubTask ) _createSubTaskImpl( 
"xdoclet.ejb.LocalInterfaceSubTask" );
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -376,12 +270,11 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public JBossSubTask createJboss() {
  -             jboss = new JBossSubTask();
  -             return jboss;
  +     public UtilObjectSubTask createUtilobject()
  +     {
  +             return ( UtilObjectSubTask ) _createSubTaskImpl( 
"xdoclet.ejb.UtilObjectSubTask" );
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -389,12 +282,11 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public WebSphereSubTask createWebSphere() {
  -             webSphere = new WebSphereSubTask();
  -             return webSphere;
  +     public JBossSubTask createJboss()
  +     {
  +             return ( JBossSubTask ) _createSubTaskImpl( 
"xdoclet.ejb.vendor.JBossSubTask" );
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -402,12 +294,11 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public OrionSubTask createOrion() {
  -             orion = new OrionSubTask();
  -             return orion;
  +     public WebSphereSubTask createWebSphere()
  +     {
  +             return ( WebSphereSubTask ) _createSubTaskImpl( 
"xdoclet.ejb.vendor.WebSphereSubTask" );
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -415,12 +306,11 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public WebLogicSubTask createWebLogic() {
  -             webLogic = new WebLogicSubTask();
  -             return webLogic;
  +     public OrionSubTask createOrion()
  +     {
  +             return ( OrionSubTask ) _createSubTaskImpl( 
"xdoclet.ejb.vendor.OrionSubTask" );
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -428,12 +318,11 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public MVCSoftSubTask createMVCSoft() {
  -             mvcsoft = new MVCSoftSubTask();
  -             return mvcsoft;
  +     public WebLogicSubTask createWeblogic()
  +     {
  +             return ( WebLogicSubTask ) _createSubTaskImpl( 
"xdoclet.ejb.vendor.WebLogicSubTask" );
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -441,12 +330,11 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public BluestoneSubTask createBluestone() {
  -             bluestone = new BluestoneSubTask();
  -             return bluestone;
  +     public MVCSoftSubTask createMVCSoft()
  +     {
  +             return ( MVCSoftSubTask ) _createSubTaskImpl( 
"xdoclet.ejb.vendor.MVCSoftSubTask" );
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -454,12 +342,11 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public ApacheSoapSubTask createApachesoap() {
  -             apachesoap = new ApacheSoapSubTask();
  -             return apachesoap;
  +     public BluestoneSubTask createBluestone()
  +     {
  +             return ( BluestoneSubTask ) _createSubTaskImpl( 
"xdoclet.ejb.vendor.BluestoneSubTask" );
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -467,12 +354,11 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public StrutsFormSubTask createStrutsform() {
  -             strutsformsubtask = new StrutsFormSubTask();
  -             return strutsformsubtask;
  +     public ApacheSoapSubTask createApachesoap()
  +     {
  +             return ( ApacheSoapSubTask ) _createSubTaskImpl( 
"xdoclet.ejb.vendor.ApacheSoapSubTask" );
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -480,12 +366,11 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public UtilObjectSubTask createUtilobject() {
  -             utilObject = new UtilObjectSubTask();
  -             return utilObject;
  +     public StrutsFormSubTask createStrutsform()
  +     {
  +             return ( StrutsFormSubTask ) _createSubTaskImpl( 
"xdoclet.ejb.vendor.StrutsFormSubTask" );
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -493,12 +378,11 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public CastorSubTask createCastormapping() {
  -             mappingXmlSubTask = new CastorSubTask();
  -             return mappingXmlSubTask;
  +     public CastorSubTask createCastormapping()
  +     {
  +             return ( CastorSubTask ) _createSubTaskImpl( 
"xdoclet.ejb.vendor.CastorSubTask" );
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -506,12 +390,11 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public JRunSubTask createJRun() {
  -             jrun = new JRunSubTask();
  -             return jrun;
  +     public JRunSubTask createJRun()
  +     {
  +             return ( JRunSubTask ) _createSubTaskImpl( 
"xdoclet.ejb.vendor.JRunSubTask" );
        }
   
  -
        /**
         * Describe what the method does
         *
  @@ -519,56 +402,30 @@
         * @todo-javadoc Write javadocs for method
         * @todo-javadoc Write javadocs for return value
         */
  -     public PramatiSubTask createPramati() {
  -             pramati = new PramatiSubTask();
  -             return pramati;
  +     public PramatiSubTask createPramati()
  +     {
  +             return ( PramatiSubTask ) _createSubTaskImpl( 
"xdoclet.ejb.vendor.PramatiSubTask" );
        }
   
  -
        /**
         * Gets the SubTasks attribute of the EjbDocletTask object
         *
         * @return The SubTasks value
         */
  -     protected List getSubTasks() {
  -             List subtasks = super.getSubTasks();
  -
  -             subtasks.add(this.homeInterface);
  -             subtasks.add(this.localHomeInterface);
  -             subtasks.add(this.remoteInterface);
  -             subtasks.add(this.localInterface);
  -             subtasks.add(this.session);
  -             subtasks.add(this.entityPk);
  -             subtasks.add(this.dataObject);
  -             subtasks.add(this.dao);
  -             subtasks.add(this.valueObject);
  -             subtasks.add(this.entityBmp);
  -             subtasks.add(this.entityCmp);
  -             subtasks.add(this.deploymentDescriptor);
  -             subtasks.add(this.jboss);
  -             subtasks.add(this.orion);
  -             subtasks.add(this.webSphere);
  -             subtasks.add(this.webLogic);
  -             subtasks.add(this.apachesoap);
  -             subtasks.add(this.strutsformsubtask);
  -             subtasks.add(this.utilObject);
  -             subtasks.add(this.mappingXmlSubTask);
  -             subtasks.add(this.mvcsoft);
  -             subtasks.add(this.bluestone);
  -             subtasks.add(this.jrun);
  -             subtasks.add(this.pramati);
  -
  -             return subtasks;
  +     protected List getSubTasks()
  +     {
  +             return _subTasks;
        }
   
  -
        /**
         * Gets the Context attribute of the EjbDocletTask object
         *
         * @return The Context value
         */
  -     protected DocletContext getContext() {
  -             if (context != null) {
  +     protected DocletContext getContext()
  +     {
  +             if( context != null )
  +             {
                        return context;
                }
   
  @@ -591,12 +448,27 @@
                return context;
        }
   
  +     private SubTask _createSubTaskImpl( String className )
  +     {
  +             try
  +             {
  +                     SubTask subTask = ( SubTask ) Class.forName( className 
).newInstance();
  +
  +                     _subTasks.add( subTask );
  +                     return subTask;
  +             }
  +             catch( Exception e )
  +             {
  +                     throw new BuildException( "Couldn't instantiate subtask " + 
className + ":" + e.getMessage() );
  +             }
  +     }
   
        /**
         * @author Ara Abrahamian ([EMAIL PROTECTED])
         * @created July 19, 2001
         */
  -     public static class EjbSpecVersion extends 
org.apache.tools.ant.types.EnumeratedAttribute {
  +     public static class EjbSpecVersion extends 
org.apache.tools.ant.types.EnumeratedAttribute
  +     {
                /**
                 * @todo-javadoc Describe the field
                 */
  @@ -606,13 +478,13 @@
                 */
                public final static String EJB_2_0 = "2.0";
   
  -
                /**
                 * Gets the Values attribute of the EjbSpecVersion object
                 *
                 * @return The Values value
                 */
  -             public java.lang.String[] getValues() {
  +             public java.lang.String[] getValues()
  +             {
                        return (new java.lang.String[]{
                                        EJB_1_1, EJB_2_0
                                        });
  
  
  

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

Reply via email to