{"id":255,"date":"2011-08-19T16:22:21","date_gmt":"2011-08-19T23:22:21","guid":{"rendered":"http:\/\/www.connorgarvey.com\/blog\/?p=255"},"modified":"2011-08-19T18:23:48","modified_gmt":"2011-08-20T01:23:48","slug":"a-yammer-app-using-gaelyk-for-google-app-engine","status":"publish","type":"post","link":"https:\/\/connorgarvey.com\/blog\/?p=255","title":{"rendered":"A Yammer App Using Gaelyk for Google App Engine"},"content":{"rendered":"<p>I recently attended a presentation by <a href=\"http:\/\/www.augusttechgroup.com\/tim\/about\/\">Tim Berglund<\/a> about <a href=\"http:\/\/gaelyk.appspot.com\/\">Gaelyk<\/a> at <a href=\"http:\/\/uberconf.com\/\">Uberconf<\/a>.\u00a0 The technology of Gaelyk is pretty straightforward and doesn&#8217;t need much of an introduction, especially with <a href=\"http:\/\/gaelyk.appspot.com\/tutorial\">the excellent tutorial available on its web site<\/a>.\u00a0 Watching the presentation, I was struck by how little there is to Gaelyk and wondered why I was there.\u00a0 Sitting in a room of developers and coding a working, useful application in just over an hour, though, reminded me about how much fun web programming can be.\u00a0 Many of us have become so accustomed to frameworks like Struts, WebMVC, GWT and Grails that we&#8217;ve forgotten the simpler times, when you could slap together some Servlets and JSPs and have fun putting together a small, useful app.\u00a0 Gaelyk brings back those simpler times and makes them even more enjoyable by adding the conveniences of Groovy and App Engine.<\/p>\n<p>I picked an app that I wanted to code, something that would tell Yammer users what their companies are talking about.\u00a0 It&#8217;s available for anyone to use at <a href=\"http:\/\/whatyammer.appspot.com\">http:\/\/whatyammer.appspot.com<\/a>.<\/p>\n<h1>Data access<\/h1>\n<p>Want to save a record to the database?\u00a0 Forget about messing around with bean and data access classes, database connections and ORM.\u00a0 No need to create tables.\u00a0 You&#8217;re coding for fun!<\/p>\n<div id=\"wpshdo_1\" class=\"wp-synhighlighter-outer\"><div id=\"wpshdt_1\" class=\"wp-synhighlighter-expanded\"><table border=\"0\" width=\"100%\"><tr><td align=\"left\" width=\"80%\"><a name=\"#codesyntax_1\"><\/a><a id=\"wpshat_1\" class=\"wp-synhighlighter-title\" href=\"#codesyntax_1\"  onClick=\"javascript:wpsh_toggleBlock(1)\" title=\"Click to show\/hide code block\">Code block<\/a><\/td><td align=\"right\"><a href=\"#codesyntax_1\" onClick=\"javascript:wpsh_code(1)\" title=\"Show code only\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/connorgarvey.com\/blog\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/code.png\" \/><\/a>&nbsp;<a href=\"#codesyntax_1\" onClick=\"javascript:wpsh_print(1)\" title=\"Print code\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/connorgarvey.com\/blog\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/printer.png\" \/><\/a>&nbsp;<a href=\"https:\/\/connorgarvey.com\/blog\/wp-content\/plugins\/wp-synhighlight\/About.html\" target=\"_blank\" title=\"Show plugin information\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/connorgarvey.com\/blog\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/info.gif\" \/><\/a>&nbsp;<\/td><\/tr><\/table><\/div><div id=\"wpshdi_1\" class=\"wp-synhighlighter-inner\" style=\"display: block;\"><pre class=\"groovy\" style=\"font-family:monospace;\"><span class=\"kw2\">def<\/span> user <span class=\"sy0\">=<\/span> <span class=\"kw2\">new<\/span> <span class=\"kw3\">Entity<\/span><span class=\"br0\">&#40;<\/span><span class=\"st0\">'user'<\/span><span class=\"br0\">&#41;<\/span>\nuser.<span class=\"me1\">email<\/span> <span class=\"sy0\">=<\/span> params.<span class=\"me1\">email<\/span>\nuser.<span class=\"me1\">name<\/span> <span class=\"sy0\">=<\/span> params.<span class=\"me1\">name<\/span>\nuser.<span class=\"me1\">phone<\/span> <span class=\"sy0\">=<\/span> params.<span class=\"me1\">phone<\/span>\nuser.<span class=\"me1\">save<\/span><span class=\"br0\">&#40;<\/span><span class=\"br0\">&#41;<\/span><\/pre><\/div><\/div>\n<p>That&#8217;s all.\u00a0 To get that record back out <div id=\"wpshdo_2\" class=\"wp-synhighlighter-outer\"><div id=\"wpshdt_2\" class=\"wp-synhighlighter-expanded\"><table border=\"0\" width=\"100%\"><tr><td align=\"left\" width=\"80%\"><a name=\"#codesyntax_2\"><\/a><a id=\"wpshat_2\" class=\"wp-synhighlighter-title\" href=\"#codesyntax_2\"  onClick=\"javascript:wpsh_toggleBlock(2)\" title=\"Click to show\/hide code block\">Code block<\/a><\/td><td align=\"right\"><a href=\"#codesyntax_2\" onClick=\"javascript:wpsh_code(2)\" title=\"Show code only\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/connorgarvey.com\/blog\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/code.png\" \/><\/a>&nbsp;<a href=\"#codesyntax_2\" onClick=\"javascript:wpsh_print(2)\" title=\"Print code\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/connorgarvey.com\/blog\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/printer.png\" \/><\/a>&nbsp;<a href=\"https:\/\/connorgarvey.com\/blog\/wp-content\/plugins\/wp-synhighlight\/About.html\" target=\"_blank\" title=\"Show plugin information\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/connorgarvey.com\/blog\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/info.gif\" \/><\/a>&nbsp;<\/td><\/tr><\/table><\/div><div id=\"wpshdi_2\" class=\"wp-synhighlighter-inner\" style=\"display: block;\"><pre class=\"groovy\" style=\"font-family:monospace;\">datastore.<span class=\"kw9\">execute<\/span> <span class=\"br0\">&#123;<\/span>\n  select single from user\n  where email <span class=\"sy0\">==<\/span> params.<span class=\"me1\">email<\/span>\n<span class=\"br0\">&#125;<\/span><\/pre><\/div><\/div><\/p>\n<h1>Forwarding objects to a view<\/h1>\n<p>Gaelyk views are coded in gtpl files, which are much like JSPs. The controller, echo.groovy <div id=\"wpshdo_3\" class=\"wp-synhighlighter-outer\"><div id=\"wpshdt_3\" class=\"wp-synhighlighter-expanded\"><table border=\"0\" width=\"100%\"><tr><td align=\"left\" width=\"80%\"><a name=\"#codesyntax_3\"><\/a><a id=\"wpshat_3\" class=\"wp-synhighlighter-title\" href=\"#codesyntax_3\"  onClick=\"javascript:wpsh_toggleBlock(3)\" title=\"Click to show\/hide code block\">echo.groovy<\/a><\/td><td align=\"right\"><a href=\"#codesyntax_3\" onClick=\"javascript:wpsh_code(3)\" title=\"Show code only\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/connorgarvey.com\/blog\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/code.png\" \/><\/a>&nbsp;<a href=\"#codesyntax_3\" onClick=\"javascript:wpsh_print(3)\" title=\"Print code\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/connorgarvey.com\/blog\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/printer.png\" \/><\/a>&nbsp;<a href=\"https:\/\/connorgarvey.com\/blog\/wp-content\/plugins\/wp-synhighlight\/About.html\" target=\"_blank\" title=\"Show plugin information\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/connorgarvey.com\/blog\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/info.gif\" \/><\/a>&nbsp;<\/td><\/tr><\/table><\/div><div id=\"wpshdi_3\" class=\"wp-synhighlighter-inner\" style=\"display: block;\"><pre class=\"groovy\" style=\"font-family:monospace;\">request.<span class=\"me1\">users<\/span> <span class=\"sy0\">=<\/span> datastore.<span class=\"kw9\">execute<\/span> <span class=\"br0\">&#123;<\/span> select all from user where email <span class=\"sy0\">==<\/span> params.<span class=\"me1\">email<\/span> <span class=\"br0\">&#125;<\/span>\nforward <span class=\"st0\">'showusers.gtpl'<\/span><\/pre><\/div><\/div> The view, showusers.gtpl <div id=\"wpshdo_4\" class=\"wp-synhighlighter-outer\"><div id=\"wpshdt_4\" class=\"wp-synhighlighter-expanded\"><table border=\"0\" width=\"100%\"><tr><td align=\"left\" width=\"80%\"><a name=\"#codesyntax_4\"><\/a><a id=\"wpshat_4\" class=\"wp-synhighlighter-title\" href=\"#codesyntax_4\"  onClick=\"javascript:wpsh_toggleBlock(4)\" title=\"Click to show\/hide code block\">showusers.gtpl<\/a><\/td><td align=\"right\"><a href=\"#codesyntax_4\" onClick=\"javascript:wpsh_code(4)\" title=\"Show code only\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/connorgarvey.com\/blog\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/code.png\" \/><\/a>&nbsp;<a href=\"#codesyntax_4\" onClick=\"javascript:wpsh_print(4)\" title=\"Print code\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/connorgarvey.com\/blog\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/printer.png\" \/><\/a>&nbsp;<a href=\"https:\/\/connorgarvey.com\/blog\/wp-content\/plugins\/wp-synhighlight\/About.html\" target=\"_blank\" title=\"Show plugin information\"><img decoding=\"async\" border=\"0\" style=\"border: 0 none\" src=\"https:\/\/connorgarvey.com\/blog\/wp-content\/plugins\/wp-synhighlight\/themes\/default\/images\/info.gif\" \/><\/a>&nbsp;<\/td><\/tr><\/table><\/div><div id=\"wpshdi_4\" class=\"wp-synhighlighter-inner\" style=\"display: block;\"><pre class=\"groovy\" style=\"font-family:monospace;\">Adventure <span class=\"kw3\">Time<\/span> with <span class=\"sy0\">&lt;%=<\/span> <span class=\"br0\">&#40;<\/span>request.<span class=\"me1\">users<\/span><span class=\"sy0\">*<\/span>.<span class=\"me1\">name<\/span><span class=\"br0\">&#41;<\/span>.<span class=\"kw5\">join<\/span><span class=\"br0\">&#40;<\/span><span class=\"st0\">' and '<\/span><span class=\"br0\">&#41;<\/span> <span class=\"sy0\">%&gt;<\/span><\/pre><\/div><\/div> That prints the names of all users, with the word and between each one.\u00a0 That is just a small taste of what Gaelyk makes available.\u00a0 So simple!\u00a0 So much fun!\u00a0 Single-command deployment!\u00a0 Google will host 10 apps for free, so there isn&#8217;t any reason not to <a href=\"http:\/\/gaelyk.appspot.com\/download\">try it out<\/a>.\u00a0 Just note that before you deploy, you have to visit <a href=\"http:\/\/appengine.google.com\">http:\/\/appengine.google.com<\/a> and register your new app or Google will give you a very unhelpful error message.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recently attended a presentation by Tim Berglund about Gaelyk at Uberconf.\u00a0 The technology of Gaelyk is pretty straightforward and doesn&#8217;t need much of an introduction, especially with the excellent tutorial available on its web site.\u00a0 Watching the presentation, I was struck by how little there is to Gaelyk and wondered why I was there.\u00a0 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[65],"tags":[49,50,48],"class_list":["post-255","post","type-post","status-publish","format-standard","hentry","category-groovy","tag-gaelyk","tag-google-app-engine","tag-groovy"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1ql2n-47","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/connorgarvey.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/255","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/connorgarvey.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/connorgarvey.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/connorgarvey.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/connorgarvey.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=255"}],"version-history":[{"count":7,"href":"https:\/\/connorgarvey.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/255\/revisions"}],"predecessor-version":[{"id":258,"href":"https:\/\/connorgarvey.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/255\/revisions\/258"}],"wp:attachment":[{"href":"https:\/\/connorgarvey.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/connorgarvey.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/connorgarvey.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}