Re: suggestion for 3.0 perheps?

From: Scott Ferguson <ferg@xxx.com>
Date: Wed Sep 04 2002 - 16:11:34 PDT

Martin Cooper wrote:

>>There's basically two parts of the problem: dependency and
>>make. Both
>>could be handled by special beans, similar to the way ant works,
>>although the ant tasks don't quite do the right thing.
>
>
> Can you expand on what the Ant tasks don't do quite right?

It's not that Ant is wrong, it's just that Ant's task is not the right
interface.

What this really needs is something like:

<class-loader>
   <make-loader path='WEB-INF/classes'>
     <depend-rule>
       <depend source-pattern='%.bean'
               target-pattern='%.java'/>

       <my-bean-maker source='${source}' target='${target}'/>
     </depend-rule>

     <depend-rule>
       <depend source-pattern='%.java'
               target-pattern='%.class'/>

       <javac source='${source}'/>
     </depend-rule>
   </make-loader>
</class-loader>

<class-loader> is just the replacement for the current <classpath>

<make-loader> is the new compiling loader, it might also be named
<compiling-loader>. Other loaders are <simple-loader> for
WEB-INF/classes and <directory-loader> for WEB-INF/lib.

The <depend-rule> stuff is the part I'm just making up. The syntax
above is based on GNU make.

<javac> is just like an ant task. In fact, it might actually be an ant
task.

The trick is the <depend-rule>. Ant doesn't need <depend> and
<depend-rule> because it basically just runs all the tasks. It doesn't
need to know the dependencies. Or rather it can defer that knowledge to
the task.

But Resin's classloader needs to know the dependencies. Every
<dependency-check-interval> seconds, Resin needs to see if it needs to
reload. So it needs a list of files to check for that reload. Suppose
Foo.bean generates Foo.java which generates Foo.class. If you load
Foo.class, Resin needs to know that when Foo.bean changes, it needs to
reload the web-app.

It might be possible that the <depend-rule> is unnecessary:

<make-loader path='WEB-INF/classes'>
   <depend source-pattern='%.java' target-pattern='%.class'/>
   <depend source-pattern='%.bean' target-pattern='%.java'/>

   <target name="bean">
     <my-bean/>
   </target>

   <target name="javac" depends="bean">
     <javac/>
   </target>
</make-loader>

The second example would be more like ant. If anything changes, then
just run all the tasks. There's no poing in getting any more clever and
trying to run the minimal set.

-- Scott

>
> If you can elaborate a little on what you're thinking about, I can put some
> thought into how it might be done. ;-)
>
> --
> Martin Cooper
>
>
>
>>-- Scott
>>
>>
>>>--
>>>Martin Cooper
>>>
>>>
>>>
>>>
>>>>-----Original Message-----
>>>>From: Christian Andersson [mailto:ca@xxx.no]
>>>>Sent: Saturday, August 31, 2002 2:26 PM
>>>>To: resin-interest@xxx.com
>>>>Subject: suggestion for 3.0 perheps?
>>>>
>>>>
>>>>Hi there, I was wondering if it is possible to configure
>>>>resin to check
>>>>for changes in files and execute some function in a class
>>>
>>if it is...
>>
>>>>in resin ther already is some of these
>>>>.jsp -> .java -> .class for changed .jsp pages
>>>>.java -> .class for changed .java files in
>>>>"classes" folder
>>>>
>>>>what I would like to have also is
>>>>
>>>>.bean -> .java -> .class
>>>>
>>>>if the .bean file is changed a new .java file is to be
>>>>generated and a
>>>>new .class file is to be compiled and used...
>>>>(the .bean file is an ordinary .xml file that defines the
>>>>properties in
>>>>a a bean, and some more information)
>>>>
>>>>I do this manually now, so it is not a big problem, but if
>>>>resin can do
>>>>this in the current version, that would be great, if it
>>>>cannot, is this
>>>>something that could be usefull to implement in resin 3.0?
>>>>
>>>>If this is something that would be interesting for 3.0 (and
>>>
>>does not
>>
>>>>exist in the current version) then i might have some ideas
>>>>(if they are
>>>>good or not I do not know)
>>>>
>>>>when the "generator" that produces the .java file recieves
>>>>information
>>>>that a file has been changed, it should generate the file, and then
>>>>return to resin a set of information... since the generator might
>>>>generate several .java files it should return info on every
>>>>.java file
>>>>it generates so that resin can build a list of which file
>>>>corresponds to
>>>>which .java file... it should also tell resin if it needs
>>>
>>to restart
>>
>>>>the application to get the new .java/class working...
>>>>
>>>>well that is it, but I guess that this could spring some
>>>
>>ideas in for
>>
>>>>yourself...
>>>>
>>>>/Christian Andersson
>>>>
>>>>
>>>
>>>
>>
>>
>>
>
Received on Wed 04 Sep 2002 16:11:34 -0700

This archive was generated by hypermail 2.1.8 : Thu Sep 28 2006 - 20:17:17 PDT