users
[Top] [All Lists]

RE: [cinjug-users] EJBObject and EJBLocalIObject interfaces

To: <esumerfd@xxxxxxxxxxxxxx>
Subject: RE: [cinjug-users] EJBObject and EJBLocalIObject interfaces
From: "Abraham Fathman" <abraham@xxxxxxxxxxx>
Date: Tue, 12 Dec 2006 08:17:10 -0500
Cc: <users@xxxxxxxxxx>
Delivered-to: mailing list users@cinjug.org
In-reply-to: <6a216ba20612111527m4a8d8806j1531d3926cd2b857@mail.gmail.com>
Mailing-list: contact users-help@cinjug.org; run by ezmlm
Thread-index: AccdfDoG43Tf9kKwQD27bQ73DX+WsAAceJEg
I've written an XDoclet Template to do this type of thing in the past.

If you want to go that route (the code generation route you were mentioning)
here are some things to get your started:

A reference of for the XDoclet template language can be found here:
http://xdoclet.sourceforge.net/xdoclet/templates/index.html

Snippet from build.xml:

    <taskdef name="doclet" classname="xdoclet.DocletTask">
      <classpath refid="xdoclet.classpath"/>
    </taskdef>
    
    <!-- Generate Service Interfaces -->
    <doclet destDir="${generated.src.dir}" force="${xdoclet.force}">
      <fileset dir="${src.dir}/">
        <include name="com/mycompany/services/impl/*Service.java"/>
      </fileset>
      <template destinationFile="{0}.java"
templateFile="${templates.dir}/service/InterfaceService.xdt">
        <packageSubstitution packages="impl" substituteWith="" />
      </template>
    </doclet>

InterfaceService.xdt:

package com.mycompany.services;

/**
 * Generated interface for <XDtClass:className/>.
 * <br> 
 * This interface has been generated from
 * the {@link com.mycompany.services.impl.<XDtClass:className/>
<XDtClass:className/>}
 * class. 
 * <br> 
 * The purpose of this generation is to make the maintenance of the code
easier.
 * <br><br>
 * This interface exists so the user access tier can strictly use this
interface and the implementation
 *  can be masked. It is possible the implementation could be proxied
through a cache or a network layer
 *  to an actual implementation. The implementation might or might not
extend from the original class.
 *
 * @author service/InterfaceService.xdt XDoclet Template (Abraham Fathman)
 * @see com.mycompany.services.impl.<XDtClass:className/>
 */
public interface <XDtClass:className/>
{

  <XDtMethod:forAllMethods>
  <XDtMethod:ifHasMethodTag tagName="service">
  <XDtMethod:methodComment/>
  public <XDtMethod:methodType/> <XDtMethod:methodName/>(
<XDtParameter:parameterList/> )
    <XDtMethod:exceptionList/>;


  </XDtMethod:ifHasMethodTag>
  </XDtMethod:forAllMethods>
}



Abraham Fathman


-----Original Message-----
From: esumerfd@xxxxxxxxx [mailto:esumerfd@xxxxxxxxx] On Behalf Of Edward
Sumerfield
Sent: Monday, December 11, 2006 6:28 PM
To: users@xxxxxxxxxx
Subject: [cinjug-users] EJBObject and EJBLocalIObject interfaces

Anyone have any fancy ways of removing the duplication between these
two interfaces? One needs to throw the RemoteException and the local
does not. Makes sence in theory but it means duping every method in
every bean.

I could go code generation, copy from EJBObject to EJBLocalObject and
filter out the "throws RemoteException" string. Should be a simple ant
task but someone must have solved this inefficiency already?

-- 
Ed

---------
You may unsubscribe from this mailing list
by sending a blank email addressed to:
users-unsubscribe@xxxxxxxxxx

--
Find additional help by sending a blank email
addressed to:
users-help@xxxxxxxxxx


<Prev in Thread] Current Thread [Next in Thread>