Re[2]: problems with recent change in TemplateModel....
Jacob Kjome <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Organization | Springfield Nuclear Plant |
| Message-ID | <[email protected]> |
Hello Christian, Seems to work fine :-) Jake Friday, March 07, 2003, 2:41:15 PM, you wrote: CC> Ok, this is done! I believe I have all the changes properly applied, but I'm CC> not sure how to test the contrib stuff...Diez and Steven...could you guys CC> update from cvs and confirm/deny whether things still work there? CC> You can see exactly what I changed by searching for //csc_030703.1 CC> All the unit tests work, and I have rebuilt the jars. CC> THanks, CC> Christian CC> ---------------------------------------------- CC> Christian Cryder [[email protected]] CC> Internet Architect, ATMReports.com CC> Barracuda - http://barracudamvc.org CC> ---------------------------------------------- CC> "Coffee? I could quit anytime, just not today" CC> -----Original Message----- CC> From: [email protected] CC> [mailto:[email protected]]On Behalf Of Jacob Kjome CC> Sent: Friday, March 07, 2003 9:24 AM CC> To: [email protected] CC> Subject: RE: [Barracuda] problems with recent change in TemplateModel.... CC> Hi Christian, CC> If you want to go ahead and make the necessary changes, that would be CC> great. I agree that having both getItem() methods in the interface confuses CC> things. This was just a short term solution to get everything compiling and CC> working properly until we deciding to fix things. CC> To do a clean rebuild of the contrib stuff without recompiling everything CC> else do..... CC> ant contrib -Dclean.contrib=true -Dsubskip=true CC> to clean everything do... CC> ant superclean contrib -Dsubproject=all -Dsubtarget=superclean CC> That will clean Barracuda, Build Barracuda + contrib, and then clean up CC> each of the contrib projects CC> to install the contrib projects to Tomcat to verify that they work after CC> changes do... CC> ant contrib -Dsubproject=all -Dsubtarget=catalina-install CC> later, CC> Jake CC> At 08:21 AM 3/7/2003 -0500, you wrote: CC> Hi Jake! CC> My bad. I forgot to check the contrib directory. What I'd like to do is CC> completely remove the getItem(String key) method, simply because it CC> complicates the interface - it really should have been CC> getItem(TemplateDirective td) from the beginning. I'm concerned that if we CC> leave it folks will look at the interface and go "do I need to implement CC> both???" CC> All that should be required is to change the signature in any classes CC> that implement TemplateModel. So instead of this: CC> public Object getItem(String key) CC> ... CC> they'd do this: CC> public Object getITem(TemplateDirective td) CC> String key = td.getKeyName(); CC> ... CC> pretty straightforward and easy to do. I'd be happy to make the change CC> to all the contrib code if you'd like, since its my change that is causing CC> the trouble. CC> Alternatively, any code that implements TemplateModel could be modified CC> to extend from AbstractTemplateModel, and all should be well that way too. CC> Of course, any classes that utilize TemplateModel from above (like CC> TemplateHelper, or in Diez' case, FilterFactory) have to be modified as CC> well. Again, these are relatively trivial changes, but they are changes CC> nonetheless. CC> So let me know what you think - I'd really like to just get to the one CC> new getItem() method, as opposed to two. However, I also realize that my CC> change as I made it yesterday does in fact break some existing code (which CC> is never good ;-) so I'd be happy to help fix the mess. Or if you are CC> comfortable making the changes to the contrib package, we could do it that CC> way too. CC> My guess is that outside of the Barracuda framework, there aren't too CC> many people out there actually implementing TemplateModel directly. CC> Christian CC> ---------------------------------------------- CC> Christian Cryder [[email protected]] CC> Internet Architect, ATMReports.com CC> Barracuda - http://barracudamvc.org CC> ---------------------------------------------- CC> "Coffee? I could quit anytime, just not today" CC> -----Original Message----- CC> From: [email protected] CC> [mailto:[email protected]]On Behalf Of Jacob Kjome CC> Sent: Thursday, March 06, 2003 10:49 PM CC> To: [email protected] CC> Subject: [Barracuda] problems with recent change in TemplateModel.... CC> Hi Christian, CC> I noticed that you modified TemplateModel to take a TemplateDirective CC> in getItem(). CC> You said this... CC> Log message: CC> <b>csc_030603.2</b> - changed the signature of the getItem() CC> method in the CC> TemplateModel interface from: CC> getItem(String key) CC> to: CC> getItem(TemplateDirective td) CC> This gives the model implementation access to the full CC> TemplateDirective, and opens CC> up some interesting pattern opportunities based on the key CC> data portion of directives CC> (rather than on a naming convention applied to key name, which CC> was the only option CC> available before). While changing the signature might seem CC> like it will have a big impact CC> on existing code, I don't think it will do so because CC> AbstractTemplateModel implements CC> this method and simply calls the old getItem(String key) CC> method. So old code should CC> continue to work, but it you want to implement something under CC> the new signature, you CC> certainly can. The only caveat is that if you implement this CC> new method directly, you CC> should make sure you call super.getItem() for CC> TemplateDirectives that go unhandled. CC> or are still handled in the old getItem(String key) method. CC> but it results in the following errors in the contrib projects and CC> that doesn't even include the contrib webapps, that's just the main contrib CC> package.... CC> compile.contrib: CC> [javac] Compiling 4 source files to CC> D:\myclasses\Repository\Enhydra\Barracud CC> aMVC_2003-02-17\Barracuda\WEB-INF\classes CC> [javac] CC> D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-02-17\Barracuda\sr CC> c\org\enhydra\barracuda\contrib\dbroggisch\display\filters\FilterFactory.jav CC> a:46 CC> 8: getItem(org.enhydra.barracuda.core.comp.TemplateDirective) in CC> org.enhydra.bar CC> racuda.core.comp.TemplateModel cannot be applied to (java.lang.String) CC> [javac] res.setItem((String)entry.getValue(), CC> ltm.getIte CC> m((String)entry.getKey())); CC> [javac] CC> ^ CC> [javac] CC> D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-02-17\Barracuda\sr CC> c\org\enhydra\barracuda\contrib\dbroggisch\display\filters\FilterFactory.jav CC> a:47 CC> 8: getItem(org.enhydra.barracuda.core.comp.TemplateDirective) in CC> org.enhydra.bar CC> racuda.core.comp.TemplateModel cannot be applied to (java.lang.String) CC> [javac] res.setItem(key, CC> f.filter(ltm.getItem(ke CC> y), ctx)); CC> [javac] CC> ^ CC> [javac] CC> D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-02-17\Barracuda\sr CC> c\org\enhydra\barracuda\contrib\dbroggisch\display\filters\FilterFactory.jav CC> a:48 CC> 3: getItem(org.enhydra.barracuda.core.comp.TemplateDirective) in CC> org.enhydra.bar CC> racuda.core.comp.TemplateModel cannot be applied to (java.lang.String) CC> [javac] res.setItem(key, CC> ltm.getItem(key)); CC> [javac] ^ CC> [javac] CC> D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-02-17\Barracuda\sr CC> c\org\enhydra\barracuda\contrib\dbroggisch\repopulation\RepopulationFormMap. CC> java CC> :38: CC> org.enhydra.barracuda.contrib.dbroggisch.repopulation.RepopulationFormMap s CC> hould be declared abstract; it does not define CC> getItem(org.enhydra.barracuda.cor CC> e.comp.TemplateDirective) in CC> org.enhydra.barracuda.contrib.dbroggisch.repopulati CC> on.RepopulationFormMap CC> [javac] public class RepopulationFormMap extends ErrorFormMap CC> implements Tem CC> plateModel { CC> [javac] ^ CC> [javac] CC> D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-02-17\Barracuda\sr CC> c\org\enhydra\barracuda\contrib\sam\models\MapDecorator.java:23: CC> org.enhydra.bar CC> racuda.contrib.sam.models.MapDecorator should be declared abstract; it CC> does not CC> define getItem(org.enhydra.barracuda.core.comp.TemplateDirective) in CC> org.enhydra CC> .barracuda.core.comp.TemplateModel CC> [javac] public class MapDecorator extends TemplateModelDecorator { CC> [javac] ^ CC> [javac] CC> D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-02-17\Barracuda\sr CC> c\org\enhydra\barracuda\contrib\sam\models\MapDecorator.java:63: CC> getItem(org.enh CC> ydra.barracuda.core.comp.TemplateDirective) in CC> org.enhydra.barracuda.core.comp.T CC> emplateModel cannot be applied to (java.lang.String) CC> [javac] Object value = _templateModel.getItem(key); CC> [javac] ^ CC> [javac] CC> D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-02-17\Barracuda\sr CC> c\org\enhydra\barracuda\contrib\sam\models\MapDecorator.java:75: CC> getItem(org.enh CC> ydra.barracuda.core.comp.TemplateDirective) in CC> org.enhydra.barracuda.core.comp.T CC> emplateModel cannot be applied to (java.lang.String) CC> [javac] value=mapItemAsLookup(key, CC> _templateModel.getItem(key), CC> (Map)mapper ); CC> [javac] ^ CC> [javac] CC> D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-02-17\Barracuda\sr CC> c\org\enhydra\barracuda\contrib\sam\models\MapDecorator.java:77: CC> getItem(org.enh CC> ydra.barracuda.core.comp.TemplateDirective) in CC> org.enhydra.barracuda.core.comp.T CC> emplateModel cannot be applied to (java.lang.String) CC> [javac] value=mapItemAsNumberFormat(key, CC> _templateModel.getItem( CC> key), (NumberFormat)mapper ); CC> [javac] CC> ^ CC> [javac] CC> D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-02-17\Barracuda\sr CC> c\org\enhydra\barracuda\contrib\sam\models\MapDecorator.java:79: CC> getItem(org.enh CC> ydra.barracuda.core.comp.TemplateDirective) in CC> org.enhydra.barracuda.core.comp.T CC> emplateModel cannot be applied to (java.lang.String) CC> [javac] value=mapItemAsDateFormat(key, CC> _templateModel.getItem(ke CC> y), (DateFormat)mapper ); CC> [javac] ^ CC> [javac] CC> D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-02-17\Barracuda\sr CC> c\org\enhydra\barracuda\contrib\sam\models\MapDecorator.java:81: CC> getItem(org.enh CC> ydra.barracuda.core.comp.TemplateDirective) in CC> org.enhydra.barracuda.core.comp.T CC> emplateModel cannot be applied to (java.lang.String) CC> [javac] value=mapItemAsEvent(key, CC> _templateModel.getItem(key), ( CC> ControlEvent) mapper); CC> [javac] ^ CC> [javac] CC> D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-02-17\Barracuda\sr CC> c\org\enhydra\barracuda\contrib\sam\models\MapDecorator.java:157: CC> getItem(org.en CC> hydra.barracuda.core.comp.TemplateDirective) in CC> org.enhydra.barracuda.core.comp. CC> TemplateModel cannot be applied to (java.lang.String) CC> [javac] label = CC> (String)_templateModel.getItem(l CC> abel); CC> [javac] CC> ^ CC> [javac] CC> D:\myclasses\Repository\Enhydra\BarracudaMVC_2003-02-17\Barracuda\sr CC> c\org\enhydra\barracuda\contrib\sam\models\MapDecorator.java:176: CC> getItem(org.en CC> hydra.barracuda.core.comp.TemplateDirective) in CC> org.enhydra.barracuda.core.comp. CC> TemplateModel cannot be applied to (java.lang.String) CC> [javac] v = (String) CC> _templateModel.getI CC> tem( v); CC> [javac] CC> ^ CC> [javac] 12 errors CC> BUILD FAILED CC> file:D:/myclasses/Repository/Enhydra/BarracudaMVC_2003-02-17/Barracuda/src/b CC> uild CC> -contrib.xml:84: Compile failed; see the compiler error output for CC> details. CC> I'm afraid that this might be a big deal to some people. If this is CC> going to be the way it is and it provides benefits that outweigh the pain of CC> fixing all these errors, then I'm fine with the change, but I want to make CC> sure that this is what we want before I start trying to fix the contrib and CC> my other apps. CC> Jake -- Best regards, Jacob mailto:[email protected]