Graeme Rocher's complete blog can be found at: http://graemerocher.blogspot.com
Thursday, December 15, 2011
Wednesday, April 13, 2011
Foundry which we hope will become the premier deployment model for
Grails (and Spring, Ruby, Node.js etc.) applications in the the
future. If you missed the presentation checkout the YouTube recording.
It represents the culmination of a huge amount of work within VMware and we're super excited about the potential it has to completely revolutionize deployment models for Grails applications in the future.
Here are some further resources specific to Grails users:
Website: http://www.cloudfoundry.com/
Wiki & Sample applications: https://github.com/SpringSource/cloudfoundry-samples/wiki/Grails
Plugin Documentation: http://grails-plugins.github.
Signups are currently on a first come first serve basis under a limited beta programme.
Friday, April 16, 2010
class Message {
String code
Locale locale
String text
}
class DatabaseMessageSource extends AbstractMessageSource {
protected MessageFormat resolveCode(String code, Locale locale) {
Message msg = Message.findByCodeAndLocale(code, locale)
def format
if(msg) {
format = new MessageFormat(msg.text, msg.locale)
}
else {
format = new MessageFormat(code, locale )
}
return format;
}
}
beans = {
messageSource(DatabaseMessageSource)
}
@Immutable
class MessageKey implements Serializable {
String code
Locale locale
}
beans = {
messageCache(EhCacheFactoryBean) {
timeToLive = 500
// other cache properties
}
messageSource(DatabaseMessageSource) {
messageCache = messageCache
}
}
class DatabaseMessageSource extends AbstractMessageSource {
Ehcache messageCache
@Override
protected MessageFormat resolveCode(String code, Locale locale) {
def key = new MessageKey(code,locale)
def format = messageCache.get(key)?.value
if(!format) {
Message msg = Message.findByCodeAndLocale(code, locale)
if(msg) {
format = new MessageFormat(msg.text, msg.locale)
}
else {
format = new MessageFormat(code, locale)
}
messageCache.put new Element(key, format)
return format
}
return format;
}
}
Thursday, September 17, 2009
You could use the Grails Maven plugin, but that forced you to use, heavin forbid, Maven. We also shipped with basic Ant + Ivy support, but it was only really designed to be used for automation with continuous integration servers that support Ant and not at development time.
With Grails 1.2 this all changes with the introduction of Grails' dependency resolution DSL, which you can use to define your dependencies. Built on Ivy we have now eliminated one of the last remnants of XML usage in the Grails framework:
dependencies {
runtime 'com.mysql:mysql-connector-java:5.1.5'
test 'junit:junit:3.8.2'
}Grails takes application defined dependencies (defined in grails-app/conf/BuildConfig.groovy) and merges them with dependencies defined in the framework or any installed plugins. If there are conflicts you can exclude dependencies inherited from the framework or you can override plugin dependencies.By default Grails will only resolve dependencies against your Grails installation but you can enable remote repository resolution easily:
repositories {
mavenCentral()
mavenRepo "http://repository.codehaus.org"
}If you're addicted to your pom.xml file then we have even added the ability to read dependencies from the pom.xml instead of using the DSL. All in all, Grails 1.2 will give you significantly better control over dependencies and how they are resolved.We're still on track to release Grails 1.2 by the end of the month, but if you want to hear more about it I'll be talking about Grails 1.2 at upcoming events such as JAOO (Denmark), SpringOne2GX (New Orleans, USA) and the Grails eXchange (London). See you there!

