You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Bruno Dumon <br...@outerthought.org> on 2006/03/10 14:57:10 UTC

Sharing the template block between 2.1 and 2.2 (was Re: Release 2.1.9 (again))

On Thu, 2006-03-09 at 14:49 -0700, Jason Johnston wrote:
> On Thu, 2006-03-09 at 21:10 +0000, Upayavira wrote:
> > Jason Johnston wrote:
> > > On Thu, 2006-03-09 at 08:46 -0800, Ralph Goers wrote:
> > >> Bruno Dumon wrote:
> > >>
> > >>> On Thu, 2006-03-09 at 06:35 -0800, Ralph Goers wrote:
> > >>>  
> > >>>
> > >>>> Hi. Its me again.
> > >>>>
> > >>>> Seriously, are we there yet?
> > >>>>    
> > >>>>
> > >>> I guess nothing changed since you last asked ;-)
> > >>>  
> > >>>
> > >> Not quite.  A few days passed, which is all Sylvain said he needed.  
> > >> AFAIK that is all we are waiting for.
> > > 
> > > 
> > > It gets mentioned every time someone asks about the 2.1.9 release, so to
> > > keep the pattern going: what about the Template block from trunk?  IIRC
> > > this was discussed and planned for inclusion in 2.1.9.
> > 
> > Could you make a patch? That could make it happen.
> 
> I would be glad to.  But I would need guidance, since I know nothing
> about what is required.  Is it just adding an svn:external to that
> block, or are there code changes involved?

I just gave this a try to see if it needs any special work.

Here's what I did or found out:

 * copied the java sources (src/main/java)

 * resources (src/main/resources):

   - 2.2 has imports for xconf and xroles, so for 2.1 I had to create a
set of patch files (similar as is done for forms): nothing special here

   - the resources also contained a file template-instructions.xml, I
copied this to the java sources

 * the template block needs the (new in 2.2) class
TemplateObjectModelHelper, which is outside of the template block. I
copied it in the sources of the template block

 * class JavascriptExpression and TemplateObjectModelHelper: require
changes due to changed rhino API. For JavascriptExpression I simply
commented out the code since it is not essential.

 * I got classcast exceptions when StringTemplateFactory and
ExpressionFactory were looked up from the ServiceManager. The cause is
that these classes don't have a "service interface" (their role is a
concrete class). I introduced interfaces for them.

 * Added block to gump.xml and block.properties

And then it worked. I tried it first with a simple test file and then
with the forms block, and everything seems ok.

                                    - o -

To  summarize: if we want to have a shared codebase for the template
block, things that need to handled:

 - introduce interface for StringTemplateFactory and ExpressionFactory
    ==> this is something I can do

 - don't make use of new rhino API features: I need someone else to look
into this

 - Move template_instructions.xml between the java sources instead of
the resources: I could do this, if nobody objects or knows a better way

 - TemplateObjectModelHelper: could duplicate it into 2.1 core

Opinions? Objections? Help?

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


Re: Sharing the template block between 2.1 and 2.2 (was Re: Release 2.1.9 (again))

Posted by Jean-Baptiste Quenot <jb...@apache.org>.
* Bruno Dumon:

> And then it worked. I tried it first with a simple test file and
> then with the forms block, and everything seems ok.

Great!  Thanks a lot.
-- 
Jean-Baptiste Quenot
http://caraldi.com/jbq/

Re: Sharing the template block between 2.1 and 2.2 DONE!

Posted by Bruno Dumon <br...@outerthought.org>.
On Fri, 2006-03-10 at 16:53 +0100, Reinhard Poetz wrote:
> Jason Johnston wrote:
> 
> > A question: it appears that both the 2.1.x core and the template block
> > contain the classes o.a.c.generation.JXTemplateGenerator and
> > o.a.c.transformation.JXTemplateTransformer.  In 2.1.x they're the old JX
> > we know and love, and in the template block they point to the new JX.
> > 
> > So when using those old classes in 2.1.x with the template block
> > included, which version of JX gets used?
> 
> In 2.1.x the old generator should *not* extend the new generator and in the 
> template block we should simply remove the class. In order to do this and follow 
> our versioning policy, we have to deprecate the old implementations.
> 

I followed this suggestion, as this is also what has been voted on [1].

The "move" is done now. The java sources of the template block are
shared via svn:externals.

In 2.1, the new jx template generator is by default declared in the
sitemap with the name "newjx".

[1] http://marc.theaimsgroup.com/?t=113714752400001&r=1&w=2

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


Re: Sharing the template block between 2.1 and 2.2 (was Re: Release 2.1.9 (again))

Posted by Reinhard Poetz <re...@apache.org>.
Jason Johnston wrote:

> A question: it appears that both the 2.1.x core and the template block
> contain the classes o.a.c.generation.JXTemplateGenerator and
> o.a.c.transformation.JXTemplateTransformer.  In 2.1.x they're the old JX
> we know and love, and in the template block they point to the new JX.
> 
> So when using those old classes in 2.1.x with the template block
> included, which version of JX gets used?

In 2.1.x the old generator should *not* extend the new generator and in the 
template block we should simply remove the class. In order to do this and follow 
our versioning policy, we have to deprecate the old implementations.

-- 
Reinhard Pötz           Independent Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}

                                        web(log): http://www.poetz.cc
--------------------------------------------------------------------

	

	
		
___________________________________________________________ 
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de

Re: Sharing the template block between 2.1 and 2.2 (was Re: Release 2.1.9 (again))

Posted by Jason Johnston <co...@lojjic.net>.
Bruno Dumon wrote:
...
>                                     - o -
> 
> To  summarize: if we want to have a shared codebase for the template
> block, things that need to handled:
> 
>  - introduce interface for StringTemplateFactory and ExpressionFactory
>     ==> this is something I can do
> 
>  - don't make use of new rhino API features: I need someone else to look
> into this
> 
>  - Move template_instructions.xml between the java sources instead of
> the resources: I could do this, if nobody objects or knows a better way
> 
>  - TemplateObjectModelHelper: could duplicate it into 2.1 core
> 
> Opinions? Objections? Help?
> 

Great work Bruno, thanks for doing that.  I got only as far as the first
step or two. ;-)

A question: it appears that both the 2.1.x core and the template block
contain the classes o.a.c.generation.JXTemplateGenerator and
o.a.c.transformation.JXTemplateTransformer.  In 2.1.x they're the old JX
we know and love, and in the template block they point to the new JX.

So when using those old classes in 2.1.x with the template block
included, which version of JX gets used?