facebook

MyEclipse Template customization

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #211456 Reply

    Pipeline
    Participant

    This is a question regarding the templates that are used by the MyEclipse wizards.

    I have modified the EjbSession.java template to reflect the defaults that we we want for a new Session Bean. Here is the section that contains my updates:

    /**
    * XDoclet-based stateless session bean. The class must be declared
    * <code>public</code>, according to the EJB specification.<br>
    *
    * @ejb.bean name = “<aw:className/>”
    * type = “Stateless”
    * display-name = “<aw:className/>”
    * description = “<aw:className/> EJB”
    * view-type = “both”
    * jndi-name = “ejb/<aw:className/>”
    *
    * @ejb:util generate=”physical”
    */

    The problem is that if I call my Session Bean implementation class “FooBean”, then the name attribute
    is automatically configured to <aw:className> which translates to “FooBean”. I want the name attribute
    to strip the “Bean” portion of any class name so that the following line is converted from

    * @ejb.bean name = “FooBean”

    to

    * @ejb.bean name = “Foo”

    This is important because the XDoclet builder seems to key off the name attribute when it is generating all the interface classes for my Session Beans.
    This then does not allow us to follow the J2EE naming convention for EJB Session Beans found athttp://java.sun.com/blueprints/code/namingconventions.html which states:

    Session Bean Naming Convention:
    Local interface: <component-name>Local
    Local home interface: <component-name>LocalHome
    Remote interface: <component-name>Remote
    Remote home interface: <component-name>RemoteHome
    Implementation class: <component-name>Bean
    Name in the EJB deployment descriptor: <component-name>Bean
    Display name in the EJB deployment descriptor: <expanded-component-name>SB

    So if my implentation name is “FooBean” and the name attribute is set to “FooBean” then XDoclet generates the following files:
    FooBeanLocal
    FooBeanLocalHome
    FooBeanRemote
    FooBeanRemoteHome
    FooBeanUtil

    Which is not what is desired. I would like it to generate the following files:
    FooLocal
    FooLocalHome
    FooRemote
    FooRemoteHome
    FooUtil

    So I would like to be able to call my implementation class “FooBean” and have the template somehow strip the “Bean” portion off when
    populating the name attribute of the @ejb.bean target.

    Is this possible?

    Thanks,

    Cor Ruiten

    #211467 Reply

    Greg
    Member

    Unfortunately, there is no way to get the functionality you want from the current template engine. We are currently looking at overhauling the entire template system throughtout MyEclipse and that would include Xdoclet support as well. So stay tuned…

    For now there are a couple of things you can do as workarounds.

    1) You could create the Session bean as Foo with the EJB wizard. Then run xdoclet to generate the ejb classes. Make sure that you have .ejb in your package suffix if you are using “Standard EJB” xdoclet config. Then you can refactor the main session bean class to FooBean.

    2) You also have some flexibility in the xdoclet configurations. Under the ejbdoclet, the nodes for localinterface, home interface, remote interface all have “pattern” attributes that will allow you to modify their default operation. Consult the xdoclet documentation http://xdoclet.sourceforge.net/xdoclet/ant/xdoclet/modules/ejb/EjbDocletTask.html for more info on those tags.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: MyEclipse Template customization

You must be logged in to post in the forum log in