<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-19648744</id><updated>2012-01-16T22:07:08.994-05:00</updated><category term='linux'/><category term='scripting'/><category term='scala'/><category term='jsf'/><category term='java'/><category term='grapestry'/><category term='apple'/><category term='jdo'/><category term='junit'/><category term='rants'/><category term='selenium'/><category term='symantec'/><category term='web flow'/><category term='mobility'/><category term='legacy rails'/><category term='oracle'/><category term='netbeans'/><category term='jemmy'/><category term='redhat'/><category term='grails'/><category term='tynamo'/><category term='j2me'/><category term='antivirus'/><category term='iphone'/><category term='blogger'/><category term='wicket'/><category term='groovy'/><category term='rails'/><category term='jboss'/><category term='ui-elements'/><category term='eclipse'/><category term='testing'/><category term='plugins'/><category term='jython'/><category term='netbeans rcp'/><category term='my thesis'/><category term='jFreeSafe'/><category term='mobile video'/><category term='tapestry'/><title type='text'>Alex Kotchnev's Blog</title><subtitle type='html'>Clowning around with NetBeans, Groovy &amp;amp; Grails, Tapestry, and other cool stuff.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.troymaxventures.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/-/netbeans'/><link rel='alternate' type='text/html' href='http://www.troymaxventures.com/search/label/netbeans'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Alex Kotchnev</name><uri>https://profiles.google.com/103108222242966756240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-_FzUCgGWKhc/AAAAAAAAAAI/AAAAAAAABGY/gikhtyKNdVc/s512-c/photo.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>21</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-19648744.post-6448427120712199018</id><published>2011-04-03T01:09:00.006-04:00</published><updated>2011-04-08T01:11:53.465-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='netbeans rcp'/><category scheme='http://www.blogger.com/atom/ns#' term='netbeans'/><title type='text'>NetBeans Database Explorer API and databases in NetBeans</title><content type='html'>At the recent &lt;a href="http://edu.netbeans.org/courses/nbplatform-certified-training/"&gt; NetBeans Platform Certified Training&lt;/a&gt; organized by &lt;a href="http://visitrend.com/news.htm"&gt;Visitrend&lt;/a&gt; we were discussing how to work w/ the built in database functionality. NetBeans ships w/ a pretty decent database/SQL functionality out of the box - you can connect to any JDBC compliant database, add your drivers, sling queries, edit the results. It even has code completion for SQL queries - up until SQL Server 2005 it even provided better support for SQL code authoring than the built in Management tools ( and it is still better than the standard Mysql console). &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now, it turns out that for data driven applications, it is a pretty common occurrence that the users need to connect to a database. Sometimes it makes sense to hide the details of the database; at the same time, when you're dealing with sophisticated that have intimate knowledge of the underlying database schema and need to be able to deal with the underlying data, hiding the fact that they're dealing with a database just doesn't make sense. In our case, we have a team of QA Engineers who need to be able to look into all aspects of the database behind the application, so the best a tool can do is to make the setup and access to the database as easy and transparent as possible. &lt;br /&gt;&lt;br /&gt;Thus, to solve this problem, my users need the following : &lt;br /&gt;1. Make sure that the IDE has the proper drivers set up to access our test databases&lt;br /&gt;2. Easy setup of the database connection with the details for a specific project/system under tes&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;Automatically setting up JDBC driver&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Unfortunately, Microsoft's SQL Server is not one of the JDBC drivers that ships with the IDE. A new user could just navigate to the "Drivers" node in the "Services" top component and walk through the wizard to register a new driver. This can certainly be an extra step in the list of "setup instructions". But, why should a user have to remember to do that if we can do it in a module. Thus, the first hurdle we need to overcome is have a module that automatically registers the JDBC driver in the IDE :&lt;br /&gt;&lt;br /&gt;&lt;b&gt;1. First, we need to&amp;nbsp; provide the MSSQL JDBC driver. &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;For that, I created a new Library Wrapper module. I wanted to mention this because for whatever reason when I tried providing the JDBC driver and the XML registration below in the same module, it failed to find the JDBC driver.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-rDe3Z4UUZlM/TZf0POJSsTI/AAAAAAAAApM/dakjfEfaaJ0/s1600/nb_sql_jdbc.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/-rDe3Z4UUZlM/TZf0POJSsTI/AAAAAAAAApM/dakjfEfaaJ0/s1600/nb_sql_jdbc.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;In the general case for a pure JDBC driver, this should be enough. However, in order to support windows authentication, the JDBC driver needs to have a&amp;nbsp;&amp;nbsp; dll included on the path. In order to sutpport jars that need native libraries, the native library needs to be placed in the release/modules/lib as indicated on &lt;a href="http://bits.netbeans.org/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/api.html#jni"&gt;Modules API Javadoc&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b style="clear: both;"&gt;2. Create a second module for the actual driver registration. &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Add an XML descriptor for registering new drivers (named SQLServer2008Driver.xml). For MSSQL it looks like this :&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="xml" name="code"&gt;&amp;lt;?xml version=&amp;#39;1.0&amp;#39;?&amp;gt;&lt;br /&gt;&amp;lt;!DOCTYPE driver PUBLIC &amp;#39;-//NetBeans//DTD JDBC Driver 1.1//EN&amp;#39; &amp;#39;http://www.netbeans.org/dtds/jdbc-driver-1_1.dtd&amp;#39;&amp;gt;&lt;br /&gt;&amp;lt;driver&amp;gt;&lt;br /&gt;  &amp;lt;name value=&amp;#39;SQLServer2008&amp;#39;/&amp;gt;&lt;br /&gt;  &amp;lt;display-name value=&amp;#39;Microsoft SQL Server 2008&amp;#39;/&amp;gt;&lt;br /&gt;  &amp;lt;class value=&amp;#39;com.microsoft.sqlserver.jdbc.SQLServerDriver&amp;#39;/&amp;gt;&lt;br /&gt;  &amp;lt;urls&amp;gt;&lt;br /&gt;      &amp;lt;url value=&amp;quot;nbinst:/modules/ext/sqljdbc4.jar&amp;quot;/&amp;gt;&lt;br /&gt;  &amp;lt;/urls&amp;gt;&lt;br /&gt;&amp;lt;/driver&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;I am not entirely sure of the meaning of the nbinst: prefix, but this works.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;3. Add an entry into the layer.xml file of the second module to add the driver registration XML :&amp;nbsp;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="xml" name="code"&gt;&lt;filesystem&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;folder name="Databases"&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;folder name="JDBCDrivers"&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;file name="SQLServer2008Driver.xml" url="SQLServer2008Driver.xml"&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/file&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/folder&gt;&lt;/folder&gt;&lt;br /&gt;&lt;/filesystem&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Unfortunately, in the case of the MSSQL JDBC driver just adding the dll into the module doesn't cut it as it appears that the SQL Server driver also depends on other DLLs, so it actually needs to be in c:\windows\system32 . Thus, adding the jdbc driver dll would have been not needed, as the dll needs to be copied to windows\system32 directory. To do that, register a module installer&amp;nbsp; :&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="java" name="code"&gt;public class MssqlDriverInstaller extends ModuleInstall {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void restored() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; File mssqlJdbcDll = new File(System.getenv("windir"), "system32\\sqljdbc_auth.dll");&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; boolean foundDll = mssqlJdbcDll.exists();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!foundDll) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FileOutputStream system32MssqlDll = null;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InputStream bundledDll = null;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; system32MssqlDll = new FileOutputStream(mssqlJdbcDll);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bundledDll = MssqlDriverInstaller.class.getResourceAsStream("sqljdbc_auth.dll");&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println("Copying sqljdbc_auth.dll to windows system32");&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FileUtil.copy(bundledDll, system32MssqlDll);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch (IOException ex) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Logger.getLogger(MssqlDriverInstaller.class.getName()).log(Level.SEVERE, null, ex);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } finally {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; system32MssqlDll.close();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch (IOException ex) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Logger.getLogger(MssqlDriverInstaller.class.getName()).log(Level.SEVERE, null, ex);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bundledDll.close();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch (IOException ex) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Logger.getLogger(MssqlDriverInstaller.class.getName()).log(Level.SEVERE, null, ex);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;Automatically connecting to the database&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;Now, the last step is, how to automate the creation of the database connection node now that we can now be sure that the IDE has the right driver to connect to the database: (the APIs used below are from the &lt;a href='http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-db/overview-summary.html'&gt;Database Explorer API&lt;/a&gt;, org.netbeans.api.db.explorer) &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: large;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre class="java" name="code"&gt;public void createProjectConnection(DatabaseConfig dbc) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DatabaseConfig dbConfig = dbc;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (dbConfig == null) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbConfig = DatabaseConfig.getDefault();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; JDBCDriver sqlSrvDrv = findSqlServerDriver();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (sqlSrvDrv != null) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DatabaseConnection dbConn = createDbConnection(dbConfig, sqlSrvDrv);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; final ConnectionManager connMgr = ConnectionManager.getDefault();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DatabaseConnection foundConn = findSameConnection(dbConn);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (foundConn == null) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foundConn = dbConn;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; connMgr.addConnection(dbConn);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; final DatabaseConnection dbConn2 = foundConn;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RequestProcessor.getDefault().post(new Runnable() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void run() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; connMgr.connect(dbConn2);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; connMgr.selectConnectionInExplorer(dbConn2);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch (DatabaseException ex) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Logger.getLogger(Ats3ProjectDataService.class.getName()).log(Level.SEVERE, "Failed to connect to database", ex);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch (DatabaseException ex) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Logger.getLogger(Ats3ProjectDataService.class.getName()).log(Level.SEVERE, "Failed to connect to database", ex);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private DatabaseConnection createDbConnection(DatabaseConfig dbConfig, JDBCDriver sqlSrvDrv) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DatabaseConnection dbConn;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String url = null;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; String userDb = dbConfig.getName();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (userDb != null) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (userDb.contains("${username}")) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; userDb = userDb.replace("${username}", System.getProperty("user.name"));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; userDb = System.getProperty("user.name") + "_sb_rc";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!dbConfig.getUseSqlAuth()) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url = String.format("jdbc:sqlserver://%s:1433;databaseName=%s;integratedSecurity=true", dbConfig.getServer(), userDb);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbConn = DatabaseConnection.create(sqlSrvDrv, url, "", "dbo", "", true);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url = String.format("jdbc:sqlserver://%s:1433;databaseName=%s", dbConfig.getServer(), userDb);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbConn = DatabaseConnection.create(sqlSrvDrv, url, dbConfig.getUser(), "dbo", dbConfig.getPassword(), true);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return dbConn;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private JDBCDriver findSqlServerDriver() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; JDBCDriver sqlSrvDrv = null;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; JDBCDriver[] drivers = JDBCDriverManager.getDefault().getDrivers("com.microsoft.sqlserver.jdbc.SQLServerDriver");&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // we know that there should be at least one as this module registers it&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (JDBCDriver drv : drivers) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ("SQLServer2008".equals(drv.getName())) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sqlSrvDrv = drv;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return sqlSrvDrv;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private DatabaseConnection findSameConnection(DatabaseConnection dbConn) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DatabaseConnection foundConn = null;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ConnectionManager connMgr = ConnectionManager.getDefault();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (DatabaseConnection dbc : connMgr.getConnections()) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (dbc.getDatabaseURL().equals(dbConn.getDatabaseURL())) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foundConn = dbc;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return foundConn;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/19648744-6448427120712199018?l=www.troymaxventures.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.troymaxventures.com/feeds/6448427120712199018/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.troymaxventures.com/2011/04/programmatically-working-with-databases.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/6448427120712199018'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/6448427120712199018'/><link rel='alternate' type='text/html' href='http://www.troymaxventures.com/2011/04/programmatically-working-with-databases.html' title='NetBeans Database Explorer API and databases in NetBeans'/><author><name>Alex Kotchnev</name><uri>https://profiles.google.com/103108222242966756240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-_FzUCgGWKhc/AAAAAAAAAAI/AAAAAAAABGY/gikhtyKNdVc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-rDe3Z4UUZlM/TZf0POJSsTI/AAAAAAAAApM/dakjfEfaaJ0/s72-c/nb_sql_jdbc.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19648744.post-4802053931097107447</id><published>2009-06-02T23:43:00.010-04:00</published><updated>2009-06-03T01:21:30.449-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='netbeans'/><category scheme='http://www.blogger.com/atom/ns#' term='grails'/><category scheme='http://www.blogger.com/atom/ns#' term='groovy'/><title type='text'>Quickly running a single Grails test in NetBeans</title><content type='html'>&lt;p&gt;One thing in the current NetBeans Grails project is that out of the box, you can run all tests in the project from the project's context menu but you can't run individual tests. While that is all good and well when you only have a few tests, once the tests are piling up (or you just are interested in how a particular test works), it is much preferable to be able to execute a single test at a time. &lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_GbeUi4pR7kA/SiYB4ZF__vI/AAAAAAAAAlI/JKY-OBhit1A/s1600-h/run_single_test.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 313px;" src="http://1.bp.blogspot.com/_GbeUi4pR7kA/SiYB4ZF__vI/AAAAAAAAAlI/JKY-OBhit1A/s320/run_single_test.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5342960076242026226" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;There is an &lt;a href="http://www.netbeans.org/issues/showvotes.cgi?issue_id=159833"&gt;existing issue&lt;/a&gt; to address this (so, go and vote for the issue if it seems useful, would ya?), but in the meantime, you still need to run your individual tests, right ? So, what should you do ? &lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;The trick is to just use the "Run Grails Command" feature in NetBeans and make it easily accessible so that you can run the test in a heartbeat. &lt;br /&gt;&lt;br /&gt;Here's what the feature looks like: &lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt; &lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_GbeUi4pR7kA/SiYF81BCAFI/AAAAAAAAAlQ/8nGOLixdU4Y/s1600-h/run_grails_command.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 192px; height: 320px;" src="http://2.bp.blogspot.com/_GbeUi4pR7kA/SiYF81BCAFI/AAAAAAAAAlQ/8nGOLixdU4Y/s320/run_grails_command.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5342964550503366738" /&gt;&lt;/a&gt;&lt;br /&gt;Right click on the project and select the "Run Grails Command..." option&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li style="clear:both"&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_GbeUi4pR7kA/SiYGNXVggGI/AAAAAAAAAlY/e3aJpkoJcPc/s1600-h/run_single_command_dialog.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 262px;" src="http://2.bp.blogspot.com/_GbeUi4pR7kA/SiYGNXVggGI/AAAAAAAAAlY/e3aJpkoJcPc/s320/run_single_command_dialog.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5342964834593964130" /&gt;&lt;/a&gt;&lt;br /&gt;In the dialog, type "test-app" in the Filter text box, and then type in "TestName -unit" for unit tests, or "TestName -integration" for integration tests. Note that here "TestName" is the test class name minus the "Tests" suffix for unit tests and minus the "IntegrationTests" for integration tests. &lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p style="clear:both"&gt;&lt;br /&gt;&lt;br /&gt;The good news is that NetBeans remembers the command options from the previous run (not the command though) and if you pull up the dialog you just have to type "test-app" and hit enter and it will execute your previous test class. &lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_GbeUi4pR7kA/SiYGNj2x4TI/AAAAAAAAAlg/bSwMA9qmup4/s1600-h/map_grails_shortcut_run_cmd.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 222px;" src="http://4.bp.blogspot.com/_GbeUi4pR7kA/SiYGNj2x4TI/AAAAAAAAAlg/bSwMA9qmup4/s320/map_grails_shortcut_run_cmd.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5342964837954740530" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p style="clear:both"&gt;&lt;br /&gt;Thus, the only thing you have left it to make it easy to call the "Execute Grails Command" - so, we just need to map a shortcut. In order to do that, go to Tools-&gt;Options-&gt;Key Map tab. In the "Search" box, type "grails", the "Execute Grails Command" action is there, click in the Shortcut column, type in your shortcut (I picked Ctrl+Alt-C) and hit OK. &lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Now, running your test the first time involves Ctrl-Alt-C, type "test-app", tab, type "FooBar -unit" and hitting enter. Kicking it off subsequently is Ctrl-Alt-C, type "test-app", hit enter and your tests are running !!! &lt;br /&gt;&lt;br /&gt;BEAUTY !!!&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/19648744-4802053931097107447?l=www.troymaxventures.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.troymaxventures.com/feeds/4802053931097107447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.troymaxventures.com/2009/06/quickly-running-single-grails-test-in.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/4802053931097107447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/4802053931097107447'/><link rel='alternate' type='text/html' href='http://www.troymaxventures.com/2009/06/quickly-running-single-grails-test-in.html' title='Quickly running a single Grails test in NetBeans'/><author><name>Alex Kotchnev</name><uri>https://profiles.google.com/103108222242966756240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-_FzUCgGWKhc/AAAAAAAAAAI/AAAAAAAABGY/gikhtyKNdVc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_GbeUi4pR7kA/SiYB4ZF__vI/AAAAAAAAAlI/JKY-OBhit1A/s72-c/run_single_test.png' height='72' width='72'/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19648744.post-9175747913089605708</id><published>2009-05-13T03:10:00.014-04:00</published><updated>2009-05-24T02:16:31.050-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tapestry'/><category scheme='http://www.blogger.com/atom/ns#' term='netbeans'/><title type='text'>RAD w/ Tapestry 5, NetBeans 6.7, Maven, and Jetty : Really !!!</title><content type='html'>&lt;p&gt;One of the major upsides of using Tapestry 5 is the much touted &lt;a href="http://tapestry.apache.org/tapestry5/guide/reload.html"&gt;live class and template reloading&lt;/a&gt;. Up until recently, if you followed &lt;a href="http://www.troymaxventures.com/2008/05/tapestry5-netbeans-quickstart.html"&gt;my previous post&lt;/a&gt; on working with Tapestry 5 and NetBeans, you probably ended w/ a workable solution, but still not ideal , as the live template and class reloading wasn't exactly working as expected. As a result, whenever you wanted to see the changes that you made in the live app (after running mvn jetty:run) you had to do the following:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;mvn compile resources:resources&lt;br /&gt;.........&lt;br /&gt;-----------&lt;br /&gt;[INFO] BUILD SUCCESSFUL&lt;br /&gt;[INFO] ------------------------------------------------------------------------&lt;br /&gt;[INFO] Total time: 18 seconds&lt;br /&gt;[INFO] Finished at: Wed May 13 03:16:32 EDT 2009&lt;br /&gt;[INFO] Final Memory: 16M/71M&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;The issue here was that NetBeans (in 6.1 and prior) did not support CopyOnSave or CompileOnSave properly in Maven projects (it did for NetBeans native projects, so if you had set up a NetBeans native project w/ explicit jar dependencies, etc it would work fine). The effect of running the above command was to compile your changes, and copy the compiled classes and modified resources into your &amp;lt;outputDirectory&amp;gt; (typically target/classes) . So, the 18 seconds above are not exactly something to lose sleep over, but it's still not the same like having the immediate Grails(or Rails)-like immediate feedback loop (that is, "Ctrl-S-&gt;Alt-Tab to browser-&gt;F5", which is "Save-&gt;Switch to Browser-&gt;Refresh"). &lt;br /&gt;&lt;br /&gt;In any case, help is on the way. &lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;In the most recent version of NetBeans (in the &lt;a href="http://bits.netbeans.org/download/trunk/nightly/latest/"&gt;6.7 daily builds&lt;/a&gt; ), the issues w/ CopyOnSave support has been fixed (well, almost fixed, see &lt;a href="http://www.netbeans.org/issues/show_bug.cgi?id=152974"&gt;the NetBeans IssuZilla issue&lt;/a&gt;), and now it transparently copies your modified resource files to target/[app-name]/WEB-INF/classes. Thus, with just a minor tweak, you can accomplish a Tapestry 5 Nirvana. &lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt; First, set up a new Maven project by File-&gt;New Project-&gt;Select Maven project type. Follow &lt;a href="http://www.troymaxventures.com/2008/05/tapestry5-netbeans-quickstart.html"&gt;my previous instructions&lt;/a&gt; on creating the actual project. Just a side note, for some reason the latest production T5 version (5.1) doesn't show up on the list of available archetypes in NetBeans. &lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt; Running the app is easy, the default project comes w/ the Jetty plugin set up, so you can just run "mvn jetty:run" on the console. &lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;Alternatively, map a custom Maven goal in NetBeans by right clicking on the project, going to Custom-Goals and mapping jetty:run . See the screenshots for some extra help&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_GbeUi4pR7kA/Shjioy6p-HI/AAAAAAAAAko/J0w7moGS-80/s1600-h/maven_custom_goal1.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 255px;" src="http://3.bp.blogspot.com/_GbeUi4pR7kA/Shjioy6p-HI/AAAAAAAAAko/J0w7moGS-80/s320/maven_custom_goal1.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5339266548738160754" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_GbeUi4pR7kA/ShjizwVDr1I/AAAAAAAAAkw/S9YDYpOnYZM/s1600-h/maven_custom_goal2.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 213px;" src="http://1.bp.blogspot.com/_GbeUi4pR7kA/ShjizwVDr1I/AAAAAAAAAkw/S9YDYpOnYZM/s320/maven_custom_goal2.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5339266737022152530" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_GbeUi4pR7kA/ShjjCAPREGI/AAAAAAAAAk4/XTnelzt47eY/s1600-h/maven_custom_goal3.png"&gt;&lt;img style="float:left; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 320px; height: 218px;" src="http://4.bp.blogspot.com/_GbeUi4pR7kA/ShjjCAPREGI/AAAAAAAAAk4/XTnelzt47eY/s320/maven_custom_goal3.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5339266981810999394" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li style="clear:both"&gt;The default project setup comes with an Index page living in the web app context. Now that you ran Jetty, you should be able to just make changes to the template, and see them immediately. The secret here is that Jetty runs by default out of src/main/webapp, so T5 picks up the changes out of the box, no additional support by the IDE is needed. &lt;br /&gt;&lt;br /&gt;The problem here is that if you tried making changes to your page class (e.g. Index.java), they're not being picked up. Jetty runs from the classes in target/classes. The idea here is that we want to IDE to autocompile the changes, drop them into target/classes and have T5 pick up the new page classes. As mentioned at the beginning of the post, if you just ran the maven build again (e.g. mvn compiler:compile), but we need something better. &lt;br /&gt;&lt;br /&gt;OK, so, go to the project properties, go to the Build-Compile section. In the panel, select from the "Compile on Save" (COS) dropdown the "for both application and test execution". &lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_GbeUi4pR7kA/ShjjWYeIO3I/AAAAAAAAAlA/lsUfyR4v13Y/s1600-h/deploy-on-save.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 229px;" src="http://4.bp.blogspot.com/_GbeUi4pR7kA/ShjjWYeIO3I/AAAAAAAAAlA/lsUfyR4v13Y/s320/deploy-on-save.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5339267331913169778" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The trick to remember here is that this only works for "supported servers" (e.g. I know that at least Tomcat and Glassfish are in that list) where the IDE would compile the new classes, and re-deploy them on the server. Jetty is not one of these supported servers, and in order for the Compile-on-save goodness to work, the IDE needs to know you ran the app so that it can activate COS. Now, although you probably don't want to run the app in Tomcat , go ahead and run the app, select to run it in Tomcat. Now that you ran the app in Tomcat, NetBeans activated COS for this app, and now if you make new changes to your Index.java, NetBeans copies out the compiled classes to target/classes, and Jetty picks up the changes. After you run the app, you can just stop Tomcat (and the COS feature will continue working). &lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;This is pretty close to perfect. Trouble is, if you have any page templates under src/main/resources, you're still out of luck, as the resources don't get copied out into target/classes after you do the initial jetty:run. But don't despair, there is just one more step that will get us there. &lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt; Add the following to your pom.xml&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&amp;lt;outputDirectory&amp;gt;${project.build.directory}/${project.build.finalName}/WEB-INF/classes&amp;lt;/outputDirectory&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Now, this is a bit of a hack. Basically, we're telling maven to use the target/[app-name]/WEB-INF/classes to do the initial and any subsequent builds, which is where both the classes from src/main (and whereever else) and src/main/resources end up. The trick here is that this is the same directory that "mvn package" uses, and it is also the same directory that NetBeans uses for the Compile-on-save functionality. Basically, when you make changes to your page template sin src/main/resources (and after you've run your app in Tomcat once), NetBeans continues to compile the classes and copy the modified resources from src/main/resources and drop them into the target/[app-name]/WEB-INF/classes. &lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Considering that this is indeed a a hack, &lt;a href="http://www.netbeans.org/issues/show_bug.cgi?id=152974"&gt;I filed a patch&lt;/a&gt; for NetBeans to properly support this T5 setup in Maven project. However, what got into 6.7 is only the fix to properly copy resources into target/[app-name]/WEB-INF/classes (and not in target/classes). The develoeper on the issue has some other ideas on how this should go, hopefully the full fix will go into the NetBeans version after 6.7. In the meantime, either use this little hack, or I'll probably try to repackage my fix as a standalone plugin to support this out of the box.&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/19648744-9175747913089605708?l=www.troymaxventures.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.troymaxventures.com/feeds/9175747913089605708/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.troymaxventures.com/2009/05/rad-w-tapestry-5-netbeans-67-maven-and.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/9175747913089605708'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/9175747913089605708'/><link rel='alternate' type='text/html' href='http://www.troymaxventures.com/2009/05/rad-w-tapestry-5-netbeans-67-maven-and.html' title='RAD w/ Tapestry 5, NetBeans 6.7, Maven, and Jetty : Really !!!'/><author><name>Alex Kotchnev</name><uri>https://profiles.google.com/103108222242966756240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-_FzUCgGWKhc/AAAAAAAAAAI/AAAAAAAABGY/gikhtyKNdVc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_GbeUi4pR7kA/Shjioy6p-HI/AAAAAAAAAko/J0w7moGS-80/s72-c/maven_custom_goal1.png' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19648744.post-5673112230332670302</id><published>2009-05-06T00:45:00.016-04:00</published><updated>2009-05-13T00:34:30.936-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='legacy rails'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='netbeans'/><category scheme='http://www.blogger.com/atom/ns#' term='grails'/><title type='text'>Converting legacy Rails apps to Grails : The Views</title><content type='html'>Alrighty, we're getting close to the finish line here. So far, we've covered &lt;a href="http://www.troymaxventures.com/2008/10/converting-legacy-rails-apps-to-grails.html"&gt;General Project Setup&lt;/a&gt;, &lt;a href="http://www.troymaxventures.com/2008/10/converting-legacy-rails-apps-to-grails_31.html"&gt;Migrating the Domain&lt;/a&gt;, &lt;a href="http://www.troymaxventures.com/2009/05/converting-legacy-rails-apps-to-grails.html"&gt;Migrating the Controllers&lt;/a&gt;, and now we'll talk about migrating the views. After that, if I have a little bit of life left in me, I'll briefly speak about replacing the existing plugins in the Rails app w/ equivalent Grails plugin, and that should be the end of this series. &lt;br /&gt;&lt;br /&gt;Now, on to the content. &lt;br /&gt;&lt;ol&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="#generalSetup"&gt;General Setup&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="#layouts"&gt;Layouts&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="#pageByPageMigration"&gt;Page-by-page migration&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="#tags"&gt;Tags&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;a href="#conclusion"&gt;Conclusion&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;    &lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;a href="#" name="generalSetup"&gt;1. General Setup&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_GbeUi4pR7kA/SgEWEB197rI/AAAAAAAAAkI/BrEOZ3-o9JQ/s1600-h/rails_views_structure.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 240px; height: 291px;" src="http://1.bp.blogspot.com/_GbeUi4pR7kA/SgEWEB197rI/AAAAAAAAAkI/BrEOZ3-o9JQ/s320/rails_views_structure.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5332567692253458098" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_GbeUi4pR7kA/SgEWNB2mArI/AAAAAAAAAkQ/LPAoqfCKo3E/s1600-h/grails_views_structure.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 221px; height: 320px;" src="http://2.bp.blogspot.com/_GbeUi4pR7kA/SgEWNB2mArI/AAAAAAAAAkQ/LPAoqfCKo3E/s320/grails_views_structure.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5332567846874907314" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;As you're probably used to it by now, the Grails and the Rails app have very similar approaches to storing views and templates. As you can see on the screenshots, the Rails views are in the "Views" project node, whereas in the Grails project, they're located in the "View and Layouts" project node. Inside of this folder, the views are partitioned by controller, e.g. the views and templates for controller "FooController" in the Grails app, sit inside of the view/foo subfolder. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;a href="#" name="layouts"&gt;2. Layouts&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Another interesting folder in both Rails and Grails is the Layouts folder (in Grails, Views and Layouts - layouts project folder). There, the projects store the differet project layouts. The general idea here is mostly the same: different parts of the app will have different layout needs. Migrating the layouts from Rails to Grails involves mostly tag-for-tag conversion of the rhtml to gsp. A couple of useful facts about that process. &lt;br /&gt;&lt;br /&gt;1. As mentioned in the &lt;a href=""&gt;previous post&lt;/a&gt;, both frameworks have a reasonable set of defaults for the layout selection. I can't quite remember all the details about how Rails chooses its defaults, but the converted application mostly specified on a per-controller basis by specifying the element, e.g. : &lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="ruby"&gt;&lt;br /&gt;class FooController &lt;br /&gt;    layout "internal"&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This Rails snippet will use the views/layouts/internal.rhtml layout. &lt;br /&gt;&lt;br /&gt;There is no direct equivalent for specifying the desired layout inside of a controller in Grails. Instead, a user can add a layout with the same name as the controller (e.g. layouts/foo.gsp for FooController). Although I don't recall this being used in the Rails app, Grails also provides the ability to specify a template to use for rendering a view by specifying a &amp;lt;meta name="layout" content="landing"&amp;gt;&amp;lt;/meta&amp;gt;. Rendering a view that specifies the layout in this way will use the view/layouts/internal.gsp layout. &lt;br /&gt;&lt;br /&gt;2. Converting the Rails layouts&lt;br /&gt;The Rails layouts that I worked with used the following statements in the &amp;lt;head&amp;gt; element: &lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;%= stylesheet_link_merged :base %&amp;gt;&lt;br /&gt;&amp;lt;%= stylesheet_link_merged :print, 'media' =&amp;gt; 'print' %&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;%= javascript_include_merged :base %&amp;gt;&lt;br /&gt;&amp;lt;%= javascript_include_merged :application %&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I can't quite say I know what all of the above statements do. I inspected the output the actual HTML output and replaced it with the following in my Grails template:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;  &amp;lt;head&amp;gt;&lt;br /&gt; &amp;lt;link rel="shortcut icon" href="${createLinkTo(dir:'images',file:'favicon.ico')}" type="image/x-icon" /&amp;gt;&lt;br /&gt; &amp;lt;link rel="stylesheet" href="${createLinkTo(dir:'stylesheets/active_scaffold',file:'stylesheet.css')}" media="screen" type="text/css" /&amp;gt;&lt;br /&gt; &amp;lt;link href="${createLinkTo(dir:'stylesheets',file:'styles.css')}" media="screen" rel="Stylesheet" type="text/css" /&amp;gt;&lt;br /&gt; &amp;lt;link href="${createLinkTo(dir:'stylesheets',file:'print.css')}" media="print" rel="Stylesheet" type="text/css" /&amp;gt;&lt;br /&gt; &amp;lt;link href="${createLinkTo(dir:'stylesheets/active_scaffold/default',file:'stylesheet.css')}" media="screen" rel="Stylesheet" type="text/css" /&amp;gt;&lt;br /&gt; &amp;lt;!--[if IE]&amp;gt;&lt;br /&gt;  &amp;lt;link href="${createLinkTo(dir:'stylesheets/active_scaffold/default',file:'stylesheet-ie.css')}" media="screen" rel="Stylesheet" type="text/css" /&amp;gt;&lt;br /&gt; &amp;lt;![endif]--&amp;gt;&lt;br /&gt; &amp;lt;g:layoutHead /&amp;gt;&lt;br /&gt; &amp;lt;g:javascript library="application" /&amp;gt;&lt;br /&gt; &amp;lt;g:javascript library="prototype" /&amp;gt;&lt;br /&gt; &amp;lt;g:javascript library="scriptaculous" /&amp;gt;&lt;br /&gt;  &amp;lt;/head&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;A couple of things to note here : &lt;br /&gt;* Using the ${createLinkTo()} tag inside of the stylesheet links : it is very convenient and makes the generation of the links pretty foolproof. &lt;br /&gt;* Using the &amp;lt;g:layoutHead /&amp;gt; statement : allows the inclusion of any elements from the &amp;lt;head&amp;gt; element of the "client" page (the page that is using the layout). &lt;br /&gt;&lt;br /&gt;Inside of the body of the template, the Rails template use the &amp;lt;%= yield%&amp;gt; statement to include the body of the client page. The equivalent statement in the Grails layout is the &amp;lt;g:layoutBody&amp;gt;&lt;br /&gt;&lt;br /&gt;Finally, Rails allows client views to contribute "additional" content into the final output. In other words, the template can define an "area" where the client template can contribute markup, in a way that the said markup shows up in the parts of the layout that are generally rendered by the template. For example, if the client pages need to contribute markup to the content of the "sidebar", then, the layout would use something like the following:&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;    &amp;lt;% if !@content_for_sidebar.nil? %&amp;gt;&lt;br /&gt;        &amp;lt;div id="right_sidebar_content_main"&amp;gt;&lt;br /&gt;            &amp;lt;%= yield(:sidebar) %&amp;gt;&lt;br /&gt;        &amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;% end %&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The client template, contributes to the layout as follows: &lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&amp;lt;% content_for :sidebar do%&amp;gt;&lt;br /&gt; &amp;lt;div&amp;gt; This content will show up under the 'right_sidear_content_main' section in the final output &amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;% end %&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In Grails, in order to implement the same feature, we have to resort to a less used and somewhat obscure feature of the underlying templating system that Grails users : Sitemesh. Here's the equivalent in the Grails project:&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;    &amp;lt;g:if test="${pageProperty(name:'page.sidebar')!=null &amp;&amp; pageProperty(name:'page.sidebar')!=''}"&amp;gt;&lt;br /&gt;        &amp;lt;div id="right_sidebar_content_main"&amp;gt;&lt;br /&gt;            &amp;lt;g:pageProperty name="page.sidebar" /&amp;gt;&lt;br /&gt;        &amp;lt;/div&amp;gt;&lt;br /&gt;    &amp;lt;/g:if&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now, in the "client" page, add content to the sidebar as follows: &lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;    &amp;lt;content tag="sidebar"&amp;gt;&lt;br /&gt;          &amp;lt;g:render template="course_notes_side_bar" /&amp;gt;&lt;br /&gt;    &amp;lt;/content&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;There is some additional info on using this feature in the Grails docs' for &lt;a href="http://grails.org/doc/1.1/ref/Tags/pageProperty.html"&gt;pageProperty&lt;/a&gt; tag, but more so in the &lt;a href="http://www.opensymphony.com/sitemesh/index.html"&gt;Sitemesh user docs&lt;/a&gt; and just &lt;a href="http://weblogs.java.net/blog/zarar/archive/2006/01/passing_arbitra.html"&gt;random blogs&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;a href="#" name="pageByPageMigration"&gt;3. Page-by-page migration&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;There is in most cases a 1-1 relationship between the views in both frameworks. Converting from the Rails views to the Grails views was mostly mechanical : see the Rails tag, find the equivalent Grails tag, and then figure out how to map the Rails tag attributes to the Grails tag attributes. In most cases, the two are similar enough and the conversion is fairly easy. At other times, Rails did provide some more features not present in Grails and migrating the pages did require some level of thought and effort. Even in that case, even for the tags that don't have a Grails equivalent, after the first couple of tags the conversion is always the same. Here's an example of an easy conversion: &lt;br /&gt;&lt;br /&gt;In Rails:&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt; &amp;lt;%= link_to_remote "Upload File",&lt;br /&gt;       {:url =&amp;gt; { :controller =&amp;gt; 'activity_items', :action =&amp;gt; 'show_upload_form', :activity_id =&amp;gt; @act_id},&lt;br /&gt;          :before =&amp;gt; "Element.show('show_upload_form')" ,&lt;br /&gt;          :success =&amp;gt; "Element.hide('show_upload_form');",&lt;br /&gt;    :update =&amp;gt; { :success =&amp;gt; "upload_form", :failure =&amp;gt; "upload_form_errors" }}, &lt;br /&gt;        {:class =&amp;gt; "action", :title =&amp;gt;"Add a new file."} %&amp;gt; &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In Grails: &lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&amp;lt;g:remoteLink controller='activityItems' action='show_upload_form'&lt;br /&gt;        params="[act_id:act_id]"&lt;br /&gt;        before="Element.show('show_upload_form')"&lt;br /&gt;        onSuccess="Element.hide('show_upload_form')"&lt;br /&gt;        update="[success:'upload_form', failure:'upload_form_errors']"&lt;br /&gt;        class="action" title="Add a new file"&amp;gt; Upload File &amp;lt;/g:remoteLink&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here's another one. &lt;br /&gt;&lt;br /&gt;Rails:&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&amp;lt;%= form_remote_tag :url =&amp;gt; {:action =&amp;gt; 'update',:controller =&amp;gt; "activities", :id =&amp;gt; @activity.id},&lt;br /&gt;:before =&amp;gt; "Element.show('form-indicator-activities')" ,&lt;br /&gt;:success =&amp;gt; "Element.hide('form-indicator-activities')" %&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Grails:&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&amp;lt;g:formRemote url="[action:'update', controller:'activities', id:activity.id]" name="editActivityForm"&lt;br /&gt;    before="Element.show('form-indicator-activities')"&lt;br /&gt;    onSuccess="Element.hide('form-indicator-activities')"&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I found that because the Rails app assumed to be deployed at the root of the context (e.g. http://localhost:3000/), whereas the Grails app always assumes that it will be deployed to a non-root context path (e.g. /foo), in many cases I found myself replacing static image references with links created with ${createLinkTo()}&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;FROM: &lt;br /&gt;&amp;lt;img src="/images/indicator.gif" id='addurl' style='display:none;' /&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;TO:&lt;br /&gt;&amp;lt;img src="${createLinkTo(dir:"images",file:"indicator.gif")}" id='addurl' style='display:none;' /&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here's an example of a Rails tag that didn't have a direct equivalent in Grails. &lt;br /&gt;&lt;br /&gt;Rails:&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&amp;lt;%= text_field_with_auto_complete(:course, :title, {:class=&amp;gt;"SearchTextBox", :value =&amp;gt; " type here, then hit enter", :onclick=&amp;gt;"this.value=(this.value == ' type here, then hit enter')?'':this.value;", :onblur =&amp;gt; "this.value=(this.value == '')?' type here, then hit enter':this.value;"}, completion_options = {})  %&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In Grails, I created a template that contained the same html + javascript that the Rails tag produced:&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&amp;lt;%-- The content below was migrated from the Rails app, could be improved if using a plugin providing a cleaner autocompletion setup --%&amp;gt;&lt;br /&gt;Search&lt;br /&gt;&lt;br /&gt;&amp;lt;style type="text/css"&amp;gt;&lt;br /&gt;  div.auto_complete {&lt;br /&gt; width: 350px;&lt;br /&gt; background: #fff;&lt;br /&gt;  }&lt;br /&gt;  div.auto_complete ul {&lt;br /&gt; border:1px solid #888;                         &lt;br /&gt; margin:0;&lt;br /&gt; padding:0;&lt;br /&gt; width:100%;&lt;br /&gt; list-style-type:none;&lt;br /&gt;  }&lt;br /&gt;  div.auto_complete ul li {&lt;br /&gt; margin:0;&lt;br /&gt; padding:3px;&lt;br /&gt;  }&lt;br /&gt;  div.auto_complete ul li.selected {&lt;br /&gt; background-color: #ffb;&lt;br /&gt;  }&lt;br /&gt;  div.auto_complete ul strong.highlight {&lt;br /&gt; color: #800;&lt;br /&gt; margin:0;&lt;br /&gt; padding:0;&lt;br /&gt;  }&lt;br /&gt;&amp;lt;/style&amp;gt;&lt;br /&gt;&amp;lt;input autocomplete="off" class="SearchTextBox" id="course_title" name="course.title" onblur="this.value=(this.value == '')?' type here, then hit enter':this.value;" onclick="this.value=(this.value == ' type here, then hit enter')?'':this.value;" size="30" value=" type here, then hit enter" type="text"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;div style="position: absolute; left: 1275px; top: 161px; width: 230px; display: none;" class="auto_complete" id="course_title_auto_complete"&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;//&amp;lt;![CDATA[&lt;br /&gt;var course_title_auto_completer = new Ajax.Autocompleter('course_title', 'course_title_auto_complete', "${createLink(controller:'courses', action:'auto_complete_for_course_title')}", {})&lt;br /&gt;//]]&amp;gt;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Finally, Rails definitely has some more advanced scaffolding features that Grails didn't support out of the box or did not have a direct equivalent. Similarly to the example above, I just used the html that the scaffold generated, stuffed that into a separate template and used that. &lt;br /&gt;&lt;br /&gt;Rails:&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&amp;lt;%= render :active_scaffold =&amp;gt; "notes", :constraints =&amp;gt; {:user_id =&amp;gt; current_user.id, :course_id =&amp;gt; @course.id} %&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In Grails, this became a standalone template (_notes_scaffold.gsp), which initially contained the static HTML generated by Rails, which I then rigged to support dynamically generate the needed markup (e.g. loop, etc). In the end, the call to the scaffold code above, becomes the following:&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;   &amp;lt;g:render template="/notes/notes_scaffold" model="[notes:UserNote.findAllByUserAndCourse(user?:current_user(),course)]" /&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;a href="#" name="tags"&gt;4. Helpers and Tags&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;In a couple of instances, the Rails app depended on the "helpers" - seemingly a collection o methods that are available to be executed either from the view or contoller. I ended up encapsulating some of these common operations into taglibs, so that the usage of the said tags in grails is as follows: &lt;br /&gt;&lt;br /&gt;Rails (a sample Helper located in the Helpers project node):&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_GbeUi4pR7kA/SgE3-ECGwkI/AAAAAAAAAkY/TeJHqKQAR_I/s1600-h/rails_helpers.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 237px; height: 204px;" src="http://2.bp.blogspot.com/_GbeUi4pR7kA/SgE3-ECGwkI/AAAAAAAAAkY/TeJHqKQAR_I/s320/rails_helpers.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5332604973157368386" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="ruby"&gt;&lt;br /&gt;require 'bluecloth'&lt;br /&gt;module ApplicationHelper&lt;br /&gt; include TagsHelper&lt;br /&gt;    def link_to_button(label)&lt;br /&gt;     "&amp;lt;table cellpadding=0 cellspacing=0 class=button_action_link&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td align=right style=\"background: url('/images/left_button_curve.gif') no-repeat; width: 8px; height: 23px;\"&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td nowarp=\"nowrap\" style=\"background: url('/images/center_button_bg.gif') repeat;\"&amp;gt; #{label} &amp;lt;/td&amp;gt;&amp;lt;td style=\"background: url('/images/right_button_curve.gif') no-repeat; width: 29px; height: 23px;\"&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;"&lt;br /&gt;   end      &lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_GbeUi4pR7kA/SgE4K8rrwOI/AAAAAAAAAkg/c1O4bDzFJp0/s1600-h/grails_taglib.png"&gt;&lt;img style="float:left; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 241px; height: 212px;" src="http://2.bp.blogspot.com/_GbeUi4pR7kA/SgE4K8rrwOI/AAAAAAAAAkg/c1O4bDzFJp0/s320/grails_taglib.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5332605194522575074" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;In Grails, it becomes the following:&lt;br /&gt;class CosTagLib {&lt;br /&gt;&lt;br /&gt;    def linkToButton = { attrs -&gt;&lt;br /&gt;        out &amp;lt;&amp;lt; "&amp;lt;table cellpadding=0 cellspacing=0 class=button_action_link&gt;&amp;lt;tr&gt;&amp;lt;td align=right style=\"background: url('${createLinkTo(dir:"images",file:"left_button_curve.gif")}') no-repeat; width: 8px; height: 23px;\"&gt;&amp;lt;/td&gt;&amp;lt;td nowarp=\"nowrap\" style=\"background: url('${createLinkTo(dir:"images",file:"center_button_bg.gif")}') repeat;\"&gt; ${attrs.label} &amp;lt;/td&gt;&amp;lt;td style=\"background: url('${createLinkTo(dir:"images",file:"right_button_curve.gif")}') no-repeat; width: 29px; height: 23px;\"&gt;&amp;lt;/td&gt;&amp;lt;/tr&gt;&amp;lt;/table&gt;"&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;An alternative to adding common helper functionality in tag libraries is to add the same methods as public methods on the superclass. For example, the parent controller contains the following closure:&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;    def current_user = {&lt;br /&gt;  if (this.currentUser==null &amp;&amp; session.user) {&lt;br /&gt;   this.currentUser = User.get(session.user.id)&lt;br /&gt;  }&lt;br /&gt;        println "Returning currentUser ${currentUser} "&lt;br /&gt;  return currentUser;&lt;br /&gt; }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Then, in GSPs, one can use the closure as follows:&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;   &lt;g:render template="/notes/notes_scaffold" model="[notes:UserNote.findAllByUserAndCourse(user?:current_user(),course)]" /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;a href="#" name="conclusion"&gt;5. Conclusion&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;It's interesting that the migration of views/templates is probably the least complicated part of migrating a Rails app to Grails. Yet, at the same time, together w/ migrating the controllers it was possibly the most time consuming task. Understandably, these artifacts represent ARE the web application. While there probably isn't a good way to automatically convert the controller code, the view code is much more amenable to such an automated conversion, tag-for-tag. &lt;br /&gt;&lt;br /&gt;For a lot of these repetitive tasks of converting the app UI tag by tag ( I didn't spend the time to create an auto-converter), I ended up creating a couple of NetBeans live templates that give me parameter and code completion of attributes, jumping between different params, etc.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/19648744-5673112230332670302?l=www.troymaxventures.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.troymaxventures.com/feeds/5673112230332670302/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.troymaxventures.com/2009/05/converting-legacy-rails-apps-to-grails_05.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/5673112230332670302'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/5673112230332670302'/><link rel='alternate' type='text/html' href='http://www.troymaxventures.com/2009/05/converting-legacy-rails-apps-to-grails_05.html' title='Converting legacy Rails apps to Grails : The Views'/><author><name>Alex Kotchnev</name><uri>https://profiles.google.com/103108222242966756240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-_FzUCgGWKhc/AAAAAAAAAAI/AAAAAAAABGY/gikhtyKNdVc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_GbeUi4pR7kA/SgEWEB197rI/AAAAAAAAAkI/BrEOZ3-o9JQ/s72-c/rails_views_structure.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19648744.post-6050026609053975937</id><published>2009-05-05T17:37:00.013-04:00</published><updated>2009-05-13T00:34:14.549-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='legacy rails'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='netbeans'/><category scheme='http://www.blogger.com/atom/ns#' term='grails'/><category scheme='http://www.blogger.com/atom/ns#' term='groovy'/><title type='text'>Converting legacy Rails apps to Grails : The Controllers</title><content type='html'>So, you've already looked at the previous blog posts on &lt;a href='http://www.troymaxventures.com/2008/10/converting-legacy-rails-apps-to-grails.html'&gt;Setting up the Project&lt;/a&gt; and &lt;a href="http://www.troymaxventures.com/2008/10/converting-legacy-rails-apps-to-grails_31.html"&gt;Migrating the Domain Objects&lt;/a&gt;. The whole world must be wondering "What happened to this blog post series, did people just stop migrating from Rails to Grails?". Well, I've been in &lt;a href="http://tapestry.apache.org/tapestry5"&gt;Tapestry&lt;/a&gt; land for the last 6-7 months and haven't had much free time to finish my blogging endeavor to finish my series of articles. But, what do you know : all of a sudden the topic of migrating legacy Rails apps to Grails came back to the fore for me (work related, don't ask, it's top secret), and here I am. In a valiant effort, I will try to finish off the topic in one fell swoop (hopefully today) and bang out a couple of different articles that document in details the ups and downs of such a migration. &lt;br /&gt;&lt;br /&gt;Because this article is on the long side, here is the Table of Contents:&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="#overviewOfControllers"&gt;Overview of Controllers&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="#generalLanguageIssues"&gt;General language related issues.&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="#inputProcessing"&gt;Input Processing&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="#inputValidationAndErrors"&gt;Input Validation and Error Reporting&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="#renderingResponses"&gt;Rendering Responses&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="#advancedAjaxiness"&gt;Advanced Ajaxiness : Dynamic Javascript&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="#conclusion"&gt;Conclusion&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;a href="#" name="overviewOfControllers"&gt;1. Overview of controllers&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_GbeUi4pR7kA/SgD9rY6qaLI/AAAAAAAAAjo/z1bHr8O5yEc/s1600-h/rails_controllers.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 237px; height: 142px;" src="http://2.bp.blogspot.com/_GbeUi4pR7kA/SgD9rY6qaLI/AAAAAAAAAjo/z1bHr8O5yEc/s320/rails_controllers.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5332540880671369394" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_GbeUi4pR7kA/SgD915t_H6I/AAAAAAAAAjw/7j9D-oNX6eQ/s1600-h/grails_controllers.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 233px; height: 173px;" src="http://1.bp.blogspot.com/_GbeUi4pR7kA/SgD915t_H6I/AAAAAAAAAjw/7j9D-oNX6eQ/s320/grails_controllers.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5332541061275262882" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now, back to the meat and potatoes of this article : migrating the Rails controllers to Grails. It's no secret that Grails heavily borrowed ideas from Rails (and NO, Grails is not Groovy on Rails, there's no mass transit involved at all, it's the good ole cup that everyone wants) and as can be seen from the screenshot of the project setup, both framework keep the controllers in the Controllers NetBeans project folder. Creating Grails controllers is easy: just right click on the Controllers project folder and select "New Controller". NetBeans walks you through naming the Controller properly and creates the needed file and run the regular Grails "create-controller" task, which in creates a default view for the controller. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_GbeUi4pR7kA/SgD-D2vjULI/AAAAAAAAAj4/3X0VHRHk-0Q/s1600-h/rails_controller_structure1.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 162px; height: 320px;" src="http://1.bp.blogspot.com/_GbeUi4pR7kA/SgD-D2vjULI/AAAAAAAAAj4/3X0VHRHk-0Q/s320/rails_controller_structure1.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5332541300994691250" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_GbeUi4pR7kA/SgD-Maz_FtI/AAAAAAAAAkA/9c3XpBh1wCs/s1600-h/grails_controller_structure.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 204px; height: 320px;" src="http://3.bp.blogspot.com/_GbeUi4pR7kA/SgD-Maz_FtI/AAAAAAAAAkA/9c3XpBh1wCs/s320/grails_controller_structure.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5332541448115918546" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The structure of the controllers themselves is very similar as well : in both cases, there is a one-to-one relationship between the Rails and Grails controllers. Inside the controller, in both cases, there is a class containing a bunch of closures , methods, and private member variables. In both cases, the closures in the controller become a part of the "public api" exposed by the controller, as all closures can be called from the URL (e.g. http://localhost:8080/app/controllerName/closure -&gt; http://localhost:8080/app/account/login). Private methods are not accessible to be invoked from the URL. For "old school" Java developers who might not be intimately familiar w/ Rails or Grails, it is interesting to note that the controllers are thread safe : that is, they can contain instance variables that will not be clobbered if two concurrent requests are sent to the same controller. A new controller instance is created for each Http request. &lt;br /&gt;&lt;br /&gt;OK, let's see what's inside the controller. Here's an example Rails controller: &lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="ruby"&gt;&lt;br /&gt;class ActivityItemsController &lt; ApplicationController    &lt;br /&gt;  def create&lt;br /&gt;    @activity_item = ActivityItem.new(params[:activity_item])    &lt;br /&gt;    if @activity_item.save      &lt;br /&gt;      // do whatever &lt;br /&gt;    else&lt;br /&gt;      // do whatever else&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Converting this same controller to Grails would look like this: &lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;class ActivityItemsController extends ApplicationController {&lt;br /&gt;    def activity_item;&lt;br /&gt;    &lt;br /&gt;    def create = {&lt;br /&gt;        this.activity_item = new ActivityItem(params.activity_item)&lt;br /&gt;        if (activity.save()) {&lt;br /&gt;            // do whatever&lt;br /&gt;        } else {&lt;br /&gt;            // do whatever else&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;a name="generalLanguageIssues" href="#"&gt;2. General language related issues.&lt;/a&gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;A lot of things to talk about here. First of all, just looking at the code it looks almost the same. The first superficial difference is the naming convention for the classes : in Rails user underscore_separated_file_names, whereas Groovy uses CamelCase. One notable difference is that in Grails, you do need to declare the class members, whereas in Rails (due to Ruby heritage), the properties can directly be assigned to when needed (e.g. @activity_item = ....). While the Ruby approach does save one line of code to declare the property, while migrating the code I found it very helpful to see the declarations at the top of the Groovy class. When you don't declare the class members upfront, it seems that it's quite easy to create a whole bunch of properties in the Ruby class w/o realizing how many you've created, which generally can lead to muddying the interface (mind you, the said properties are publicly accessible - e.g. from views, other closures, methods, etc).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;a href="#" name="inputProcessing"&gt;3. Input processing&lt;/a&gt;&lt;/span&gt; &lt;br /&gt;The second thing to note is the existence of the "params" map in both cases. In both cases, one can both read from and write to the params map using the accepted syntax : map[:key] in Ruby and map.key or map[key] in Groovy. So, nothing particularly interesting here. A bunch of other default objects are available in the Grails controller (probably quite familiar to Java Devs) such as servletContext, session, request, params, flash. Dealing with all is mostly the same in both frameworks and should be familiar to anyone done anything on the web.&lt;br /&gt;&lt;br /&gt;When processing input, in a number of places, Rails uses the following shortcut/idiom to bulk update the values of many attributes of an object from request parameters at once:&lt;br /&gt;&lt;pre name="code" class="ruby"&gt;&lt;br /&gt;   class Foo &lt;br /&gt;   &lt;br /&gt;    def bar &lt;br /&gt;        @activity.update_attributes(params[:activity])&lt;br /&gt;    end&lt;br /&gt;   end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;To cut the long story short, this take in the value of request parameters and binds them to values in the object (note, this has severe security implications but that's a different topic to discuss). Grails offers an equivalent statement with: &lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;   class Foo {&lt;br /&gt;        def activity&lt;br /&gt;        &lt;br /&gt;        def bar = {&lt;br /&gt;            bindData(activity,params.activity)&lt;br /&gt;        }&lt;br /&gt;   &lt;br /&gt;   }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;If using the straight out &lt;a href="http://grails.org/doc/1.1/ref/Controllers/bindData.html"&gt;bindData&lt;/a&gt; method from Grails it accomplishes the same thing, with the same security implications. Whenever I actually bumped into examples like this, I tried to address some of the security issues by using the "more advanced" bindData method in Grails, which allows specifying parameters to exclude and a prefix of a property to use for binding, e.g. if I only wanted to bind the customer.name and customer.phone attributes from the request and I definitely wanted to prevent the customer.id attribute being affected, I'd use something like this:&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;bindData(myCustomerObject,params,["id"], "customer")&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;a href="#" name="inputValidationAndErrors"&gt;4. Input Validation and Error Reporting&lt;/a&gt;&lt;/span&gt;  &lt;br /&gt;In both framework, a large part of validating the input that is written to the domain model is done by specifying constraints in the domain model itself (e.g. see &lt;a href="http://www.troymaxventures.com/2008/10/converting-legacy-rails-apps-to-grails_31.html"&gt;the article&lt;/a&gt; about the Rails-&gt;Grails domain migration). Thus, in both frameworks, code like this is pretty common: &lt;br /&gt;&lt;pre name="code" class="ruby"&gt;&lt;br /&gt;if @activity.save&lt;br /&gt;    // do whatever on success&lt;br /&gt;else&lt;br /&gt;   flash[:error]= @activity.errors.full_messages.join("&lt;br/&gt;") &lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In Grails, the code looks very similar:&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;if (activity.save()) {&lt;br /&gt;    // do whatever on success&lt;br /&gt;} else {&lt;br /&gt;    flash.error = activity.errors&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;One minor difference here is that (at least in this app), the Rails just concatenated the error messages as text and placed them in the "error" property in flash scope. In contrast, Grails assigns the actual "errors" object to the same flash property, then allowing the view to render these error objects as it wishes (e.g. using the &lt;a href="http://grails.org/doc/1.1/ref/Tags/renderErrors.html"&gt;g:renderErrors&lt;/a&gt; tag), which would allow rendering an error for a particular property, etc.&lt;br /&gt;&lt;br /&gt;In both frameworks, validation of can happen in the controller itself, and errors can be added to the relevant error property (in the appropriate scope). &lt;br /&gt;&lt;br /&gt;One more advanced feature of Grails that I found very useful later on in the conversion are the Grails are the form beans that you can use to populate values from the request (thus shielding from the security issues referred to further up), validating the input in a domain-class style approach, and generating errors in a nice and easy manner. So, here's the form object:&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;&lt;br /&gt;public class ChangePasswordForm {&lt;br /&gt; String oldPassword;&lt;br /&gt; String password;&lt;br /&gt; String passwordConfirmation;&lt;br /&gt;&lt;br /&gt; static constraints = {&lt;br /&gt;  oldPassword(nullable:false,blank:false)&lt;br /&gt;  password(nullable:false, blank:false, size:4..40)&lt;br /&gt;  passwordConfirmation(nullable:false, blank:false, size:4..40,&lt;br /&gt;   validator: { oldPw, chgPwdCmd -&gt;&lt;br /&gt;    if (oldPw!=chgPwdCmd.password) {&lt;br /&gt;     return "notsame.message"&lt;br /&gt;    }&lt;br /&gt;   }&lt;br /&gt;  )&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You'll note the declarative syntax familiar from domain object validation, it's a beauty !!!&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;&amp;lt;g:formRemote url="[action:'change_password']" name="ChangePasswordForm"&lt;br /&gt;       before="Element.show('form-indicator-pwd')"&lt;br /&gt;       onSuccess="Element.hide('form-indicator-pwd')"&amp;gt;&lt;br /&gt;                   &lt;br /&gt;&amp;lt;/g:formRemote&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Add the following to your grails-app/i18n/messages.properties for custom error messages:&lt;br /&gt;&lt;pre name="code"&gt;&lt;br /&gt;#Custom messages&lt;br /&gt;forms.ChangePasswordForm.passwordConfirmation.notsame.message=Password confirmation not the same as password&lt;br /&gt;wrong.password.message.forms.ChangePasswordForm.password=Old password is wrong, please enter again&lt;br /&gt;forms.ChangePasswordForm.password.blank.message={0} cannot be blank&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Finally, using the form in the controller when submitted:&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;def change_password = { ChangePasswordForm changePasswordForm -&gt;   &lt;br /&gt;        if (!changePasswordForm.hasErrors()) {   &lt;br /&gt;            // accessing the values from the form&lt;br /&gt;            def pwdValue = changePasswordForm.password&lt;br /&gt;            // adding a custom error to the form for an error not enforced in constraints&lt;br /&gt;            if (whateverRandomReasonYouWantToRejectAField) {&lt;br /&gt;                changePasswordForm.errors.rejectValue("password","wrong.password.message")&lt;br /&gt;            }&lt;br /&gt;            // do whatever &lt;br /&gt;        } else {&lt;br /&gt;            // do whatever else&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Finally, it seemed like a pretty common idiom in the Rails app to use dynamic javascript (I will talk about that plugin later ) to render errors back to the client:&lt;br /&gt;&lt;pre name="code" class="ruby"&gt;&lt;br /&gt;      if (@activity.save) &lt;br /&gt;            // do whatever on success &lt;br /&gt;      else&lt;br /&gt;        flash[:error] = "#{@activity.errors.full_messages.join('&lt;br/&gt;')}"&lt;br /&gt;          render :update do |page|&lt;br /&gt;            page.replace_html "errors_div", :partial =&gt; "common/errors_flash",:layout=&gt;false&lt;br /&gt;            // do whatever else to the page&lt;br /&gt;          end&lt;br /&gt;      end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In essense, this takes the validation errors, renders them using the "errors_flash" template, and replaces the content of the "errors_div" in the page with the rendering result. This approach caused me a lot of grief initially, but after a little bit of work it turned into the following in my Grails app: &lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;    if (activity_item.save()) {&lt;br /&gt;        // do whatever on success &lt;br /&gt;    } else {&lt;br /&gt;        js_error(activity_item.errors)&lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Where the js_error method in the controller superclass, looks something like this (using the dynamic javascript plugin that will be discussed later): &lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;def js_error = { errors -&gt;&lt;br /&gt;    flash.error = errors&lt;br /&gt;    log.debug "Sending errors back to client: ${errors}"&lt;br /&gt;    renderJavascript {&lt;br /&gt;        update 'errors_div', [text:g.render(template:"/common/errors_flash")]&lt;br /&gt;        callFunction "Element.show" , 'errors_div'&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;a href="#" name="renderingResponses"&gt;5. Rendering Responses&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;Converting the response rendering from Rails to Grails was pretty straightforward, here's the Rails example:&lt;br /&gt;&lt;pre name="code" class="ruby"&gt;&lt;br /&gt;  def new&lt;br /&gt;    render :partial =&gt; "new", :layout =&gt; false&lt;br /&gt;  end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In Grails, this becomes:&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;    def _new = {&lt;br /&gt;        render(template:"new")&lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;One tricky thing to note here is that because "new" is a Groovy keyword, I could not use the same closure name, NBD. The &lt;a href="http://grails.org/doc/1.1/ref/Controllers/render.html"&gt;render controller method&lt;/a&gt; is pretty much the best thing since sliced bread and can render a whole bunch of things like regular pages, templates, XML, or JSON. Grails uses a convention that partial pages (templates) are named starting w/ an underscore. Thus, when you do:&lt;br /&gt;&lt;pre name="code" style="java"&gt;&lt;br /&gt;   render(template:"fooTemplate")&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Grails finds the _footemplate.gsp file and renders it (equivalent to the Rails render :partial =&gt; "footemplate" which renders _footemplate.rhtml). &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;One other common idiom in the Rails app was to issue redirects from the controller: &lt;br /&gt;&lt;pre name="code" class="ruby"&gt;&lt;br /&gt;redirect_to  :action =&gt; 'show', :controller =&gt; 'activities', :id=&gt; params[:act_id]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Grails supports this idiom pretty nicely with the &lt;a href="http://grails.org/doc/1.1/ref/Controllers/redirect.html"&gt;redicect controller method&lt;/a&gt; with pretty much the same parameters:&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;redirect(controller:'activities', action:'show', id:params.act_id)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This particular project was using both script-centered and content-centered AJAX, and not much data-centered AJAX, so I didn't get to use JSON or XML rendering much; however, I always found the automatic marshalling to JSON or XML pretty cool: &lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;// Automatic marshalling of XML and JSON&lt;br /&gt;import grails.converters.*&lt;br /&gt;…&lt;br /&gt;render Book.list(params) as JSON&lt;br /&gt;render Book.get(params.id) as XML&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Finally, one cool feature of Rails that I initially missed was the ability to specify the default layout per controller :&lt;br /&gt;&lt;pre name="code" class="ruby"&gt;&lt;br /&gt;class ActivitiesController &lt; ApplicationController&lt;br /&gt;  layout "internal"&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The statement above sets the default layout for this controller in the controller itself. Grails supports specifying the layout either by convention (e.g. grails-app/views/layouts/CONTROLLER.gsp or grails-app/views/layouts/CONTROLLER/ACTION.gsp , effectively equivalent to specifying layout="internal" in the controller)  or explicitly in the template by specifying a meta tag (&amp;lt;meta name="layout" content="internal"&amp;gt;&amp;lt/meta&amp;lt;) in the template. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;a href="#" name="advancedAjaxiness"&gt;6. Advanced Ajaxiness : Dynamic Javascript&lt;/a&gt;&lt;/span&gt; &lt;br /&gt;I was planning to discuss Rails plugins in a separate article; however, there is one particular Grails plugin that was extremely useful to cover a portion of Rails that Grails doesn't cover out of the box. More specifically, I'm talking about the Rails script centered AJAX w/ dynamic javascript, e.g. : &lt;br /&gt;&lt;pre name="code" class="ruby"&gt;&lt;br /&gt;render :update do |page|&lt;br /&gt;    page.replace_html "errors_div", :partial =&gt; "common/errors_flash",:layout=&gt;false&lt;br /&gt;    page.replace_html "show_activities", :partial=&gt;"show", :layout=&gt;false&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;As explained before, this replaces the content of the "errors_div" in the page w/ the rendered "errors_flash" template (which basically renders the flash errors in a list or something like that), and then replaces the content of the "show_activities" div w/ the content of the partial template. &lt;br /&gt;&lt;br /&gt;My initial approach was to change the actual pages to process the response and update the right div w/ the returned content, but it was a big PITA, considering how much the Rails app used this. Finally, after some searching on the net, I found the &lt;a href="http://www.grails.org/Dynamic+Javascript+Plugin"&gt;Dynamic Javascript&lt;/a&gt; plugin. It had most of the features I needed to implement this Rails idiom with something like this: &lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;renderJavascript {&lt;br /&gt;    update 'errors_div', [text:g.render(template:"/common/errors_flash")]&lt;br /&gt;    callFunction "Element.show" , 'errors_div'&lt;br /&gt;    update 'show_activities', [text:g.render(template:"show_activities")]&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now, in places where I needed to update multiple elements on the page, I ended up using this style of code in the controller itself. However, the majority of the uses were the following:&lt;br /&gt;* Render an error div&lt;br /&gt;* Replace a content div w/ the content of a template&lt;br /&gt;* A combination of the two. &lt;br /&gt;&lt;br /&gt;As a result, I moved the following code into the parent class of my controllers: &lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;def js_error = { errors -&gt;&lt;br /&gt;    flash.error = errors&lt;br /&gt;    log.debug "Sending errors back to client: ${errors}"&lt;br /&gt;    renderJavascript {&lt;br /&gt;        update 'errors_div', [text:g.render(template:"/common/errors_flash")]&lt;br /&gt;        callFunction "Element.show" , 'errors_div'&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;def js_render = { replaceDiv,replaceContent -&gt;&lt;br /&gt;    renderJavascript {&lt;br /&gt;        replace replaceDiv, [text:replaceContent]&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;def js_error_and_replace = { errors, replaceDiv,replaceContent -&gt;&lt;br /&gt;    flash.error = errors&lt;br /&gt;    println "Found errors ${errors}"&lt;br /&gt;    renderJavascript {&lt;br /&gt;        update 'errors_div', [text:g.render(template:"/common/errors_flash")]&lt;br /&gt;        callFunction "Element.show" , 'errors_div'&lt;br /&gt;        replace replaceDiv, replaceContent&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Which significantly simplified the code in the actual controllers, e.g. : &lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;if (this.user.authenticate(user.login, changePasswordForm.password)) {&lt;br /&gt;    if (this.user.save()) {&lt;br /&gt;        flash.notice = "Password Changed"&lt;br /&gt;        js_render("change_password", g.render(template:"change_password_form"))&lt;br /&gt;    } else {&lt;br /&gt;        flash.notice = "Password could not be changed"&lt;br /&gt;        js_error(user.errors)&lt;br /&gt;    }&lt;br /&gt;} else {&lt;br /&gt;    println "Didn't authenticate w/ password"   &lt;br /&gt;    js_error_and_replace(changePasswordForm.errors,"change_password",[text:g.render(template:"change_password_form")])&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;As mentioned above (and as expected), Grails support redirects pretty nicely. However, Javascript redirects , though not necessarily tricky, still required an extra piece of code to the parent controller:&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;def js_redirect = { redirectUrl -&gt;&lt;br /&gt;    def jsRedirect = "document.location = \'$redirectUrl\'"    &lt;br /&gt;    renderJavascript {&lt;br /&gt;        appendJavascript jsRedirect;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;At which point, the code in the controller is really straightforward:&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;js_redirect(createLink(controller:'activities', action:'show',id:params.id))&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;However, one of the use cases involved a form executing in a frame (an upload form that did some status updates in a frame), which depending on the content returned in the frame, needed to redirect the whole browser window whenever the upload was done. In Rails it was handled as such: &lt;br /&gt;&lt;pre name="code" class="ruby"&gt;&lt;br /&gt;responds_to_parent do&lt;br /&gt;    render :update do |page|&lt;br /&gt;      flash[:notice] = "File Uploaded Sucessfully"&lt;br /&gt;      page.redirect_to :action =&gt;'show', :controller=&gt;'activities', :id=&gt;params[:activity_id]&lt;br /&gt;    end&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The code in the parent controller to support this idiom is as follows:&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;def parent_redirect = { redirectUrl -&gt;    &lt;br /&gt;    render (text : "&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;"+&lt;br /&gt;        "&amp;lt;script type='text/javascript' charset='utf-8'&amp;gt;"+&lt;br /&gt;            "var loc = document.location;"+&lt;br /&gt;            "with(window.parent) {"+&lt;br /&gt;            " setTimeout(function() { "+&lt;br /&gt;                    "window.eval(document.location = \'$redirectUrl\'); loc.replace('about:blank'); "+&lt;br /&gt;                "}, 1)"+&lt;br /&gt;            "}"+&lt;br /&gt;        "&amp;lt;/script&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;")&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;One final note on the Dynamic Javascript plugin : the plugin that is uploaded on the Grails wiki is version 0.1 . The plugin appears to not be maintained actively; however, the linked author's blog (http://blog.peelmeagrape.net/2007/10/9/dynamic-javascript-plugin-for-grails) has version 0.2 of the plugin. Still, when I was heavily using this plugin, I ran into some issues with it and had to patch it as follows (in plugins/dynamic-javascript-0.2/src/groovy/JavascriptBuilder.groovy , commented out code is the broken part):&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;    private String renderTemplate(Map options)&lt;br /&gt;    {&lt;br /&gt;//        StringWriter s = new StringWriter()&lt;br /&gt;//        GrailsWebRequest webRequest = (GrailsWebRequest)RequestContextHolder.currentRequestAttributes();&lt;br /&gt;//        HttpServletResponse response = webRequest.getCurrentResponse();&lt;br /&gt;//        def writer = (RoutablePrintWriter)webRequest.getOut()&lt;br /&gt;        return controller.g.render(options);&lt;br /&gt;//        writer.destination.out.toString();&lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I posted on the author's blog w/ the proposed change, and later on received a notification that he liked the change and that he would incorporate it into the plugin. However, it appears that the plugin on his page is still at version 0.2 and my comment has disappeared from the blog. Oh, well... &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;a href="#" name="conclusion"&gt;Conclusion&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;It was quite a journey so far. None of the problems in migrating controllers are particularly difficult or mind bending; however, there are just a lot of different issues to deal with if you're starting from scratch. So, now that you have all this good info, &lt;span style="font-weight:bold;"&gt;START MIGRATING THAT RAILS APP THAT YOU'VE BEEN EYEING, WOULD YA !!???!!!&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/19648744-6050026609053975937?l=www.troymaxventures.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.troymaxventures.com/feeds/6050026609053975937/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.troymaxventures.com/2009/05/converting-legacy-rails-apps-to-grails.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/6050026609053975937'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/6050026609053975937'/><link rel='alternate' type='text/html' href='http://www.troymaxventures.com/2009/05/converting-legacy-rails-apps-to-grails.html' title='Converting legacy Rails apps to Grails : The Controllers'/><author><name>Alex Kotchnev</name><uri>https://profiles.google.com/103108222242966756240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-_FzUCgGWKhc/AAAAAAAAAAI/AAAAAAAABGY/gikhtyKNdVc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_GbeUi4pR7kA/SgD9rY6qaLI/AAAAAAAAAjo/z1bHr8O5yEc/s72-c/rails_controllers.png' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19648744.post-6550335578525453645</id><published>2008-11-01T00:18:00.019-04:00</published><updated>2009-05-05T14:12:36.575-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='netbeans'/><category scheme='http://www.blogger.com/atom/ns#' term='grails'/><category scheme='http://www.blogger.com/atom/ns#' term='groovy'/><title type='text'>Converting legacy Rails apps to Grails : The Domain</title><content type='html'>&lt;span style="font-weight: bold;font-size:100%;" &gt;A little story about legacies...&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;(skip this if you're not interested in hearing a sobbing sentimental story and just want to get to the good stuff)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;First a short story about my usage of "legacy" in the title of the post. So, here it is : a few years ago, Rails explodes on the scene. Everybody around you who knows a thing or two about web apps start thinking and asking whether your next app should be in Rails instead of XXX [substitute your framework here]. Nevermind that you'll be writing an "enterprise application" that would most likely need to integrate with the rest of your infrastructure (Java, PHP, whatever), or that the said application might have some performance requirements (e.g. it actually needs to DO something, instead of just pushing a few form feelds from and to the database).&lt;br /&gt;&lt;br /&gt;Alright, so, Ruby is cool, Ruby is all the rage. You bring in that intern that seems to be a Rails wizard, he totally blinded you with how he put together an app w/ 3-4 forms in less than an hour. Nobody on your existing team can do that : they want to "think about the problem", "understand what needs to be done", put some thought into how to do it, and only then start writing the code. Not so w/ your superstar intern : he's banging out page after page, form after form, it's glitzy and it's Ajaxy, your heart is about to melt from the love towards your unexpected intern saviour.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Fast forward to a few years later. Your intern is gone, he's onto his next new and exciting gig. Your loyal developers have learned a few tricks from the now "old and crusty" Rails app, you got the next version of your Java web framework and your devs are doing quite better with giving you the "quick forms" when you need them. Your customers, initially raving about how quickly they got their app, are now increasingly annoyed that when they ask for what is seemingly simple feature (e.g. hook into this other database that's not mysql, talk to that 'other app' that's been there for a while) and your estimates are way too high ('cause you have to write all that stuff from scratch). To make things worse, your developers actually popped the hood on the Rails app, and it's a big happy bowl of spaghetti : the controllers have their hands in everything : poking around the database, spitting back dynamic javascript groping the glitzy UI in the most unbelievable places (and btw, your devs don't want to touch it with a ten foot pole). When your company scored that big customer, everybody was enamoured by the cha-ching of the cash register, but nobody thought that all those new users will want to use your intern's app (which btw, turned out to not know much about web apps in general, as Rails was the first thing he learned), and now both new and existing customers are not so happy that it takes longer and longer for the app to service them. On top of that, there are very few people who do understand all the magic that happens under the hood in the Rails app, and there are yet fewer people who know how to scale it to the level you need.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.archives.gov.on.ca/english/exhibits/christmas03/pics/3772_locomotive_820.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 820px; height: 522px;" src="http://www.archives.gov.on.ca/english/on-line-exhibits/christmas-03/pics/3772_locomotive_820.jpg" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;That's the place where the phrase "Legacy Rails" really starts making sense. Sure, there are new releases that promise a little more glitz to your app, the framework is still being actively developed, and nearly everyone out there has heard of Rails by now. But now that you're in this situation, can you really put your job on the line that just this next release will have the promised silver bullet ? Or would it maybe be better to just move the game back into your home court, where you set the rules, your dev team knows the ins and outs of the technology like the back of their hand, it scales well, integrates with EVERYTHING you could imagine ? That's when you really want that little Rails locomotive to let off some steam and disappear into the distance just as quickly as it arrived.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Anyway, I digress :-) Back to what I was talking about : how do you migrate the app to Grails.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;Now The Goodies&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Below is a sample Rails model class that we'll use to talk about the migration:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="ruby"&gt;&lt;br /&gt;class Activity &lt; ActiveRecord::Base&lt;br /&gt;  has_many :activity_items&lt;br /&gt;  has_many :user_notes  &lt;br /&gt;  belongs_to :competency_group&lt;br /&gt;  belongs_to :course&lt;br /&gt;  &lt;br /&gt;  has_many :activity_item_assets&lt;br /&gt;   &lt;br /&gt;  belongs_to :created_by, :class_name =&gt; "User", :foreign_key =&gt; "created_by"&lt;br /&gt;  belongs_to :updated_by, :class_name =&gt; "User", :foreign_key =&gt; "updated_by"&lt;br /&gt;  &lt;br /&gt;  validates_presence_of :title, :instruction_text, :competency_group_id&lt;br /&gt;  validates_length_of :title, :maximum  =&gt; AdminType::COURSE_TITLE_LENGTH&lt;br /&gt;  validates_uniqueness_of :title, :scope =&gt; [:competency_group_id]&lt;br /&gt;  &lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And the equivalent Grails domain object:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;&lt;br /&gt;class Activity {&lt;br /&gt;&lt;br /&gt;String title, instructionText&lt;br /&gt;Date createdAt, updatedAt&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;static hasMany = [activityItems : ActivityItem, userNotes : UserNote, activityItemAssets:ActivityItemAsset]&lt;br /&gt;static belongsTo = [competencyGroup:CompetencyGroup, course : Course, createdBy : User, updatedBy : User]&lt;br /&gt;&lt;br /&gt;static constraints = {&lt;br /&gt;   title(nullable:false,blank:false,size:1..AdminType.COURSE_TITLE_LENGTH,unique:['competencyGroup'])&lt;br /&gt;   instructionText(nullable:false, blank:false)&lt;br /&gt;   createdAt(nullable:true)&lt;br /&gt;   updatedAt(nullable:true)&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;static mapping = {&lt;br /&gt;   table 'activities'&lt;br /&gt;   createdBy column:'created_by'&lt;br /&gt;   updatedBy column:'updated_by'&lt;br /&gt;   version false&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1. Location &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Both Rails and Grails have a specific place where you can keep your domain objects. In Rails, you keep it in the app/models directory (the Models directory in your NetBeans project), whereas in Grails it's in grails-app/domain directory (the Domain Classes folder in the NetBeans project).&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;2. Purpose &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In both cases, the purpose of the domain objects represent the most important concepts in your application. Additionally, they typically are "persistence capable" (e.g. you can persist an instance w/ a single call), and they provide for a fairly simple specification of relationships w/ other domain objects, as well as allow for specifying validation rules.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_GbeUi4pR7kA/SQztC77HyQI/AAAAAAAAAgw/AYBZir0XTjM/s1600-h/grails_new_domain_class.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 400px; height: 259px;" src="http://1.bp.blogspot.com/_GbeUi4pR7kA/SQztC77HyQI/AAAAAAAAAgw/AYBZir0XTjM/s400/grails_new_domain_class.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5263842699190454530" /&gt;&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_GbeUi4pR7kA/SQzuS3-zYXI/AAAAAAAAAg4/F3TyGF4wTYQ/s1600-h/grails_new_domain_class_wizard.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 320px; height: 220px;" src="http://1.bp.blogspot.com/_GbeUi4pR7kA/SQzuS3-zYXI/AAAAAAAAAg4/F3TyGF4wTYQ/s320/grails_new_domain_class_wizard.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5263844072521687410" /&gt;&lt;/a&gt;&lt;br /&gt;NetBeans provides fairly basic support for creating the domain objects : you get a little wizard that asks for the name of the domain object and it creates the Groovy class for you. One of the cool things about how NetBeans handles Grails is that it doesn't create any new metadata (e.g. there's no project directory created), and because the NetBeans project system is based on Ant, the NetBeans project simply delegates the creation of the domain class to the Grails Ant scripts. &lt;br /&gt;&lt;br /&gt;Note that when you're looking at the differences between the Grails and the Rails classes, you will notice that (by design), the Grails class is much more focused on the domain, whereas the Rails class is much closer to the database. Thus, for example, you will notice that in the last line of the Rails validation, it references the "competency_group_id". I would imagine this is where my lack of knowledge of the Rails CoC (convention over configuration) bit me in the back, but in a number of places (that I'll mention), the Rails code is allowed to reference "assumed" column names (based on the CoC), which is generally confusing, and also seems to be very refactoring unfriendly (e.g. what if at some point in life, I needed to have a slightly different colum name - would I have to hunt down &lt;span style="font-weight: bold;"&gt;all&lt;/span&gt; references to that column)???&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;3. Class properties &amp;amp; Relationships&lt;/span&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;&lt;br /&gt;class Activity {&lt;br /&gt;&lt;br /&gt;   String title, instructionText&lt;br /&gt;   Date createdAt, updatedAt&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   static hasMany = [activityItems : ActivityItem, userNotes : UserNote, activityItemAssets:ActivityItemAsset]&lt;br /&gt;   static belongsTo = [competencyGroup:CompetencyGroup, course : Course, createdBy : User, updatedBy : User]&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Migrating the class properties &amp;amp; relationships is pretty straightforward. For each "simple" property in the Rails class, you can declare a corresponding one in the Groovy class. Declaring the equivalent relationships in the Grails class is also quite straightforward, as the relationship names are pretty much the same. Although there is nothing in Groovy that prevents you from using the Rails naming conventions for properties (e.g. user_name), the Groovy convention is very much like in Java - CamelCase.&lt;br /&gt;&lt;br /&gt;This is probably due to my Java background, but I found the ability to declare a class member variable anywhere in the Ruby class much less readable than the equivalent Groovy class. What I mean is that, in the example above, the ":title" property is not mentioned anywhere before the validation constraint. Thus, in order to figure out the properties, you need to examine not only the relationships but also all validation constraints. Although in the Groovy class, the declaration of the relationships similarly defines properties in the class, but at least in validation, mapping, etc. you definitely need to refer to properties that are declared somewhere. I guess this probably comes down to preference, but in my opinion, looking at the Grails class, I can see all the available properties at a glance.&lt;br /&gt;&lt;br /&gt;In a very similar manner, I find that even the relationship declarations are very much more readable in Grails. One glance, and I can recognize all relationship types (e.g. one to one, many-to-one, whatever) and the properties corresponding to those relationships. In contrast, although the same can be accomplished in the Rails declarations (e.g. if you specify all has_one mentions one after another), not all Rails model classes that I had to look at followed such a convention.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;4. Validation &lt;/span&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;static constraints = {&lt;br /&gt;   title(nullable:false,blank:false,size:1..AdminType.COURSE_TITLE_LENGTH,unique:['competencyGroup'])&lt;br /&gt;   instructionText(nullable:false, blank:false)&lt;br /&gt;   createdAt(nullable:true)&lt;br /&gt;   updatedAt(nullable:true)&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Once again, migrating the Rails validations is pretty straightforward, although not all Rails validations had a 1:1 translation in Grails. This is where &lt;a href="http://grails.org/doc/1.0.x/guide/single.html#7.%20Validation"&gt;the validation section of the Grails manual &lt;/a&gt; came in very handy, expecially during the first steps in the conversion when I wasn't really sure how to convert from one constraint in Rails to its Grails counterpart.&lt;br /&gt;&lt;br /&gt;One thing to notice that is subtle but different between the Grails and Rails validations. In Grails, if a class property is not explicitly declared as "nullable", it is by default required. On quite a few occasions during the conversion, after initially migrating the explicit Rails constraints, I found myself going back to the domain class in order to make some of the Grails domain class fields optional.&lt;br /&gt;&lt;br /&gt;One final point on validation is the  title uniqueness constraint. In Rails it looks like :&lt;br /&gt;&lt;pre name="code" class="ruby"&gt;&lt;br /&gt;validates_uniqueness_of :title, :scope =&gt; [:competency_group_id]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And in Grails it is :&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;title(nullable:false,blank:false,size:1..AdminType.COURSE_TITLE_LENGTH,unique:['competencyGroup'])&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The thing to notice here is that Rails directly goes to the colum name, whereas Grails just uses the property name declared in the class.&lt;br /&gt;&lt;br /&gt;Once again, I find the Grails validation section much more readable, as all constraints are organized in one section, and they're organized around the concepts that a user cares about. Thus, when I'm thinking about the validations that apply to a title, I can specify all constraints in the title constraints, compared to the Rails style, where the declarations are focused around the constraints (e.g. when you are thinking about a concept in the domain, do you think "Hm, let me figure out which properties of this class might need a format constraint?", or do you think "Hm, let me see, a title, what kind of constraints might it need, maybe a format constraint?"&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;5. Mapping into the database &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;&lt;br /&gt;static mapping = {&lt;br /&gt;   table 'activities'&lt;br /&gt;   createdBy column:'created_by'&lt;br /&gt;   updatedBy column:'updated_by'&lt;br /&gt;   version false&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;As you see in the "mapping" section of the Grails class, there were a few attributes that needed to mapped explicitly. The reason I had to do this is that at least during the initial migration, it was preferable that the Rails and Grails app work off the same database schema, so that the two apps can be tested side-by-side on the same data.&lt;br /&gt;&lt;br /&gt;The mapping of the Grails app into the Rails database was pretty straightforward, as they follow very similar naming conventions for naming the database columns. First, Rails has the habit of converting the domain class names to plural for the table names, thus I had to add the mapping in the Grails app to point to the same tables. Additionally, the Rails class explicitly stated that the foreign keys that connect the user and activity are "created_by" and "updated_by", whereas the default Grails naming convention for the foreign keys would have been "created_by_id" and "updated_by_id", hence the additional mapping.&lt;br /&gt;&lt;br /&gt;You will additionally notice the explicit disabling of the "version" column in the Grails class. The issue here is that by default, Grails uses a "version" column in order to allow Hibernate to do optimistic locking in transactions. Note that removing the version column from the Grails  app has its penalties; however, at least in the initial implementation it was more important to have the same database schema, than to focus on performance. Although initially (before disabling the column) Grails very gracefully handled the addition of the new "version" column to the database, it became an issue when the column was added on a populated database, and the version would receive a null default value. Thus, had I decided to keep it for each table, I would have had to update the version column manually to contain 0 (so that Grails could increment as necessary, otherwise a NPE came up when Grails pulled a null from the database).&lt;br /&gt;&lt;br /&gt;It is recommended that such a version column is restored after the initial migration period in order to allow Hibernate to make use of its optimistic locking performance optimizations.&lt;br /&gt;&lt;br /&gt;6. Non persistent attributes&lt;br /&gt;By default, all attributes defined in the class are persisted in the database. Now, in the example of the User class below, the cleartext password really shouldn't be persisted. Rails gets around it by  declaring it as a virtual attribute:&lt;br /&gt;&lt;pre name="code" class="ruby"&gt;&lt;br /&gt;class User &lt; ActiveRecord::Base  &lt;br /&gt;  # Virtual attribute for the unencrypted password&lt;br /&gt;  attr_accessor :password&lt;br /&gt;  &lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The Grails domain class takes a slightly different approach, where the field is still declared, but is also mentioned in a special class attribute to indicate to Grails that the field shouldn't be persisted , and the 'password false' in the mapping section to indicate that a column shouldn't be created in the database.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;class User {&lt;br /&gt;    static mapping = {&lt;br /&gt;       table 'users'&lt;br /&gt;       password false&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    static transients = [ "password"]&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;7. Persistence events&lt;br /&gt;&lt;pre name="code" class="java"&gt;&lt;br /&gt;class Foo {&lt;br /&gt;    def beforeInsert = {&lt;br /&gt;        makeActivationCode()&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;As mentioned above, Rails supports the ability to automatically hook into the persistence events , in the case above, to execute the specified closure at a particular point in the persistence lifecycle. Grails doesn't support this out of the box, but it is extremely easy to accomplish the same functionality by installing the Grails &lt;a href="http://docs.codehaus.org/display/GRAILS/Hibernate+Events+Plugin"&gt;Hibernate Events Plugin&lt;/a&gt;, and then specify a couple of specially named closures&lt;br /&gt;&lt;br /&gt;All in all, throughout the whole conversion I had the feeling that when the Grails folks sat down to figure out how to do things, they put a little bit of thought into how developers actually work with domain classes, what's readable, and what's not, whereas the Rails approach has a little bit more of a "hacked up" feel to it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/19648744-6550335578525453645?l=www.troymaxventures.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.troymaxventures.com/feeds/6550335578525453645/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.troymaxventures.com/2008/10/converting-legacy-rails-apps-to-grails_31.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/6550335578525453645'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/6550335578525453645'/><link rel='alternate' type='text/html' href='http://www.troymaxventures.com/2008/10/converting-legacy-rails-apps-to-grails_31.html' title='Converting legacy Rails apps to Grails : The Domain'/><author><name>Alex Kotchnev</name><uri>https://profiles.google.com/103108222242966756240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-_FzUCgGWKhc/AAAAAAAAAAI/AAAAAAAABGY/gikhtyKNdVc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_GbeUi4pR7kA/SQztC77HyQI/AAAAAAAAAgw/AYBZir0XTjM/s72-c/grails_new_domain_class.png' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19648744.post-6271821059087895391</id><published>2008-10-23T23:23:00.009-04:00</published><updated>2009-01-09T14:41:27.432-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='netbeans'/><category scheme='http://www.blogger.com/atom/ns#' term='grails'/><category scheme='http://www.blogger.com/atom/ns#' term='groovy'/><title type='text'>Converting legacy Rails apps to Grails (with NetBeans) : General Project Setup</title><content type='html'>It is hard to describe the pleasure of writing the title above, especially the "legacy" part :-) Although lately the jumping up and down of Ruby &amp; Rails fanboys has subsided a little, after &lt;a href="http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html"&gt;people started realizing&lt;/a&gt; that Rails is not going to kill anything (much less Java, hell if PHP people start going back to PHP that says A LOT!!!). So, a few years later I got a chance to chime in on the subject. &lt;br /&gt;&lt;br /&gt;Anyway, the specific reason for writing this post is that I had a chance to take an existing Rails app, and move it to Grails. Some of the reasons for even attempting is that as much effort and hype has gone into Ruby and Rails, the (C)Ruby is not even close in being able to integrate with everything else like Java can. When you throw into the mix that even JRuby is starting to be faster than (C)Ruby, and that Groovy kicks the pants out of JRuby, there's also a performance story to be told for Grails. Finally, when you throw in the existence of a clear migration path in performance sensitive Groovy/Grails components directly into java (e.g. moving Groovy controllers to Spring MVC controllers, or Groovy services to Java services), migrating from Rails to Grails for integration for performance purposes is just a no brainer. &lt;br /&gt;&lt;br /&gt;Anyway, enough of this high level stuff. I'm sure that if some Rails fanboys get a hold of this article, I'll probably get flamed with claims how Ruby &amp; Rails can perform, and who knows what else, but I'll just leave the high level stuff at what I said above, and I'll focus on on comparing what I saw in Rails from the point of view of a  Grails (and long term Java) developer. Additionally, I will be using a daily NetBeans 6.5 build (very close to RC1) to illustrate the steps I take along the way. &lt;br /&gt;&lt;br /&gt;So, let's get started. &lt;br /&gt;&lt;br /&gt;1. First, getting started with a project. In both Grails and Rails it's very simple to get started with the facilities NetBeans provides. For both Grails and Rails , NetBeans 6.5 provides wizards for creating a new project. &lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_GbeUi4pR7kA/SQFKvqCflfI/AAAAAAAAAfU/0qWocCcgZ1Q/s1600-h/new_grails_project_setup.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 134px;" src="http://1.bp.blogspot.com/_GbeUi4pR7kA/SQFKvqCflfI/AAAAAAAAAfU/0qWocCcgZ1Q/s320/new_grails_project_setup.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5260568022344504818" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_GbeUi4pR7kA/SQFK5-d6RGI/AAAAAAAAAfc/p_h9WxMGshw/s1600-h/new_rails_project_setup2.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 320px; height: 132px;" src="http://1.bp.blogspot.com/_GbeUi4pR7kA/SQFK5-d6RGI/AAAAAAAAAfc/p_h9WxMGshw/s320/new_rails_project_setup2.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5260568199626900578" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Now, a few comments on the contents of the screenshots. First of all, NetBeans 6.5 ships directly with Groovy &amp; Grails support for the "Java" packaged download (e.g. from http://download.netbeans.org/netbeans/6.5/rc/). In contrast, for the Ruby/Rails support, you have to either download the Ruby package from the same location, or after downloading the Java installer / package, you have to go to the plugin center and install the Ruby/Rails plugin (either way, quite easy). Secondly, when you look at the options for Ruby/Rails projects, you might think that there are more options w/ Ruby and Rails, but it is actually quite deceiving. The reason that there are no separate options to create a "new Grails app w/ existing sources" is that NetBeans totally rocks and can directly open an existing Grails project without having to add any additional project data. On the Groovy front, you can just add Groovy scripts and classes into any Java project, so the extra options in the project menu are just not needed. &lt;br /&gt;&lt;br /&gt;So, at first glance, very marginally and despite the outstanding NetBeans Ruby/Rails support, Grails scores the first point for me. &lt;br /&gt;&lt;br /&gt;2. Second, I had to figure out what the general setup of a Rails app. Here's what a typical project structure looks like in both Grails and Rails: &lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_GbeUi4pR7kA/SQFNfYC-VGI/AAAAAAAAAfk/Av4lROz8QE4/s1600-h/grails_project_setup.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 285px; height: 312px;" src="http://3.bp.blogspot.com/_GbeUi4pR7kA/SQFNfYC-VGI/AAAAAAAAAfk/Av4lROz8QE4/s320/grails_project_setup.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5260571041171657826" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_GbeUi4pR7kA/SQFNmutiLrI/AAAAAAAAAfs/u3Ktrd9A1XE/s1600-h/rails_project_setup1.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 234px; height: 320px;" src="http://4.bp.blogspot.com/_GbeUi4pR7kA/SQFNmutiLrI/AAAAAAAAAfs/u3Ktrd9A1XE/s320/rails_project_setup1.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5260571167514832562" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Now, comparing the two project structures, it's very easy to get around the Rails app if you're familiar w/ a Grails project layout. A couple of things to note in the Rails project structure : &lt;br /&gt;* The root of the web app is in the "Public" directory in the Rails app, while in the Grails project it's in the "Web Application" project folder. &lt;br /&gt;* There is a "helpers" folder in the Rails app, which initially puzzled me. In most general terms, the helpers folder contains "controller helpers". Roughly speaking, the functionality that existed in "helpers" in the Rails app eventually founds its way in taglibs in the Grails app. Although I'm not 100% certain of the convention and usage of these helper methods in the Rails app, it seemed like the Rails active scaffold seemed to use some parts of what's in the helpers (however, i could be wrong). &lt;br /&gt;* There is the "Migrations" folder in the Rails project, which seems to be generally useful and not present in the Grails app. Now, I would imagine that such a database centric functionality might not be that relevant in a Grails app, as a Grails app really isn't as aware of the database (as it deals w/ the domain model and not database columns as the Rails app does). Still, it seems like because Grails apps end up very much data driven, some method of managing the schema modifications could be generally useful (although, I really don't have any specific suggestions of what such a tool might be). &lt;br /&gt;* (although you don't see this in the screenshots) If you had plugins installed into your Grails app, you would have a "Plugins" folder, which is roughly equivalent to the Rails "Vendors" foler. &lt;br /&gt;* Finally, the Grails app has a folder called "Services" for creating transactional services , for which the Rails app doesn't have an explicit counterpart. More on transaction handling later. &lt;br /&gt;&lt;br /&gt;All in all, in the rest of the project layout, they're very similar, and if one knows the one framework, it's pretty straightforward to grok the other one. &lt;br /&gt;&lt;br /&gt;Alright, this is the general setup stuff so far. I have a lot more to write about : plugins, ajax support, services, transactions, the whole nine yards. Just to give you a sneak preview, the bottom line is that migrating a Rails app to Grails works very nicely, although not without a few minor hurdles to jump over. More on that in the next post, stay tuned...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/19648744-6271821059087895391?l=www.troymaxventures.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.troymaxventures.com/feeds/6271821059087895391/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.troymaxventures.com/2008/10/converting-legacy-rails-apps-to-grails.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/6271821059087895391'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/6271821059087895391'/><link rel='alternate' type='text/html' href='http://www.troymaxventures.com/2008/10/converting-legacy-rails-apps-to-grails.html' title='Converting legacy Rails apps to Grails (with NetBeans) : General Project Setup'/><author><name>Alex Kotchnev</name><uri>https://profiles.google.com/103108222242966756240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-_FzUCgGWKhc/AAAAAAAAAAI/AAAAAAAABGY/gikhtyKNdVc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_GbeUi4pR7kA/SQFKvqCflfI/AAAAAAAAAfU/0qWocCcgZ1Q/s72-c/new_grails_project_setup.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19648744.post-6127277507107329490</id><published>2008-05-15T02:41:00.017-04:00</published><updated>2008-12-10T03:50:48.859-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tapestry'/><category scheme='http://www.blogger.com/atom/ns#' term='netbeans'/><title type='text'>Tapestry5 NetBeans Quickstart</title><content type='html'>I have been following the development of Tapestry 5 closely for the last couple of months, and I even got the first Tapestry 5 book that came out. I'm a big Tapestry fan, and I've been looking forward to the new Tapestry 5 release. I even lucked out and had a chance to talk to &lt;a href="http://tapestryjava.blogspot.com/"&gt;Howard&lt;/a&gt; in person:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_GbeUi4pR7kA/SCveQnOb0UI/AAAAAAAAAUU/8pm_V7zUJ7w/s1600-h/nfjs_howard.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_GbeUi4pR7kA/SCveQnOb0UI/AAAAAAAAAUU/8pm_V7zUJ7w/s400/nfjs_howard.jpg" alt="" id="BLOGGER_PHOTO_ID_5200494571718168898" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;One of the cool things that keeps drawing me towards Tapestry is the goal to make it really easy and intuitive to work with. One of the goals that I remember hearing for Tapestry 5 was to make it that easy, that it would compete more w/ Grails &amp;amp; Rails and not so much w/ traditional Java Web app frameworks (e.g. Struts, Struts2, etc)&lt;br /&gt;&lt;br /&gt;However, when I first took a look at Tapestry 5, I was a little disappointed by the six line Maven command that one had to type in when starting a new project (e.g. see http://tapestry.apache.org/tapestry5/tutorial1/first.html):&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;mvn archetype:create&lt;br /&gt;-DarchetypeGroupId=org.apache.tapestry&lt;br /&gt;-DarchetypeArtifactId=quickstart&lt;br /&gt;-DgroupId=org.apache.tapestry&lt;br /&gt;-DartifactId=tutorial1&lt;br /&gt;-DpackageName=org.apache.tapestry.tutorial&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Compare that with Grails:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;grails create-app&lt;br /&gt;&lt;br /&gt;Welcome to Grails 1.0 - http://grails.org/&lt;br /&gt;Licensed under Apache Standard License 2.0&lt;br /&gt;Grails home is set to: /usr/local/java/grails&lt;br /&gt;Application name not specified. Please enter:&lt;br /&gt;FooApp&lt;br /&gt;---------------&lt;br /&gt;[propertyfile] Updating property file: /home/polrtex/temp/FooApp/application.properties&lt;br /&gt;Created Grails Application at /home/polrtex/temp/FooApp&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;It is true that one doesn't create an application all that often, and copy-and-pasting&lt;br /&gt;these initial 5-6 lines would not be that big of a deal. However, for a newcomer, the Tapestry 5 experience has to be really smooth and starting a new app should be a breeze.&lt;br /&gt;&lt;br /&gt;So, you would say, what does this have to do with NetBeans ?&lt;br /&gt;&lt;br /&gt;Here it comes. As usual, NetBeans rocks everyone's socks, by lowering the entry barrier into starting an application. Here are the first steps (equivalent to the first two pages of the Tapestry tutorial : http://tapestry.apache.org/tapestry5/tutorial1/env.html). Here is what you need to do:&lt;br /&gt;( Assuming that you already have a good install of NetBeans 6.1).&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Install the NetBeans Maven plugin by going into Tools -&gt; Plugins . Type "maven" in the upper-left corner search box and install the plugin. The result should look something like this:&lt;pre&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_GbeUi4pR7kA/SCvgiXOb0WI/AAAAAAAAAUk/rS9Y8nDnDQ0/s1600-h/t5_netbeans_maven_plugin.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_GbeUi4pR7kA/SCvgiXOb0WI/AAAAAAAAAUk/rS9Y8nDnDQ0/s400/t5_netbeans_maven_plugin.png" alt="" id="BLOGGER_PHOTO_ID_5200497075684102498" border="0" /&gt;&lt;/a&gt;&lt;/pre&gt; &lt;/li&gt;&lt;li&gt;Create a new Maven project   &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_GbeUi4pR7kA/SCvhjnOb0XI/AAAAAAAAAUs/aMcOjEkD-So/s1600-h/t5_netbeans_getting_new_project_pg1.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_GbeUi4pR7kA/SCvhjnOb0XI/AAAAAAAAAUs/aMcOjEkD-So/s400/t5_netbeans_getting_new_project_pg1.png" alt="" id="BLOGGER_PHOTO_ID_5200498196670566770" border="0" /&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Expand the "Archetypes from remote Maven repositories" and scroll down to find the Tapestry5 quickstart archetype . You might want to pay close attention to the description and select the latest archetypes (in my case, for 5.0.11)&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_GbeUi4pR7kA/SCvidHOb0YI/AAAAAAAAAU0/6EQ4X3Vu0r8/s1600-h/t5_netbeans_getting_new_project_pg2.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_GbeUi4pR7kA/SCvidHOb0YI/AAAAAAAAAU0/6EQ4X3Vu0r8/s400/t5_netbeans_getting_new_project_pg2.png" alt="" id="BLOGGER_PHOTO_ID_5200499184513044866" border="0" /&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Now that you have the nice wizard, fill out the configuration attributes to specify the group id, the location of the project, the name of the project, etc. &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_GbeUi4pR7kA/SCvi6nOb0ZI/AAAAAAAAAU8/DXMqCAuMw8w/s1600-h/t6_netbeans_getting_new_project_pg3.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_GbeUi4pR7kA/SCvi6nOb0ZI/AAAAAAAAAU8/DXMqCAuMw8w/s400/t6_netbeans_getting_new_project_pg3.png" alt="" id="BLOGGER_PHOTO_ID_5200499691319185810" border="0" /&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;When you hit Finish, Maven will start downloading all the dependencies and setting up your project.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Your new and shiny project is ready to go. Go into the project Properties and select your desired server to deploy to:&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_GbeUi4pR7kA/SCvj9XOb0aI/AAAAAAAAAVE/Ir1_l8GJXvY/s1600-h/t5_netbeans_select_server.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_GbeUi4pR7kA/SCvj9XOb0aI/AAAAAAAAAVE/Ir1_l8GJXvY/s400/t5_netbeans_select_server.png" alt="" id="BLOGGER_PHOTO_ID_5200500838075453858" border="0" /&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Run the project from the project context menu and you're up and running !!!! &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_GbeUi4pR7kA/SCvkxXOb0cI/AAAAAAAAAVU/xPBVno6BcqQ/s1600-h/t9_netbeans_new_project_run0.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_GbeUi4pR7kA/SCvkxXOb0cI/AAAAAAAAAVU/xPBVno6BcqQ/s320/t9_netbeans_new_project_run0.png" alt="" id="BLOGGER_PHOTO_ID_5200501731428651458" border="0" /&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;One very cool option that makes the Tapestry 5 setup almost identical to the Grails setup is the ability to run the application in Jetty by going to the command line and running:&lt;br /&gt;mvn jetty:run&lt;br /&gt;&lt;br /&gt;The upside of doing this is that after you run it, there is no deployment step. Tapestry supports reloading of the page templates as well as the page classes. As a result, whenever you make a change to a page, you can save it, refresh the browser and see the changes . Similarly, when you make a change to a class, compile it and the changes are immediately visible to the application. Such a setup really cuts down on waiting for the app to deploy. &lt;br /&gt;&lt;br /&gt;So now, looking back a little bit, this setup is indeed very competitive w/ the Grails setup. In Grails, you would download the Grails distribution, and then would run the "grails create-app" command to create the new project. Grails would then prompt you for some properties (e.g. project name) and you're done. For Tapestry, it's quite similar; however, instead of downloading the Tapestry distribution, you would simply download Maven2 (or in the case of NetBeans, you would install the NetBeans plugin). Even better for Tapestry, if you already have Maven install, then starting a new app becomes a zero cost operation : you just specify the command line args (or better yet, use NetBeans to create the new app) and you're on your way, all dependencies already in place. &lt;br /&gt;&lt;br /&gt;So, so far it's a tie between Grails and Tapestry. Grals vs Tapestry = 1:1&lt;br /&gt;&lt;br /&gt;Enjoy your shiny and new Tapestry 5 app in NetBeans !!!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/19648744-6127277507107329490?l=www.troymaxventures.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.troymaxventures.com/feeds/6127277507107329490/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.troymaxventures.com/2008/05/tapestry5-netbeans-quickstart.html#comment-form' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/6127277507107329490'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/6127277507107329490'/><link rel='alternate' type='text/html' href='http://www.troymaxventures.com/2008/05/tapestry5-netbeans-quickstart.html' title='Tapestry5 NetBeans Quickstart'/><author><name>Alex Kotchnev</name><uri>https://profiles.google.com/103108222242966756240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-_FzUCgGWKhc/AAAAAAAAAAI/AAAAAAAABGY/gikhtyKNdVc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_GbeUi4pR7kA/SCveQnOb0UI/AAAAAAAAAUU/8pm_V7zUJ7w/s72-c/nfjs_howard.jpg' height='72' width='72'/><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19648744.post-2860095315227702766</id><published>2008-05-02T23:35:00.003-04:00</published><updated>2008-05-02T23:45:21.142-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='plugins'/><category scheme='http://www.blogger.com/atom/ns#' term='netbeans'/><title type='text'>Quick File Chooser in NetBeans 6.1</title><content type='html'>I'm on a roll today, but I thought I'd drop this tip as well.&lt;br /&gt;&lt;br /&gt;I'm a big fan of the NetBeans Quick File Chooser plugin, it makes it oh-so-easy to open up a file without having to detach my fingers from the keyboard. So, if you Google for the plugin, you'll find &lt;a href="http://blogs.sun.com/tor/entry/netbeans_plugins_i_use_part1"&gt;Tor's recommendation&lt;/a&gt;  of the same; however, you can't find it on the &lt;a href="http://plugins.netbeans.org/"&gt;Plugin Center&lt;/a&gt; . So, what if you really wanted to use the Quick File Chooser, in NetBeans 6.1, what should you do ? In the past, I've always copied the plugin with my netbeans preferences from the previous version that I've used, and it's worked OK. However, I decided on a clean NetBeans install on my home laptop, and I couldn't get my hands on it.&lt;br /&gt;&lt;br /&gt;So, I followed a tip from &lt;a href="http://blogs.sun.com/octav/entry/bleeding_edge_plugins"&gt;Octavian's blog&lt;/a&gt;    , added the Netbeans Latest Build update center, and ... voila, the Quick File Chooser is in the list of available plugins. Since it doesn't depend on any of the features of 6.1+ code, it works great in 6.1 as well.   &lt;a href="http://plugins.netbeans.org/"&gt;&lt;span style="display: block;" id="formatbar_Buttons"&gt;&lt;span class="on" style="display: block;" id="formatbar_CreateLink" title="Link" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmouseup="" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 8);ButtonMouseDown(this);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/19648744-2860095315227702766?l=www.troymaxventures.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.troymaxventures.com/feeds/2860095315227702766/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.troymaxventures.com/2008/05/quick-file-chooser-in-netbeans-61.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/2860095315227702766'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/2860095315227702766'/><link rel='alternate' type='text/html' href='http://www.troymaxventures.com/2008/05/quick-file-chooser-in-netbeans-61.html' title='Quick File Chooser in NetBeans 6.1'/><author><name>Alex Kotchnev</name><uri>https://profiles.google.com/103108222242966756240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-_FzUCgGWKhc/AAAAAAAAAAI/AAAAAAAABGY/gikhtyKNdVc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19648744.post-3166605318957869556</id><published>2008-05-02T13:26:00.009-04:00</published><updated>2008-12-10T03:50:49.126-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='netbeans'/><category scheme='http://www.blogger.com/atom/ns#' term='junit'/><title type='text'>Freeform projects NetBeans JUnit test results : binding output to source code</title><content type='html'>As I had mentioned in a &lt;a href="http://www.troymaxventures.com/2007/05/junit-results-in-free-form-projects.html"&gt;prior post&lt;/a&gt; a while back, it is pretty straightforward to bind the output of a Freeform Project JUnit task to the NetBeans JUnit test results. However, there are a couple of minor tweaks that I find myself making and forgetting, so, I thought I'd drop a blog entry, even just as a reminder for myself.&lt;br /&gt;&lt;br /&gt;First, make sure that the JUnit task as a showoutput="true" attribute and has a formatter that explicitly states that doesn't use a file, e.g.&lt;br /&gt;&lt;br /&gt;&amp;lt;&lt;span style="font-weight: bold;"&gt;formatter usefile="false" &lt;/span&gt;type="brief"/&amp;gt;&lt;br /&gt;&lt;br /&gt;Emphasis on not using a file : e.g. you can use an xml formatter and it would work; however, if you don't specify the usefile="false" attribute, everything goes to the file and NetBeans doesn't get a chance to capture the output and display the results in a nice JUnit test results tree. As a result, the best combination ends up being a combination of a xml formatter that outputs to a file, and a brief formatter that doesn't, e.g. :&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;junit fork="yes" printsummary="withOutAndErr" &lt;span style="font-weight: bold;"&gt;showoutput="true"&lt;/span&gt;                  errorProperty="test.failed"            failureProperty="test.failed" filtertrace="false"&amp;gt;&lt;br /&gt;         &amp;lt;formatter type="xml"&amp;gt;&lt;br /&gt;         &lt;span style="font-weight: bold;"&gt;&amp;lt;formatter usefile="false" type="brief" /&amp;gt;&lt;/span&gt;&lt;br /&gt;         &amp;lt;classpath refid="whatever-path-id"&amp;gt;&lt;br /&gt;&amp;lt;/classpath&amp;gt;&lt;br /&gt;&amp;lt;/junit&amp;gt;&lt;br /&gt;&lt;br /&gt;The second important part of working with the JUnit results in NetBeans is to make sure that when a test fails, when you click on the failure in the JUnit results, you want NetBeans to take you to the right line in the source code:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_GbeUi4pR7kA/SBtQ6nbLeUI/AAAAAAAAAT0/3Sz1KBQp7t8/s1600-h/netbeans_junit_beauty.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_GbeUi4pR7kA/SBtQ6nbLeUI/AAAAAAAAAT0/3Sz1KBQp7t8/s320/netbeans_junit_beauty.png" alt="" id="BLOGGER_PHOTO_ID_5195835563047614786" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;In order to accomplish that, make sure that you properly set the output directory for your test cases in your NetBeans project with the UI or project.xml:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;In the Project Properties UI&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_GbeUi4pR7kA/SBtnfXbLeVI/AAAAAAAAAT8/y8woSAfcAiE/s1600-h/junit_output_project_props.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_GbeUi4pR7kA/SBtnfXbLeVI/AAAAAAAAAT8/y8woSAfcAiE/s320/junit_output_project_props.png" alt="" id="BLOGGER_PHOTO_ID_5195860383663618386" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;In the nbproject/project.xml&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;...&lt;br /&gt;&amp;lt;java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2"&amp;gt;\n            ....&lt;br /&gt;&amp;lt;compilation-unit&amp;gt;&lt;br /&gt; &amp;lt;package-root&amp;gt;test/integration&amp;lt;/package-root&amp;gt;&lt;br /&gt;          &amp;lt;unit-tests/&amp;gt;&lt;br /&gt; &amp;lt;classpath mode="compile"&amp;gt;${test.completion.classpath}&amp;lt;/classpath&amp;gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;     &amp;lt;built-to&amp;gt;dest/test/unit&amp;lt;/built-to&amp;gt;&lt;/span&gt;&lt;br /&gt; &amp;lt;source-level&amp;gt;1.5&amp;lt;/source-level&amp;gt;&lt;br /&gt;&amp;lt;/compilation-unit&amp;gt;&lt;br /&gt;....&lt;br /&gt;&amp;lt;/java-data&amp;gt;&lt;br /&gt;....&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/19648744-3166605318957869556?l=www.troymaxventures.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.troymaxventures.com/feeds/3166605318957869556/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.troymaxventures.com/2008/05/freeform-projects-netbeans-junit-test.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/3166605318957869556'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/3166605318957869556'/><link rel='alternate' type='text/html' href='http://www.troymaxventures.com/2008/05/freeform-projects-netbeans-junit-test.html' title='Freeform projects NetBeans JUnit test results : binding output to source code'/><author><name>Alex Kotchnev</name><uri>https://profiles.google.com/103108222242966756240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-_FzUCgGWKhc/AAAAAAAAAAI/AAAAAAAABGY/gikhtyKNdVc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_GbeUi4pR7kA/SBtQ6nbLeUI/AAAAAAAAAT0/3Sz1KBQp7t8/s72-c/netbeans_junit_beauty.png' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19648744.post-7513279784630948564</id><published>2007-08-04T01:28:00.000-04:00</published><updated>2007-08-06T10:02:33.799-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jemmy'/><category scheme='http://www.blogger.com/atom/ns#' term='netbeans'/><category scheme='http://www.blogger.com/atom/ns#' term='groovy'/><title type='text'>Groovy + Jemmy GUI automation</title><content type='html'>This is something that I came up at work, I thought other people outside of work could make use of it as well. If you're wondering about the obscure references to BizApp and such, this is because I removed the name of the actual app from the text.&lt;br /&gt;&lt;br /&gt;OK, so we established that  &lt;a title="Groovy" href="http://groovy.codehaus.org/"&gt;Groovy&lt;/a&gt; rocks. Now, I've worked at the company long enough to know that there exists a GUI application that kinda does what I need. I know it works, since I can build the GUI app, run it, push the buttons on it, and it creates all the outputs that I need. Now, the only problem is that I'd like to generate a decent amount of these outputs so that I can have a realistic testing scenario.&lt;br /&gt;&lt;br /&gt;Now, I'm certain that there is a "cleaner" and "more proper" way of creating these test outputs. However, my colleague who wrote the BizApp app already figured out how to accomplish what the application needs to do (including all the nitty gritty technical details). Would it be nice if I had access to a simple action that does that ? Certainly. Do I have it now ? Nope. When do I need the outputs to test my client app ? YESTERDAY !! So, what should I do ???&lt;br /&gt;&lt;br /&gt;Enter the combination of &lt;a title="Groovy" href="http://groovy.codehaus.org%20/"&gt;Groovy&lt;/a&gt; and &lt;a title="Jemmy" href="http://jemmy.netbeans.org/"&gt;Jemmy&lt;/a&gt;. We know what Groovy is, now what is Jemmy??? From their site, it's a library that allows GUI driven testing. In effect, it allows me to programmatically specify the actions that I need on the GUI, and execute them. Great !! Step 1 compete !&lt;br /&gt;&lt;br /&gt;Now, step 2. Jemmy is a Java library, I don't quite know exactly how to use the API, and I don't quite know the exact sequence of actions that I'll need to perform through Jemmy. So, if I had to write a Java app to exercise BizApp through Jemmy, there'll be a lot of trial and error hindered by compilation. So, what should I do ?? Groovy is an excellent way to explore a particular API, but how can I plug in Groovy and Jemmy together in order to get this job done ?&lt;br /&gt;&lt;br /&gt;Alright, alright, enough of the round-about way of explaining things, here is what to do:&lt;br /&gt;&lt;br /&gt;* Setup a NetBeans Groovy scripting project. For that, you need a recent &lt;a title="NetBeans" href="http://www.netbeans.org/"&gt;NetBeans&lt;/a&gt; setup, with the  &lt;a title="Coyote" href="http://coyote.dev.java.net/"&gt;Coyote&lt;/a&gt; plugin installed. The same can certainly be achieved with an Groovy Eclipse plugin as well, but since I don't dig Eclipse, I'll show it in NetBeans. After Coyote is installed, you just set up a new project&lt;br /&gt;&lt;br /&gt;&lt;img src="" alt="" /&gt;&lt;br /&gt;&lt;div style="padding: 1em 0pt; text-align: left;"&gt;&lt;img src="http://docs.google.com/File?id=dfsmd7s6_28cxvg5bhq" /&gt;&lt;/div&gt; * Add the BizApp dependencies in the project. In my case, they're in d:JDevelopBuildsBizApp Add all jars from that directory into the project build. Notice the Jemmy libary at the bottom of the screenshot : it can be added either using the NetBeans update center, or by just downloading the Jemmy library and adding the jar as a dependency in the project. &lt;br /&gt;&lt;br /&gt;&lt;div style="padding: 1em 0pt; text-align: left;"&gt;&lt;div style="padding: 1em 0pt; text-align: left;"&gt;&lt;img src="http://docs.google.com/File?id=dfsmd7s6_31hfkk9xhj" /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;* Add the Groovy/Jemmy bootstrap script and add the content below, inserting the correct main class for the application. This script will launch BizApp, and will then fire up a blank Groovy console where we can execute our little script in. Right click on the Coyote project, and select "Run Project".&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import org.netbeans.jemmy.*;&lt;br /&gt;import org.netbeans.jemmy.explorer.*;&lt;br /&gt;import org.netbeans.jemmy.operators.*;&lt;br /&gt;&lt;br /&gt;// Fire up the BizApp Application&lt;br /&gt;new ClassReference("com.mycompany.MyAppMainClass").startApplication();&lt;br /&gt;&lt;br /&gt;// Get a reference to the BizApp JFrame and put it into the console's script binding.&lt;br /&gt;mainFrame = new JFrameOperator("BizApp"); &lt;br /&gt;def bind = new Binding()&lt;br /&gt;bind.setProperty("testScript",this)&lt;br /&gt;bind.setProperty("mainFrame",mainFrame)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// Fire up the Groovy console.&lt;br /&gt;def console = new groovy.ui.Console(this.class.classLoader,bind)&lt;br /&gt;console.run() &lt;br /&gt;Thread.sleep(600000)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;* Now, we have both BizApp and the Groovy Console running side by side. Inside of the Groovy console, we can use Jemmy to programmatically manipulate the GUI (e.g. press buttons, select from checkboxes, etc). The Jemmy statements would look something like the script below. You can sometimes get away without firing a new thread, but if you don't the Groovy console script might block the UI and prevent Jemmy from executing it's input on BizApp&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;t = new Thread() {&lt;br /&gt;       // do whatever you need to do with Jemmy, push buttons, select combos, type into text fields, etc.&lt;br /&gt;}&lt;br /&gt;t.start()&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="padding: 1em 0pt; text-align: left;"&gt;&lt;div style="padding: 1em 0pt; text-align: left;"&gt;&lt;img src="http://docs.google.com/File?id=dfsmd7s6_32hczgv9hd" /&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;* Finally, figure out what you need to do with the GUI app you're working with and script it.  Pseudocode looks like this:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;       select from merchant dropdown&lt;br /&gt;       select from vendor dropdown&lt;br /&gt;       hit the "Process" button&lt;br /&gt;       hit the "Back" button twice (to get to the main screen)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;* The Groovy setup script looks something like the one below. I usually execute this first, so that my Groovy console has references to the combos and buttons so that I don't have to import the Jemmy classes every time (e.g. the Groovy console doesn't remember the imports that you might have done in previous executions, but it will remember the variables that you might have declared&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;// Import Jemmy specific classes&lt;br /&gt;import org.netbeans.jemmy.*;&lt;br /&gt;import org.netbeans.jemmy.explorer.*;&lt;br /&gt;import org.netbeans.jemmy.operators.*;&lt;br /&gt;&lt;br /&gt;// Get references to all UI widgets so that we don't have to re-import&lt;br /&gt;// the Jemmy classes every time. The names of these variables will be&lt;br /&gt;// stored in the "binding" and can be accessed in subsequent script/snippet&lt;br /&gt;// executions&lt;br /&gt;merchantOp = new JComboBoxOperator(mainFrame,0)&lt;br /&gt;vendorOp = new JComboBoxOperator(mainFrame,1)&lt;br /&gt;processButtonOp = new JButtonOperator(mainFrame,"Process")&lt;br /&gt;backButtonOp = new JButtonOperator(mainFrame,"Back")&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;* Write put the script that will actually do the work. The script is typically derived by executing the statements one by one and seeing that they do the right things. The script below processes an order for the first merchant and vendor and then comes back. See the Jemmy API for details on available widgets operators, etc.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;t = new Thread() {&lt;br /&gt;       merchantOp.selectItem(0)&lt;br /&gt;       vendorOp.selectItem(0)&lt;br /&gt;       processOpButton.push()&lt;br /&gt;       backButtonOp.push()&lt;br /&gt;       backButtonOp.push()&lt;br /&gt;}&lt;br /&gt;t.start()&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;* Finally, the last step is to typically put something together that will do what you need repetitively. My script is below, I have it saved in the Coyote project directory, and I load it up from the Groovy console when it fires up. Note that I typically just hightlight and run the first part of the code first (to get references to all the buttons, etc), and then only run the second part when I need to run BizApp for a long time.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;// Import Jemmy specific classes&lt;br /&gt;import org.netbeans.jemmy.*;&lt;br /&gt;import org.netbeans.jemmy.explorer.*;&lt;br /&gt;import org.netbeans.jemmy.operators.*;&lt;br /&gt;&lt;br /&gt;// Get references to all UI widgets so that we don't have to re-import&lt;br /&gt;// the Jemmy classes every time. The names of these variables will be&lt;br /&gt;// stored in the "binding" and can be accessed in subsequent script/snippet&lt;br /&gt;// executions&lt;br /&gt;merchantOp = new JComboBoxOperator(mainFrame,0)&lt;br /&gt;vendorOp = new JComboBoxOperator(mainFrame,1)&lt;br /&gt;processButtonOp = new JButtonOperator(mainFrame,"Process")&lt;br /&gt;backButtonOp = new JButtonOperator(mainFrame,"Back")&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// Creating orders for a merchant involves creating orders for each vendor for the merchant.&lt;br /&gt;def processMerchantVendor(count,merchants) {&lt;br /&gt;   t = new Thread() {&lt;br /&gt;       count.times {&lt;br /&gt;                       try {&lt;br /&gt;                               merchants.each { merchantIndex -&amp;gt;&lt;br /&gt;                                       merchantOp.selectItem(merchantIndex)&lt;br /&gt;                                       if (merchantOp.selectedItem == "some_merchant") return&lt;br /&gt;                                       (0..vendorOp.itemCount).each { vendorIndex -&amp;gt;&lt;br /&gt;                                               if (merchantOp.itemCount &amp;gt; merchantIndex &amp;amp;&amp; vendorOp.itemCount &amp;gt; vendorIndex) {                                               &lt;br /&gt;                                                       Thread.sleep(50)&lt;br /&gt;                                                       vendorOp.selectItem(vendorIndex)&lt;br /&gt;                                                       Thread.sleep(50)&lt;br /&gt;                                                       processButtonOp.push()&lt;br /&gt;                                                       Thread.sleep(50)&lt;br /&gt;                                                       backButtonOp.push()&lt;br /&gt;                                                       Thread.sleep(50)&lt;br /&gt;                                                       backButtonOp.push()&lt;br /&gt;                                               }&lt;br /&gt;                                       }&lt;br /&gt;                               }&lt;br /&gt;                       } catch (Exception e) {  }&lt;br /&gt;               }   &lt;br /&gt;   }&lt;br /&gt;   t.start()&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// This creates test orders for all merchants, 10 times in a row.&lt;br /&gt;processMerchantVendor(10,(1..merchantOp.itemCount))&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/19648744-7513279784630948564?l=www.troymaxventures.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.troymaxventures.com/feeds/7513279784630948564/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.troymaxventures.com/2007/08/groovy-jemmy-gui-automation-this-is.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/7513279784630948564'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/7513279784630948564'/><link rel='alternate' type='text/html' href='http://www.troymaxventures.com/2007/08/groovy-jemmy-gui-automation-this-is.html' title='Groovy + Jemmy GUI automation'/><author><name>Alex Kotchnev</name><uri>https://profiles.google.com/103108222242966756240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-_FzUCgGWKhc/AAAAAAAAAAI/AAAAAAAABGY/gikhtyKNdVc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19648744.post-4776199254933057037</id><published>2007-06-15T01:09:00.002-04:00</published><updated>2008-05-02T23:50:09.791-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='netbeans'/><category scheme='http://www.blogger.com/atom/ns#' term='scripting'/><title type='text'>CDJUG June meeting</title><content type='html'>I was at the &lt;a title="Capital District Java User Group (CDJUG)" href="http://www.cdjdn.com/"&gt;Capital District Java User Group (CDJUG)&lt;/a&gt; meeting yesterday and it was quite an interesting experience. For starters, I wasn't sure if I was going to the meeting until the last minute, and I didn't even know if I was going to stay the whole time. Secondly, at the last minute I was pleasantly surprised that there were going to be 2 presentations at the meeting.&lt;br /&gt;&lt;br /&gt;Anthony will be posting the presentation slides in the next few days on the site, but in the meantime, I'll write a few notes from the meeting.&lt;br /&gt;&lt;br /&gt;THe first presentation was on the &lt;a title="Sleep (JVM) scripting language" href="http://sleep.hick.org/"&gt;Sleep (JVM) scripting language&lt;/a&gt; by &lt;a href="http://rsmudge.livejournal.com/"&gt;Raphael Mudge&lt;/a&gt;. He was a very energetic guy, and it was quite a bit of fun just listening to him. Good work Raphael ! Now, the presentation was great, but I personally am far from being convinced that this is something that I will be investing my time into. Here's the deal:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;I've already dabbled into at least a couple of JVM scripting languages (Jython in the past, and now Groovy). THere is a couple of dozen more scripting languages on the JVM which are all interesting to mess around with. Thus, in order to convince a developer to spend time with the language, a scripting language needs to have a number of different characteristics. Granted, Raphi has quite an interesting character, the conversation with him before the presentation was very engaging. At the same time, as with any open source project, the key factor in whether the project will survive is the size of the community. Now, I know Raphi said that there were a bunch of people using the scripting language; however, as it is with a bunch of other open source projects, typically the top 1-2 contenders in the space gather 90+% of the developer attention and community. Although the other languages are not necessarily doomed to fail, they have to find their own niche and a set of committed developers in order to survive. Granted, it seemed like SLeep already has a niche by being used in jIRCii; however, it appeared that Raphi was the sole significant developer. So, the question is, what happens when/if he loses interest ? &lt;/li&gt;&lt;li&gt;Raphi specifically mentioned that he's not trying to be all things to all people, and considering that it is a much smaller project and community than the other scripting languages, that is a very reasonable goal. However, in order to win developer mindshare, it seems to me that having a decent size standard library with utility functions and being able to call into the JVM for everything else, it's not enough any more. I'm judging from my personal experience: one of the major selling points of Groovy to me was that it DID have the convenient, easy xml processing, JDBC access, command line interface, etc. etc. etc, all on top of its seamless integration with the JVM.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Now, this is just me, but I never grokked the Perl syntax. Seriously, this was probably the first language that I looked at when I was first trying to understand what web programming was all about (10 years ago).. and today, I'm still looking at the syntax and it can never fit into my skull...&lt;br /&gt;&lt;/li&gt;&lt;li&gt;A couple of notes on the presentation:&lt;/li&gt;&lt;/ol&gt;&lt;ul&gt;&lt;li&gt;        I didn't quite get it if slee was able to extend the classpath at runtime. Raphi showed thate there was an interactive console (big plus in my opinion, Groovy still kinda sucks in this area); however, one big selling point for me was that at any point I could throw in a couple more jars to the classloader and start loading classes from there.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Raphi mentioned that it was his intent to have a clear separation between the sleep program and where it calls into Java; however, for me personally, that was a downside. I found the method calls to be kinda cryptic ( I couldn't quite follow what was happening in a couple of nested method calls - I admit, it might just be my fault, as I haven't seen Objective-C syntax on which the Sleep syntax is based). At the same tie, I didn't see any type of bean properties (e.g. instead of doing foo.setBar('baz'), doing foo.bar='baz'), which for a scripting language is a must in my opinion.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The documentation seemed to be excellent&lt;/li&gt;&lt;li&gt;All the time when I was looking at the presentation, I was thinking that after NetBeans 6.0 comes out, he should have a Schliemann module for Sleep syntax. :-)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Runtime size was pretty small , big plus for embedding uses...&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Now, the second presentation was the main reason why I went to the meeting. It was about NetBeans by the author of  &lt;a title="Pro NetBeans IDE 5.5 Enterprise Edition" href="http://www.pronetbeans.com/"&gt;Pro NetBeans IDE 5.5 Enterprise Edition&lt;/a&gt;, Adam Myatt.  I was really thrilled to meet him as I had heard from Anthony that he lives in the Capital District area, and that he's a big NetBeans supporter. I was also really looking forward to checking out his book as I had read a couple of good reviews. Adam did an excellent presentation, he was on his game, and I have rarely seen someone present so many things in such a tight and organized manner. He did an excellent job at presenting NetBeans to the people who had gathered and received a very positive response - one of my coworkers actually re-installed NetBeans the next day and was trying stuff out with it. Way to go , Adam ! One thing that totally blew me away during the presentation was the relatively small footprint of NetBeans. When he was doing the demo of NB 5.5.1, the memory rarely went above 100 MB, and I was quite impressed since he was doing quite a bit (and his laptop was not the greatest to begin with). Considering that he did everything from UML diagrams to Visual Web Pack demos, I was VERY impressed. Then, when he was doing the NetBeans 6.0 preview, I was even more impressed as it hovered around 50 MB - AMAZING !&lt;br /&gt;&lt;br /&gt;I was personally a bit disappointed that I didn't learn too much from the presentation. I understand that I was  not the target audience for it, as I've been a NetBeans user for quite a long time, and I knew 99% of the stuff that Adam talked about. He was covering a lot of ground (more width than depth) as was necessary to present to the majority of the audience. But all in all, I liked the presentation and I'm looking forward to the next time we meet up : maybe we might even get a chance to talk a bit..&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/19648744-4776199254933057037?l=www.troymaxventures.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.troymaxventures.com/feeds/4776199254933057037/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.troymaxventures.com/2007/06/i-was-at-capital-district-java-user.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/4776199254933057037'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/4776199254933057037'/><link rel='alternate' type='text/html' href='http://www.troymaxventures.com/2007/06/i-was-at-capital-district-java-user.html' title='CDJUG June meeting'/><author><name>Alex Kotchnev</name><uri>https://profiles.google.com/103108222242966756240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-_FzUCgGWKhc/AAAAAAAAAAI/AAAAAAAABGY/gikhtyKNdVc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19648744.post-2553877953158979063</id><published>2007-05-31T19:04:00.002-04:00</published><updated>2008-12-10T03:50:49.782-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='netbeans'/><category scheme='http://www.blogger.com/atom/ns#' term='junit'/><title type='text'>JUnit results in free form projects</title><content type='html'>At work, I'm working with a couple of colleagues on a project. Now, as is probably usual in many other environments, we all use different tools to work on the project: I use NetBeans, and the other two guys use Eclipse and Emacs. Thus, we have agreed that the Ant build scripts will be "the truth" : they have to be maintained and kept as the main tool for building, testing, and running the application.&lt;br /&gt;&lt;br /&gt;So, all of that is great; however, I really like my NetBeans IDE, and I just couldn't continue living life without being able to use all of it's goodness. The best thing about NetBeans is that it is Ant based and it has the smarts/hooks to understand what you're trying to do (even in a freeform project), so that it can help you best. Here are the steps that I took to get my testing configuration going for a freeform project:&lt;br /&gt;&lt;br /&gt;1. The first thing I did is to review the &lt;a href='http://www.netbeans.org/kb/41/freeform-config.html'&gt;NetBeans Advanced Free Form Project Configuration &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;2. I added a compile selected item and debug project tasks (the debug task was quite useful since the code I was trying to understand was kinda convoluted and the debugger was invaluable in understanding how it works):&lt;br /&gt;&lt;br /&gt;Here is what I added to my nbproject/project.xml (the ide-actions section): &lt;br /&gt;&lt;pre language="xml"&gt;&lt;br /&gt; &amp;lt;action name='debug'&amp;gt;&lt;br /&gt;                    &amp;lt;script&amp;gt;nbproject/ide-file-targets.xml&amp;lt;/script&amp;gt;&lt;br /&gt;                    &amp;lt;target&amp;gt;debug-nb&amp;lt;/target&amp;gt;&lt;br /&gt;                &amp;lt;/action&amp;gt;&lt;br /&gt;                &amp;lt;action name='compile.single'&amp;gt;&lt;br /&gt;                    &amp;lt;script&amp;gt;nbproject/ide-file-targets.xml&amp;lt;/script&amp;gt;&lt;br /&gt;                    &amp;lt;target&amp;gt;compile-selected-files-in-test&amp;lt;/target&amp;gt;&lt;br /&gt;                    &amp;lt;context&amp;gt;&lt;br /&gt;                        &amp;lt;property&amp;gt;files&amp;lt;/property&amp;gt;&lt;br /&gt;                        &amp;lt;folder&amp;gt;test&amp;lt;/folder&amp;gt;&lt;br /&gt;                        &amp;lt;pattern&amp;gt;\.java$&amp;lt;/pattern&amp;gt;&lt;br /&gt;                        &amp;lt;format&amp;gt;relative-path&amp;lt;/format&amp;gt;&lt;br /&gt;                        &amp;lt;arity&amp;gt;&lt;br /&gt;                            &amp;lt;separated-files&amp;gt;,&amp;lt;/separated-files&amp;gt;&lt;br /&gt;                        &amp;lt;/arity&amp;gt;&lt;br /&gt;                    &amp;lt;/context&amp;gt;&lt;br /&gt;                &amp;lt;/action&amp;gt;&lt;br /&gt;                &amp;lt;action name='test.single'&amp;gt;&lt;br /&gt;                    &amp;lt;script&amp;gt;nbproject/ide-file-targets.xml&amp;lt;/script&amp;gt;&lt;br /&gt;                    &amp;lt;target&amp;gt;run-selected-files-in-test&amp;lt;/target&amp;gt;&lt;br /&gt;                    &amp;lt;context&amp;gt;&lt;br /&gt;                        &amp;lt;property&amp;gt;classname&amp;lt;/property&amp;gt;&lt;br /&gt;                        &amp;lt;folder&amp;gt;test&amp;lt;/folder&amp;gt;&lt;br /&gt;                        &amp;lt;pattern&amp;gt;\.java$&amp;lt;/pattern&amp;gt;&lt;br /&gt;                        &amp;lt;format&amp;gt;java-name&amp;lt;/format&amp;gt;&lt;br /&gt;                        &amp;lt;arity&amp;gt;&lt;br /&gt;                            &amp;lt;one-file-only&amp;gt;&amp;lt;/one-file-only&amp;gt;&lt;br /&gt;                        &amp;lt;/arity&amp;gt;&lt;br /&gt;                    &amp;lt;/context&amp;gt;&lt;br /&gt;                &amp;lt;/action&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;My ide-file-targets.xml additions look like this: &lt;br /&gt;&lt;pre language="xml"&gt;&lt;br /&gt;&amp;lt;target name='compile-selected-files-in-test'&amp;gt;&lt;br /&gt;        &amp;lt;fail unless='files'&amp;gt;Must set property 'files'&amp;lt;/fail&amp;gt;&lt;br /&gt;        &amp;lt;mkdir dir='${test.classes.dir}'&amp;gt;&amp;lt;/mkdir&amp;gt;&lt;br /&gt;        &amp;lt;javac srcdir='test' source='1.6' includes='${files}' destdir='${test.classes.dir}'&amp;gt;&lt;br /&gt;            &amp;lt;classpath refid='run.test.class.path'&amp;gt;&amp;lt;/classpath&amp;gt;&lt;br /&gt;        &amp;lt;/javac&amp;gt;&lt;br /&gt;    &amp;lt;/target&amp;gt;&lt;br /&gt;    &amp;lt;target name='run-selected-files-in-test'&amp;gt;&lt;br /&gt;        &amp;lt;fail unless='classname'&amp;gt;Must set property 'files'&amp;lt;/fail&amp;gt;&lt;br /&gt;        &amp;lt;mkdir dir='${test.classes.dir}'&amp;gt;&amp;lt;/mkdir&amp;gt;&lt;br /&gt;        &amp;lt;junit dir='${test.classes.dir}' printsummary='true' showoutput='true' fork='true'&amp;gt;&lt;br /&gt;            &lt;br /&gt;            &amp;lt;classpath refid='run.test.class.path'&amp;gt;&amp;lt;/classpath&amp;gt;&lt;br /&gt;            &amp;lt;formatter type='brief' usefile='false'&amp;gt;&amp;lt;/formatter&amp;gt;&lt;br /&gt;            &amp;lt;formatter type='xml'&amp;gt;&amp;lt;/formatter&amp;gt;&lt;br /&gt;            &amp;lt;test name='${classname}'&amp;gt;&amp;lt;/test&amp;gt;&lt;br /&gt;        &amp;lt;/junit&amp;gt;&lt;br /&gt;    &amp;lt;/target&amp;gt;&lt;br /&gt;   &amp;lt;target name='debug-nb' depends='compile, compile-test'&amp;gt;&lt;br /&gt;        &amp;lt;path id='sourcepath'&amp;gt;&lt;br /&gt;            &amp;lt;pathelement path='src/'&amp;gt;&amp;lt;/pathelement&amp;gt;&lt;br /&gt;            &amp;lt;pathelement path='test/'&amp;gt;&amp;lt;/pathelement&amp;gt;&lt;br /&gt;            &amp;lt;pathelement path='..\\DeclTypeSys\\src'&amp;gt;&amp;lt;/pathelement&amp;gt;&lt;br /&gt;            &amp;lt;pathelement path='..\\DeclTypeSys\\test'&amp;gt;&amp;lt;/pathelement&amp;gt;&lt;br /&gt;        &amp;lt;/path&amp;gt;&lt;br /&gt;        &amp;lt;nbjpdastart transport='dt_socket' name='perspective' addressproperty='jpda.address'&amp;gt;&lt;br /&gt;            &amp;lt;classpath refid='run.test.class.path'&amp;gt;&amp;lt;/classpath&amp;gt;&lt;br /&gt;            &amp;lt;sourcepath refid='sourcepath'&amp;gt;&amp;lt;/sourcepath&amp;gt;&lt;br /&gt;        &amp;lt;/nbjpdastart&amp;gt;&lt;br /&gt;        &amp;lt;junit dir='${test.classes.dir}' showoutput='true' printsummary='yes' fork='true'&amp;gt;&lt;br /&gt;            &amp;lt;jvmarg value='-Xdebug'&amp;gt;&amp;lt;/jvmarg&amp;gt;&lt;br /&gt;            &amp;lt;jvmarg value='-Xnoagent'&amp;gt;&amp;lt;/jvmarg&amp;gt;&lt;br /&gt;            &amp;lt;jvmarg value='-Djava.compiler=none'&amp;gt;&amp;lt;/jvmarg&amp;gt;&lt;br /&gt;            &amp;lt;jvmarg value='-Xrunjdwp:transport=dt_socket,address=${jpda.address},suspend=y'&amp;gt;&amp;lt;/jvmarg&amp;gt;&lt;br /&gt;            &lt;br /&gt;            &amp;lt;formatter type='xml'&amp;gt;&amp;lt;/formatter&amp;gt;&lt;br /&gt;            &amp;lt;formatter usefile='false' type='brief'&amp;gt;&amp;lt;/formatter&amp;gt;&lt;br /&gt;            &amp;lt;classpath refid='run.test.class.path'&amp;gt;&amp;lt;/classpath&amp;gt;&lt;br /&gt;            &amp;lt;batchtest&amp;gt;&lt;br /&gt;                &amp;lt;fileset dir='${basedir}/test'&amp;gt;&lt;br /&gt;                    &lt;br /&gt;                    &amp;lt;include name='**/**/*Test.java'&amp;gt;&amp;lt;/include&amp;gt;&lt;br /&gt;                &amp;lt;/fileset&amp;gt;&lt;br /&gt;            &amp;lt;/batchtest&amp;gt;&lt;br /&gt;        &amp;lt;/junit&amp;gt;&lt;br /&gt;    &amp;lt;/target&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;After I did that, my JUnit results look like this: &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href='http://1.bp.blogspot.com/_GbeUi4pR7kA/Rl-8AuS1a0I/AAAAAAAAABU/wVpsJ7eZlB8/s1600-h/netbeans_plain_junit.png' onblur='try {parent.deselectBloggerImageGracefully();} catch(e) {}'&gt;&lt;img border='0' id='BLOGGER_PHOTO_ID_5070978426055519042' alt='' src='http://1.bp.blogspot.com/_GbeUi4pR7kA/Rl-8AuS1a0I/AAAAAAAAABU/wVpsJ7eZlB8/s320/netbeans_plain_junit.png' style='margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;'&gt;&lt;/img&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So, that was OK, but far from great. I thought that there should be a way to invoke the NetBeans JUnit test runner; however, googling around for it didn't help much. Then, just when I was about to lose hope, I ran upon these couple of posts:&lt;br /&gt;&lt;br /&gt;&lt;a href='http://junit.netbeans.org/doc/binding-freeform-to-output.html'&gt;Binding Freeform to Output&lt;/a&gt; and &lt;br /&gt;&lt;a href='http://weblogs.java.net/blog/gsporar/archive/2006/02/uportal_develop_4.html'&gt; UPortal Develop by Greg Sporar &lt;/a&gt; . &lt;br /&gt;&lt;br /&gt;3.A slight complication on my end : I really didn't want to mess around with the target name of the original build.xml since the other team members were using that already. Thus, I added the following task to my ide-file-targets.xml: &lt;br /&gt;&lt;pre language="xml"&gt;&lt;br /&gt;    &amp;lt;target name='test-project'&amp;gt;&lt;br /&gt;       &lt;br /&gt;        &amp;lt;antcall target='junit'&amp;gt;&amp;lt;/antcall&amp;gt;&lt;br /&gt;    &amp;lt;/target&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;and changed the test single target name to "test-run-selected-files-in-test", so that the target name starts with "test" and changed the corresponding entry in my project.xml to run the right target. &lt;br /&gt;&lt;br /&gt;And now, my test results look like this:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href='http://1.bp.blogspot.com/_GbeUi4pR7kA/Rl-7auS1azI/AAAAAAAAABM/Vz_mDvMb6rI/s1600-h/netbeans_junit_beauty.png' onblur='try {parent.deselectBloggerImageGracefully();} catch(e) {}'&gt;&lt;img border='0' id='BLOGGER_PHOTO_ID_5070977773220490034' alt='' src='http://1.bp.blogspot.com/_GbeUi4pR7kA/Rl-7auS1azI/AAAAAAAAABM/Vz_mDvMb6rI/s320/netbeans_junit_beauty.png' style='margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;'&gt;&lt;/img&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;BEAUTY !!!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/19648744-2553877953158979063?l=www.troymaxventures.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.troymaxventures.com/feeds/2553877953158979063/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.troymaxventures.com/2007/05/junit-results-in-free-form-projects.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/2553877953158979063'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/2553877953158979063'/><link rel='alternate' type='text/html' href='http://www.troymaxventures.com/2007/05/junit-results-in-free-form-projects.html' title='JUnit results in free form projects'/><author><name>Alex Kotchnev</name><uri>https://profiles.google.com/103108222242966756240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-_FzUCgGWKhc/AAAAAAAAAAI/AAAAAAAABGY/gikhtyKNdVc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_GbeUi4pR7kA/Rl-8AuS1a0I/AAAAAAAAABU/wVpsJ7eZlB8/s72-c/netbeans_plain_junit.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19648744.post-8722112580883138263</id><published>2007-05-23T01:24:00.000-04:00</published><updated>2008-12-10T03:50:50.094-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='netbeans'/><category scheme='http://www.blogger.com/atom/ns#' term='junit'/><category scheme='http://www.blogger.com/atom/ns#' term='groovy'/><title type='text'>NetBeans testing with Groovy</title><content type='html'>I'm making some progress on my thesis, and as one can expect, when I'm writing code, I need to be writing some unit tests for it. Now, I know that Groovy is an excellent candidate for writing unit tests (better than the traditional JUnit stuff that NetBeans supports out of the box). However, it isn't quite obvious exactly how is one supposed to use and run these Groovy unit tests inside of NetBeans (apart form hacking together a crude solution where you have to add a line to a file, every time you need something to the suite() method). I just want to be able to hit the Alt-F6 button and have all of my tests run like magic : no manual additions to the suite, no tweaking. &lt;br /&gt;&lt;br /&gt;So, in the end it worked, with a couple of gotchas:&lt;br /&gt;1. NetBeans only seems to like running JUnit Test cases (when you hit Alt-F6) if and only if the test case name ends with "Test". That's kinda clunky, and as far as I know is not a requirement of JUnit itself. THere is nothing preventing you from executing the unit test individually (e.g. right-click -&gt; run) - it runs like magic, but unless the class name ends with "Test", NetBeans doesn't add it to the bucket of tests to run. &lt;br /&gt;&lt;br /&gt;2. The &lt;a href="http://coyote.dev.java.net"&gt; coyote module &lt;/a&gt; provides some support for testing in Groovy; however, it is not entirely intuitive exactly how that is done. In effect, if you want things to work nicely, you have to do 2 things:&lt;br /&gt; - first, select a class that you want to test, go to Tools - Groovy Tests - Create Tests. That will basically greate a suite and a test in the $PROJECT/groovy-tests directory, as well as a groovy class in there. &lt;br /&gt;&lt;br /&gt;A note a couple of months later, after the completion of the thesis project: Groovy worked great for the unit and integration testing of my project. It was fairly easy to script any of the scenarios that I had in mind, and after I had the general template for working with the groovy tests, it became quite easy to have pretty decent test coverage. Actually, the Groovy tests ended up being one of the important reasons for managing to complete the project after losing all of the work that I had done for the last 1.5 years ( yeah, I know i'm dumb not to have a backup, so, if YOU are working on something that important, DO A BACKUP NOW!!!). &lt;br /&gt;&lt;br /&gt;Here is what my setup looks like:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_GbeUi4pR7kA/RlJ3QeS1awI/AAAAAAAAAA0/eEUERQ0pm1E/s1600-h/groovy_testing1.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_GbeUi4pR7kA/RlJ3QeS1awI/AAAAAAAAAA0/eEUERQ0pm1E/s320/groovy_testing1.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5067243655638903554" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;1. I have one Java class for each type of tests that I wrote in Groovy. That is useful to be able to say "Test Project" from the project menu, and have all Groovy Tests executed in a meaningful manner. &lt;br /&gt;&lt;br /&gt;2. Each Java JUnit subclass, has something like this in it. In effect, that takes the all Groovy files starting with "Service" and makes test suite out of them. One thing to note is that (slightly inconventiently), when the unit tests are run, all test methods from all groovy files show up under the name of the Java test class e.g. &lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_GbeUi4pR7kA/RlJ3Y-S1axI/AAAAAAAAAA8/nMAl5DrysjI/s1600-h/groovy_test_results.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_GbeUi4pR7kA/RlJ3Y-S1axI/AAAAAAAAAA8/nMAl5DrysjI/s320/groovy_test_results.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5067243801667791634" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public  static Test suite() throws Exception {&lt;br /&gt;        TestSuite suite = new TestSuite("HandlerTests");&lt;br /&gt;        &lt;br /&gt;suite.addTest(AllTestSuite.suite("/home/polrtex/Docs/UofS_SE/Thesis/Implementation/MvpService/test/groovytest","Service*.groovy"));&lt;br /&gt;        &lt;br /&gt;        return suite;&lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;3. Finally, the Groovy test has some test methods in it, which get executed when you run the "Test" command on the project.&lt;br /&gt;&lt;br /&gt;One final note on the tests themselves. I was using Spring 2.0 for my project, so I wanted to use the same datasource and service classes that the Spring Framework provides. Now, I knew that there were a couple of supporting Spring test classes (e.g. org.springframework.test.AbstractTransactionalDataSourceSpringContextTests), but I wasn't quite sure how to use them when the test are implemented in Groovy. What I ended up doing was to have a base Java class that extended the Spring test class mentioned above, and then have all of my Groovy tests extend that class. One thing that was interesting to note here was that I had to use the Spring autowire by name option, and the population of protected variables e.g. &lt;br /&gt;&lt;pre&gt;&lt;br /&gt;class DaoTest  extends com.troymaxventurs.mvp.test.MvpBaseTest {&lt;br /&gt;    //protected ds;);&lt;br /&gt;    protected mvpDAO;&lt;br /&gt;    protected mvpDataSource;&lt;br /&gt;    DaoTest() {&lt;br /&gt;        super("DaoTest")&lt;br /&gt;        setPopulateProtectedVariables(true)        &lt;br /&gt;        setAutowireMode(AUTOWIRE_BY_NAME)                     &lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The reason I needed it to populate the protected variables (and not the bean fields) is that when these Groovy tests were instantiated, Spring tried to populate some Groovy specific public properties (e.g. the metaClass property), and thus, it failed along the way. With the population of protected variables, I could specify exactly what I wanted to have populated, without having to worry about any magic that Spring does to discover what dependencies to inject.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/19648744-8722112580883138263?l=www.troymaxventures.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.troymaxventures.com/feeds/8722112580883138263/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.troymaxventures.com/2007/03/netbeans-testing-with-groovy.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/8722112580883138263'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/8722112580883138263'/><link rel='alternate' type='text/html' href='http://www.troymaxventures.com/2007/03/netbeans-testing-with-groovy.html' title='NetBeans testing with Groovy'/><author><name>Alex Kotchnev</name><uri>https://profiles.google.com/103108222242966756240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-_FzUCgGWKhc/AAAAAAAAAAI/AAAAAAAABGY/gikhtyKNdVc/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_GbeUi4pR7kA/RlJ3QeS1awI/AAAAAAAAAA0/eEUERQ0pm1E/s72-c/groovy_testing1.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19648744.post-5739621145759552931</id><published>2007-03-30T10:26:00.000-04:00</published><updated>2007-08-04T02:37:26.244-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='netbeans'/><title type='text'>Customizing the executable</title><content type='html'>I'm currently working on an NetBeans RCP based app, spending a huge&lt;br /&gt;amount of my time on the platform. I got around to customizing the&lt;br /&gt;application that I'm working on, and I did recall Geertjan's post about cleaning up&lt;br /&gt;the app from the NetBeans specific stuff. &lt;a href="http://blogs.sun.com/geertjan/entry/changing_a_windows_executable_s"&gt;Geertjan did mention&lt;/a&gt; that&lt;br /&gt;you could fix the executable icon (on Windows) by using the resource&lt;br /&gt;editor on the built zip file. Well, the altenative is to make a copy&lt;br /&gt;of the executable from your ${harness.dir}/launchers/app.exe to your&lt;br /&gt;local project dir, edit the executable resources by using the Resource&lt;br /&gt;Hacker that Geertjan recommended, and modify the build script to use&lt;br /&gt;the modified executable to use your updated executable for building&lt;br /&gt;your app. So, the changes to my harness build file are as described&lt;br /&gt;below. It is indeed a bit of a hack, as one I'd imagine that it&lt;br /&gt;wouldn't be advisable to edit the global build scripts (that build for&lt;br /&gt;all projects); however, it seems that this is a more universal need&lt;br /&gt;for platform developers - one should be able to totally customize the&lt;br /&gt;branding of the application. While the majority of the work is&lt;br /&gt;possible to be done within NetBeans (with the excellent support of the&lt;br /&gt;platform modules), the ability to customize the icon on the executable&lt;br /&gt;is a very important one as well.&lt;br /&gt;&lt;br /&gt;in the body of the build-launchers target ($platform_dir/harness/suite.xml):&lt;br /&gt;&lt;br /&gt;right after :&lt;br /&gt;&lt;pre language="xml"&gt;&lt;br /&gt;&amp;lt;mkdir dir="${build.launcher.dir}/etc"/&amp;gt;&lt;br /&gt;&amp;lt;mkdir dir="${build.launcher.dir}/bin"/&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Add the following :&lt;br /&gt;&lt;pre language="xml"&gt;&lt;br /&gt;&amp;lt;available file="branding/launcher/${app.name}.exe" property="local.launcher.found" /&amp;gt;&lt;br /&gt;&amp;lt;antcall target="make-local-launcher" inheritall="true"/&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;then, add a new target in the same file&lt;br /&gt;&lt;pre language="xml"&gt;&lt;br /&gt;&amp;lt;target name="make-local-launcher" unless="local.launcher.found"&amp;gt;&lt;br /&gt;&amp;lt;mkdir dir="branding/launcher" /&amp;gt;&lt;br /&gt;&amp;lt;copy file="${harness.dir}/launchers/app.exe"&lt;br /&gt;tofile="branding/launcher/${app.name}.exe" overwrite="false"/&amp;gt;&lt;br /&gt;&amp;lt;/target&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/19648744-5739621145759552931?l=www.troymaxventures.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.troymaxventures.com/feeds/5739621145759552931/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.troymaxventures.com/2007/03/customizing-executable.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/5739621145759552931'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/5739621145759552931'/><link rel='alternate' type='text/html' href='http://www.troymaxventures.com/2007/03/customizing-executable.html' title='Customizing the executable'/><author><name>Alex Kotchnev</name><uri>https://profiles.google.com/103108222242966756240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-_FzUCgGWKhc/AAAAAAAAAAI/AAAAAAAABGY/gikhtyKNdVc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19648744.post-6421221097309898149</id><published>2007-03-20T00:55:00.000-04:00</published><updated>2007-08-27T02:37:58.390-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='netbeans'/><category scheme='http://www.blogger.com/atom/ns#' term='groovy'/><title type='text'>NetBeans Groovy console</title><content type='html'>Alright, I didn't think I'd be putting it out there, but since&lt;br /&gt;Geertjan blogged about it, here is the source to what I was doing with&lt;br /&gt;the Groovy console in NetBeans.. I didn't think I'd be putting it&lt;br /&gt;somewhere, since it's a bit of a hack (a proper solution to the&lt;br /&gt;problem would probably use GroovyShell to interpret things and use&lt;br /&gt;purely NetBeans for the creation of the UI end of things). But, since&lt;br /&gt;it's out there in the wild, here is my "New and Improved" NetBeans groovy console. &lt;br /&gt;One cool thing  to note is that it picks up the Groovy Console key mappings, thus all shortcuts work exactly the same. &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;br /&gt; package com.troymaxventures.nbgroovyconsole;&lt;br /&gt;&lt;br /&gt;import groovy.lang.Binding;&lt;br /&gt;import java.awt.BorderLayout;&lt;br /&gt;import java.io.Serializable;&lt;br /&gt;import java.util.ArrayList;&lt;br /&gt;import java.util.List;&lt;br /&gt;import javax.swing.Action;&lt;br /&gt;import javax.swing.ActionMap;&lt;br /&gt;import javax.swing.InputMap;&lt;br /&gt;import javax.swing.JComponent;&lt;br /&gt;import javax.swing.JMenu;&lt;br /&gt;import javax.swing.JMenuBar;&lt;br /&gt;import javax.swing.JMenuItem;&lt;br /&gt;import javax.swing.KeyStroke;&lt;br /&gt;import javax.swing.MenuElement;&lt;br /&gt;import org.openide.ErrorManager;&lt;br /&gt;import org.openide.explorer.ExplorerManager;&lt;br /&gt;import org.openide.explorer.ExplorerUtils;&lt;br /&gt;import org.openide.util.Lookup;&lt;br /&gt;import org.openide.util.NbBundle;&lt;br /&gt;import org.openide.windows.TopComponent;&lt;br /&gt;import org.openide.windows.WindowManager;&lt;br /&gt;&lt;br /&gt;/**&lt;br /&gt; * Top component which displays something.&lt;br /&gt; */&lt;br /&gt;final class GroovyConsoleTopComponent extends TopComponent implements&lt;br /&gt;ExplorerManager.Provider, Lookup.Provider {&lt;br /&gt;&lt;br /&gt;    private static GroovyConsoleTopComponent instance;&lt;br /&gt;    /** path to the icon used by the component and its open action */&lt;br /&gt;//    static final String ICON_PATH = "SET/PATH/TO/ICON/HERE";&lt;br /&gt;&lt;br /&gt;    private static final String PREFERRED_ID = "GroovyConsoleTopComponent";&lt;br /&gt;    private ExplorerManager manager;&lt;br /&gt;    private Lookup lookup;&lt;br /&gt;&lt;br /&gt;    private GroovyConsoleTopComponent() {&lt;br /&gt;        initComponents();&lt;br /&gt;        manager = new ExplorerManager();&lt;br /&gt;        setName(NbBundle.getMessage(GroovyConsoleTopComponent.class,&lt;br /&gt;"CTL_GroovyConsoleTopComponent"));&lt;br /&gt;        setToolTipText(NbBundle.getMessage(GroovyConsoleTopComponent.class,&lt;br /&gt;"HINT_GroovyConsoleTopComponent"));&lt;br /&gt;        Binding bind = new Binding();&lt;br /&gt;        groovy.ui.Console console = new&lt;br /&gt;groovy.ui.Console(this.getClass().getClassLoader(),bind);&lt;br /&gt;        bind.setProperty("console",console);&lt;br /&gt;        try {&lt;br /&gt;            console.run();&lt;br /&gt;            add(console.getFrame().getJMenuBar(),BorderLayout.NORTH);&lt;br /&gt;            add(console.getFrame().getContentPane(),BorderLayout.CENTER);&lt;br /&gt;            ActionMap am = this.getActionMap();&lt;br /&gt;            InputMap im =&lt;br /&gt;this.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);&lt;br /&gt;            setShortcutMaps(console.getFrame().getJMenuBar(),am,im);&lt;br /&gt;            console.getFrame().setVisible(false);&lt;br /&gt;            this.revalidate();&lt;br /&gt;            lookup = ExplorerUtils.createLookup(manager, am);&lt;br /&gt;        } catch (Throwable e) {&lt;br /&gt;            e.printStackTrace();&lt;br /&gt;            ErrorManager.getDefault().notify(e);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//        setIcon(Utilities.loadImage(ICON_PATH, true));&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private  void setShortcutMaps(JMenuBar jmb, ActionMap am, InputMap im) {&lt;br /&gt;&lt;br /&gt;        for (JMenuItem me3 : getMenuItems(jmb)) {&lt;br /&gt;            Action a = ((JMenuItem)me3).getAction();&lt;br /&gt;            KeyStroke k = ((JMenuItem)me3).getAccelerator();&lt;br /&gt;            im.put(k,a.getValue(Action.NAME));&lt;br /&gt;            am.put(a.getValue(Action.NAME),a);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private List getMenuItems(MenuElement me) {&lt;br /&gt;        List thisLevelMenuItems = new ArrayList();&lt;br /&gt;        if (me!=null &amp;&amp; me.getSubElements()!=null &amp;&amp;&lt;br /&gt;me.getSubElements().length&gt;0) {&lt;br /&gt;            for (MenuElement me1 : me.getSubElements()) {&lt;br /&gt;                if (me1 instanceof JMenuItem &amp;&amp; !(me1 instanceof JMenu)) {&lt;br /&gt;                    thisLevelMenuItems.add((JMenuItem)me1);&lt;br /&gt;                } else {&lt;br /&gt;                    thisLevelMenuItems.addAll(getMenuItems(me1));&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        return thisLevelMenuItems;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public ExplorerManager getExplorerManager() {&lt;br /&gt;        return manager;&lt;br /&gt;    }&lt;br /&gt;    public Lookup getLookup() {&lt;br /&gt;        return lookup;&lt;br /&gt;    }&lt;br /&gt;// ...methods as before, but replace componentActivated and&lt;br /&gt;// componentDeactivated with e.g.:&lt;br /&gt;    public void addNotify() {&lt;br /&gt;        super.addNotify();&lt;br /&gt;        ExplorerUtils.activateActions(manager, true);&lt;br /&gt;    }&lt;br /&gt;    public void removeNotify() {&lt;br /&gt;        ExplorerUtils.activateActions(manager, false);&lt;br /&gt;        super.removeNotify();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /** This method is called from within the constructor to&lt;br /&gt;     * initialize the form.&lt;br /&gt;     * WARNING: Do NOT modify this code. The content of this method is&lt;br /&gt;     * always regenerated by the Form Editor.&lt;br /&gt;     */&lt;br /&gt;    //&lt;br /&gt;    private void initComponents() {&lt;br /&gt;        pnlButtons = new javax.swing.JPanel();&lt;br /&gt;        pnlMain = new javax.swing.JPanel();&lt;br /&gt;&lt;br /&gt;        setLayout(new java.awt.BorderLayout());&lt;br /&gt;&lt;br /&gt;    }//&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    // Variables declaration - do not modify&lt;br /&gt;    private javax.swing.JPanel pnlButtons;&lt;br /&gt;    private javax.swing.JPanel pnlMain;&lt;br /&gt;    // End of variables declaration&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Gets default instance. Do not use directly: reserved for&lt;br /&gt;*.settings files only,&lt;br /&gt;     * i.e. deserialization routines; otherwise you could get a&lt;br /&gt;non-deserialized instance.&lt;br /&gt;     * To obtain the singleton instance, use {@link findInstance}.&lt;br /&gt;     */&lt;br /&gt;    public static synchronized GroovyConsoleTopComponent getDefault() {&lt;br /&gt;        if (instance == null) {&lt;br /&gt;            instance = new GroovyConsoleTopComponent();&lt;br /&gt;        }&lt;br /&gt;        return instance;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Obtain the GroovyConsoleTopComponent instance. Never call&lt;br /&gt;{@link #getDefault} directly!&lt;br /&gt;     */&lt;br /&gt;    public static synchronized GroovyConsoleTopComponent findInstance() {&lt;br /&gt;        TopComponent win =&lt;br /&gt;WindowManager.getDefault().findTopComponent(PREFERRED_ID);&lt;br /&gt;        if (win == null) {&lt;br /&gt;            ErrorManager.getDefault().log(ErrorManager.WARNING,&lt;br /&gt;"Cannot find GroovyConsole component. It will not be located properly&lt;br /&gt;in the window system.");&lt;br /&gt;            return getDefault();&lt;br /&gt;        }&lt;br /&gt;        if (win instanceof GroovyConsoleTopComponent) {&lt;br /&gt;            return (GroovyConsoleTopComponent)win;&lt;br /&gt;        }&lt;br /&gt;        ErrorManager.getDefault().log(ErrorManager.WARNING, "There&lt;br /&gt;seem to be multiple components with the '" + PREFERRED_ID + "' ID.&lt;br /&gt;That is a potential source of errors and unexpected behavior.");&lt;br /&gt;        return getDefault();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public int getPersistenceType() {&lt;br /&gt;        return TopComponent.PERSISTENCE_ALWAYS;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void componentOpened() {&lt;br /&gt;        // TODO add custom code on component opening&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void componentClosed() {&lt;br /&gt;        // TODO add custom code on component closing&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /** replaces this in object stream */&lt;br /&gt;    public Object writeReplace() {&lt;br /&gt;        return new ResolvableHelper();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    protected String preferredID() {&lt;br /&gt;        return PREFERRED_ID;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    final static class ResolvableHelper implements Serializable {&lt;br /&gt;        private static final long serialVersionUID = 1L;&lt;br /&gt;        public Object readResolve() {&lt;br /&gt;            return GroovyConsoleTopComponent.getDefault();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/19648744-6421221097309898149?l=www.troymaxventures.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.troymaxventures.com/feeds/6421221097309898149/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.troymaxventures.com/2007/03/netbeans-groovy-console.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/6421221097309898149'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/6421221097309898149'/><link rel='alternate' type='text/html' href='http://www.troymaxventures.com/2007/03/netbeans-groovy-console.html' title='NetBeans Groovy console'/><author><name>Alex Kotchnev</name><uri>https://profiles.google.com/103108222242966756240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-_FzUCgGWKhc/AAAAAAAAAAI/AAAAAAAABGY/gikhtyKNdVc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19648744.post-115785220658085927</id><published>2006-09-09T20:03:00.000-04:00</published><updated>2007-08-27T02:38:23.656-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='netbeans rcp'/><category scheme='http://www.blogger.com/atom/ns#' term='netbeans'/><title type='text'>NetBeans module development book</title><content type='html'>Geertjan is on a roll: he just posted the first chapter of the &lt;a href="http://blogs.sun.com/geertjan/entry/pilot_chapter_for_upcoming_netbeans"&gt;NetBeans module development book &lt;/a&gt; on his blog. He always surpises me by his posts and always makes me say " I wish I had this when I was doing my stuff so that I wouldn't have spent as much time figuring things out on my own". &lt;br /&gt;&lt;br /&gt;The first book on NetBeans that I've read is about NetBeans 3.5. Although that was really nice in getting me up to speed on NetBeans at the time, a lot of the things in it (especially on the module development side) don't really apply. It is a really nice book to help you understand the inner workings of NetBeans; however, at the same time, a lot of the inner workings have changed and it becomes pretty difficult to figure out on your own which one of the things in that book are still valid, and which ones aren't. From that perspective, the book that Geertjan has started would be invaluable in that respect. &lt;br /&gt;&lt;br /&gt;Since this (hopefully) last semester I would try to focus a lot on my thesis project (which has to do with J2ME mobile video), I probably wouldn't have much time to spend on digging around the NetBeans APIs and trying to figure them out on my own. At the same time, if Geertjan continues to write this book, I could probably try to write a "parallel" set of examples that do the same things that he illustrates for Wicket and Click for Tapestry.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/19648744-115785220658085927?l=www.troymaxventures.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.troymaxventures.com/feeds/115785220658085927/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.troymaxventures.com/2006/09/netbeans-module-development-book.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/115785220658085927'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/115785220658085927'/><link rel='alternate' type='text/html' href='http://www.troymaxventures.com/2006/09/netbeans-module-development-book.html' title='NetBeans module development book'/><author><name>Alex Kotchnev</name><uri>https://profiles.google.com/103108222242966756240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-_FzUCgGWKhc/AAAAAAAAAAI/AAAAAAAABGY/gikhtyKNdVc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19648744.post-115625294550996755</id><published>2006-08-20T09:21:00.000-04:00</published><updated>2007-08-27T02:38:45.568-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tapestry'/><category scheme='http://www.blogger.com/atom/ns#' term='netbeans rcp'/><category scheme='http://www.blogger.com/atom/ns#' term='netbeans'/><title type='text'>Tapestry NetBeans Plugin</title><content type='html'>This is repost of my original post - since it was linked by Geertjan and NetBeans weekly news at two different URLs, here it goes...:&lt;br /&gt;&lt;br /&gt;I've read up a bit on Tapestry and I've followed &lt;a href="http://blogs.sun.com/geertjan"&gt;Geertjan's&lt;/a&gt; blog  for quite a while now. I've been a NetBeans fan for quite a while now (since 3.5), and Geertjan's blog has been really eye opening in what is possible with NetBeans. So, a while back, he was really excited about Wicket, and he started working on a plugin for developing Wicket apps in NetBeans. It appears that in the last few months, with the help of Petr they've built quite a nice set up to support Wicket in NetBeans. &lt;br /&gt;&lt;br /&gt;What that means about me is that I will try to do something similar, but with Tapestry. What I will try to do is to develop a plugin that will support Tapestry development in NetBeans. Geertjan has already done most of the work here as he has covered a lot of the topics that are required to build a nice web framework support plugin for NetBeans. At the same time, as he seems to point out in one of his latest entries, the information that is required to build such a plugin is either scattered all over the net (or the NetBeans.org site), or is in the source code for his &lt;a href="https://nbwicketsupport.dev.java.net/"&gt;Wicket support plugin&lt;/a&gt; . Now that I'm trying to organize my thoughts about this project better, I start noticing that he's also done a great job of documenting his work and his progress along the way. However, I guess giving it a second run wouldn't hurt anyone. &lt;br /&gt;&lt;br /&gt;I will probably try to put up a post that would list the proposed features for such a plugin. However, the idea is that the plugin should make working with Tapestry easier, maybe even to the point of not having to know all the nitty-gritty details of exactly how Tapestry works. It should probably have all the nice features of the Wicket plugin, translated into the Tapestry world. &lt;br /&gt;&lt;br /&gt;One thing that I've considered in the past is to dig into the &lt;a href="http://spindle.sourceforge.net/"&gt;Spindle&lt;/a&gt; project (which is an Eclipse Tapestry support plugin which has an Eclipse specific and an Eclipse agnostic part) and try to adapt it to work for NetBeans. Now, the thing is that part of my goals includes learning the NetBeans APIs along the way. So, while sometime down the road, looking into using the Spindle implementation and putting up a NetBeans frontend to it would make sense, it appears that for now it would make the most sense to see about implementing the basics in NetBeans only... &lt;br /&gt;&lt;br /&gt;I will also probably post more details on the steps required to accomplish this; however, after a few hours of playing around with NetBeans, the tutorials on the site, Geertjan's tutorials, as well as the NetBeans APIs, I've put together the first few things for the plugin... Here are a couple of screenshots that just give me an enormous adrenaline rush... &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;First, a blank Tapestry project, set up and ready to go (I wish I knew how to do this a while back at work, as with both Tapestry and JSF/Facelets I've always kept referring to a sample project that I know it works when I've done new projects...):&lt;br /&gt;&lt;a href="http://photos1.blogger.com/blogger/4909/1204/1600/tapestry_blank_project.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://photos1.blogger.com/blogger/4909/1204/320/tapestry_blank_project.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Geertjan is probably going to laugh at this one as this is dirt simple to do, but damn, it is nice to be able t accomplish this. &lt;br/&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The next one is showing how the Tapestry framework is added to the list of supported frameworks in a standard NetBeans web project. I admit right off the bat that I took all the code from the Wicket plugin and replaced all references to Wicket with references to Tapestry. I still need to remove some of the config options here that really have nothing to do with Tapestry, but this is a very nice start (I was initially having some trouble getting the framework support in - I spent a good number of hours until I found out exactly how to register the framework in the IDE). &lt;br /&gt;&lt;a href="http://photos1.blogger.com/blogger/4909/1204/1600/tapestry_framework_support.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://photos1.blogger.com/blogger/4909/1204/320/tapestry_framework_support.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;&lt;br /&gt;The last one is a list of a couple of new file types added to a project. Most likely, I will have to restrict them to Tapestry projects only, but it's a nice start again. THere is more work to be done to maybe create a graphical customizer for a Tapestry page, but still.. I'm pumped.. :-) &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/blogger/4909/1204/1600/tapestry_filetypes.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://photos1.blogger.com/blogger/4909/1204/320/tapestry_filetypes.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/19648744-115625294550996755?l=www.troymaxventures.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.troymaxventures.com/feeds/115625294550996755/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.troymaxventures.com/2006/08/tapestry-netbeans-plugin.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/115625294550996755'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/115625294550996755'/><link rel='alternate' type='text/html' href='http://www.troymaxventures.com/2006/08/tapestry-netbeans-plugin.html' title='Tapestry NetBeans Plugin'/><author><name>Alex Kotchnev</name><uri>https://profiles.google.com/103108222242966756240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-_FzUCgGWKhc/AAAAAAAAAAI/AAAAAAAABGY/gikhtyKNdVc/s512-c/photo.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19648744.post-115389097016600046</id><published>2006-07-21T01:15:00.000-04:00</published><updated>2007-08-27T02:40:27.273-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tapestry'/><category scheme='http://www.blogger.com/atom/ns#' term='netbeans rcp'/><category scheme='http://www.blogger.com/atom/ns#' term='netbeans'/><title type='text'>Tapestry NetBeans plugin</title><content type='html'>I've read up a bit on Tapestry and I've followed &lt;a href="http://blogs.sun.com/geertjan"&gt;Geertjan's&lt;/a&gt; blog  for quite a while now. I've been a NetBeans fan for quite a while now (since 3.5), and Geertjan's blog has been really eye opening in what is possible with NetBeans. So, a while back, he was really excited about Wicket, and he started working on a plugin for developing Wicket apps in NetBeans. It appears that in the last few months, with the help of Petr they've built quite a nice set up to support Wicket in NetBeans. &lt;br /&gt;&lt;br /&gt;What that means about me is that I will try to do something similar, but with Tapestry. What I will try to do is to develop a plugin that will support Tapestry development in NetBeans. Geertjan has already done most of the work here as he has covered a lot of the topics that are required to build a nice web framework support plugin for NetBeans. At the same time, as he seems to point out in one of his latest entries, the information that is required to build such a plugin is either scattered all over the net (or the NetBeans.org site), or is in the source code for his &lt;a href="https://nbwicketsupport.dev.java.net/"&gt;Wicket support plugin&lt;/a&gt; . Now that I'm trying to organize my thoughts about this project better, I start noticing that he's also done a great job of documenting his work and his progress along the way. However, I guess giving it a second run wouldn't hurt anyone. &lt;br /&gt;&lt;br /&gt;I will probably try to put up a post that would list the proposed features for such a plugin. However, the idea is that the plugin should make working with Tapestry easier, maybe even to the point of not having to know all the nitty-gritty details of exactly how Tapestry works. It should probably have all the nice features of the Wicket plugin, translated into the Tapestry world. &lt;br /&gt;&lt;br /&gt;One thing that I've considered in the past is to dig into the &lt;a href="http://spindle.sourceforge.net/"&gt;Spindle&lt;/a&gt; project (which is an Eclipse Tapestry support plugin which has an Eclipse specific and an Eclipse agnostic part) and try to adapt it to work for NetBeans. Now, the thing is that part of my goals includes learning the NetBeans APIs along the way. So, while sometime down the road, looking into using the Spindle implementation and putting up a NetBeans frontend to it would make sense, it appears that for now it would make the most sense to see about implementing the basics in NetBeans only... &lt;br /&gt;&lt;br /&gt;I will also probably post more details on the steps required to accomplish this; however, after a few hours of playing around with NetBeans, the tutorials on the site, Geertjan's tutorials, as well as the NetBeans APIs, I've put together the first few things for the plugin... Here are a couple of screenshots that just give me an enormous adrenaline rush... &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;First, a blank Tapestry project, set up and ready to go (I wish I knew how to do this a while back at work, as with both Tapestry and JSF/Facelets I've always kept referring to a sample project that I know it works when I've done new projects...):&lt;br /&gt;&lt;a href="http://photos1.blogger.com/blogger/4909/1204/1600/tapestry_blank_project.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://photos1.blogger.com/blogger/4909/1204/320/tapestry_blank_project.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Geertjan is probably going to laugh at this one as this is dirt simple to do, but damn, it is nice to be able t accomplish this. &lt;br/&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The next one is showing how the Tapestry framework is added to the list of supported frameworks in a standard NetBeans web project. I admit right off the bat that I took all the code from the Wicket plugin and replaced all references to Wicket with references to Tapestry. I still need to remove some of the config options here that really have nothing to do with Tapestry, but this is a very nice start (I was initially having some trouble getting the framework support in - I spent a good number of hours until I found out exactly how to register the framework in the IDE). &lt;br /&gt;&lt;a href="http://photos1.blogger.com/blogger/4909/1204/1600/tapestry_framework_support.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://photos1.blogger.com/blogger/4909/1204/320/tapestry_framework_support.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;&lt;br /&gt;The last one is a list of a couple of new file types added to a project. Most likely, I will have to restrict them to Tapestry projects only, but it's a nice start again. THere is more work to be done to maybe create a graphical customizer for a Tapestry page, but still.. I'm pumped.. :-) &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://photos1.blogger.com/blogger/4909/1204/1600/tapestry_filetypes.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://photos1.blogger.com/blogger/4909/1204/320/tapestry_filetypes.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/19648744-115389097016600046?l=www.troymaxventures.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.troymaxventures.com/feeds/115389097016600046/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.troymaxventures.com/2006/07/tapestry-netbeans-plugin.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/115389097016600046'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/115389097016600046'/><link rel='alternate' type='text/html' href='http://www.troymaxventures.com/2006/07/tapestry-netbeans-plugin.html' title='Tapestry NetBeans plugin'/><author><name>Alex Kotchnev</name><uri>https://profiles.google.com/103108222242966756240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-_FzUCgGWKhc/AAAAAAAAAAI/AAAAAAAABGY/gikhtyKNdVc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19648744.post-114475802638299534</id><published>2006-04-11T08:20:00.001-04:00</published><updated>2008-08-08T13:06:43.918-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='netbeans'/><category scheme='http://www.blogger.com/atom/ns#' term='j2me'/><category scheme='http://www.blogger.com/atom/ns#' term='mobility'/><title type='text'>Opensourcing of Mobility Pack</title><content type='html'>World, take note, the Mobility Pack has been open sourced !!!! Awesome....&lt;br /&gt;&lt;a href="http://blogs.sun.com/roller/page/lukas?entry=opensoucing_of_mobility_pack"&gt;Opensoucing of Mobility Pack&lt;/a&gt;. Well, I can't wait to get my hands on the source code so that I can figure out why the hell the WTK 2.2 emulator would not play videos under Linux - it only shows a black rectangle, the media "pretends" that it's playing, but nothing is displayed. What would also be cool is that for my thesis presentation, I would be able to make an "Emulator connector" for the server side of my Mobile Video Streaming project, so that when the media becomes available, I can "send" a text message to the emulator directly from the server side (and not having to do stuff manually)...&lt;br /&gt;&lt;br /&gt;All in all... AWESOME !!!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/19648744-114475802638299534?l=www.troymaxventures.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.troymaxventures.com/feeds/114475802638299534/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.troymaxventures.com/2006/04/opensourcing-of-mobility-pack.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/114475802638299534'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/114475802638299534'/><link rel='alternate' type='text/html' href='http://www.troymaxventures.com/2006/04/opensourcing-of-mobility-pack.html' title='Opensourcing of Mobility Pack'/><author><name>Alex Kotchnev</name><uri>https://profiles.google.com/103108222242966756240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-_FzUCgGWKhc/AAAAAAAAAAI/AAAAAAAABGY/gikhtyKNdVc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-19648744.post-114441774870154225</id><published>2006-04-07T09:47:00.001-04:00</published><updated>2008-08-08T13:06:20.779-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='netbeans'/><title type='text'>Netbeans Community Chat</title><content type='html'>Check out the first &lt;a href="http://qa.netbeans.org/chats/chat_1/transcript.html"&gt;NetBeans chat &lt;/a&gt; - a lot of good ideas of what needs to be done in Netbeans, as well as a good feel of the important people around the development. Lots of good ideas from the chat and I'll be looking forward to seeing them : e.g. setting up a centralized wiki for NetBeans, setting up some RSS feeds about new documentation and stuff, setting up a centralized spot with useful update centers, etc. &lt;br /&gt;&lt;br /&gt;Reading through the chat makes me think about something.. I do believe NetBeans is superior to Eclipse - seriously, I've tried to set up Eclipse on a few occasions (e.g. JBossIDE), but after the first hour of trying to install everything I need, I just give up.. In NetBeans, everything just comes in integrated very nicely. However, one thing that I think Netbeans is behind Eclipse is tool support for various projects - e.g. xdoclet tag completion (although there is a pretty good shot at creating a module), better hibernate support, etc. I do think that one of the reasons that a lot of people go for Eclipse is that it just has a little tool that supports what they're currently doing..  &lt;br /&gt;&lt;br /&gt;Something else that is NetBeans related that I just remembered - I was really bummed out when I found out that Nokia has moved their IDE to Eclipse (with  carbidej and I guess carbideC+).. I was really happy to just install their Nokia Developer Suite and have some extensions to my NetBeans install...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/19648744-114441774870154225?l=www.troymaxventures.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.troymaxventures.com/feeds/114441774870154225/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.troymaxventures.com/2006/04/netbeans-community-chat.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/114441774870154225'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19648744/posts/default/114441774870154225'/><link rel='alternate' type='text/html' href='http://www.troymaxventures.com/2006/04/netbeans-community-chat.html' title='Netbeans Community Chat'/><author><name>Alex Kotchnev</name><uri>https://profiles.google.com/103108222242966756240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-_FzUCgGWKhc/AAAAAAAAAAI/AAAAAAAABGY/gikhtyKNdVc/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry></feed>
