<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>A Day At The Races &#187; grails</title>
	<atom:link href="http://blog.jetztgrad.net/category/grails/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.jetztgrad.net</link>
	<description>Programming was my first love, and it will be my last.</description>
	<lastBuildDate>Mon, 26 Jul 2010 22:27:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Released Grails Spy plugin 0.2</title>
		<link>http://blog.jetztgrad.net/2010/07/released-grails-spy-plugin-0-2/</link>
		<comments>http://blog.jetztgrad.net/2010/07/released-grails-spy-plugin-0-2/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 21:50:40 +0000</pubDate>
		<dc:creator>jetztgradnet</dc:creator>
				<category><![CDATA[grails]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[spy]]></category>

		<guid isPermaLink="false">http://blog.jetztgrad.net/?p=225</guid>
		<description><![CDATA[I just released version 0.2 of my Grails Spy plugin.
About
The Grails Spy plugin provides some views to inspect Grails internals such as the Spring application context(s), artefacts, etc.
As most of the beans of the Grails WebApplicationContext are constructed at runtime with the help of a BeanBuilder, there is no Spring xml file with bean definitions.
In [...]]]></description>
			<content:encoded><![CDATA[<p>I just released version 0.2 of my <a href="http://grails.org">Grails</a> <a href="http://grails.org/plugin/spy">Spy plugin</a>.</p>
<p><b>About</b></p>
<p>The Grails Spy plugin provides some views to inspect Grails internals such as the Spring application context(s), artefacts, etc.</p>
<p>As most of the beans of the Grails WebApplicationContext are constructed at runtime with the help of a BeanBuilder, there is no Spring xml file with bean definitions.</p>
<p>In order to browse the dynamic bean definitions, Grails Spy can be used to watch into an application’s guts.</p>
<p><b>Installation</b></p>
<pre>grails install-plugin spy</pre>
<p><b>Usage</b></p>
<p>Simply install the plugin, enable the Spy controller for the <code>dev</code> environment and run <code>grails run-app</code>. Then browse to <a href="http://localhost:8080/yourapp/spy">http://localhost:8080/yourapp/spy</a> and enjoy.</p>
<p><b>Changes</b></p>
<ul>
<li>For security reasons the Spy controller must now be enabled in Config.groovy:
<pre>
grails.plugins.spy.enabled = true
</pre>
<p>	The plugin can be enabled or disabled individually for each environment. Example:</p>
<pre>
environments {
    production {
        grails.serverURL = "http://www.changeme.com"
    }
    development {
        grails.serverURL = "http://localhost:8080/${appName}"
	grails.plugins.spy.enabled = true
    }
    test {
        grails.serverURL = "http://localhost:8080/${appName}"
    }
}
</pre>
</li>
<li>&apos;inspect&apos; is now the default action for the spy controller, so it can be called as <a href="http://localhost:8080/yourapp/spy">http://localhost:8080/yourapp/spy</a> instead of <a href="http://localhost:8080/yourapp/spy/inspect">http://localhost:8080/yourapp/spy/inspect</a></li>
</ul>
<p><b>License</b></p>
<p>The Spy plugin is released under the <a href="http://apache.org/licenses/LICENSE-2.0.txt">Apache License 2.0</a>.</p>
<p><b>Source code and Issues</b></p>
<p>The source code is hosted at <a href="http://github.com/jetztgradnet/grails-spy-plugin">GitHub</a>, issues can be reported <a href="http://github.com/jetztgradnet/grails-spy-plugin/issues">here</a>.</p>
<p><b>Screenshots</b></p>
<p>Eye-candy you say? See below:</p>
<p><b>GrailsSpy: GrailsApplication</b></p>
<p><a href="/wp-content/uploads/2010/01/GrailsSpy-GrailsApplication.png"><img src="/wp-content/uploads/2010/01/GrailsSpy-GrailsApplication-65x300.png" alt="" title="GrailsSpy: GrailsApplication" width="65" height="300" class="aligncenter size-medium wp-image-197" /></a></p>
<p><b>GrailsSpy: ApplicationContext view</b></p>
<p><a href="/wp-content/uploads/2010/01/GrailsSpy-MainApplicationContext.png"><img src="/wp-content/uploads/2010/01/GrailsSpy-MainApplicationContext-141x300.png" alt="" title="GrailsSpy: ApplicationContext view" width="141" height="300" class="aligncenter size-medium wp-image-199" /></a></p>
<p><b>GrailsSpy: bean view</b></p>
<p><a href="/wp-content/uploads/2010/01/GrailsSpy-jspViewResolver.png"><img src="/wp-content/uploads/2010/01/GrailsSpy-jspViewResolver-300x242.png" alt="" title="GrailsSpy: bean view" width="300" height="242" class="aligncenter size-medium wp-image-198" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jetztgrad.net/2010/07/released-grails-spy-plugin-0-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Released Grails spy plugin</title>
		<link>http://blog.jetztgrad.net/2010/01/released-grails-spy-plugin/</link>
		<comments>http://blog.jetztgrad.net/2010/01/released-grails-spy-plugin/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 15:30:47 +0000</pubDate>
		<dc:creator>jetztgradnet</dc:creator>
				<category><![CDATA[grails]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[spy]]></category>

		<guid isPermaLink="false">http://blog.jetztgrad.net/?p=195</guid>
		<description><![CDATA[While digging through the inner workings of Grails in order to improve my OSGi plugin, it is sometimes necessary to inspect the GrailsApplication object and its companion Spring ApplicationContext(s).
As most of the beans of the Grails WebApplicationContext are constructed at runtime with the help of a BeanBuilder, there is no Spring xml file with bean [...]]]></description>
			<content:encoded><![CDATA[<p>While digging through the inner workings of Grails in order to improve my <a href="http://grails.org/plugin/osgi">OSGi plugin</a>, it is sometimes necessary to inspect the <a href="http://www.grails.org/doc/1.2.0/api/index.html?org/codehaus/groovy/grails/commons/GrailsApplication.html">GrailsApplication</a> object and its companion Spring <a href="http://www.grails.org/doc/1.2.0/api/index.html?org/codehaus/groovy/grails/commons/spring/GrailsApplicationContext.html">ApplicationContext</a>(s).</p>
<p>As most of the beans of the Grails WebApplicationContext are constructed at runtime with the help of a <code>BeanBuilder</code>, there is no Spring xml file with bean definitions.</p>
<p>Only the main application context can be inspected, e.g. by <a href="/2010/01/script-to-inspect-jar-and-war-files-grails-applications-and-plugins/">extracting it</a> from the generated war file:</p>
<p><code><a href="/2010/01/script-to-inspect-jar-and-war-files-grails-applications-and-plugins/">jinspect</a> -a target/myapp-0.1.war</code></p>
<p>In order to browse the dynamic bean definitions I created a little plugin called <b><a href="http://grails.org/plugin/spy">Grails Spy</a></b>, which can be used to watch into an application&#8217;s guts.</p>
<p><b>License</b></p>
<p>The Spy plugin is released under the <a href="http://apache.org/licenses/LICENSE-2.0.txt">Apache License 2.0</a>.</p>
<p><b>Source code and Issues</b></p>
<p>The source code is hosted at <a href="http://github.com/jetztgradnet/grails-spy-plugin">GitHub</a>, issues can be reported <a href="http://github.com/jetztgradnet/grails-spy-plugin/issues">here</a>.</p>
<p><b>Installation</b></p>
<p>As always, simply execute <code>grails install-plugin spy</code>.</p>
<p><em>Note:</em> until the Grails <a href="http://grails.org/plugin/spy">plugin page</a> is sync&#8217;ed, the plugin can also be installed using<br />
<code>grails install-pluginhttp://cloud.github.com/downloads/jetztgradnet/grails-spy-plugin/grails-spy-0.1.zip</code></p>
<p><b>Usage</b></p>
<p>Simply browse to <a href="http://localhost:8080/myapp/spy/">http://localhost:8080/myapp/spy/</a> and have a closer look.</p>
<p><em>Note:</em> this path is NOT PROTECTED, so don&#8217;t do this in a production environment! Or at least use one of the <a href="http://grails.org/plugin/search?q=security">security plugins</a> to protect this page.</p>
<p><b>Screenshots</b></p>
<p>Eye-candy you say? See below:</p>
<p><b>GrailsSpy: GrailsApplication</b></p>
<p><a href="http://blog.jetztgrad.net/wp-content/uploads/2010/01/GrailsSpy-GrailsApplication.png"><img src="http://blog.jetztgrad.net/wp-content/uploads/2010/01/GrailsSpy-GrailsApplication-65x300.png" alt="" title="GrailsSpy: GrailsApplication" width="65" height="300" class="aligncenter size-medium wp-image-197" /></a></p>
<p><b>GrailsSpy: ApplicationContext view</b></p>
<p><a href="http://blog.jetztgrad.net/wp-content/uploads/2010/01/GrailsSpy-MainApplicationContext.png"><img src="http://blog.jetztgrad.net/wp-content/uploads/2010/01/GrailsSpy-MainApplicationContext-141x300.png" alt="" title="GrailsSpy: ApplicationContext view" width="141" height="300" class="aligncenter size-medium wp-image-199" /></a></p>
<p><b>GrailsSpy: bean view</b></p>
<p><a href="http://blog.jetztgrad.net/wp-content/uploads/2010/01/GrailsSpy-jspViewResolver.png"><img src="http://blog.jetztgrad.net/wp-content/uploads/2010/01/GrailsSpy-jspViewResolver-300x242.png" alt="" title="GrailsSpy: bean view" width="300" height="242" class="aligncenter size-medium wp-image-198" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jetztgrad.net/2010/01/released-grails-spy-plugin/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Updated bash completion script for OSX and Grails 1.1 &amp; 1.2</title>
		<link>http://blog.jetztgrad.net/2010/01/updated-bash-completion-script-for-osx-and-grails-1-1-1-2/</link>
		<comments>http://blog.jetztgrad.net/2010/01/updated-bash-completion-script-for-osx-and-grails-1-1-1-2/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 12:03:16 +0000</pubDate>
		<dc:creator>jetztgradnet</dc:creator>
				<category><![CDATA[grails]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://blog.jetztgrad.net/?p=174</guid>
		<description><![CDATA[Fernando Takai wrote an excellent bash completion script (also available here, originally from Ted Naleid), which makes calling Grails commands much easier. 
Some examples: 
Within a Grails application directory, listing all available commands:
myapp&#62; grails [tab][tab]
bootstrap                create-integration-test  generate-controller   [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://fernandotakai.wordpress.com/2008/08/05/grails-auto-complete/">Fernando Takai</a> wrote an excellent bash completion script (also available <a href="http://www.grails.org/Grails+Bash+Completion+Script">here</a>, originally from <a href="http://naleid.com/blog/2008/03/25/autocomplete-grails-script-names-in-bashzsh/">Ted Naleid</a>), which makes calling Grails commands much easier. </p>
<p>Some examples: </p>
<p>Within a Grails application directory, listing all available commands:</p>
<p><code>myapp&gt; grails [tab][tab]<br />
bootstrap                create-integration-test  generate-controller      list-plugins_            set-version<br />
bug-report               create-plugin_           generate-views           package                  shell<br />
clean                    create-script            help_                    package-plugin_          stats<br />
compile                  create-service           init                     plugin-info_             test-app<br />
console                  create-tag-lib           install-dependency       release-plugin           tomcat<br />
create-app_              create-unit-test         install-plugin           run-app                  uninstall-plugin<br />
create-controller        dependency-report        install-templates        run-war                  upgrade<br />
create-domain-class      doc                      integrate-with           schema-export            war<br />
create-filters           generate-all             list-plugin-updates      set-proxy_<br />
</code></p>
<p>Within a Grails application directory, completing a command:</p>
<p><code>myapp&gt; grails run-[tab][tab]<br />
run-app  run-war<br />
</code></p>
<p>Outside of a Grails application directory, listing all available commands:</p>
<p><code>home&gt; grails [tab][tab]<br />
create-app      create-plugin   help            list-plugins    package-plugin  plugin-info     set-proxy<br />
</code></p>
<p><b>Changes</b></p>
<p>I updated the script to adapt it to new Grails versions and made some minor changes:</p>
<p>* works with plugin provided scripts in Grails version >= 1.1, were plugins are stored under <code>$HOME/.grails/<em>grailsversion</em>/projects/<em>appname</em>/plugins</code>.<br />
* detects the Grails version from <code>$GRAILS_HOME</code> instead of choosing the latest version from <code>$HOME/.grails</code>.<br />
* adapts to different locations of <code>plugins-list.xml</code>, which changed with newer Grails versions<br />
* does not need gawk (which is not installed by default on OSX)</p>
<p>My version of the script was tested with Grails 1.2 and OSX Snow Leopard and can be found at <a href="http://gist.github.com/270209">GitHub</a> or below.</p>
<p><b>Installation</b></p>
<p>Save the script to an appropriate path (e.g. <code>~/bin/grails-bash-completion.sh</code>)<br />
<code>[ -r ~/bin/grails-bash-completion.sh ] &#038;&#038; source ~/bin/grails-bash-completion.sh</code></p>
<p><b>The complete Script</b></p>
<script src="http://gist.github.com/270209.js"></script>
]]></content:encoded>
			<wfw:commentRss>http://blog.jetztgrad.net/2010/01/updated-bash-completion-script-for-osx-and-grails-1-1-1-2/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Script to inspect jar and war files, Grails applications and plugins</title>
		<link>http://blog.jetztgrad.net/2010/01/script-to-inspect-jar-and-war-files-grails-applications-and-plugins/</link>
		<comments>http://blog.jetztgrad.net/2010/01/script-to-inspect-jar-and-war-files-grails-applications-and-plugins/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 12:42:57 +0000</pubDate>
		<dc:creator>jetztgradnet</dc:creator>
				<category><![CDATA[grails]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://blog.jetztgrad.net/?p=162</guid>
		<description><![CDATA[I just wrote a little script to inspect jar and war files, Grails applications and plugins.
Installation
Simply copy the script to somewhere in your path (e.g. ~/bin) and make it executable using
chmod +x jinspect
I tested the script on OSX Snow Leopard, but it should run on other versions of OSX and Linux, too. 
Examples:
List all files [...]]]></description>
			<content:encoded><![CDATA[<p>I just wrote a <a href="http://gist.github.com/268474">little script</a> to inspect jar and war files, Grails applications and plugins.</p>
<p><b>Installation</b></p>
<p>Simply copy the script to somewhere in your path (e.g. <code>~/bin</code>) and make it executable using<br />
<code>chmod +x jinspect</code></p>
<p>I tested the script on OSX Snow Leopard, but it should run on other versions of OSX and Linux, too. </p>
<p><b>Examples:</b></p>
<p>List all files in a war/jar/zip:<br />
<code>jinspect -l myapp.war</code></p>
<p>Show contents of some files in a jar/war/zip:<br />
<code>jinspect myapp.war index.html another.txt</code></p>
<p>List gsp and jsp files in a war:<br />
<code>jinspect -JG myapp.war</code></p>
<p>Show contents of web.xml file in a war:<br />
<code>jinspect -w myapp.war</code></p>
<p>Extract and save web.xml file in a war:<br />
<code>jinspect -Xw myapp.war</code></p>
<p>Show contents of the Plugin class of a Grails plugin:<br />
<code>jinspect -P grails-osgi-0.1.zip</code></p>
<p><b>Available options:</b><br />
<code><br />
jinspect [-hHvxXoawmISMWjJrgGcCpPlLZZZ] jarfile [filename ...]<br />
Options:<br />
-h show help<br />
-v be more verbose<br />
-X save specified files (including path) to the current directory instead of printing them<br />
-l list war contents; specify again to include more information<br />
-x list xml files<br />
-o list properties files<br />
-c list class files<br />
-j list java files<br />
-J list jsp files<br />
-S list js files<br />
-g list groovy files<br />
-G list gsp files<br />
-H list html files<br />
-C list css files<br />
-I list image files<br />
-L list files in lib directory<br />
-M list files in META-INF directory<br />
-W list files in WEB-INF directory<br />
-a show WEB-INF/applicationContext.xml<br />
-w show WEB-INF/web.xml<br />
-r show WEB-INF/grails.xml<br />
-m show META-INF/MANIFEST.MF<br />
-p show plugin.xml<br />
-P show *GrailsPlugin.groovy<br />
-d show manifest headers in nicely formatted way; implies -m<br />
-D <name> display named manifest header; can be used multiple times, implies -m<br />
</code></p>
<p><b>Script</b><br />
(also available on <a href="http://gist.github.com/268474">GitHub</a>)<br />
<script src="http://gist.github.com/268474.js"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jetztgrad.net/2010/01/script-to-inspect-jar-and-war-files-grails-applications-and-plugins/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Grails on OSGi (3): Released Grails OSGi plugin 0.1</title>
		<link>http://blog.jetztgrad.net/2010/01/released-grails-osgi-plugin-0-1/</link>
		<comments>http://blog.jetztgrad.net/2010/01/released-grails-osgi-plugin-0-1/#comments</comments>
		<pubDate>Sun, 03 Jan 2010 02:35:54 +0000</pubDate>
		<dc:creator>jetztgradnet</dc:creator>
				<category><![CDATA[grails]]></category>
		<category><![CDATA[osgi]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[release]]></category>

		<guid isPermaLink="false">http://blog.jetztgrad.net/?p=133</guid>
		<description><![CDATA[The Grails OSGi plugin provides scripts to package a Grails application as an OSGi bundle. Additionally the bundle(s) may be run in an OSGi container assembled ad hoc by the excellent Pax Runner or deployed to a SpringSource DM Server.
License
The OSGi plugin is released under the Apache License 2.0.
Installation
Simply call grails install-plugin osgi to install [...]]]></description>
			<content:encoded><![CDATA[<p>The Grails OSGi plugin provides scripts to package a Grails application as an OSGi bundle. Additionally the bundle(s) may be run in an OSGi container assembled ad hoc by the excellent <a href="http://paxrunner.ops4j.org">Pax Runner</a> or deployed to a <a href="http://www.springsource.org/dmserver">SpringSource DM Server</a>.</p>
<p><b>License</b></p>
<p>The OSGi plugin is released under the <a href="http://apache.org/licenses/LICENSE-2.0.txt">Apache License 2.0</a>.</p>
<p><b>Installation</b></p>
<p>Simply call <code>grails install-plugin osgi</code> to install the OSGi plugin. </p>
<p><b>Usage:</b></p>
<p><b>Creating an OSGi bundle from the Grails application</b></p>
<p><code>grails bundle<br />
grails prod bundle</code></p>
<p><b>Running the bundle</b></p>
<p><code>grails run-bundle<br />
grails prod run-bundle</code></p>
<p>The application can be accessed at <a href="http://localhost:8080/myapp/">http://localhost:8080/myapp/</a>.</p>
<p>Note: at first start the OSGi runtime is assembled, which may take some time, while Maven is downloading the internet&#8230;</p>
<p><b>Creating a zipped OSGi runtime</b></p>
<p><code>grails assemble-osgi-runtime<br />
grails prod assemble-osgi-runtime</code></p>
<p><b>Deploy bundle to DM Server</b></p>
<p><code>grails dmserver deploy</code> (Not yet implemented)</p>
<p><b>Getting around the OSGi runtime</b></p>
<p>The OSGi runtime is based on the <a href="http://www.eclipse.org/equinox">Equinox</a> OSGi framework, <a href="http://paxweb.ops4j.org">Pax Web</a> and some additional bundles.</p>
<p><b>Web Console</b></p>
<p>The <a href="http://felix.apache.org/site/apache-felix-web-console.html">Felix Web Management Console</a> provides excellent insight into the inner workings (see Screenshots). It can be accessed at <a href="http://localhost:8080/system/console/">http://localhost:8080/system/console/</a> with user &#8220;admin&#8221; and password &#8220;admin&#8221;.</p>
<p><a href="http://blog.jetztgrad.net/wp-content/uploads/2010/01/ManagementConsole.png"><img src="http://blog.jetztgrad.net/wp-content/uploads/2010/01/ManagementConsole-197x300.png" alt="" title="Web Management Console" width="197" height="300" class="aligncenter size-medium wp-image-158" /></a></p>
<p><a href="http://blog.jetztgrad.net/wp-content/uploads/2010/01/ManagementConsole-GrailsAppBundle.png"><img src="http://blog.jetztgrad.net/wp-content/uploads/2010/01/ManagementConsole-GrailsAppBundle-77x300.png" alt="" title="Management Console: Details of the Grails application bundle" width="77" height="300" class="aligncenter size-medium wp-image-160" /></a></p>
<p><b>Shell Console</b></p>
<p>The command <code>grails run-bundle</code> drops the user in the Equinox Shell. Typing <code>help</code> shows the available commands.</p>
<p><b>How it works</b></p>
<p>In order to be a valid OSGi bundle, the application is war&#8217;ed and provided with the necessary bundle manifest headers (see <code>scripts/_Event.groovy</code> for details).<br />
The bundle can be created using <code>grails bundle</code>.  </p>
<p>The OSGi runtime is assembled in the <code>target/osgi</code> directory.</p>
<p><b>Source code and Issues</b></p>
<p>The source code is hosted at <a href="http://github.com/jetztgradnet/grails-osgi-plugin">GitHub</a>, issues can be reported <a href="http://github.com/jetztgradnet/grails-osgi-plugin/issues">here</a>.</p>
<p><b>Roadmap</b></p>
<ul>
<li>make bundle generation configurable (e.g. include/exclude dependencies, &#8230;)</li>
<li>make OSGi runtime created by <code>grails run-bundle</code> and <code>grails assemble-osgi-runtime</code> configurable</li>
<li>support auto-reloading of changed artifacts</li>
<li>use Spring DM instead of Pax Web as Web extender</li>
<li>remove dependencies from bundle and package them as their own plugins (re-using existing bundles from the <a href="http://www.springsource.com/repository">SpringSource Enterprise Repository</a></li>
<li>export main Grails beans and application context as OSGi service</li>
<li>export services as OSGi service (via <code>static expose = 'osgi'</code>)</li>
<li>provide access to OSGi <code>BundleContext</code> to artifacts (controllers, services, &#8230;)</li>
<li>implement deployment to DM Server</li>
<li>consider other deployment options: Apache Karaf, &#8230;</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.jetztgrad.net/2010/01/released-grails-osgi-plugin-0-1/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
		</item>
		<item>
		<title>Grails on OSGi (2): First steps</title>
		<link>http://blog.jetztgrad.net/2009/11/grails-on-osgi-2-first-steps/</link>
		<comments>http://blog.jetztgrad.net/2009/11/grails-on-osgi-2-first-steps/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 11:43:07 +0000</pubDate>
		<dc:creator>jetztgradnet</dc:creator>
				<category><![CDATA[grails]]></category>
		<category><![CDATA[osgi]]></category>

		<guid isPermaLink="false">http://blog.jetztgrad.net/?p=77</guid>
		<description><![CDATA[This part of the series shows the necessary step to get a Grails application running in an OSGi environment as a monolithic bundle.]]></description>
			<content:encoded><![CDATA[<p>The first step on the road to running Grails applications in an OSGi environment is to get a simple application to run as a monolithic bundle (almost) without changes.</p>
<p><br/></p>
<p><b>Test application</b></p>
<p>We create a simple Grails application (e.g. the one described in a <a href="https://www.ibm.com/developerworks/java/library/j-grails01158/">article on developer works</a>; the application has a single domain class <code>Trip</code>, the controller and all views are generated). A single domain class and the corresponding controller is all we need for a simple test.</p>
<p><br/></p>
<p><b>Bundle 101</b></p>
<p>For the first attempt, the Grails application will be transformed, into a single, monolithic bundle (see <a href="/2009/11/grails-on-osgi-1-thoughts">part 1</a> for possible modularization levels) containing all dependencies like Grails, Groovy, Hibernate, Spring, &#8230; </p>
<p>A bundle is basically a JAR or WAR with some special headers in its manifest file. Required headers are <code>Bundle-SymbolicName</code>, which uniquely identifies the bundle, <code>Bundle-Version</code>, which specifies the bundle version (multiple versions of the bundle can run concurrently!) and <code>Bundle-ClassPath</code>, which specifies the classpath within the bundle. Other important headers are <code>Import-Package</code> and <code>Export-Package</code>, which are necessary when using code and resources from and providing classes to other bundles.</p>
<p><br/></p>
<p><b>Preparing the bundle</b></p>
<p>In order to create a valid bundle manifest, <code>$GRAILS_HOME/scripts/_GrailsWar.groovy</code> must be patched with <a href="http://github.com/jetztgradnet/grails-osgi-testenv/blob/master/bundle-manifest.patch"> bundle-manifest.patch</a>:</p>
<p><code>cd $GRAILS_HOME<br />
patch -p0 < /pacth/to/bundle-manifest.patch<br />
</code></p>
<p>In the future, the changes could either be integrated into Grails directly  or into a OSGi plugin.</p>
<p>Our Grails application will need to be transformed into a bundle, so we package it using <code>grails war</code>. The application and all dependencies are contained in the resulting WAR file.</p>
<p>The bundle manifest can now be inspected using the following command (on Linux or Mac OSX):</p>
<p><code>unzip -p target/trip-planner-0.1.war META-INF/MANIFEST.MF</code></p>
<p>The manifest now looks like this:</p>
<p><code><br />
Manifest-Version: 1.0<br />
Ant-Version: Apache Ant 1.7.1<br />
Created-By: 14.1-b02-92 (Apple Inc.)<br />
Bundle-ManifestVersion: 2<br />
Bundle-Name: trip-planner<br />
Bundle-SymbolicName: trip-planner<br />
Bundle-Version: 0.1<br />
Bundle-ClassPath: WEB-INF/classes,WEB-INF/lib/antlr-2.7.6.jar,WEB-INF/<br />
 lib/aopalliance-1.0.jar,WEB-INF/lib/aspectjrt-1.6.2.jar,WEB-INF/lib/a<br />
 spectjweaver-1.6.2.jar,WEB-INF/lib/cglib-nodep-2.1_3.jar,WEB-INF/lib/<br />
 commons-beanutils-1.8.0.jar,WEB-INF/lib/commons-codec-1.3.jar,WEB-INF<br />
 /lib/commons-collections-3.2.1.jar,WEB-INF/lib/commons-dbcp-1.2.2.jar<br />
 ,WEB-INF/lib/commons-el-1.0.jar,WEB-INF/lib/commons-fileupload-1.2.1.<br />
 jar,WEB-INF/lib/commons-io-1.4.jar,WEB-INF/lib/commons-lang-2.4.jar,W<br />
 EB-INF/lib/commons-pool-1.5.3.jar,WEB-INF/lib/commons-validator-1.3.1<br />
 .jar,WEB-INF/lib/dom4j-1.6.1.jar,WEB-INF/lib/ehcache-1.6.1.jar,WEB-IN<br />
 F/lib/ejb3-persistence-1.0.2.GA.jar,WEB-INF/lib/grails-bootstrap-1.2-<br />
 M4.jar,WEB-INF/lib/grails-core-1.2-M4.jar,WEB-INF/lib/grails-crud-1.2<br />
 -M4.jar,WEB-INF/lib/grails-docs-1.2-M4.jar,WEB-INF/lib/grails-gorm-1.<br />
 2-M4.jar,WEB-INF/lib/grails-resources-1.2-M4.jar,WEB-INF/lib/grails-s<br />
 pring-1.2-M4.jar,WEB-INF/lib/grails-web-1.2-M4.jar,WEB-INF/lib/groovy<br />
 -all-1.6.5.jar,WEB-INF/lib/hibernate-annotations-3.4.0.GA.jar,WEB-INF<br />
 /lib/hibernate-commons-annotations-3.3.0.ga.jar,WEB-INF/lib/hibernate<br />
 -core-3.3.1.GA.jar,WEB-INF/lib/hibernate-ehcache-3.3.1.GA.jar,WEB-INF<br />
 /lib/hsqldb-1.8.0.10.jar,WEB-INF/lib/javassist-3.4.GA.jar,WEB-INF/lib<br />
 /jcl-over-slf4j-1.5.6.jar,WEB-INF/lib/jta-1.1.jar,WEB-INF/lib/jul-to-<br />
 slf4j-1.5.6.jar,WEB-INF/lib/log4j-1.2.15.jar,WEB-INF/lib/org.springfr<br />
 amework.aop-3.0.0.RC1.jar,WEB-INF/lib/org.springframework.asm-3.0.0.R<br />
 C1.jar,WEB-INF/lib/org.springframework.aspects-3.0.0.RC1.jar,WEB-INF/<br />
 lib/org.springframework.beans-3.0.0.RC1.jar,WEB-INF/lib/org.springfra<br />
 mework.context-3.0.0.RC1.jar,WEB-INF/lib/org.springframework.context.<br />
 support-3.0.0.RC1.jar,WEB-INF/lib/org.springframework.core-3.0.0.RC1.<br />
 jar,WEB-INF/lib/org.springframework.expression-3.0.0.RC1.jar,WEB-INF/<br />
 lib/org.springframework.instrument-3.0.0.RC1.jar,WEB-INF/lib/org.spri<br />
 ngframework.jdbc-3.0.0.RC1.jar,WEB-INF/lib/org.springframework.jms-3.<br />
 0.0.RC1.jar,WEB-INF/lib/org.springframework.orm-3.0.0.RC1.jar,WEB-INF<br />
 /lib/org.springframework.oxm-3.0.0.RC1.jar,WEB-INF/lib/org.springfram<br />
 ework.transaction-3.0.0.RC1.jar,WEB-INF/lib/org.springframework.web-3<br />
 .0.0.RC1.jar,WEB-INF/lib/org.springframework.web.servlet-3.0.0.RC1.ja<br />
 r,WEB-INF/lib/oro-2.0.8.jar,WEB-INF/lib/oscache-2.4.1.jar,WEB-INF/lib<br />
 /sitemesh-2.4.jar,WEB-INF/lib/slf4j-api-1.5.6.jar,WEB-INF/lib/slf4j-l<br />
 og4j12-1.5.6.jar,WEB-INF/lib/standard-1.1.2.jar,WEB-INF/lib/xpp3_min-<br />
 1.1.3.4.O.jar<br />
Import-Package: javax.servlet,javax.servlet.http,javax.servlet.resourc<br />
 es,javax.servlet.jsp.resources;resolution:=optional,javax.xml.parsers<br />
 ,org.w3c.dom,org.xml.sax,org.xml.sax.ext,org.xml.sax.helpers<br />
Webapp-Context: trip-planner</p>
<p>Name: Grails Application<br />
Implementation-Title: trip-planner<br />
Implementation-Version: 0.1<br />
Grails-Version: 1.2-M4<br />
</code></p>
<p>Note that <code>Bundle-ClassPath</code> contains all dependencies required by Grails, JAR files from the <code>lib/</code> directory, and those contributed by installed Grails plugins.</p>
<p>The bundle imports some packages from the <a href="http://java.sun.com/products/servlet/2.5/docs/servlet-2_5-mr2/index.html">Servlet specification</a>. This is to ensure, that the bundle uses the same classes as the web container, otherwise the classes would not be compatible, as they would be loaded by different class loaders.</p>
<p>BTW: if you need to have a look at the generated web.xml, you can achieve it like this:</p>
<p><code>unzip -p target/trip-planner-0.1.war WEB-INF/web.xml | xmllint --format -</code></p>
<p><br/></p>
<p><b>Running the bundle</b></p>
<p>In order to run the bundle, it must be installed into an OSGi container like <a href="http://eclipse.org/equinox">Equinox</a> (the base for the Eclipse IDE), <a href="http://felix.apache.org">Apache Felix</a>, or <a href="http://www.knopflerfish.org/">Knopflerfish</a>. The test environment described below uses Equinox. Other frameworks could be used as well, but I haven't tested them yet.</p>
<p>Additionally we need a web container like <a href="http://tomcat.apache.org/">Tomcat</a> or <a href="http://www.mortbay.org/jetty/">Jetty</a>. The web container needs also to be installed within the OSGi container, so we skip the download on the main site(s), but go looking for OSGI-fied versions. Jetty is OSGi-capable out of the box, an adapted Tomcat also used in <a href="http://www.springsource.com/products/dmserver">Spring dm server</a> can be found at the SpringSource <a href="http://www.springsource.com/repository/app/">Enterprise Bundle Repository</a>. (Note: Tomcat does not yet work, so we currently use Jetty. I get no errors, but all requests seem to get silently ignored.)</p>
<p>The remaining part is a module usually called Web Extender, which bridges the gap between web applications and the web container. The web extender looks for bundles matching a certain criteria (e.g. existance of <code>WEB-INF/web.xml</code> or some bundle headers) and configures these as a web application. Candidates are <a href="http://wiki.ops4j.org/display/paxweb/Pax+Web">Pax Web</a> and <a href="http://www.springsource.org/osgi">Spring-DM</a>.</p>
<p>As Pax Web is currently not able to configure a Grails applications because of <a href="http://issues.ops4j.org/browse/PAXWEB-148">PAXWEB-148</a>, and Spring-DM will probably be required for other OSGi and Spring related stuff anyway, we use the latter as Web Extender.</p>
<p><br/></p>
<p><b>Test environment</b></p>
<p>The test environment is made up of the excellent <a href="http://paxrunner.ops4j.org/">Pax Runner</a> with a <a href="http://github.com/jetztgradnet/grails-osgi-testenv">set of configuration files</a>. Pax Runner is basically a starter for OSGi applications. It supports different OSGi frameworks and provisions both framework and bundles from sources like Maven repos, web servers, or directories.</p>
<p>The test environment loads the Equinox OSGi Framework (version 3.5.1), Spring-DM 2.0M1, Spring 3.0RC1, and Jetty (Tomcat doesn’t work right know). All configuration files be found on <a href="http://github.com/jetztgradnet/grails-osgi-testenv">GitHub</a>.</p>
<p>The test environment can be installed using the following commands:</p>
<p>Create a directory and change into it:</p>
<p><code>mkdir testenv; cd testenv</code></p>
<p>Download Pax Runner, extract it and create a version agnostic link:</p>
<p><code>curl -o pax-runner-assembly-1.3.0-jdk15.tar.gz http://repo1.maven.org/maven2/org/ops4j/pax/runner/pax-runner-assembly/1.3.0/pax-runner-assembly-1.3.0-jdk15.tar.gz</code></p>
<p><code>tar xzf pax-runner-assembly-1.3.0-jdk15.tar.gz</code></p>
<p><code>ln -s pax-runner-1.3.0 pax-runner</code></p>
<p>Get the example configuration:</p>
<p><code>git clone git://github.com/jetztgradnet/grails-osgi-testenv.git</code></p>
<p>The framework can be started with the following command:</p>
<p><code>cd grails-osgi-testenv<br />
./pax-osgitest</code></p>
<p>After lots of log messages, we arrive at a prompt of the command shell. Help is available using <code>help</code>.</p>
<p>We now type <code>ss</code> to get an overview over all running bundles:</p>
<p><code><br />
osgi> ss</p>
<p>Framework is launched.</p>
<p>id	State       Bundle<br />
0	ACTIVE      org.eclipse.osgi_3.5.1.R35x_v20090827<br />
1	ACTIVE      org.eclipse.osgi.util_3.2.0.v20090520-1800<br />
2	ACTIVE      org.eclipse.osgi.services_3.2.0.v20090520-1800<br />
3	ACTIVE      org.springframework.aop_3.0.0.RC1<br />
4	ACTIVE      org.springframework.asm_3.0.0.RC1<br />
5	ACTIVE      org.springframework.aspects_3.0.0.RC1<br />
6	ACTIVE      org.springframework.beans_3.0.0.RC1<br />
7	ACTIVE      org.springframework.context_3.0.0.RC1<br />
8	ACTIVE      org.springframework.context.support_3.0.0.RC1<br />
9	ACTIVE      org.springframework.core_3.0.0.RC1<br />
10	ACTIVE      org.springframework.expression_3.0.0.RC1<br />
11	ACTIVE      org.springframework.jdbc_3.0.0.RC1<br />
12	INSTALLED   org.springframework.jms_3.0.0.RC1<br />
13	ACTIVE      org.springframework.orm_3.0.0.RC1<br />
14	ACTIVE      org.springframework.transaction_3.0.0.RC1<br />
15	ACTIVE      org.springframework.web_3.0.0.RC1<br />
16	ACTIVE      org.springframework.web.servlet_3.0.0.RC1<br />
17	ACTIVE      com.springsource.org.aopalliance_1.0.0<br />
18	ACTIVE      com.springsource.org.objectweb.asm_2.2.3<br />
19	ACTIVE      com.springsource.net.sf.cglib_2.1.3<br />
20	ACTIVE      org.springframework.osgi.core_2.0.0.M1<br />
21	ACTIVE      org.springframework.osgi.extender_2.0.0.M1<br />
22	ACTIVE      org.springframework.osgi.io_2.0.0.M1<br />
23	ACTIVE      org.springframework.osgi.web_2.0.0.M1<br />
24	ACTIVE      org.springframework.osgi.web.extender_2.0.0.M1<br />
	            Fragments=28<br />
25	ACTIVE      com.springsource.org.mortbay.jetty.server_6.1.9<br />
26	ACTIVE      com.springsource.org.mortbay.util_6.1.9<br />
27	ACTIVE      org.springframework.osgi.jetty.start.osgi_1.0.0<br />
28	RESOLVED    org.springframework.osgi.jetty.web.extender.fragment.osgi_1.0.1<br />
	            Master=24<br />
29	ACTIVE      com.springsource.javax.activation_1.1.1<br />
30	ACTIVE      com.springsource.javax.annotation_1.0.0<br />
31	ACTIVE      com.springsource.javax.el_1.0.0<br />
32	ACTIVE      com.springsource.javax.ejb_3.0.0<br />
33	ACTIVE      com.springsource.javax.mail_1.4.1<br />
34	ACTIVE      com.springsource.javax.persistence_1.99.0<br />
35	ACTIVE      com.springsource.javax.transaction_1.1.0<br />
36	ACTIVE      com.springsource.javax.servlet_2.5.0<br />
37	ACTIVE      com.springsource.javax.servlet.jsp_2.1.0<br />
38	ACTIVE      com.springsource.javax.xml.bind_2.1.7<br />
39	ACTIVE      com.springsource.javax.xml.rpc_1.1.0<br />
40	ACTIVE      com.springsource.javax.xml.soap_1.3.0<br />
41	ACTIVE      com.springsource.javax.xml.stream_1.0.1<br />
42	ACTIVE      com.springsource.javax.xml.ws_2.1.1<br />
43	ACTIVE      org.apache.felix.webconsole_2.0.2<br />
45	ACTIVE      org.ops4j.pax.logging.pax-logging-api_1.4.0<br />
46	ACTIVE      org.ops4j.pax.logging.pax-logging-service_1.4.0<br />
47	ACTIVE      org.eclipse.equinox.util_1.0.100.v20090520-1800<br />
48	ACTIVE      org.eclipse.equinox.ds_1.1.1.R35x_v20090806<br />
49	ACTIVE      org.eclipse.equinox.cm_1.0.100.v20090520-1800<br />
50	ACTIVE      org.eclipse.equinox.supplement_1.1.0.v20080421-2006<br />
51	ACTIVE      org.eclipse.equinox.common_3.4.0.v20080421-2006<br />
52	ACTIVE      org.eclipse.equinox.preferences_3.2.201.R34x_v20080709<br />
53	ACTIVE      org.ops4j.pax.url.assembly_1.1.1<br />
54	ACTIVE      org.ops4j.pax.url.classpath_1.1.1<br />
55	ACTIVE      org.ops4j.pax.url.cache_1.1.1<br />
56	ACTIVE      org.ops4j.pax.url.mvn_1.1.1<br />
57	ACTIVE      org.ops4j.pax.url.link_1.1.1<br />
58	ACTIVE      org.ops4j.pax.url.war_1.1.1<br />
59	ACTIVE      org.ops4j.pax.url.wrap_1.1.1<br />
</code></p>
<p>We can now install our bundle:</p>
<p><code>install file:/path/to/trip-planner-0.1.war<br />
Bundle id is 60<br />
</code></p>
<p>After installing we run <code>ss</code> again. Our bundle is now installed and in the <code>RESOLVED</code> state. With the id of our bundle (the number in the first column), we can now start it:</p>
<p><code>start 60</code></p>
<p>The application should now be reachable at <a href="http://localhost:8080/trip-planner-0.1/">http://localhost:8080/trip-planner-0.1/</a>. If you get a <code>404</code> HTTP error, wait a moment, to give the web extender time to configure the bundle.</p>
<p>The <code>system</code> directory serves as the current directory of the OSGi container. The HSQLdb files from our test application will be created there, log messages of the container are written to the <code>system/logs</code> directory.</p>
<p>If our web bundle has been changed, we can simply update it using <code> update 60</code>. If this does not work, we can un- and reinstall it using <code>uninstall 60</code> and the installation procedure described above.</p>
<p><br/></p>
<p><b>Next steps</b></p>
<p>As outlined in <a href="/2009/11/grails-on-osgi-1-thoughts">part 1</a>, the ultimate goal is to create modular Grails applications. The next step will be to extract the dependencies from the monolithic bundle and put them into their own bundles. Spring and Groovy are already available as bundles, other dependencies may need to be replaced with an OSGi-ready version, e.g. from the SpringSource <a href="http://www.springsource.com/repository/app/">Bundle Repository</a>. </p>
<p>There will be some issues regarding singletons (e.g. <code>ApplicationHolder</code>, <code>ConfigurationHolder</code>) and class loading (Hibernate), but I think, they can be resolved with some work.</p>
<p>The findings may finally find their way into Grails or a Grails OSGi plugin.</p>
<p>Stay tuned...</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jetztgrad.net/2009/11/grails-on-osgi-2-first-steps/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Grails on OSGi (1): Thoughts</title>
		<link>http://blog.jetztgrad.net/2009/11/grails-on-osgi-1-thoughts/</link>
		<comments>http://blog.jetztgrad.net/2009/11/grails-on-osgi-1-thoughts/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 01:41:02 +0000</pubDate>
		<dc:creator>jetztgradnet</dc:creator>
				<category><![CDATA[grails]]></category>
		<category><![CDATA[osgi]]></category>

		<guid isPermaLink="false">http://blog.jetztgrad.net/?p=30</guid>
		<description><![CDATA[Running a Grails application in an OSGi environment provides many benefits such as better modularization. There are different levels of OSGi support, each with its own set of advantages and disadvantages.]]></description>
			<content:encoded><![CDATA[<p><b>What is OSGi</b></p>
<p>The <a href="http://www.osgi.org">OSGi</a> Alliance (formerly known as the Open Services Gateway initiative) is a consortium of companies in the Java world, which develop the OSGi Service Platform, a framework for component-oriented software. Originally developed for embeded devices, OSGi frameworks can now also be found in enterprise, mobile, home, telematics and consumer products.</p>
<p>Applications in an OSGi environment are split into individual modules called bundles, which are usually provided as jar files. Each bundle provides a manifest file containing meta data, which describe its name, version, dependencies and offerings, i.e. code and services. An OSGi container can host multiple applications at once, each application can be started or stopped any time.</p>
<p>The OSGi <a href="http://www.osgi.org/Specifications/HomePage">specifications</a> describe both the core framework and a set of standard services for common functionality such as logging, web access, declarative services, etc.  A more detailed description can be found <a href="http://www.osgi.org/About/Technology">here</a>.</p>
<p>There are multiple OSGi implementations available. Well-known open source implementations include <a href="http://eclipse.org/equinox">Equinox</a>, which is the base for the Eclipse IDE and eco system, <a href="http://felix.apache.org">Apache Felix</a> and <a href="http://www.knopflerfish.org/">Knopflerfish</a>.</p>
<p><br/></p>
<p><b>Benefits</b></p>
<p>Running a Grails application in an OSGi environment would bring some benefits:</p>
<ul>
<li>Support for modularization</li>
<li>Handling and versioning of components and dependencies (*)</li>
<li>Separation of applications</li>
<li>Dependencies and used libraries can be transferred independently to the application server, which makes for smaller application bundles and therefore faster transmission</li>
<li>Easy in-place update and reloading of individual components during runtime</li>
<li>Service-oriented architecture</li>
</ul>
<p>(*) Alltough starting with version 1.2 Grails provides good support for <a href="http://grails.org/doc/1.2.x/guide/3.%20Configuration.html#3.7%20Dependency%20Resolution"> versioning and  dependency resolution</a> with the integration of Ivy)</p>
<p><br/></p>
<p><b>Progress so far</b></p>
<p>JIRA issue <a href="http://jira.codehaus.org/browse/GRAILS-2221">GRAILS-2221</a> for OSGi support for Grails exists for quite some time. Originally OSGi support was requested with an eye towards a plugin system. Grails now has its own plugin system, but OSGi support is on the roadmap for Grails 2.0, whenever that will be released <img src='http://blog.jetztgrad.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p><em>Update:</em> Grails 1.2 will contain a valid OSGi <a href="http://github.com/grails/grails/blob/master/grails/maven/grails-core.mf">bundle manifest</a>, so the Grails jars may already be pulled out of a Grails application bundle and installed sepearately.</p>
<p><br/></p>
<p><b>Possible implementation levels</b></p>
<p>There are several possibilities running a Grails application in an OSGi environment:</p>
<ul>
<li>Monolithic application (Compatibility mode)</li>
<li>Modularized application</li>
<li>Fully componentized application</li>
</ul>
<p><br/></p>
<p><b> Monolithic application (Compatibility mode)</b></p>
<p>This can be seen as a first step of an OSGi-fied Grails application and should be already possible today with some manual steps. </p>
<p>The Grails application is packaged as a WAR file with the manifest file containing necessary OSGi headers, like <code>Bundle-SymbolicName</code>, <code>Bundle-Version</code>, <code>Bundle-ClassPath</code>, and <code>Import-Package</code>. </p>
<p>An OSGi framework providing a web service and corresponding web extender like <a href="http://www.springsource.org/osgi">Spring-DM</a> or <a href="http://wiki.ops4j.org/display/paxweb/Pax+Web">Pax Web</a> can now run this application. </p>
<p>Advantages:</p>
<ul>
<li>Already possible today</li>
<li>No classloading issues</li>
</ul>
<p>Disadvantages:</p>
<ul>
<li>No modularization</li>
<li>Big, monolithic bundle, slow upload to an application server</li>
</ul>
<p><br/></p>
<p><b>Modularized application</b></p>
<p>The next step will be splitting a Grails application into individual bundles. Ideally each of Grails&#8217; and the application&#8217;s dependencies like Hibernate, Sitemesh, etc. would come as its own (set of) bundle(s). </p>
<p>Spring and Groovy already contain OSGi meta data and can be run unmodified in an OSGi environment, OSGi-fied bundles of some other dependencies can be found in the bundle repositories provided by <a href="http://www.springsource.com/repository/app/">SpringSource</a>, <a href="http://felix.apache.org/obr/">Apache Felix</a>, or <a href="http://www.knopflerfish.org/repo/repository.xml">Knopflerfish</a>. Eclipse also hosts some third-party libraries, e.g. many commonly-used Apache jars, which were converted to OSGi bundles, in the <a href="http://eclipse.org/orbit/">Orbit</a> project.</p>
<p>The Grails application itself would be another bundle. As it contains no dependencies, it would be quite small and can therefore easily be transferred to an application server.</p>
<p>Advantages:</p>
<ul>
<li>Shared dependencies for all Grails applications</li>
<li>Small bundle for faster upload to an application server</li>
</ul>
<p>Disadvantages:</p>
<ul>
<li>Issues with Grails&#8217; singletons, when running more than one Grails application in a single VM (*)</li>
<li>Classloading issues</li>
</ul>
<p>(*) This is also the case when running more than one Grails application in a servlet container with shared jars, e.g. using <code>grails war --nojars</code>.</p>
<p><br/></p>
<p><b>Fully componentized application</b></p>
<p>Many posts on the Grails <a href="http://grails.org/Mailing+lists">mailing list</a> ask for ways to modularize big web applications. The most common answer and approach is to split the application into multiple Grails plugins. </p>
<p>In an OSGi environment, the Grails application could be split into multiple bundles, each of which can be individually updated or reloaded. Each Grails plugin would compose a bundle of its own, which could be used and shared by multiple Grails applications.</p>
<p>A starting point for implementing this approach could be the newly created <a href="http://blog.springsource.com/2009/06/22/modular-web-applications-with-springsource-slices/">Spring Slices</a> project.</p>
<p>Advantages:</p>
<ul>
<li>Full modularization</li>
<li>Small bundles for fast uploads to an application server</li>
</ul>
<p>Disadvantages:</p>
<ul>
<li>Issues with Grails&#8217; singletons, when running more than one Grails application in a single VM</li>
<li>Classloading issues</li>
</ul>
<p><br/></p>
<p><b>OSGi-fied Development mode</b></p>
<p>The Grails development mode (aka <code>grails run-app</code>) could also profit from OSGi support. With the OSGi framework constantly running, changes could be integrated by simply updating or reloading individual bundles. Even major changes would only mean reloading some bundles. This would reduce startup times, as the VM is always running and does not need to be stopped and restarted.</p>
<p>For extreme cases, each controller/domain class/Grails artefact could even be temporarily packaged in its own bundle. </p>
<p><br/></p>
<p><b>Conclusion</b></p>
<p>Real OSGi support for Grails is still some time in the future. There is a lot to do and some issues regarding classloading and singletons to resolve. This series of blog posts will look at OSGi support from different angles and try to find solutions to emerging problems. Stay tuned&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jetztgrad.net/2009/11/grails-on-osgi-1-thoughts/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PlugRepo mentioned in Grails Podcast</title>
		<link>http://blog.jetztgrad.net/2009/09/plugrepo-mentioned-in-grails-podcast/</link>
		<comments>http://blog.jetztgrad.net/2009/09/plugrepo-mentioned-in-grails-podcast/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 14:16:32 +0000</pubDate>
		<dc:creator>jetztgradnet</dc:creator>
				<category><![CDATA[grails]]></category>
		<category><![CDATA[plugrepo]]></category>

		<guid isPermaLink="false">http://blog.jetztgrad.net/?p=26</guid>
		<description><![CDATA[PlugRepo was mentioned in the most recent edition of Grails Podcast. Thanks, Glen and Sven!
]]></description>
			<content:encoded><![CDATA[<p>PlugRepo was mentioned in the <a href="http://www.grailspodcast.com/blog/id/485">most recent edition</a> of <a href="http://www.grailspodcast.com/">Grails Podcast</a>. Thanks, <a href="http://blogs.bytecode.com.au/glen/">Glen</a> and <a href="http://hansamann.wordpress.com/">Sven</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jetztgrad.net/2009/09/plugrepo-mentioned-in-grails-podcast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Started new offline Grails Plugin Repository</title>
		<link>http://blog.jetztgrad.net/2009/09/started-new-offline-grails-plugin-repository/</link>
		<comments>http://blog.jetztgrad.net/2009/09/started-new-offline-grails-plugin-repository/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 02:04:49 +0000</pubDate>
		<dc:creator>jetztgradnet</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://blog.jetztgrad.net/?p=13</guid>
		<description><![CDATA[Plugrepo is an offline Grails (and maybe Griffon) plugin repository. It can be used as an offline proxy for the grails.org repository as well as a repository for internal plugins, which are not ment to be published.
The application is work in progress, see project page at http://github.com/jetztgradnet/plugrepo/

]]></description>
			<content:encoded><![CDATA[<p>Plugrepo is an offline Grails (and maybe Griffon) plugin repository. It can be used as an offline proxy for the grails.org repository as well as a repository for internal plugins, which are not ment to be published.</p>
<p>The application is work in progress, see project page at <a title="GitHub" href="http://github.com/jetztgradnet/plugrepo/">http://github.com/jetztgradnet/plugrepo/</a></p>
<p><a title="GitHub" href="http://github.com/jetztgradnet/plugrepo/"></a><img class="alignnone size-medium wp-image-11" title="PlugRepo main screen" src="http://blog.jetztgrad.net/wp-content/uploads/2009/07/screenshot-main-300x256.png" alt="PlugRepo main screen" width="300" height="256" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jetztgrad.net/2009/09/started-new-offline-grails-plugin-repository/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>(Temporarily) pulling the plug on Grails Monitor Plugin</title>
		<link>http://blog.jetztgrad.net/2008/02/temporarily-pulling-the-plug-on-grails-monitor-plugin/</link>
		<comments>http://blog.jetztgrad.net/2008/02/temporarily-pulling-the-plug-on-grails-monitor-plugin/#comments</comments>
		<pubDate>Fri, 22 Feb 2008 13:04:00 +0000</pubDate>
		<dc:creator>jetztgradnet</dc:creator>
				<category><![CDATA[grails]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[release]]></category>

		<guid isPermaLink="false">http://blog.jetztgrad.net/?p=7</guid>
		<description><![CDATA[I&#8217;m terribly sorry, but I have to (at least temporarily) pull the plug on Monitor Plugin due to possible conflicts with my employer.
In my professional live I&#8217;m working on high availability and monitoring software. When I showed the plugin to my employer,he asked me to suspend any activities regarding the plugin, until they decide whether [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m terribly sorry, but I have to (at least temporarily) pull the plug on Monitor Plugin due to possible conflicts with my employer.</p>
<p>In my professional live I&#8217;m working on high availability and monitoring software. When I showed the plugin to my employer,<br />he asked me to suspend any activities regarding the plugin, until they decide whether this conflicts with our products.</p>
<p>I hope I will be able to continue with the monitor plugin, but until this issue is resolved, I have removed both sources and<br />downloads. </p>
<p>Regards,</p>
<p>Wolfgang</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jetztgrad.net/2008/02/temporarily-pulling-the-plug-on-grails-monitor-plugin/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
