You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by John Menke <jo...@murphyfutures.com> on 2001/06/19 19:15:48 UTC

TDK possibly auto generate EJB's?

Thanks to a suggestion from Scott Eade (thanks Scott :)) I'm looking into a
product called EJBDoclet.  It's based on Ant and will auto generate EJB's
based on a combination of XML of java source code that is commented
correctly.  With a few tweaks, it may be possible to integrate this system
in with the existing TDK build files so that it reads the schema.xml like
the Torque does and generate the beans automagically.

I have a few questions based on this:

1.  I am proposing that the auto generation process produce 2 beans for each
table. One entity bean that maps to the table and One Session bean that
wraps the entity bean. The session bean could be used similar to the way the
Peer classes are used currently.

-- the problem with this is that beans might be too simple and not do
exactly what the user wants. I think that some customization will have to
able to made if the user selects to do so.  (EJBDoclet should be able to
handle this be letting the user specify a base class for the Entity Bean and
base class for the Session bean)

Question is:  Does this represent a valid architecture?  (One session bean
per entity bean?) Or should we try to develop some sort of abstraction where
one session bean controls many entity beans? Personally, I think that with
the auto generation the 1/1 mapping of session beans to entity beans will be
OK.

2. I am just learning Ant, so it would be helpful if somebody pointed to the
scripts that read the schema file and generate the SQL.  (I will probably be
able to find them, but at the moment I'm still looking).









---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


RE: TDK possibly auto generate EJB's?

Posted by John Menke <jo...@murphyfutures.com>.
>
> I think the idea is a good one, as long as it does not intend to replace
> the current (fast and easy) Peers mechanism.
>

It's not intended to replace Peers.  Only to provide EJB capabilities to the
Turbine developer.  That's why I'm not sure about default EJB's being
generated:  all that would be possible with the default beans would be to
replicate the abilities of basic Peer operations. (Of course you get the
added features of Transaction management with EJB, but the data access would
be similar).  I think people wanting to integrate EJB's might need more
specific classes generated.  They could still use EJBDoclet though.



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: TDK possibly auto generate EJB's?

Posted by Bruno Unna <br...@iac.com.mx>.
Hello, John.

If I was to use the automatically generated EJBs, I would expect only
one EJB (entity) associated to the table. Otherwise, the model becomes
unnecesarily confusing IMHO. What should be provided, along with the
EJB, is a sample skeleton of code showing how to contact the EJB server,
how to instantiate the EJB and (probably) how to use its accesor
methods.

I think the idea is a good one, as long as it does not intend to replace
the current (fast and easy) Peers mechanism.


On 19 Jun 2001 13:15:48 -0400, John Menke wrote:
> Thanks to a suggestion from Scott Eade (thanks Scott :)) I'm looking into a
> product called EJBDoclet.  It's based on Ant and will auto generate EJB's
> based on a combination of XML of java source code that is commented
> correctly.  With a few tweaks, it may be possible to integrate this system
> in with the existing TDK build files so that it reads the schema.xml like
> the Torque does and generate the beans automagically.
> 
> I have a few questions based on this:
> 
> 1.  I am proposing that the auto generation process produce 2 beans for each
> table. One entity bean that maps to the table and One Session bean that
> wraps the entity bean. The session bean could be used similar to the way the
> Peer classes are used currently.
> 
> -- the problem with this is that beans might be too simple and not do
> exactly what the user wants. I think that some customization will have to
> able to made if the user selects to do so.  (EJBDoclet should be able to
> handle this be letting the user specify a base class for the Entity Bean and
> base class for the Session bean)
> 
> Question is:  Does this represent a valid architecture?  (One session bean
> per entity bean?) Or should we try to develop some sort of abstraction where
> one session bean controls many entity beans? Personally, I think that with
> the auto generation the 1/1 mapping of session beans to entity beans will be
> OK.
> 
> 2. I am just learning Ant, so it would be helpful if somebody pointed to the
> scripts that read the schema file and generate the SQL.  (I will probably be
> able to find them, but at the moment I'm still looking).
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
--
"Create like a god,                Bruno Unna <br...@iac.com.mx>
 command like a king,                   Internet de Alta Calidad
 and work like a slave."              Red Hat Certified Engineer
             Kawasaki                   PGP public key available


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


RE: TDK possibly auto generate EJB's?

Posted by John Menke <jo...@murphyfutures.com>.
>
> John - The files that read the schema and generate the SQL aren't
> really in Ant per se.  It's the Torque add-on to Turbine that
> reads the schema file.

Thanks, I see the where it's Velocity templates doing to the work...

I know that the EJBDoclet can write the java code.  I will look at their
examples more.

As for the auto generation of the EJB's - I wonder if generating the default
beans is going to be truly useful.  Any customization will require the user
to make a template bean class and run this through the EJBDoclet program -
this is harder than just having it produced by default, but... I'm starting
to think that many people will not use the default version anyway...

Maybe just a tutorial of how to use EJBDoclet to generate the beans should
be included in the TDK?

-john


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: TDK possibly auto generate EJB's?

Posted by Ian Wallace <iw...@context.com>.
John - The files that read the schema and generate the SQL aren't really in Ant per se.  It's the Torque add-on to Turbine that reads the schema file
and runs it through some Velocity scripts to produce the SQL files, (ant runs them by using the taskdefs specified in the build.xml).  

Personally I would start my search with the 'newapp' build.xml file and look at the project-sql, project-om, etc targets.  They are really what's
generating the SQL, OM classes, etc.

Possible classes to look into are (I'd start with the torque-sql maybe?)

<target name="init-tasks">
    <taskdef name="torque-sql"-
      classname="org.apache.turbine.torque.TorqueSQLTask">
      <classpath refid="classpath"/>
    </taskdef>
    <taskdef name="torque-om"-
      classname="org.apache.turbine.torque.TorqueObjectModelTask">
      <classpath refid="classpath"/>
    </taskdef>
    <taskdef name="sql-xml"-
      classname="org.apache.turbine.torque.TorqueSQLTransformTask">
      <classpath refid="classpath"/>
    </taskdef>
    <taskdef name="texen"-
      classname="org.apache.velocity.texen.ant.TexenTask">
      <classpath refid="classpath"/>
    </taskdef>
</target>

Really you are going to end up writting Velocity scripts to generate the java code.
Hope that helps.

ian

John Menke wrote:
> 
> Thanks to a suggestion from Scott Eade (thanks Scott :)) I'm looking into a
> product called EJBDoclet.  It's based on Ant and will auto generate EJB's
> based on a combination of XML of java source code that is commented
> correctly.  With a few tweaks, it may be possible to integrate this system
> in with the existing TDK build files so that it reads the schema.xml like
> the Torque does and generate the beans automagically.
> 
> I have a few questions based on this:
> 
> 1.  I am proposing that the auto generation process produce 2 beans for each
> table. One entity bean that maps to the table and One Session bean that
> wraps the entity bean. The session bean could be used similar to the way the
> Peer classes are used currently.
> 
> -- the problem with this is that beans might be too simple and not do
> exactly what the user wants. I think that some customization will have to
> able to made if the user selects to do so.  (EJBDoclet should be able to
> handle this be letting the user specify a base class for the Entity Bean and
> base class for the Session bean)
> 
> Question is:  Does this represent a valid architecture?  (One session bean
> per entity bean?) Or should we try to develop some sort of abstraction where
> one session bean controls many entity beans? Personally, I think that with
> the auto generation the 1/1 mapping of session beans to entity beans will be
> OK.
> 
> 2. I am just learning Ant, so it would be helpful if somebody pointed to the
> scripts that read the schema file and generate the SQL.  (I will probably be
> able to find them, but at the moment I'm still looking).
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org

-- 
+----------------------------------+
 iwallace@context.com
+----------------------------------+

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: TDK possibly auto generate EJB's?

Posted by ji...@respublica.fr.
First thing , where can one find EJBDoclet?

I think it would be too optimistic to think the autogenerated EJB's 
would be used 'as is', that's why I proposed to do the first step 
(autogenerate a skeleton), letting the programmer fill the blanks.

Documentation/Tutorials are ALWAYS useful, if you can come up with one.

-- Denis.

On Wednesday, June 20, 2001, at 01:45  pm, John Menke wrote:

>>
>> Instead of specifying the base class, you can generate a skeleton class
>> that is not overwritten if the class file already exists. The user can
>> modify the skeleton to do what s/he wants. The problem is, how to
>> integrate this with the Peer mechanism
>>
>
> It looks like  EJBDoclet offers templating capabilities.  I think we 
> could
> use information obtained from schema file to drive the templating 
> process.
> The question is: how many people would use the default EJB's I think 
> many
> people would need more customized versions.
>
> If this is true, maybe a tutorial of how to use EJBDoclet and then how 
> to
> integrate the classes it generates it more appropriate than just having
> EJBDoclet autogenerate EJB's??? (What do you think?)
>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


RE: TDK possibly auto generate EJB's?

Posted by John Menke <jo...@murphyfutures.com>.
>
> First thing , where can one find EJBDoclet?
>
http://sourceforge.net/projects/ejbdoclet

> I think it would be too optimistic to think the autogenerated EJB's
> would be used 'as is', that's why I proposed to do the first step
> (autogenerate a skeleton), letting the programmer fill the blanks.
>

EJBDoclet does this.  Check it out.


> Documentation/Tutorials are ALWAYS useful, if you can come up with one.

I will work on the Tutorial. I'm getting busy again at work, but I can spend
some time on it.

Let me know if you have any sugestions after you look at EJBDoclet.

--john


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: TDK possibly auto generate EJB's?

Posted by Denis Bredelet <br...@euro.apple.com>.
First thing , where can one find EJBDoclet?

I think it would be too optimistic to think the autogenerated EJB's 
would be used 'as is', that's why I proposed to do the first step 
(autogenerate a skeleton), letting the programmer fill the blanks.

Documentation/Tutorials are ALWAYS useful, if you can come up with one.

-- Denis.

On Wednesday, June 20, 2001, at 01:45  pm, John Menke wrote:

>>
>> Instead of specifying the base class, you can generate a skeleton class
>> that is not overwritten if the class file already exists. The user can
>> modify the skeleton to do what s/he wants. The problem is, how to
>> integrate this with the Peer mechanism
>>
>
> It looks like  EJBDoclet offers templating capabilities.  I think we 
> could
> use information obtained from schema file to drive the templating 
> process.
> The question is: how many people would use the default EJB's I think 
> many
> people would need more customized versions.
>
> If this is true, maybe a tutorial of how to use EJBDoclet and then how 
> to
> integrate the classes it generates it more appropriate than just having
> EJBDoclet autogenerate EJB's??? (What do you think?)
>

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


RE: TDK possibly auto generate EJB's?

Posted by John Menke <jo...@murphyfutures.com>.
>
> Instead of specifying the base class, you can generate a skeleton class
> that is not overwritten if the class file already exists. The user can
> modify the skeleton to do what s/he wants. The problem is, how to
> integrate this with the Peer mechanism
>

It looks like  EJBDoclet offers templating capabilities.  I think we could
use information obtained from schema file to drive the templating process.
The question is: how many people would use the default EJB's I think many
people would need more customized versions.

If this is true, maybe a tutorial of how to use EJBDoclet and then how to
integrate the classes it generates it more appropriate than just having
EJBDoclet autogenerate EJB's??? (What do you think?)


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: TDK possibly auto generate EJB's?

Posted by ji...@respublica.fr.
On Tuesday, June 19, 2001, at 06:15  pm, John Menke wrote:

>
> -- the problem with this is that beans might be too simple and not do
> exactly what the user wants. I think that some customization will have 
> to
> able to made if the user selects to do so.  (EJBDoclet should be able to
> handle this be letting the user specify a base class for the Entity 
> Bean and
> base class for the Session bean)

Instead of specifying the base class, you can generate a skeleton class 
that is not overwritten if the class file already exists. The user can 
modify the skeleton to do what s/he wants. The problem is, how to 
integrate this with the Peer mechanism

>
> Question is:  Does this represent a valid architecture?  (One session 
> bean
> per entity bean?) Or should we try to develop some sort of abstraction 
> where
> one session bean controls many entity beans? Personally, I think that 
> with
> the auto generation the 1/1 mapping of session beans to entity beans 
> will be
> OK.
>
> 2. I am just learning Ant, so it would be helpful if somebody pointed 
> to the
> scripts that read the schema file and generate the SQL.  (I will 
> probably be
> able to find them, but at the moment I'm still looking).
>
>

-- Denis.

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org