Concept of engine or mountable engine in Grails? - grails

In rails there seems to be a quite popular concept of engines even for things that are not stand-alone plugins but rather tiny contained web apps running in a web application.
I know grails has plugins the supplement the main application but I am wondering if grails can have sub-applications. For example you have a main application but then want a forum sub-application that simply uses the auth & auth models from the main application so that it does not need its own.
Is there any documentation or some basic concept tutorials on the engine concept for Grails?
Essentially I want to have a small main application that deals with auth & auth and some management but get all my other features to be sub-applications like splitting out forum, news, store, blog, etc but that all rely on the auth & auth of the main application. (making for a more modular grails app)
Thanks

Grails plugins are conceptually very similar to Rails Engines. The Grails plugin system can certainly be used to create a reusable component as you describe. You can embed all kinds of functionality into a Grails plugin including domain classes, controllers, UrlMappings, and views -- most things you would put into an application can be put into a plugin and it will be merged into whatever applications use that plugin.
There is a somewhat old blog post describing this approach here. The Grails user guide also has a detailed chapter on plugins.

Related

Grails UI in 2.3.4

I am coming from the Spring + Hibernate + JSF/primefaces site. What I like in Grails is its scaffolding site, so that basic CRUD apps can be created rather quickly.
However, which libaries do you recommend for a beginner in Grails for creating a UI? It should be created quickly and straightforward and also be feature rich (have a look at the primefaces libary)!
The very basic GSP pages are really powerful, especially when combined with any modern JS library. With them you can assemble a complex rich GUIs in instant (well, almost :) )
There are also numerous grails plugins to include almost any view technology of your choice into your web-app, e.g. http://grails.org/plugin/kickstart-with-bootstrap
I would suggest http://grails.org/plugin/twitter-bootstrap once installed you can use the documentation at http://getbootstrap.com/ as your guide.

Web front-end tools for Grails project

I previously developed only Java SE applications, and now I am trying to do some small project in Grails. My front-end developing skills are really bad. Ok, I got the main ideas behind GSP in Grails, but there are many tools which alow to simplify front-end development, like Twitter Bootstrap.
My question is, what tools for front end are best suited for Grails project and can be naturally combined with GSP?
Another option I am looking into is doing whole front-end on something like Flex, how hard is it to do such thing in Grails?
Grails is best suited for HTML+CSS+JS front-end. You still can use Flex, Vaadin, GWT, etc., if you prefer. But standard HTML + modern framework is really easier to use.
For standard web app, based on html/css/js, I can recommend Twitter Bootstrap plugin (but you aren't limited to it). It's very useful framework, but you should know all basics (html and css)

grails & backbone.js

ive currently been developing a Java EE project, using regular web services and backbone.js for my front end. (As i like things being loaded/added to the page, without the page refreshing (async, backbone)).
I wanted to find out if anyone has used grails along with backbone and what their experience is?
Grails would be for server side stuff, and backbone for handling the front end.
Or can grails do this itself. IE, with grails, can you dynamically load stuff onto a page without refreshing. For example, a todo list.
Is it difficult to add backbone to grails?
I've used Backbone + Grails, for two projects. And didn't see any problem, absolutelly.
Backbone is client-side only framework, very flexible, developed with idea that it should be compatible with nearly all server-side stuff. It just expecting RESTful/RESTful-like server side API. And also, you can alway use your own server-client transport implementation, see Backbone.sync (but I'm sure, you don't need it for standard Grails app)
Grails, at other hand, it very flexible server-side framework (mostly server-side). By using Grails you can make RESTful api w/o any problem. Basically you just need to respond with JSON, that's enough.
PS you can also use Grails tags for ajax, like remoteLink and plain jQuery, but Backbone is much more powerful (and easy to learn)
It's not that complex. You can try following this tutorial.
It's a Grails 2.x & BackboneJS project, which utilises the resources plugin.
The tutorial link provided by #chanwit is not working but you can use github link of same project.

Symfony as a helper for Wordpress plugin development

I have seen several integrations between wordpress and symfony, but they are made with the goal of managins static pages content inside wordpress and symfony acting as the controller.
Wordpress plugin development api seems really basic and primitive and you have no way o code with the MVC pattern out of the box. So the big question is, what would be an starting point to create plugins in wordpress, and create admin sections in it, but using Symfony power to manage database access, form creation and validation, etc .....
I had briefly considered a similar approach for integrating Lithium with WordPress, but ran into a great deal of hurdles that made another approach seem more worthwhile: create an MVC framework that was specifically designed to work inside of WordPress.
It's not yet as full-featured as Symfony, Rails, etc, but WP MVC has similar architecture to the major MVC frameworks and should be easy to pick up if you're familiar with them. It ties in directly with existing WordPress functionality. When you create scaffolding for a resource, for example, the code that's created includes an admin controller and admin views (which look similar to WordPress's native index/add/edit views for posts), as well as the appropriate WordPress routing and a public controller and public index/show views to display the resource on the public side, within the active theme.
There's more info on it on its WordPress Plugins page, and its brief tutorial may make it seem less abstract.

What can I learn from Grails?

If I know Rails, what new ideas/patterns would I learn if I looked at Grails?
I have no intention to move to Grails and no need for a Java stack, but if there are neat ideas I could learn from Grails I'd like to learn them.
Grails has taken totally different direction. It is very hard to compare Grails and Rails.
Grails is not framework. It is stack of frameworks. You can find all the features you find in plain Spring, Hibernate, Quartz, Compass, Sitemesh frameworks. So at the end you get all the best from all these frameworks with convention-over-configuration.
However, I really want to mention about very interesting idea introduced in Grails about modulizing the application into plugins. Plugin in Grails is minimized independent project. Separating application logics into plugins allows to share your code to community and keep application in separate modules which results in easier testing and easier development.
Grails has at least two patterns I'm aware of that I believe do not exist in Rails:
Command objects (and auto binding request params to them)
Conversation based request handling using web flows

Resources