Hi Federico, I found a way around this, although it is not ideal. Sub-classing is fine as long as I do not have the parent class in the repository (I suspect it is fine if the parent class is in a different package, although I did not test this). I have the parent class in our module jar file, so executing the class does work. Still, it would be nice to have the issue resolved.
Thanks Rakesh From: Federico Grilli <[email protected]<mailto:[email protected]>> Reply-To: Magnolia User-List <[email protected]<mailto:[email protected]>> Date: Mon, 14 Feb 2011 04:41:56 -0600 To: Magnolia User-List <[email protected]<mailto:[email protected]>> Subject: Re: [magnolia-user] Issues with groovy module Hi Rakesh, this looks like a bug. Obviously the consistency check done by the groovy module before saving a Groovy class into the script repository should allow for subclassing. I'm going to look further into that. Thanks, Federico On Feb 11, 2011, at 5:41 PM, Rakesh Vidyadharan wrote: One issue I have consistently noticed is that the module groovy compiler does not like classes that sub-class other classes. Most of the classes that raised the "should have at least one class xxx" error will save fine (but not run properly obviously) if I remove the extends xxx declaration. Rakesh From: Rakesh Vidyadharan <[email protected]<mailto:[email protected]>> Reply-To: Magnolia User-List <[email protected]<mailto:[email protected]>> Date: Fri, 11 Feb 2011 10:18:52 -0600 To: Magnolia User-List <[email protected]<mailto:[email protected]>> Subject: [magnolia-user] Issues with groovy module I was trying to move some of our Groovy classes into the scripts area using the groovy module. Some classes were created fine, but some others fail with weird error messages (groovyc successfully compiles all the classes of course). Here are a couple of issues I ran into: package ucp.importer class AwardsConnection extends DatabaseConnection { AwardsConnection() { // code snipped } } I attempted to create the above under the /ucp/importer folder as AwardsConnection. I keep getting an error "ucp.importer.AwardsConnection should declare at least one class AwardsConnection". I obviously have one in the file. Same error for a few other groovy classes I attempted to place under this folder. Another issue: I have a few classes under ucp.scripts.blog package that I was trying to load into the repository. I created the directory structure, but have been unable to import any classes into this folder. Example package ucp.scripts.blog import ucp.blog.bean.Statistics import ucp.blog.books.importer.BlogConnection import ucp.blog.books.press.PressBlogImporter import ucp.scripts.RepositoryConfiguration class ImportPress extends RepositoryConfiguration { static void main( String[] args ) { ImportPress importer = new ImportPress() importer.run new Statistics() } } The error message I get is "ImportPress compilation failed: class package 'ucp.scripts.' does not match parent node '/ucp/books/blog' path in the repository. Once again, the package declaration has the full ucp.scripts.blog, but the magnolia groovy class loader seems to have issues with reading the full line. Any ideas on what the core issue may be? I could not find any other log messages, stacktraces or other information. Also, I am bit unclear from the documentation on the script dialog. Will these over-ride compiled groovy class files in our jar files? To be safe, I removed these from our jar file, but wanted to know whether the class loader will use the newer versions from the repository rather than from the jar file. Thanks Rakesh ________________________________ ---------------------------------------------------------------- For list details see http://www.magnolia-cms.com/home/community/mailing-lists.html To unsubscribe, E-mail to: <[email protected]<mailto:[email protected]>> ---------------------------------------------------------------- ________________________________ ---------------------------------------------------------------- For list details see http://www.magnolia-cms.com/home/community/mailing-lists.html To unsubscribe, E-mail to: <[email protected]<mailto:[email protected]>> ---------------------------------------------------------------- ________________________________ ---------------------------------------------------------------- For list details see http://www.magnolia-cms.com/home/community/mailing-lists.html To unsubscribe, E-mail to: <[email protected]<mailto:[email protected]>> ---------------------------------------------------------------- ---------------------------------------------------------------- For list details see http://www.magnolia-cms.com/home/community/mailing-lists.html To unsubscribe, E-mail to: <[email protected]> ----------------------------------------------------------------
