groovy

Is it possible to use a JNDI dataSource read only in Grails?

Hi, I need to add a JNDI datasource from a legacy database to my Grails (1.2.2) application. So far, the resource is added to my Tomcat (5.5) and DataSource.groovy contains: development { dataSource { jndiName = "jdbc/lrc_legacy_db" } } I also created some domain objects mapping the different tables to comfortably load...

Recursive listing of all files matching a certain filetype in Groovy

I am trying to recursively list all files that match a particular file type in Groovy. The example at link text almost does it. However, it does not list the files in the root folder. Is there a way to modify this to list files in the root folder? Or, is there a different way to do it? TIA ...

Grails custom server page (custom gsp)

I have a controller and a gsp. I go ahead and attempt to build the project but receive issues on my gsp. It is telling me "The current scope already contains a variable of the name it" <html> <head> <title>Book Collector</title> <meta name="layout" content="main" /> </head> <body> <h1>Book Editor</h1> <table> ...

Groovy sql dataset causes java.lang.OutOfMemory

I have a table with 252759 tuples. I would like to use DataSet object to make my life easier, however when I try to create a DataSet for my table, after 3 seconds, I get java.lang.OutOfMemory. I have no experience with Datasets, are there any guidelines how to use DataSet object for big tables? ...

Grails - Multiple Drop Down Boxes Values

Hey I am learning Grails. I've been playing with it for a while but nothing too serious. And let's say I have two drop down boxes, one with the type of animal and the second with the breed. How do I give the second box the values?? For example, If I select dog, it should only show me dog breeds, not the cat ones. Thanks in advance. ...

does this count as metaprogramming?

I am going to write a groovy script to generate a buttload of constants in a javascript file. ;) Maybe cross-language metaprogramming? meta-language meta-programming? To be clear, I am asking what category this falls under ...

Deploying Grails on a Production Env. (Hibernate tries updating schema)

Hi there, I am deploying to a unix box running Jboss. We are using SQL Server 2008 as our database. Once deployed I push the changes by re-deploying the war to the environment. I see server.log has errors, seems hibernate tries to re-generate/modify tables already created. I am using dbCreate = "update" setting in my datasource.groov...

groovy / grails / hibernate - configure set to be fetched eagerly

We are configuring hibernate with grails using the domain classes. Added: static hasMany = [image:Image] static fetchMode = [image:"eager"] However, when I pull the object graph each image is not loaded. Please advise. Thanks. ...

Using the output from g.render in Grails controller

Hi, I am rendering two GSP templates in a controller. The first template is rendered as follows: String couponspage = (g.render(template: "availableCoupons", contentType:"text/html", model : [:]))?.toString() I include the results of the first template in the model to the call to render the second template as follows: render(templat...

Use of Namespaces in Groovy MarkupBuilder

I want have the following output: <?xml version="1.0" encoding="UTF-8"?> <structure:structuralDataRoot xmlns:register="http://www.test.ch/register/1" xmlns:structure="http://test.ch/structure/1" > <structure:tester>ZH</structure:tester> <structure:surveyYear>2001</structure:surveyYear> <structure:surfaceData> <structure:houseS...

How can I convert a PDF into a web-browsable image?

I need to create an online viewer which converts PDF files into browsable images, like http://view.samurajdata.se/. I would like to do this in Grails. Does Grails have any plugins for this? ...

Groovy - Closures and bind, why this code doesn't work ?

I think this is a newbie question but why it fails on the last assertion? I was thinking that the closure binds the value on it, so changing it from the closure will change the value outside the closure. def value = 5 def foo(n){ return { ++n } } def test = foo(value) assert test() == 6 assert test() == 7 assert value == ...

Groovy, App Engine, and the 3000 file limit

Firstly, I'm new to groovy as of yesterday, so what I say could be incorrect. In groovy, every time you create a closure in your code, it creates a separate .class file like this Test$_closure1.class. I could easily have 3000 different closures throughout my project, which would thus push me over the 3000 file limit on App Engine. It ...

JDB debugging of Groovy/Grails code

I'm attempting to debug some issues in some (rather bletcherous) Grails code that I inherited. I'm a relative noob in Groovy and Grails although an old Java guy. Here's the problem: I have this thing running with jconsole and jdb hooks in, but it's tough to use the debugger because so much of the code is in closures. So, for example, ...

Grails, groovy: combine GORM dynamic methods - findAllBy and OrderBy

assuming the following example: I have a User class and a Item class and a user can have many items 1) Is there a combined dynamic method to get all the items for a user and also sort them after a Property? I have a controller action that gets the items for a user and send them to the view, and the view will render them all with < g:e...

In Groovy Is there a way to decorate every class to add tracing?

How would I go about making every method call of every groovy class of mine print "Entering ${methodname}" as it enters the method call? Without having to wrap every new object I create with new TracingDecorator(new Object())? ...

Multiple Groovy jars in my war file

Hi there, I noticed that my Grails war has two Groovy jars in it: groovy-1.7-rc-2.jar and groovy-all-1.7.4.jar -- What could be causing this? I took a look at my plugin dependencies, and BuildConfig but didn't find anything... ...

What are the pros & cons of functional testing frameworks for a new grails application?

I've got analysis paralysis looking at all the different functional testing options for a new grails (v1.3.4) application. I've looked at WebDriver/Selenium (which I've used before) WebTest/Canoo Geb Tellurium Grails Functional Test and there must be others. I think some of the criteria that I would use to make a decision include (in...

How do I set up a Google App Engine Project that uses Groovy in Eclipse?

How do I make a Groovy Google App Engine project in Eclipse? I have both the Groovy and the App Engine plugins installed. I'm already able to successfully make an App Engine or a Groovy project separately, but how do I make a project that is both? I tried just making an App Engine project and then adding a Groovy class to it, but I ge...

groovy, Junit4 unit test, and related test runner

I'm trying to write Junit4 test cases for my Groovy code. The Junit 4 test case works fine inside my Eclipse IDE which is SpringSource Tool Suite. I can't get a test running to run the all of the test cases, however. Here is my current attempt at a test runner. It's pretty much taken directly from the Groovy website itself: import g...