problems with recent change in TemplateModel....

Jacob Kjome <[email protected]>
Newsgroups gmane.comp.java.enhydra.barracuda.general
Message-ID <[email protected]>
Hi Christian,

I noticed that you modified TemplateModel to take a TemplateDirective in 
getItem().

You said this...

Log message:
         <b>csc_030603.2</b> - changed the signature of the getItem() 
method in the
         TemplateModel interface from:
         getItem(String key)
         to:
         getItem(TemplateDirective td)
         This gives the model implementation access to the full 
TemplateDirective, and opens
         up some interesting pattern opportunities based on the key data 
portion of directives
         (rather than on a naming convention applied to key name, which was 
the only option
         available before). While changing the signature might seem like it 
will have a big impact
         on existing code, I don't think it will do so because 
AbstractTemplateModel implements
         this method and simply calls the old getItem(String key) method. 
So old code should
         continue to work, but it you want to implement something under the 
new signature, you
         certainly can. The only caveat is that if you implement this new 
method directly, you
         should make sure you call super.getItem() for TemplateDirectives 
that go unhandled.
         or are still handled in the old getItem(String key) method.

but it results in the following errors in the contrib projects and that 
doesn't even include the contrib webapps, that's just the main contrib 
package....

compile.contrib:
     [javac] Compiling 4 source files to 
D:\myclasses\Repository\Enhydra\Barracud
aMVC_2003-02-17\Barracuda\WEB-INF\classes
     [javac] 
D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-02-17\Barracuda\sr
c\org\enhydra\barracuda\contrib\dbroggisch\display\filters\FilterFactory.java:46
8: getItem(org.enhydra.barracuda.core.comp.TemplateDirective) in 
org.enhydra.bar
racuda.core.comp.TemplateModel cannot be applied to (java.lang.String)
     [javac]                     res.setItem((String)entry.getValue(), 
ltm.getIte
m((String)entry.getKey()));
     [javac]                                                                  ^
     [javac] 
D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-02-17\Barracuda\sr
c\org\enhydra\barracuda\contrib\dbroggisch\display\filters\FilterFactory.java:47
8: getItem(org.enhydra.barracuda.core.comp.TemplateDirective) in 
org.enhydra.bar
racuda.core.comp.TemplateModel cannot be applied to (java.lang.String)
     [javac]                             res.setItem(key, 
f.filter(ltm.getItem(ke
y), ctx));
     [javac]                                                              ^
     [javac] 
D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-02-17\Barracuda\sr
c\org\enhydra\barracuda\contrib\dbroggisch\display\filters\FilterFactory.java:48
3: getItem(org.enhydra.barracuda.core.comp.TemplateDirective) in 
org.enhydra.bar
racuda.core.comp.TemplateModel cannot be applied to (java.lang.String)
     [javac]                             res.setItem(key, ltm.getItem(key));
     [javac]                                                     ^
     [javac] 
D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-02-17\Barracuda\sr
c\org\enhydra\barracuda\contrib\dbroggisch\repopulation\RepopulationFormMap.java
:38: 
org.enhydra.barracuda.contrib.dbroggisch.repopulation.RepopulationFormMap s
hould be declared abstract; it does not define 
getItem(org.enhydra.barracuda.cor
e.comp.TemplateDirective) in 
org.enhydra.barracuda.contrib.dbroggisch.repopulati
on.RepopulationFormMap
     [javac] public class RepopulationFormMap extends ErrorFormMap 
implements Tem
plateModel {
     [javac]        ^
     [javac] 
D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-02-17\Barracuda\sr
c\org\enhydra\barracuda\contrib\sam\models\MapDecorator.java:23: 
org.enhydra.bar
racuda.contrib.sam.models.MapDecorator should be declared abstract; it does not
define getItem(org.enhydra.barracuda.core.comp.TemplateDirective) in 
org.enhydra
.barracuda.core.comp.TemplateModel
     [javac] public class MapDecorator extends TemplateModelDecorator {
     [javac]        ^
     [javac] 
D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-02-17\Barracuda\sr
c\org\enhydra\barracuda\contrib\sam\models\MapDecorator.java:63: 
getItem(org.enh
ydra.barracuda.core.comp.TemplateDirective) in 
org.enhydra.barracuda.core.comp.T
emplateModel cannot be applied to (java.lang.String)
     [javac]         Object value = _templateModel.getItem(key);
     [javac]                                      ^
     [javac] 
D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-02-17\Barracuda\sr
c\org\enhydra\barracuda\contrib\sam\models\MapDecorator.java:75: 
getItem(org.enh
ydra.barracuda.core.comp.TemplateDirective) in 
org.enhydra.barracuda.core.comp.T
emplateModel cannot be applied to (java.lang.String)
     [javac]             value=mapItemAsLookup(key, 
_templateModel.getItem(key),
(Map)mapper );
     [javac]                                                      ^
     [javac] 
D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-02-17\Barracuda\sr
c\org\enhydra\barracuda\contrib\sam\models\MapDecorator.java:77: 
getItem(org.enh
ydra.barracuda.core.comp.TemplateDirective) in 
org.enhydra.barracuda.core.comp.T
emplateModel cannot be applied to (java.lang.String)
     [javac]             value=mapItemAsNumberFormat(key, 
_templateModel.getItem(
key), (NumberFormat)mapper );
     [javac]                                                            ^
     [javac] 
D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-02-17\Barracuda\sr
c\org\enhydra\barracuda\contrib\sam\models\MapDecorator.java:79: 
getItem(org.enh
ydra.barracuda.core.comp.TemplateDirective) in 
org.enhydra.barracuda.core.comp.T
emplateModel cannot be applied to (java.lang.String)
     [javac]             value=mapItemAsDateFormat(key, 
_templateModel.getItem(ke
y), (DateFormat)mapper );
     [javac]                                                          ^
     [javac] 
D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-02-17\Barracuda\sr
c\org\enhydra\barracuda\contrib\sam\models\MapDecorator.java:81: 
getItem(org.enh
ydra.barracuda.core.comp.TemplateDirective) in 
org.enhydra.barracuda.core.comp.T
emplateModel cannot be applied to (java.lang.String)
     [javac]             value=mapItemAsEvent(key, 
_templateModel.getItem(key), (
ControlEvent) mapper);
     [javac]                                                     ^
     [javac] 
D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-02-17\Barracuda\sr
c\org\enhydra\barracuda\contrib\sam\models\MapDecorator.java:157: 
getItem(org.en
hydra.barracuda.core.comp.TemplateDirective) in 
org.enhydra.barracuda.core.comp.
TemplateModel cannot be applied to (java.lang.String)
     [javac]                             label = 
(String)_templateModel.getItem(l
abel);
     [javac]                                                               ^
     [javac] 
D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-02-17\Barracuda\sr
c\org\enhydra\barracuda\contrib\sam\models\MapDecorator.java:176: 
getItem(org.en
hydra.barracuda.core.comp.TemplateDirective) in 
org.enhydra.barracuda.core.comp.
TemplateModel cannot be applied to (java.lang.String)
     [javac]                                     v = (String) 
_templateModel.getI
tem( v);
     [javac] 
^

     [javac] 12 errors

BUILD FAILED
file:D:/myclasses/Repository/Enhydra/BarracudaMVC_2003-02-17/Barracuda/src/build
-contrib.xml:84: Compile failed; see the compiler error output for details.


I'm afraid that this might be a big deal to some people.  If this is going 
to be the way it is and it provides benefits that outweigh the pain of 
fixing all these errors, then I'm fine with the change, but I want to make 
sure that this is what we want before I start trying to fix the contrib and 
my other apps.

Jake
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.