User: stevensa
  Date: 02/03/03 17:36:53

  Modified:    core/resources/xdoclet/ejb entity-body.j entitybmp.j
                        Messages.properties
  Added:       core/resources/xdoclet/ejb dao-methods.j dao.j
  Log:
  Added DAO and Bluestone subtasks
  
  Revision  Changes    Path
  1.7       +26 -7     xdoclet/core/resources/xdoclet/ejb/entity-body.j
  
  Index: entity-body.j
  ===================================================================
  RCS file: /cvsroot/xdoclet/xdoclet/core/resources/xdoclet/ejb/entity-body.j,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -w -r1.6 -r1.7
  --- entity-body.j     28 Feb 2002 21:29:28 -0000      1.6
  +++ entity-body.j     4 Mar 2002 01:36:52 -0000       1.7
  @@ -60,8 +60,8 @@
        <XDtEjbBmp:ifUseSoftLocking>
         if( getVersion() != dataHolder.getVersion() )
            throw new IllegalStateException( <XDtI18n:getString 
bundle="xdoclet.ejb.Messages" resource="entity_dataholder_version"/> );
  -     </XDtEjbBmp:ifUseSoftLocking>
   
  +     </XDtEjbBmp:ifUseSoftLocking>
         try
         {
         <XDtEjbPersistent:forAllPersistentFields not-pk="true">
  @@ -117,9 +117,12 @@
       <XDtMethod:ifHasMethod name="ejbLoad">
        <XDtMethod:ifIsNotAbstract>
         super.ejbLoad();
  +
        </XDtMethod:ifIsNotAbstract>
       </XDtMethod:ifHasMethod>
  -
  +     <XDtEjbDao:ifUsingDao>
  +      getDao().load((<XDtEjbPk:pkClass/>) ctx.getPrimaryKey(), this);
  +     </XDtEjbDao:ifUsingDao>
        <XDtEjbCmp:ifNotUsingCmp2>
         makeClean();
        </XDtEjbCmp:ifNotUsingCmp2>
  @@ -145,9 +148,12 @@
         <XDtEjbCmp:ifNotUsingCmp2>
         }
         </XDtEjbCmp:ifNotUsingCmp2>
  +
        </XDtMethod:ifIsNotAbstract>
       </XDtMethod:ifHasMethod>
  -
  +     <XDtEjbDao:ifUsingDao>
  +      getDao().store(this);
  +     </XDtEjbDao:ifUsingDao>
        <XDtEjbBmp:ifUseSoftLocking>
         setVersion( getVersion() + 1 );
        </XDtEjbBmp:ifUseSoftLocking>
  @@ -184,6 +190,10 @@
       </XDtMerge:merge>
      }
   
  +  <XDtEjbDao:ifUsingDao>
  +   private javax.ejb.EntityContext ctx = null;
  +
  +  </XDtEjbDao:ifUsingDao>
      public void setEntityContext(javax.ejb.EntityContext ctx) 
<XDtMethod:exceptionList method="setEntityContext"/>
      {
       <XDtMethod:ifHasMethod name="setEntityContext" 
parameters="javax.ejb.EntityContext">
  @@ -191,6 +201,9 @@
         super.setEntityContext(ctx);
        </XDtMethod:ifIsNotAbstract>
       </XDtMethod:ifHasMethod>
  +     <XDtEjbDao:ifUsingDao>
  +      this.ctx = ctx;
  +     </XDtEjbDao:ifUsingDao>
      }
   
      public void unsetEntityContext() <XDtMethod:exceptionList 
method="unsetEntityContext"/>
  @@ -200,6 +213,9 @@
         super.unsetEntityContext();
        </XDtMethod:ifIsNotAbstract>
       </XDtMethod:ifHasMethod>
  +     <XDtEjbDao:ifUsingDao>
  +      this.ctx = null;
  +     </XDtEjbDao:ifUsingDao>
      }
   
      public void ejbRemove() <XDtMethod:exceptionList method="ejbRemove" 
append="javax.ejb.RemoveException"/>
  @@ -207,13 +223,16 @@
       <XDtMethod:ifHasMethod name="ejbRemove">
        <XDtMethod:ifIsNotAbstract>
         super.ejbRemove();
  +
        </XDtMethod:ifIsNotAbstract>
       </XDtMethod:ifHasMethod>
  -
  +     <XDtEjbDao:ifUsingDao>
  +      getDao().remove((<XDtEjbPk:pkClass/>) ctx.getPrimaryKey());
  +     </XDtEjbDao:ifUsingDao>
       <XDtEjbDataObj:ifIsWithDataContainer>
         dataHolder = null;
  -    </XDtEjbDataObj:ifIsWithDataContainer>
   
  +    </XDtEjbDataObj:ifIsWithDataContainer>
       <XDtMethod:forAllMethods>
        <XDtEjbDataObj:ifIsAggregate>
         try
  @@ -225,9 +244,9 @@
         {
            throw new javax.ejb.EJBException(e);
         }
  +
        </XDtEjbDataObj:ifIsAggregate>
       </XDtMethod:forAllMethods>
  -
       <XDtComment:comment>
       TODO : VO must be set to null
       </XDtComment:comment>
  
  
  
  1.29      +1 -1      xdoclet/core/resources/xdoclet/ejb/entitybmp.j
  
  Index: entitybmp.j
  ===================================================================
  RCS file: /cvsroot/xdoclet/xdoclet/core/resources/xdoclet/ejb/entitybmp.j,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -w -r1.28 -r1.29
  --- entitybmp.j       7 Feb 2002 22:15:01 -0000       1.28
  +++ entitybmp.j       4 Mar 2002 01:36:53 -0000       1.29
  @@ -21,7 +21,7 @@
      <XDtMerge:merge file="xdoclet/ejb/entity-value.j">
      </XDtMerge:merge>
   
  -   <XDtMerge:merge file="xdoclet/ejb/entitybmp-dao.j">
  +   <XDtMerge:merge file="xdoclet/ejb/dao-methods.j">
      </XDtMerge:merge>
   
      <XDtMerge:merge file="entitybmp-custom.j">
  
  
  
  1.6       +2 -0      xdoclet/core/resources/xdoclet/ejb/Messages.properties
  
  Index: Messages.properties
  ===================================================================
  RCS file: /cvsroot/xdoclet/xdoclet/core/resources/xdoclet/ejb/Messages.properties,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -w -r1.5 -r1.6
  --- Messages.properties       23 Feb 2002 11:55:54 -0000      1.5
  +++ Messages.properties       4 Mar 2002 01:36:53 -0000       1.6
  @@ -7,11 +7,13 @@
   local_interface_for=Local interface for {0}.
   remote_interface_for=Remote interface for {0}.
   utility_class_for=Utility class for {0}.
  +dao_for=Data Access Object interface for {0}.
   primary_key_for=Primary key for {0}.
   cmp_layer_for=CMP layer for {0}.
   bmp_layer_for=BMP layer for {0}.
   data_object_for=Data object for {0}.
   generating_util_for=Generating Util class for ''{0}''.
  +generating_dao_for=Generating DAO class for ''{0}''.
   generating_dataobject_for=Generating Data Object class for ''{0}''.
   generating_dd=Generating EJB deployment descriptor.
   generating_bmp_for=Generating BMP class for ''{0}''.
  
  
  
  1.1                  xdoclet/core/resources/xdoclet/ejb/dao-methods.j
  
  Index: dao-methods.j
  ===================================================================
  <XDtEjbDao:ifUsingDao>
     private static <XDtEjbDao:daoClass/> dao = null;
  
     private <XDtEjbDao:daoClass/> getDao()
     {
        if (dao != null) {
           return dao;
        } else {
  <XDtClass:ifHasClassTag tagName="ejb:dao" paramName="impl-class">
           dao = new <XDtClass:classTagValue tagName="ejb:dao" 
paramName="impl-class"/>();
  </XDtClass:ifHasClassTag>
  <XDtClass:ifDoesntHaveClassTag tagName="ejb:dao" paramName="impl-class">
  <XDtClass:ifHasClassTag tagName="ejb:dao" paramName="impl-jndi">
           try{
              javax.naming.InitialContext ctx = new javax.naming.InitialContext();
              Object ref = ctx.lookup("java:comp/env/<XDtClass:classTagValue 
tagName="ejb:dao" paramName="impl-jndi"/>");
              String daoStr = (String) javax.rmi.PortableRemoteObject.narrow(ref, 
String.class);
              dao = (<XDtEjbDao:daoClass/>) Class.forName(daoStr).newInstance();
           } catch (javax.naming.NamingException e) {
              throw new IllegalStateException("DAO not defined in JNDI 
'java:comp/env/<XDtClass:classTagValue tagName="ejb:dao" paramName="impl-jndi"/>'");
           } catch (Exception e) {
              throw new IllegalStateException("Exception while looking in JNDI for 
'java:comp/env/<XDtClass:classTagValue tagName="ejb:dao" paramName="impl-jndi"/>'");
           }
  </XDtClass:ifHasClassTag>
  <XDtClass:ifDoesntHaveClassTag tagName="ejb:dao" paramName="impl-jndi">
           dao = new <XDtEjbDao:daoClass/>();
  </XDtClass:ifDoesntHaveClassTag>
  </XDtClass:ifDoesntHaveClassTag>
           dao.init();
           return dao;
        }
     }
  
  <XDtMethod:forAllMethods>
  <XDtMethod:ifHasMethodTag tagName="dao:call">
      public <XDtMethod:methodType/> 
<XDtMethod:methodName/>(<XDtParameter:parameterList/>)
              <XDtMethod:exceptionList/>
      {
  <XDtMethod:ifHasMethodTag tagName="dao:call" paramName="name">
          return getDao().<XDtMethod:methodTagValue tagName="dao:call" 
paramName="name"/>(<XDtParameter:parameterList includeDefinition="false"/>);
  </XDtMethod:ifHasMethodTag>
  <XDtMethod:ifDoesntHaveMethodTag tagName="dao:call" paramName="name">
          return 
getDao().<XDtEjbIntf:interfaceMethodName/>(<XDtParameter:parameterList 
includeDefinition="false"/>);
  </XDtMethod:ifDoesntHaveMethodTag>
      }
  
  </XDtMethod:ifHasMethodTag>
  </XDtMethod:forAllMethods>
  </XDtEjbDao:ifUsingDao>
  
  
  
  1.1                  xdoclet/core/resources/xdoclet/ejb/dao.j
  
  Index: dao.j
  ===================================================================
  /*
   * <XDtI18n:getString bundle="xdoclet.ejb.Messages" resource="do_not_edit"/>
   */
  package <XDtPackage:packageOf><XDtEjbDao:daoClass/></XDtPackage:packageOf>;
  
  <XDtClass:importedList currentClass="<XDtEjbDao:daoClass/>"/>
  
  /**
   * <XDtI18n:getString bundle="xdoclet.ejb.Messages" resource="dao_for" 
arguments="<XDtEjb:ejbName/>"/>
  <XDtClass:classCommentTags indent="0"/> */
  public interface <XDtClass:classOf><XDtEjbDao:daoClass/></XDtClass:classOf>
  {
      public void init();
  
  <XDtType:ifIsOfType type="javax.ejb.EntityBean">
      public void load(<XDtEjbPk:pkClass/> pk, <XDtClass:fullClassName/> ejb) throws 
javax.ejb.EJBException;
      public void store(<XDtClass:fullClassName/> ejb) throws javax.ejb.EJBException;
      public void remove(<XDtEjbPk:pkClass/> pk) throws javax.ejb.RemoveException, 
javax.ejb.EJBException;
  
  </XDtType:ifIsOfType>
  <XDtMethod:forAllMethods superclasses="false" sort="false">
  <XDtMethod:ifHasMethodTag tagName="dao:call">
   <XDtMethod:ifHasMethodTag tagName="dao:call" paramName="name">
      public <XDtMethod:methodType/> <XDtMethod:methodTagValue tagName="dao:call" 
paramName="name"/>(<XDtParameter:parameterList/>) <XDtMethod:exceptionList/>;
   </XDtMethod:ifHasMethodTag>
   <XDtMethod:ifDoesntHaveMethodTag tagName="dao:call" paramName="name">
      public <XDtMethod:methodType/> 
<XDtEjbIntf:interfaceMethodName/>(<XDtParameter:parameterList/>) 
<XDtMethod:exceptionList/>;
   </XDtMethod:ifDoesntHaveMethodTag>
  </XDtMethod:ifHasMethodTag>
  </XDtMethod:forAllMethods>
  
  <XDtComment:comment>
  TODO: handle @dao:method signature="..." class-level tags for including additional
  methods in the DAO.
  <XDtClass:forAllClassTags tagName="dao:method" tagKey="signature">
  </XDtClass:forAllClassTags>
  </XDtComment:comment>
  
     <XDtMerge:merge file="dao-custom.j">
     </XDtMerge:merge>
  }
  
  
  

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

Reply via email to