Archive for November 28th, 2012

The Grails app-info-hibernate plugin

Wednesday, November 28th, 2012

The original app-info plugin had support for displaying lots of information about your Grails application, and several pages for Hibernate information and graphs. The Hibernate features ended up being about half of the plugin, so originally I wanted to split out the Hibernate features into a separate plugin. This didn’t work because I wasn’t able to get the GSPs rendered; at the time it wasn’t possible to use a plugin attribute for the render method to tell Grails where to find the controller mixin’s GSPs.

When Grails 2.0 was released my hand was forced though, since there wasn’t a version of the Hibernate Tools library that I use to generate table and entity graphs which worked with the updated version of Hibernate that Grails now uses. I was able to create a mostly-working version of the db-reverse-engineer plugin which also uses Hibernate Tools by forking the Gant script in its own JVM and using a different Hibernate jar, but that wasn’t possible in the app-info plugin because the functionality is part of the runtime, not just a script. So I removed the Hibernate features with plans to create an app-info-hibernate plugin once there was a compatible Hibernate Tools jar; I wrote about this here.

Fortunately there is finally a “CR1” version of the Hibernate Tools library in Maven Central, and in my testing I discovered that the plugin attribute does work in the Grails 2.0 render method, so I finished up the work for the plugin and released it today. I also released an update of the db-reverse-engineer plugin which uses the updated library and no longer needs the hackish workaround of forking a new process; install version 0.5 by adding compile ':db-reverse-engineer:0.5' to your BuildConfig.groovy.


Using the plugin is very similar to what I described in the original blog post. Add the plugin to BuildConfig.groovy:

plugins {
   ...

   compile ':app-info-hibernate:0.2'
}

(that there’s no need to add the app-info plugin since it will be transitively installed) and configure the grails.plugins.dynamicController.mixins map in Config.groovy:

grails.plugins.dynamicController.mixins = [
   'com.burtbeckwith.grails.plugins.appinfo.IndexControllerMixin':
      'com.burtbeckwith.appinfo_test.AdminManageController',

   'com.burtbeckwith.grails.plugins.appinfo.Log4jControllerMixin' :
      'com.burtbeckwith.appinfo_test.AdminManageController',

   'com.burtbeckwith.grails.plugins.appinfo.SpringControllerMixin' :
      'com.burtbeckwith.appinfo_test.AdminManageController',

   'com.burtbeckwith.grails.plugins.appinfo.MemoryControllerMixin' :
      'com.burtbeckwith.appinfo_test.AdminManageController',

   'com.burtbeckwith.grails.plugins.appinfo.PropertiesControllerMixin' :
      'com.burtbeckwith.appinfo_test.AdminManageController',

   'com.burtbeckwith.grails.plugins.appinfo.ScopesControllerMixin' :
      'com.burtbeckwith.appinfo_test.AdminManageController',

   'com.burtbeckwith.grails.plugins.appinfo.ThreadsControllerMixin' :
      'com.burtbeckwith.appinfo_test.AdminManageController',

   'com.burtbeckwith.grails.plugins.appinfo.hibernate.HibernateControllerMixin' :
      'com.burtbeckwith.appinfo_test.AdminManageController',

   'app.info.custom.example.MyConfigControllerMixin' :
      'com.burtbeckwith.appinfo_test.AdminManageController'
]

One thing to be aware of is that the HibernateControllerMixin package has changed; it’s now in the com.burtbeckwith.grails.plugins.appinfo.hibernate package.

Note that due to some issues in the updated grails.org site, the app-info plugin page isn’t editable, so it’s out of date, and there’s no plugin page yet for the app-info-hibernate plugin. It will be at http://grails.org/plugin/app-info-hibernate when the issues are resolved. You can install the plugin, it’s just not viewable in the plugin portal.


You can download a sample application that uses the plugin here.

This Week in Grails (2012-47)

Wednesday, November 28th, 2012

The big news of this week is the updated grails.org site. This was a big effort and a combination of work by VMware employees and community members, including Eric Berry, Damien Vitrac, and Craig Burke. The site is a Grails application and is open source – the repo is here if you have a fix or a new feature and want to send a pull request. We track issue in JIRA here so if you see anything weird let us know.

As part of the site upgrade, we’ve implemented a new system for submitting plugins. Instead of mailing the dev list, submit it with this form. Disqus is enabled throughout the site, so you can use that to make suggestions and ask questions about submitted plugins, and comment on other parts of the site too.

The winners of the Grails48 hackathon have been announced. Congrats to the team at OSOCO for their 1st-place finish!

The early access edition of Programming Grails was updated this week with three new chapters, for a total of ten. Only two more to go 🙂


If you want to keep up with these “This Week in Grails” posts you can access them directly via their category link or in an RSS reader with the feed for just these posts.


Translations of this post:



Plugins

There were 3 new plugins released:

  • bootstrap-theme version 1.0.RC2. Provides a basic Platform UI Theme based on Twitter Bootstrap
  • bootstrap-ui version 1.0.RC2. Twitter Bootstrap based UI Set for plugin platform
  • platform-ui version 1.0.RC1. Abstracted UI elements and theming for plugin/application interoperability

and 7 updated plugins:

  • jesque version 0.5.0. Groovier approach to using jesque
  • lamer-filter version 1.0.2. NOTFOUND
  • page-resources version 0.2.1. Enhances the resources plugin by allowing for creation of ‘page’ resource modules using convention over configuration
  • platform-core version 1.0.RC1. Provides functionality for plugins to use to achieve greater integration with each other and with applications
  • release version 2.1.0. Publishes Grails plugins either to a public or private repository
  • spring-security-facebook version 0.10. Plugin for Facebook Authentication, as extension to Grails Spring Security Core plugin
  • vaadin version 1.7.0-beta9.2. Adds Vaadin (http://vaadin.com/) integration

Interesting Tweets

Jobs



User groups and Conferences


Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 License.