SlideShare a Scribd company logo
1 of 72
Download to read offline
A lightweight
                                         Groovy toolkit
                            for developing web applications
                                     on Google App Engine
vendredi 17 décembre 2010
A lightweight
                                         Groovy toolkit
                            for developing web applications
                                     on Google App Engine
vendredi 17 décembre 2010
Guillaume Laforge / @glaforge

       • Groovy Project Manager
       • Head of Groovy Development
         at SpringSource
       • Initiator of the Grails framework
       • Founder of the Gaelyk toolkit
       • Co-author of Groovy in Action
       • Member of «Les Cast Codeurs» podcast

       • Speaker: JavaOne, QCon, JavaZone, Sun TechDays,
         Devoxx, The Spring Experience, SpringOne2GX,
         JAX, Dynamic Language World, IJTC, and more...

    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   2
vendredi 17 décembre 2010
Cloud
  Computing
vendredi 17 décembre 2010
IaaS, PaaS, SaaS



       • Software as a Service
               – Gmail, SalesForce.com                                                                                   SaaS
       • Platform as a Service
               – Google App Engine
                                                                                                                         PaaS
       • Infrastructure as a Service
               – Amazon EC2
                                                                                                                         IaaS
    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.          4
vendredi 17 décembre 2010
IaaS, PaaS, SaaS



       • Software as a Service
               – Gmail, SalesForce.com                                                                                   SaaS
       • Platform as a Service
               – Google App Engine
                                                                                                                         PaaS
       • Infrastructure as a Service
               – Amazon EC2
                                                                                                                         IaaS
    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.          4
vendredi 17 décembre 2010
IaaS, PaaS, SaaS



       • Software as a Service
               – Gmail, SalesForce.com                                                                                   SaaS
       • Platform as a Service
               – Google App Engine
                                                                                                                         PaaS
       • Infrastructure as a Service
               – Amazon EC2
                                                                                                                         IaaS
    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.          4
vendredi 17 décembre 2010
Google App Engine

       • Google’s PaaS solution
       • Run your app on Google’s infrastructure

       • Initially just Python supported

       • 1+ year ago, Java supported added too
               – Sandboxed JVM
               – Jetty servlet container


       • Several JVM-compatible language supported


    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   5
vendredi 17 décembre 2010
Key aspects

       • You can use most of your usual web frameworks for
         developping apps on App Engine Java
               – A WAR file, basically!
               – Uploading to the cloud by sending deltas of changes

       • No OS image, or software to install
               – Unlike with Amazon EC2

       • All the scaling aspects are handled for you
               – Database / session replication, load balancing...

       • There are quotas, but you need a high traffic
         application to start being charged
               – Free to get started

    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   6
vendredi 17 décembre 2010
Available services

       • Memcache                                                                                                        – Send / receive Jabber
                                                                                                                           messages (GTalk)
               – JCache implementation
               – Save on CPU and DB                                                                               • User
                                                                                                                         – Use Google’s user/
       • URL Fetch                                                                                                         authentication system
               – Access remote resources                                                                                 – OAuth support
               – HttpUrlConnection
                                                                                                                  • Cron & Task queues
       • Mail                                                                                                            – Schedule tasks at regular
               – Support both incoming and                                                                                 intervals
                 outgoing emails                                                                                         – Queue units of work
       • Images                                                                                                   • Blobstore
               – Resize, crop, rotate...                                                                                 – For storing large content
       • XMPP                                                                                                     • And much more...
    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.                                 7
vendredi 17 décembre 2010
Limitations

       •Not our usual relational database
               – key / value datastore

       •30 seconds request duration limit
       • Forbidden to
               – write on the file system
               – create threads
               – use raw sockets
               – issue system calls
               – use IO / Swing / etc. directly
                      •There’s a whitelist of classes allowed

       • Number of files and their size are limited
    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   8
vendredi 17 décembre 2010
Quotas




    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   9
vendredi 17 décembre 2010
Quotas (1/2)

       •Bandwidth                                                                                                 •Mail
               – 1,3M requests/day                                                                                       – 7K calls/day
               – 1GB/day in/out                                                                                          – 2K recepients/day
               – 6.5 CPU hours/day                                                                                       – 5K emails/day
                                                                                                                         – 2K attachments
                                                                                                                         – 100MB of attachments
       •Datastore
               – 10M calls
               – 1GB/day                                                                                          •URL Fetch
               – 12GB in / 115GB out                                                                                     – 657K calls/day
               – 60 CPU hours/day                                                                                        – 4GB in/out /day



    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.                            10
vendredi 17 décembre 2010
Quotas (2/2)

       •XMPP                                                                                                      •Memcache
               – 657K calls/day                                                                                          – 8.6M calls/day
               – 4GB data sent/day                                                                                       – 10GB in
               – 657K recepients/day                                                                                     – 50GB out
               – 1MB invitations/day
                                                                                                                  •Task queues
       •Image manipulation                                                                                               – 100K calls

        –864 calls/day
        –1GB in / 5GB out
        –2.5M transforms



    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.                      11
vendredi 17 décembre 2010
Quotas (2/2)

       •XMPP                                                                                                      •Memcache
               – 657K calls/day                                                                                          – 8.6M calls/day
               – 4GB data sent/day                                                                                       – 10GB in
               – 657K recepients/day                                                                                     – 50GB out
               – 1MB invitations/day
                                                                                                                  •Task queues
       •Image manipulation                                                                                               – 100K calls

        –864 calls/day
                                                                                                                                            ur es
        –1GB in / 5GB out                                                                                                           d fig
                                                                                                                              da te
        –2.5M transforms
                                                                                                                         O ut

    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.                              11
vendredi 17 décembre 2010
The Datastore




vendredi 17 décembre 2010
The datastore...

       • Not your father’s relational database! «NoSQL»

       • Distributed key / value store
               – Based on Google’s «BigTable»
               – Schema-less approach
       • Supporting
               – Transactions and partitioning
               – Hierarchies through entity groups
       • Data access APIs
               – JPA and JDO
                      • but adds a big request load time factor
               – Direct low-level APIs

    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   13
vendredi 17 décembre 2010
...and its «limitations»

       • You’re not using SQL
               –No joins
               – No database constraints
               – No aggregation functions (count, avg...)


       • In a query, you can only filter on one column
         for inequality

       • Transactions only available in entity groups

       • You can only update an entity once in a transaction

    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   14
vendredi 17 décembre 2010
Nice dashboard

vendredi 17 décembre 2010
http://gaelyk.appspot.com




vendredi 17 décembre 2010
                                  F
http://gaelyk.appspot.com




vendredi 17 décembre 2010
                                  F
• Gaelyk is a lightweight Groovy toolkit on top of
         the Google App Engine Java SDK

       • Gaelyk builds on Groovy’s servlet support
               – Groovlets: Groovy scripts instead of raw servlets!
               – Groovy templates: JSP-like template engine
               – Both allow for a clean separation of views and logic


       • Gaelyk provides several enhancements around the
         GAE Java SDK to make life easier, thanks to
         Groovy’s dynamic nature


    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   17
vendredi 17 décembre 2010
Why Groovy?

       • Groovy is a dynamic language for the JVM
               – very flexible, malleable, expressive and concise syntax
               – easy to learn for Java developers
                      • deriving from the Java 5 grammar
               – provides powerful APIs to simplify the life of developers
                      • possibility to dynamically enrich existing APIs
               – support for Groovlets and its own template engine




    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   18
vendredi 17 décembre 2010
Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   19
vendredi 17 décembre 2010
Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   19
vendredi 17 décembre 2010
Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   19
vendredi 17 décembre 2010
Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   19
vendredi 17 décembre 2010
Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   19
vendredi 17 décembre 2010
Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   19
vendredi 17 décembre 2010
Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   19
vendredi 17 décembre 2010
Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   19
vendredi 17 décembre 2010
Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   19
vendredi 17 décembre 2010
Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   19
vendredi 17 décembre 2010
Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   19
vendredi 17 décembre 2010
First steps...



 • Go to http://gaelyk.appspot.com
 • Download the template project
 • Put your first Groovlet in /WEB-INF/groovy
 • And your templates in /WEB-INF/pages
 • And you’re ready to go!
 • Launch dev_appserver.sh
 • Go to http://localhost:8080/
vendredi 17 décembre 2010
The web.xml

                                                                                       ">
                       <web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5
                         <servlet>
                           <servlet-name>GroovletServlet</servlet-name>
                           <servlet-class>groovyx.gaelyk.GaelykServlet</servlet-class>
                         </servlet>
                         <servlet>
                           <servlet-name>TemplateServlet</servlet-name>
                                                                                        -class>
                           <servlet-class>groovyx.gaelyk.GaelykTemplateServlet</servlet
                         </servlet>

                            <servlet-mapping>
                              <servlet-name>GroovletServlet</servlet-name>
                              <url-pattern>*.groovy</url-pattern>
                            </servlet-mapping>
                            <servlet-mapping>
                              <servlet-name>TemplateServlet</servlet-name>
                              <url-pattern>*.gtpl</url-pattern>
                            </servlet-mapping>

                          <welcome-file-list>
                            <welcome-file>index.gtpl</welcome-file>
                          </welcome-file-list>
                        </web-app>



    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   21
vendredi 17 décembre 2010
MVC: Groovlets and templates




                                    Groovlets                                                                            Templates
                                   (controllers)                                                                           (views)




                                                                                        Entities
                                                                                       (domain)




    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.


vendredi 17 décembre 2010
                                                                                                                                     22
A groovlet

       • Instead of writing full-blown servlets, just write
         Groovy scripts (aka Groovlets)

                                     def numbers = [1, 2, 3, 4]
                                     def now = new Date()

                                      html.html {
                                          body {
                                              numbers.each { number -> p number }
                                              p now
                                          }
                                      }




    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   23
vendredi 17 décembre 2010
A groovlet

       • Instead of writing full-blown servlets, just write
         Groovy scripts (aka Groovlets)

                                     def numbers = [1, 2, 3, 4]
                                     def now = new Date()

                                      html.html {
                                          body {
                                              numbers.each { number -> p number }
                                              p now
                                          }
                                                                                                                                     di ng
                                                                                                                                   oa
                                      }

                                                                                                                              -rel
                                                                                                                           to
                                                                                                                         Au
    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.                       23
vendredi 17 décembre 2010
A template

                                          <html>
                                              <body>
                                                   <p><%
                                                       def message = "Hello World!"
                                                       print message %>
                                                   </p>
                                                   <p><%= message %></p>
                                                   <p>${message}</p>
                                                   <ul>
                                                   <% 3.times { %>
                                                        <li>${message}</li>
                                                   <% } %>
                                                   </ul>
                                               </body>
                                           </html>


    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   24
vendredi 17 décembre 2010
A template

                                          <html>
                                              <body>
                                                   <p><%
                                                       def message = "Hello World!"
                                                       print message %>
                                                   </p>
                                                   <p><%= message %></p>
                                                   <p>${message}</p>
                                                   <ul>
                                                   <% 3.times { %>
                                                        <li>${message}</li>
                                                   <% } %>
                                                                                                                                     di ng
                                                   </ul>
                                                                                                                                el oa
                                               </body>
                                                                                                                           to -r
                                                                                                                         Au
                                           </html>


    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.                       24
vendredi 17 décembre 2010
Shortcuts

    • Google services                                                                                               • Variables available
      –datastore                                                                                                      –request / response
      –blobstore                                                                                                      –context / application
      –memcache                                                                                                       –sessions
      –capabilities                                                                                                   –params / headers
      –images                                                                                                         –out / sout / html
      –urlFetch                                                                                                       –localMode / app.*
      –mail
      –userService / user                                                                                           • Methods available
      –defaultQueue / queues                                                                                          –include / forward /
      –xmpp                                                                                                            redirect
      –namespace                                                                                                      –println / print
    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.                         25
vendredi 17 décembre 2010
D E M O
                                      26
vendredi 17 décembre 2010
Groovy sugar!




vendredi 17 décembre 2010
Sending emails with Gaelyk




                        mail.send to:                                                  'to@gmail.com',
                                from:                                                  'other@gmail.com',
                             subject:                                                  'Hello World',
                            htmlBody:                                                  '<bold>Hello</bold>'




    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   28
vendredi 17 décembre 2010
...compared to Java


      Properties props = new Properties();
                                                          , null);
      Sessio n session = Session.getDefaultInstance(props

      try {
          Message msg = new MimeMessage(session);
                                                          om", "Admin"));
          msg .setFrom(new InternetAddress("other@gmail.c
                                                   O,
          msg.addRecipient(Message.RecipientType.T
                                                                 , "Mr. User"));
                            new InternetAddress("to@example.com"
          msg.setSubject("Hello World");
          msg.setText("<bold>Hello</bold>");
          Transport.send(msg);
      } catch (AddressException e) {}
      } catch (MessagingException e) {}




    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   29
vendredi 17 décembre 2010
Accessing the datastore

       • Direct interaction with the low-level datastore API
                                                                                         ty
                                          import com.google.appengine.api.datastore.Enti
                                           
                                          Entity entity = new Entity("person")
                                           
                                                                                       map
                                          // subscript notation, like when accessing a
                                          entity['name'] = "Guillaume Laforge"
                                           
                                          // normal property access notation
                                          entity.age = 32

                                           entity.save()
                                           entity.delete()

                                            datastore.withTransaction {
                                                // do stuff with your entities
                                                // within the transaction
                                            }


    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   30
vendredi 17 décembre 2010
Querying to be improved...

                      import com.google.appengine.api.datastore.*
                                                                                         der.*
                      import static com.google.appengine.api.datastore.FetchOptions.Buil
                       
                      // query the scripts stored in the datastore
                      def query = new Query("savedscript")
                       
                      // sort results by descending order of the creation date
                      query.addSort("dateCreated", Query.SortDirection.DESCENDING)
                       
                                                                                        author
                      // filters the entities so as to return only scripts by a certain
                                                                                         r)
                      query.addFilter("author", Query.FilterOperator.EQUAL, params.autho
                        
                       PreparedQuery preparedQuery = datastore.prepare(query)
                        
                       // return only the first 10 results
                       def entities = preparedQuery.asList( withLimit(10) )




    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   31
vendredi 17 décembre 2010
...into something groovier?



                                  def entities = datastore.query {
                                      select all from savedscript
                                      sort desc by dateCreated
                                      where author == params.author
                                      limit 10
                                  } as List




    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   32
vendredi 17 décembre 2010
...into something groovier?



                                  def entities = datastore.query {
                                      select all from savedscript
                                      sort desc by dateCreated
                                      where author == params.author
                                      limit 10                         te d!
                                  } as List                       m en
                                                                                                                         p le
                                                                                                            et Im
                                                                                                        o tY
                                                                                                  N


    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.          32
vendredi 17 décembre 2010
URL Routing system (1/3)

       • You can have friendly URL mappings with the URL
         routing system
            all "/blog/@year/@month/@day/@title",
                                                                    @day@title=@title"
                forward: "/blog.groovy?year=@year&month=@month@day=

            get "/blog/@year/@month/@day",
                                                                    @day"
                forward: "/blog.groovy?year=@year&month=@month@day=

             all "/aboutus",
                 redirect: "/blog/2008/10/20/about-us"

             get "/book/isbn/@isbn",
                 forward: "/book.groovy?isbn=@isbn",
                 validate: { isbn ==~ /d{9}(d|X)/ }


               – You’ll have to configure the RouteFilter in web.xml

    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   33
vendredi 17 décembre 2010
URL Routing system (2/3)

       • You can also define caching times

                       get "/aboutus", cache: 24.hours,
                           forward: "/aboutus.gtpl"

                       get "/breaking-news", cache: 1.minute,
                           forward: "/news.groovy?last=10"


               – Nice for GAE’s infamous «loading requests»
                      •less critical with GAE SDK 1.4
                              – ability to reserve 3 instances (billing)
                              – warmup requests

    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   34
vendredi 17 décembre 2010
URL Routing system (3/3)

       • Namespace awareness: nice for multitenancy
       • Capability awareness: for graceful degradation

            // @cust customer variable could be « acme »
            post "/@cust/update", forward: "/update.groovy",
                                 namespace: { "ns-$cust" }

                                                                  es status
            // different destinations depending on the GAE servic
            get "/speakers", forward {
                to "/speakers.groovy" // default destination
                // when the datastore is not available
                to "/unavailable.gtpl" on DATASTORE not ENABLED
                // show some maintenance is upcoming
                                                                       
                to "/speakers.groovy?maintenance=true" on DATASTORE
                        is SCHEDULED_MAINTENANCE
             }

    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   35
vendredi 17 décembre 2010
Capabilities

       • Google App Engine allows you to know the status
         and availability of the various services
               – DATASTORE, DATESTORE_WRITE, MEMCACHE...
               – ENABLED, DISABLED, UNKNOWN,
                 SCHEDULED_MAINTENANCE
               – is() and not() methods


                  if (capabilities[DATASTORE_WRITE].is(ENABLED)) {
                      // write some content in the datastore
                  } else {
                      // otherwise, redirect to some maintenance page
                  }


    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   36
vendredi 17 décembre 2010
Task queue API

                         // access a configured queue using the subscript notation
                         queues['dailyEmailQueue']
                          
                         // or using the property access notation
                         queues.dailyEmailQueue
                          
                         // you can also access the default queue with:
                         queues.default
                         defaultQueue

                          // add a task to the queue
                          queue << [
                              countdownMillis: 1000, url: "/task/dailyEmail",
                              taskName: "sendDailyEmailNewsletter",
                              method: 'PUT', params: [date: '20090914'],
                              payload: content
                          ]


    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   37
vendredi 17 décembre 2010
Jabber / XMPP support (1/3)

       • Sending instant messages

                    String recipient = "someone@gmail.com"
                     
                    // check if the user is online
                    if (xmpp.getPresence(recipient).isAvailable()) {
                        // send the message
                        def status = xmpp.send(to: recipient,
                                             body: "Hello, how are you?")
                      
                                  // checks the message was successfully
                                  // delivered to all the recipients
                                  assert status.isSuccessful()
                     }



    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   38
vendredi 17 décembre 2010
Jabber / XMPP support (2/3)

       • Sending instant messages with an XML payload
                    String recipient = "service@gmail.com"
                     
                    // check if the service is online
                    if (xmpp.getPresence(recipient).isAvailable()) {
                        // send the message
                        def status = xmpp.send(to: recipient, xml: {
                            customers {
                                customer(id: 1) {
                                    name 'Google'
                                }
                            }
                        })
                     
                        // checks the message was successfully delivered to the service
                        assert status.isSuccessful()
                     }



    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   39
vendredi 17 décembre 2010
Jabber / XMPP support (2/3)

       • Sending instant messages with an XML payload
                    String recipient = "service@gmail.com"
                     
                    // check if the service is online
                    if (xmpp.getPresence(recipient).isAvailable()) {
                        // send the message
                        def status = xmpp.send(to: recipient, xml: {
                            customers {
                                customer(id: 1) {              <customers>
                                    name 'Google'                  <customer id=’1’>
                                }                                      <name>Google</name>
                            }                                      </customer>
                                                               </customers>
                        })
                     
                        // checks the message was successfully delivered to the service
                        assert status.isSuccessful()
                     }



    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   39
vendredi 17 décembre 2010
Jabber / XMPP support (3/3)

       • Receving incoming instant messages
               – Configure the XmppServlet in web.xml
               – Add the inbound message service in appengine-web.xml

                     // get the body of the message
                     message.body
                     // get the sender Jabber ID
                     message.from
                     // get the list of recipients Jabber IDs
                     message.recipients
                      
                     // if the message is an XML document instead of a raw string message
                     if (message.isXml()) {
                         // get the raw XML
                         message.stanza
                         // get a document parsed with XmlSlurper
                         message.xml
                     }


    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   40
vendredi 17 décembre 2010
Memcache service

       • Map notation access to the cache

                                                               }
            class Country implements Serialzable { String name
             
            def countryFr = new Country(name: 'France')
             
                                                                  in the cache
            // use the subscript notation to put a country object
            // (you can also use non-string keys)
            memcache['FR'] = countryFr
             
            // check that a key is present in the cache
            if ('FR' in memcache) {
                                                                   the cache using a key
                // use the subscript notation to get an entry from
                def countryFromCache = memcache['FR']
              }




    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   41
vendredi 17 décembre 2010
Closure memoization

       • Cache the return values for each dinstinct
         invocation (for a given arguments set)

                                                                     ->
                  def countEntities = memcache.memoize { String kind
                      datastore.prepare( new Query(kind) )
                               .countEntities()
                  }

                   // first call
                   def totalPics = countEntityes('photos')

                   // second call, hitting the cache
                   totalPics = countEntityes('photos')



    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   42
vendredi 17 décembre 2010
Blobstore enhancements

       • The blobstore allows to store some large content
               – images, videos, etc.
              def blob = ...
              print blob.filename // contentType, creation, size

               // output the content of the blob to the response
               blob.serve response

               // read the content of the blob
               blob.withReader { Reader r -> ... }
               blob.withStream { InputStream is -> ... }

                // delete the blob
                blob.delete()

    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   43
vendredi 17 décembre 2010
Images service

       • Readable DSL for manipulating images

                          def blobKey = ...

                          def image = blobKey.image.transform {
                              resize 1600, 1200
                              crop 0.1, 0.1, 0.9, 0.9
                              horizontal flip // vertical flip too
                              rotate 90
                              feeling lucky // image corrections
                          }

                           def thumbnail = image.resize(100, 100)


    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   44
vendredi 17 décembre 2010
Channel Service

       • For Comet-style applications

                          def token = hannel.createChannel('clientID')
                          channel.send 'clientID', 'Hi!'



       • Then in the view, in JavaScript...

                           channel = new goog.appengine.Channel(token);
                           socket = channel.open();
                           socket.onmessage = function(msg) { ... }




    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   45
vendredi 17 décembre 2010
Simple plugin system (1/3)

    • Gaelyk features a simple plugin system for
      extending your apps and share commonalities

    • A plugin lets you
            – provide additional groovlets and templates
            – contribute new URL routes
            – add new categories
            – define variables in the binding
            – override existing binding variables (in 0.6)
            – provide any static content
            – add new libraries
            – do any initialization
            – add before/after request hooks (in 0.6)
    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   46
vendredi 17 décembre 2010
Simple plugin system (2/3)

    • A plugin is actually just a zip file!
            – Basically, just a Gaelyk application, minus...
                    •the Groovy / Gaelyk / GAE JARs
                    •the web.xml and appengine-web.xml descriptors
            – But with a /WEB-INF/plugins/myplugin.groovy
              descriptor


    • A plugin must be referenced in /WEB-INF/
      plugins.groovy with
            – install myplugin
                    •shortcut to /WEB-INF/plugins/myplugin.groovy



    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   47
vendredi 17 décembre 2010
Simple plugin system (3/3)

    • An example plugin descriptor
            – /WEB-INF/plugins/jsonPlugin.groovy
              import net.sf.json.*
              import net.sf.json.groovy.*
               
              // add new variables in the binding
              binding {
                                                                            le
                  jsonLibVersion = "2.3"          // a simple string variab
                                                                             of a 3rd‐party JAR
                  json = new JsonGroovyBuilder()  // an instance of a class
              }
               
              // add new routes with the usual routing system format
              routes {
                  get "/json", forward: "/json.groovy"
              }
               
              // install a category you've developped
               categories jsonlib.JsonlibCategory

               before { req, resp ‐> ... } // or after, coming in 0.6
                
               // any other initialization code you'd need

    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   48
vendredi 17 décembre 2010
a ry
                                             m m
                   S u




    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.


vendredi 17 décembre 2010
Summary

    • Easy access to a cloud solution
            –Deploying Java apps, as easily as you would with PHP
    • Familiar to Java folks
            –Your good old Servlet centric webapps style
    • Pretty cheap
            –You need a high-trafficed website to reach the quotas
    • Gaelyk provides a simplified approach to
      creating Servlet centric webapps in a
      productive manner
            –Leveraging Groovy’s servlet / template support and
             dynamic capabilities

    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   50
vendredi 17 décembre 2010
What’s coming next?

    • Expect more sugar around the Datastore
            – An SQL-like query DSL
            – Easier relationship management (builder?)
            – Support for the async datastore API


    • Perhaps pre-compiled groovlets and templates
            – Less needed since SDK 1.4
                    • (reserve 3 hot instances, warmup requests)


    • Testing facilities specific to Gaelyk
       –testing utility class, Spock-specific ones...

    • Anything that’ll come up in newer GAE SDK versions
    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   51
vendredi 17 décembre 2010
Thanks for your attention!




                                         e
                                 e Laforg velopment
                      Gu illaum oovy De         m
                             of Gr e@gmail.co
                      Head laforg
                       E mail: g glaforge
                                 @
                       T witter:

                                                                                                                • References:
                                                                                                                     • http://gaelyk.appspot.com/
                                                                                                                     • http://groovy.codehaus.org/
                                                                                                                     • http://code.google.com/
                                                                                                                         appengine/


    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.                               52
vendredi 17 décembre 2010
Picture credits

             Light bulb: https://newsline.llnl.gov/retooling/mar/03.28.08_images/lightBulb.png
             Speed limit : http://www.morguefile.com/archive/display/18492
             Warehouse : http://www.morguefile.com/archive/display/85628
             Check mark: http://www.lnl.infn.it/~epics/WikiDumps/localhost/600px-symbol_ok.svg.png
             Puzzle: http://www.everystockphoto.com/photo.php?imageId=263521
             Light bulb: https://newsline.llnl.gov/retooling/mar/03.28.08_images/lightBulb.png
             Clouds http://www.morguefile.com/archive/display/627059
             http://www.morguefile.com/archive/display/625552
             http://www.morguefile.com/archive/display/629785
             Duke ok GAE http://weblogs.java.net/blog/felipegaucho/archive/ae_gwt_java.png
             Python logo : http://python.org/images/python-logo.gif
             Gaelyc cross with clouds : http://www.morguefile.com/archive/display/37889
             Speed limit : http://www.morguefile.com/archive/display/18492
             Warehouse : http://www.morguefile.com/archive/display/85628
             Snow foot steps : http://www.flickr.com/photos/robinvanmourik/2875929243/
             Sugar : http://www.flickr.com/photos/ayelie/441101223/sizes/l/
             Press release: http://www.napleswebdesign.net/wp-content/uploads/2009/06/press_release_11.jpg




    Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited.   53
vendredi 17 décembre 2010

More Related Content

What's hot

Introduction to First Commercial Memcached Service for Cloud
Introduction to First Commercial Memcached Service for CloudIntroduction to First Commercial Memcached Service for Cloud
Introduction to First Commercial Memcached Service for CloudGear6
 
Acquia Commons
Acquia CommonsAcquia Commons
Acquia Commonshernanibf
 
SQLUG event: An evening in the cloud: the old, the new and the big
 SQLUG event: An evening in the cloud: the old, the new and the big  SQLUG event: An evening in the cloud: the old, the new and the big
SQLUG event: An evening in the cloud: the old, the new and the big Mike Martin
 
Turbo-Charge Collaboration by Automating Site Provisioning in SharePoint 2010...
Turbo-Charge Collaboration by Automating Site Provisioning in SharePoint 2010...Turbo-Charge Collaboration by Automating Site Provisioning in SharePoint 2010...
Turbo-Charge Collaboration by Automating Site Provisioning in SharePoint 2010...SPTechCon
 
Tricks And Tradeoffs Of Deploying My Sql Clusters In The Cloud
Tricks And Tradeoffs Of Deploying My Sql Clusters In The CloudTricks And Tradeoffs Of Deploying My Sql Clusters In The Cloud
Tricks And Tradeoffs Of Deploying My Sql Clusters In The CloudMySQLConference
 
PassKit on iOS 6
PassKit on iOS 6PassKit on iOS 6
PassKit on iOS 6Xamarin
 
Sp2010 high availlability
Sp2010 high availlabilitySp2010 high availlability
Sp2010 high availlabilitySamuel Zürcher
 
Load-balancing web servers Load-balancing web servers
Load-balancing web servers Load-balancing web serversLoad-balancing web servers Load-balancing web servers
Load-balancing web servers Load-balancing web serverswebhostingguy
 
SDEC2011 Big engineer vs small entreprenuer
SDEC2011 Big engineer vs small entreprenuerSDEC2011 Big engineer vs small entreprenuer
SDEC2011 Big engineer vs small entreprenuerKorea Sdec
 
Empowering the Social Web with Apache Shindig
Empowering the Social Web with Apache ShindigEmpowering the Social Web with Apache Shindig
Empowering the Social Web with Apache Shindigplindner
 
Optimizing training on Apache MXNet
Optimizing training on Apache MXNetOptimizing training on Apache MXNet
Optimizing training on Apache MXNetAmazon Web Services
 
2011 june-kuala-lumpur-gtug-hackathon
2011 june-kuala-lumpur-gtug-hackathon2011 june-kuala-lumpur-gtug-hackathon
2011 june-kuala-lumpur-gtug-hackathonikailan
 
Контроль зверей: инструменты для управления и мониторинга распределенных сист...
Контроль зверей: инструменты для управления и мониторинга распределенных сист...Контроль зверей: инструменты для управления и мониторинга распределенных сист...
Контроль зверей: инструменты для управления и мониторинга распределенных сист...yaevents
 
Cloud Connected Devices on a Global Scale (CPN303) | AWS re:Invent 2013
Cloud Connected Devices on a Global Scale (CPN303) | AWS re:Invent 2013Cloud Connected Devices on a Global Scale (CPN303) | AWS re:Invent 2013
Cloud Connected Devices on a Global Scale (CPN303) | AWS re:Invent 2013Amazon Web Services
 

What's hot (16)

Introduction to First Commercial Memcached Service for Cloud
Introduction to First Commercial Memcached Service for CloudIntroduction to First Commercial Memcached Service for Cloud
Introduction to First Commercial Memcached Service for Cloud
 
RubyConf 2009
RubyConf 2009RubyConf 2009
RubyConf 2009
 
Acquia Commons
Acquia CommonsAcquia Commons
Acquia Commons
 
SQLUG event: An evening in the cloud: the old, the new and the big
 SQLUG event: An evening in the cloud: the old, the new and the big  SQLUG event: An evening in the cloud: the old, the new and the big
SQLUG event: An evening in the cloud: the old, the new and the big
 
Turbo-Charge Collaboration by Automating Site Provisioning in SharePoint 2010...
Turbo-Charge Collaboration by Automating Site Provisioning in SharePoint 2010...Turbo-Charge Collaboration by Automating Site Provisioning in SharePoint 2010...
Turbo-Charge Collaboration by Automating Site Provisioning in SharePoint 2010...
 
Tricks And Tradeoffs Of Deploying My Sql Clusters In The Cloud
Tricks And Tradeoffs Of Deploying My Sql Clusters In The CloudTricks And Tradeoffs Of Deploying My Sql Clusters In The Cloud
Tricks And Tradeoffs Of Deploying My Sql Clusters In The Cloud
 
PassKit on iOS 6
PassKit on iOS 6PassKit on iOS 6
PassKit on iOS 6
 
Sp2010 high availlability
Sp2010 high availlabilitySp2010 high availlability
Sp2010 high availlability
 
Load-balancing web servers Load-balancing web servers
Load-balancing web servers Load-balancing web serversLoad-balancing web servers Load-balancing web servers
Load-balancing web servers Load-balancing web servers
 
SDEC2011 Big engineer vs small entreprenuer
SDEC2011 Big engineer vs small entreprenuerSDEC2011 Big engineer vs small entreprenuer
SDEC2011 Big engineer vs small entreprenuer
 
Empowering the Social Web with Apache Shindig
Empowering the Social Web with Apache ShindigEmpowering the Social Web with Apache Shindig
Empowering the Social Web with Apache Shindig
 
Optimizing training on Apache MXNet
Optimizing training on Apache MXNetOptimizing training on Apache MXNet
Optimizing training on Apache MXNet
 
2011 june-kuala-lumpur-gtug-hackathon
2011 june-kuala-lumpur-gtug-hackathon2011 june-kuala-lumpur-gtug-hackathon
2011 june-kuala-lumpur-gtug-hackathon
 
Контроль зверей: инструменты для управления и мониторинга распределенных сист...
Контроль зверей: инструменты для управления и мониторинга распределенных сист...Контроль зверей: инструменты для управления и мониторинга распределенных сист...
Контроль зверей: инструменты для управления и мониторинга распределенных сист...
 
Cloud Connected Devices on a Global Scale (CPN303) | AWS re:Invent 2013
Cloud Connected Devices on a Global Scale (CPN303) | AWS re:Invent 2013Cloud Connected Devices on a Global Scale (CPN303) | AWS re:Invent 2013
Cloud Connected Devices on a Global Scale (CPN303) | AWS re:Invent 2013
 
Apache performance
Apache performanceApache performance
Apache performance
 

Viewers also liked

Ast transformations
Ast transformationsAst transformations
Ast transformationsHamletDRC
 
Groovy Domain Specific Languages - SpringOne2GX 2012
Groovy Domain Specific Languages - SpringOne2GX 2012Groovy Domain Specific Languages - SpringOne2GX 2012
Groovy Domain Specific Languages - SpringOne2GX 2012Guillaume Laforge
 
Groovy 2.0 update at Devoxx 2012
Groovy 2.0 update at Devoxx 2012Groovy 2.0 update at Devoxx 2012
Groovy 2.0 update at Devoxx 2012Guillaume Laforge
 
Les nouveautés de Groovy 2 -- Mix-IT 2013
Les nouveautés de Groovy 2 -- Mix-IT 2013Les nouveautés de Groovy 2 -- Mix-IT 2013
Les nouveautés de Groovy 2 -- Mix-IT 2013Guillaume Laforge
 
Groovy workshop à Mix-IT 2013
Groovy workshop à Mix-IT 2013Groovy workshop à Mix-IT 2013
Groovy workshop à Mix-IT 2013Guillaume Laforge
 

Viewers also liked (7)

Ast transformations
Ast transformationsAst transformations
Ast transformations
 
Groovy 2.0 webinar
Groovy 2.0 webinarGroovy 2.0 webinar
Groovy 2.0 webinar
 
Groovy Domain Specific Languages - SpringOne2GX 2012
Groovy Domain Specific Languages - SpringOne2GX 2012Groovy Domain Specific Languages - SpringOne2GX 2012
Groovy Domain Specific Languages - SpringOne2GX 2012
 
Groovy 2.0 update at Devoxx 2012
Groovy 2.0 update at Devoxx 2012Groovy 2.0 update at Devoxx 2012
Groovy 2.0 update at Devoxx 2012
 
Les nouveautés de Groovy 2 -- Mix-IT 2013
Les nouveautés de Groovy 2 -- Mix-IT 2013Les nouveautés de Groovy 2 -- Mix-IT 2013
Les nouveautés de Groovy 2 -- Mix-IT 2013
 
Groovy workshop à Mix-IT 2013
Groovy workshop à Mix-IT 2013Groovy workshop à Mix-IT 2013
Groovy workshop à Mix-IT 2013
 
Groovy 2 and beyond
Groovy 2 and beyondGroovy 2 and beyond
Groovy 2 and beyond
 

Similar to Gaelyk - Groovy Grails eXchange 2010 - Guillaume Laforge

Red Dirt Ruby Conference
Red Dirt Ruby ConferenceRed Dirt Ruby Conference
Red Dirt Ruby ConferenceJohn Woodell
 
Aloha on-rails-2009
Aloha on-rails-2009Aloha on-rails-2009
Aloha on-rails-2009John Woodell
 
What is Google App Engine?
What is Google App Engine?What is Google App Engine?
What is Google App Engine?weschwee
 
Google App Engine At A Glance
Google App Engine At A GlanceGoogle App Engine At A Glance
Google App Engine At A GlanceStefan Christoph
 
Google Cloud Platform, Compute Engine, and App Engine
Google Cloud Platform, Compute Engine, and App EngineGoogle Cloud Platform, Compute Engine, and App Engine
Google Cloud Platform, Compute Engine, and App EngineCsaba Toth
 
Gaelyk update - Guillaume Laforge - SpringOne2GX 2011
Gaelyk update - Guillaume Laforge - SpringOne2GX 2011Gaelyk update - Guillaume Laforge - SpringOne2GX 2011
Gaelyk update - Guillaume Laforge - SpringOne2GX 2011Guillaume Laforge
 
Gaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Gaelyk - SpringOne2GX - 2010 - Guillaume LaforgeGaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Gaelyk - SpringOne2GX - 2010 - Guillaume LaforgeGuillaume Laforge
 
Appscale at CLOUDCOMP '09
Appscale at CLOUDCOMP '09Appscale at CLOUDCOMP '09
Appscale at CLOUDCOMP '09Chris Bunch
 
Platform as a service google app engine
Platform as a service   google app enginePlatform as a service   google app engine
Platform as a service google app engineDeepu S Nath
 
Introduction to Google's Cloud Technologies
Introduction to Google's Cloud TechnologiesIntroduction to Google's Cloud Technologies
Introduction to Google's Cloud TechnologiesChris Schalk
 
Javaedge 2010-cschalk
Javaedge 2010-cschalkJavaedge 2010-cschalk
Javaedge 2010-cschalkChris Schalk
 
Cloud Services Powered by IBM SoftLayer and NetflixOSS
Cloud Services Powered by IBM SoftLayer and NetflixOSSCloud Services Powered by IBM SoftLayer and NetflixOSS
Cloud Services Powered by IBM SoftLayer and NetflixOSSaspyker
 
Vtcb technologies-esa candidates
Vtcb technologies-esa candidatesVtcb technologies-esa candidates
Vtcb technologies-esa candidatesNieves Salor
 
Cloud Platforms for Java
Cloud Platforms for JavaCloud Platforms for Java
Cloud Platforms for Java3Pillar Global
 
Java Night 2010 SteamCannon
Java Night 2010 SteamCannonJava Night 2010 SteamCannon
Java Night 2010 SteamCannonmarekgoldmann
 
DevOps and Cloud at NI
DevOps and Cloud at NIDevOps and Cloud at NI
DevOps and Cloud at NIErnest Mueller
 
Introduction to Google Cloud Platform Technologies
Introduction to Google Cloud Platform TechnologiesIntroduction to Google Cloud Platform Technologies
Introduction to Google Cloud Platform TechnologiesChris Schalk
 

Similar to Gaelyk - Groovy Grails eXchange 2010 - Guillaume Laforge (20)

Red Dirt Ruby Conference
Red Dirt Ruby ConferenceRed Dirt Ruby Conference
Red Dirt Ruby Conference
 
Aloha on-rails-2009
Aloha on-rails-2009Aloha on-rails-2009
Aloha on-rails-2009
 
App Engine Meetup
App Engine MeetupApp Engine Meetup
App Engine Meetup
 
What is Google App Engine?
What is Google App Engine?What is Google App Engine?
What is Google App Engine?
 
Google App Engine At A Glance
Google App Engine At A GlanceGoogle App Engine At A Glance
Google App Engine At A Glance
 
Google Cloud Platform, Compute Engine, and App Engine
Google Cloud Platform, Compute Engine, and App EngineGoogle Cloud Platform, Compute Engine, and App Engine
Google Cloud Platform, Compute Engine, and App Engine
 
Gaelyk update - Guillaume Laforge - SpringOne2GX 2011
Gaelyk update - Guillaume Laforge - SpringOne2GX 2011Gaelyk update - Guillaume Laforge - SpringOne2GX 2011
Gaelyk update - Guillaume Laforge - SpringOne2GX 2011
 
Gaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Gaelyk - SpringOne2GX - 2010 - Guillaume LaforgeGaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Gaelyk - SpringOne2GX - 2010 - Guillaume Laforge
 
Appscale at CLOUDCOMP '09
Appscale at CLOUDCOMP '09Appscale at CLOUDCOMP '09
Appscale at CLOUDCOMP '09
 
Platform as a service google app engine
Platform as a service   google app enginePlatform as a service   google app engine
Platform as a service google app engine
 
Introduction to Google's Cloud Technologies
Introduction to Google's Cloud TechnologiesIntroduction to Google's Cloud Technologies
Introduction to Google's Cloud Technologies
 
Javaedge 2010-cschalk
Javaedge 2010-cschalkJavaedge 2010-cschalk
Javaedge 2010-cschalk
 
Cloud Services Powered by IBM SoftLayer and NetflixOSS
Cloud Services Powered by IBM SoftLayer and NetflixOSSCloud Services Powered by IBM SoftLayer and NetflixOSS
Cloud Services Powered by IBM SoftLayer and NetflixOSS
 
Vtcb technologies-esa candidates
Vtcb technologies-esa candidatesVtcb technologies-esa candidates
Vtcb technologies-esa candidates
 
Cloud Platforms for Java
Cloud Platforms for JavaCloud Platforms for Java
Cloud Platforms for Java
 
Java Night 2010 SteamCannon
Java Night 2010 SteamCannonJava Night 2010 SteamCannon
Java Night 2010 SteamCannon
 
PaaS with Java
PaaS with JavaPaaS with Java
PaaS with Java
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 
DevOps and Cloud at NI
DevOps and Cloud at NIDevOps and Cloud at NI
DevOps and Cloud at NI
 
Introduction to Google Cloud Platform Technologies
Introduction to Google Cloud Platform TechnologiesIntroduction to Google Cloud Platform Technologies
Introduction to Google Cloud Platform Technologies
 

More from Guillaume Laforge

Lift off with Groovy 2 at JavaOne 2013
Lift off with Groovy 2 at JavaOne 2013Lift off with Groovy 2 at JavaOne 2013
Lift off with Groovy 2 at JavaOne 2013Guillaume Laforge
 
Groovy update at SpringOne2GX 2012
Groovy update at SpringOne2GX 2012Groovy update at SpringOne2GX 2012
Groovy update at SpringOne2GX 2012Guillaume Laforge
 
Groovy 1.8 et 2.0 au BreizhC@mp 2012
Groovy 1.8 et 2.0 au BreizhC@mp 2012Groovy 1.8 et 2.0 au BreizhC@mp 2012
Groovy 1.8 et 2.0 au BreizhC@mp 2012Guillaume Laforge
 
Groovy 1.8 and 2.0 at GR8Conf Europe 2012
Groovy 1.8 and 2.0 at GR8Conf Europe 2012Groovy 1.8 and 2.0 at GR8Conf Europe 2012
Groovy 1.8 and 2.0 at GR8Conf Europe 2012Guillaume Laforge
 
Groovy 2.0 update - Cloud Foundry Open Tour Moscow - Guillaume Laforge
Groovy 2.0 update - Cloud Foundry Open Tour Moscow - Guillaume LaforgeGroovy 2.0 update - Cloud Foundry Open Tour Moscow - Guillaume Laforge
Groovy 2.0 update - Cloud Foundry Open Tour Moscow - Guillaume LaforgeGuillaume Laforge
 
Going to Mars with Groovy Domain-Specific Languages
Going to Mars with Groovy Domain-Specific LanguagesGoing to Mars with Groovy Domain-Specific Languages
Going to Mars with Groovy Domain-Specific LanguagesGuillaume Laforge
 
Groovy 2.0 - Devoxx France 2012
Groovy 2.0 - Devoxx France 2012Groovy 2.0 - Devoxx France 2012
Groovy 2.0 - Devoxx France 2012Guillaume Laforge
 
Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011
Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011
Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011Guillaume Laforge
 
GPars et PrettyTime - Paris JUG 2011 - Guillaume Laforge
GPars et PrettyTime - Paris JUG 2011 - Guillaume LaforgeGPars et PrettyTime - Paris JUG 2011 - Guillaume Laforge
GPars et PrettyTime - Paris JUG 2011 - Guillaume LaforgeGuillaume Laforge
 
Groovy Update - Guillaume Laforge - Greach 2011
Groovy Update - Guillaume Laforge - Greach 2011Groovy Update - Guillaume Laforge - Greach 2011
Groovy Update - Guillaume Laforge - Greach 2011Guillaume Laforge
 
Groovy Update, what's new in Groovy 1.8 and beyond - Guillaume Laforge - Spri...
Groovy Update, what's new in Groovy 1.8 and beyond - Guillaume Laforge - Spri...Groovy Update, what's new in Groovy 1.8 and beyond - Guillaume Laforge - Spri...
Groovy Update, what's new in Groovy 1.8 and beyond - Guillaume Laforge - Spri...Guillaume Laforge
 
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...Guillaume Laforge
 
Cloud foundry intro with groovy
Cloud foundry intro with groovyCloud foundry intro with groovy
Cloud foundry intro with groovyGuillaume Laforge
 
Groovy update - S2GForum London 2011 - Guillaume Laforge
Groovy update - S2GForum London 2011 - Guillaume LaforgeGroovy update - S2GForum London 2011 - Guillaume Laforge
Groovy update - S2GForum London 2011 - Guillaume LaforgeGuillaume Laforge
 
Groovy DSLs - S2GForum London 2011 - Guillaume Laforge
Groovy DSLs - S2GForum London 2011 - Guillaume LaforgeGroovy DSLs - S2GForum London 2011 - Guillaume Laforge
Groovy DSLs - S2GForum London 2011 - Guillaume LaforgeGuillaume Laforge
 
Gaelyk - Guillaume Laforge - GR8Conf Europe 2011
Gaelyk - Guillaume Laforge - GR8Conf Europe 2011Gaelyk - Guillaume Laforge - GR8Conf Europe 2011
Gaelyk - Guillaume Laforge - GR8Conf Europe 2011Guillaume Laforge
 
Groovy 1.8 update - Guillaume Laforge - GR8Conf Europe 2011
Groovy 1.8 update - Guillaume Laforge - GR8Conf Europe 2011Groovy 1.8 update - Guillaume Laforge - GR8Conf Europe 2011
Groovy 1.8 update - Guillaume Laforge - GR8Conf Europe 2011Guillaume Laforge
 
Gaelyk - JFokus 2011 - Guillaume Laforge
Gaelyk - JFokus 2011 - Guillaume LaforgeGaelyk - JFokus 2011 - Guillaume Laforge
Gaelyk - JFokus 2011 - Guillaume LaforgeGuillaume Laforge
 

More from Guillaume Laforge (20)

Lift off with Groovy 2 at JavaOne 2013
Lift off with Groovy 2 at JavaOne 2013Lift off with Groovy 2 at JavaOne 2013
Lift off with Groovy 2 at JavaOne 2013
 
Groovy update at SpringOne2GX 2012
Groovy update at SpringOne2GX 2012Groovy update at SpringOne2GX 2012
Groovy update at SpringOne2GX 2012
 
JavaOne 2012 Groovy update
JavaOne 2012 Groovy updateJavaOne 2012 Groovy update
JavaOne 2012 Groovy update
 
Groovy 1.8 et 2.0 au BreizhC@mp 2012
Groovy 1.8 et 2.0 au BreizhC@mp 2012Groovy 1.8 et 2.0 au BreizhC@mp 2012
Groovy 1.8 et 2.0 au BreizhC@mp 2012
 
Groovy 1.8 and 2.0 at GR8Conf Europe 2012
Groovy 1.8 and 2.0 at GR8Conf Europe 2012Groovy 1.8 and 2.0 at GR8Conf Europe 2012
Groovy 1.8 and 2.0 at GR8Conf Europe 2012
 
Groovy 2.0 update - Cloud Foundry Open Tour Moscow - Guillaume Laforge
Groovy 2.0 update - Cloud Foundry Open Tour Moscow - Guillaume LaforgeGroovy 2.0 update - Cloud Foundry Open Tour Moscow - Guillaume Laforge
Groovy 2.0 update - Cloud Foundry Open Tour Moscow - Guillaume Laforge
 
Going to Mars with Groovy Domain-Specific Languages
Going to Mars with Groovy Domain-Specific LanguagesGoing to Mars with Groovy Domain-Specific Languages
Going to Mars with Groovy Domain-Specific Languages
 
Groovy 2.0 - Devoxx France 2012
Groovy 2.0 - Devoxx France 2012Groovy 2.0 - Devoxx France 2012
Groovy 2.0 - Devoxx France 2012
 
Whats new in Groovy 2.0?
Whats new in Groovy 2.0?Whats new in Groovy 2.0?
Whats new in Groovy 2.0?
 
Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011
Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011
Groovy Update, new in 1.8 and beyond - Guillaume Laforge - Devoxx 2011
 
GPars et PrettyTime - Paris JUG 2011 - Guillaume Laforge
GPars et PrettyTime - Paris JUG 2011 - Guillaume LaforgeGPars et PrettyTime - Paris JUG 2011 - Guillaume Laforge
GPars et PrettyTime - Paris JUG 2011 - Guillaume Laforge
 
Groovy Update - Guillaume Laforge - Greach 2011
Groovy Update - Guillaume Laforge - Greach 2011Groovy Update - Guillaume Laforge - Greach 2011
Groovy Update - Guillaume Laforge - Greach 2011
 
Groovy Update, what's new in Groovy 1.8 and beyond - Guillaume Laforge - Spri...
Groovy Update, what's new in Groovy 1.8 and beyond - Guillaume Laforge - Spri...Groovy Update, what's new in Groovy 1.8 and beyond - Guillaume Laforge - Spri...
Groovy Update, what's new in Groovy 1.8 and beyond - Guillaume Laforge - Spri...
 
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...
 
Cloud foundry intro with groovy
Cloud foundry intro with groovyCloud foundry intro with groovy
Cloud foundry intro with groovy
 
Groovy update - S2GForum London 2011 - Guillaume Laforge
Groovy update - S2GForum London 2011 - Guillaume LaforgeGroovy update - S2GForum London 2011 - Guillaume Laforge
Groovy update - S2GForum London 2011 - Guillaume Laforge
 
Groovy DSLs - S2GForum London 2011 - Guillaume Laforge
Groovy DSLs - S2GForum London 2011 - Guillaume LaforgeGroovy DSLs - S2GForum London 2011 - Guillaume Laforge
Groovy DSLs - S2GForum London 2011 - Guillaume Laforge
 
Gaelyk - Guillaume Laforge - GR8Conf Europe 2011
Gaelyk - Guillaume Laforge - GR8Conf Europe 2011Gaelyk - Guillaume Laforge - GR8Conf Europe 2011
Gaelyk - Guillaume Laforge - GR8Conf Europe 2011
 
Groovy 1.8 update - Guillaume Laforge - GR8Conf Europe 2011
Groovy 1.8 update - Guillaume Laforge - GR8Conf Europe 2011Groovy 1.8 update - Guillaume Laforge - GR8Conf Europe 2011
Groovy 1.8 update - Guillaume Laforge - GR8Conf Europe 2011
 
Gaelyk - JFokus 2011 - Guillaume Laforge
Gaelyk - JFokus 2011 - Guillaume LaforgeGaelyk - JFokus 2011 - Guillaume Laforge
Gaelyk - JFokus 2011 - Guillaume Laforge
 

Recently uploaded

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 

Recently uploaded (20)

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 

Gaelyk - Groovy Grails eXchange 2010 - Guillaume Laforge

  • 1. A lightweight Groovy toolkit for developing web applications on Google App Engine vendredi 17 décembre 2010
  • 2. A lightweight Groovy toolkit for developing web applications on Google App Engine vendredi 17 décembre 2010
  • 3. Guillaume Laforge / @glaforge • Groovy Project Manager • Head of Groovy Development at SpringSource • Initiator of the Grails framework • Founder of the Gaelyk toolkit • Co-author of Groovy in Action • Member of «Les Cast Codeurs» podcast • Speaker: JavaOne, QCon, JavaZone, Sun TechDays, Devoxx, The Spring Experience, SpringOne2GX, JAX, Dynamic Language World, IJTC, and more... Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 2 vendredi 17 décembre 2010
  • 4. Cloud Computing vendredi 17 décembre 2010
  • 5. IaaS, PaaS, SaaS • Software as a Service – Gmail, SalesForce.com SaaS • Platform as a Service – Google App Engine PaaS • Infrastructure as a Service – Amazon EC2 IaaS Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 4 vendredi 17 décembre 2010
  • 6. IaaS, PaaS, SaaS • Software as a Service – Gmail, SalesForce.com SaaS • Platform as a Service – Google App Engine PaaS • Infrastructure as a Service – Amazon EC2 IaaS Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 4 vendredi 17 décembre 2010
  • 7. IaaS, PaaS, SaaS • Software as a Service – Gmail, SalesForce.com SaaS • Platform as a Service – Google App Engine PaaS • Infrastructure as a Service – Amazon EC2 IaaS Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 4 vendredi 17 décembre 2010
  • 8. Google App Engine • Google’s PaaS solution • Run your app on Google’s infrastructure • Initially just Python supported • 1+ year ago, Java supported added too – Sandboxed JVM – Jetty servlet container • Several JVM-compatible language supported Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 5 vendredi 17 décembre 2010
  • 9. Key aspects • You can use most of your usual web frameworks for developping apps on App Engine Java – A WAR file, basically! – Uploading to the cloud by sending deltas of changes • No OS image, or software to install – Unlike with Amazon EC2 • All the scaling aspects are handled for you – Database / session replication, load balancing... • There are quotas, but you need a high traffic application to start being charged – Free to get started Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 6 vendredi 17 décembre 2010
  • 10. Available services • Memcache – Send / receive Jabber messages (GTalk) – JCache implementation – Save on CPU and DB • User – Use Google’s user/ • URL Fetch authentication system – Access remote resources – OAuth support – HttpUrlConnection • Cron & Task queues • Mail – Schedule tasks at regular – Support both incoming and intervals outgoing emails – Queue units of work • Images • Blobstore – Resize, crop, rotate... – For storing large content • XMPP • And much more... Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 7 vendredi 17 décembre 2010
  • 11. Limitations •Not our usual relational database – key / value datastore •30 seconds request duration limit • Forbidden to – write on the file system – create threads – use raw sockets – issue system calls – use IO / Swing / etc. directly •There’s a whitelist of classes allowed • Number of files and their size are limited Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 8 vendredi 17 décembre 2010
  • 12. Quotas Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 9 vendredi 17 décembre 2010
  • 13. Quotas (1/2) •Bandwidth •Mail – 1,3M requests/day – 7K calls/day – 1GB/day in/out – 2K recepients/day – 6.5 CPU hours/day – 5K emails/day – 2K attachments – 100MB of attachments •Datastore – 10M calls – 1GB/day •URL Fetch – 12GB in / 115GB out – 657K calls/day – 60 CPU hours/day – 4GB in/out /day Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 10 vendredi 17 décembre 2010
  • 14. Quotas (2/2) •XMPP •Memcache – 657K calls/day – 8.6M calls/day – 4GB data sent/day – 10GB in – 657K recepients/day – 50GB out – 1MB invitations/day •Task queues •Image manipulation – 100K calls –864 calls/day –1GB in / 5GB out –2.5M transforms Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 11 vendredi 17 décembre 2010
  • 15. Quotas (2/2) •XMPP •Memcache – 657K calls/day – 8.6M calls/day – 4GB data sent/day – 10GB in – 657K recepients/day – 50GB out – 1MB invitations/day •Task queues •Image manipulation – 100K calls –864 calls/day ur es –1GB in / 5GB out d fig da te –2.5M transforms O ut Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 11 vendredi 17 décembre 2010
  • 16. The Datastore vendredi 17 décembre 2010
  • 17. The datastore... • Not your father’s relational database! «NoSQL» • Distributed key / value store – Based on Google’s «BigTable» – Schema-less approach • Supporting – Transactions and partitioning – Hierarchies through entity groups • Data access APIs – JPA and JDO • but adds a big request load time factor – Direct low-level APIs Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 13 vendredi 17 décembre 2010
  • 18. ...and its «limitations» • You’re not using SQL –No joins – No database constraints – No aggregation functions (count, avg...) • In a query, you can only filter on one column for inequality • Transactions only available in entity groups • You can only update an entity once in a transaction Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 14 vendredi 17 décembre 2010
  • 19. Nice dashboard vendredi 17 décembre 2010
  • 22. • Gaelyk is a lightweight Groovy toolkit on top of the Google App Engine Java SDK • Gaelyk builds on Groovy’s servlet support – Groovlets: Groovy scripts instead of raw servlets! – Groovy templates: JSP-like template engine – Both allow for a clean separation of views and logic • Gaelyk provides several enhancements around the GAE Java SDK to make life easier, thanks to Groovy’s dynamic nature Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 17 vendredi 17 décembre 2010
  • 23. Why Groovy? • Groovy is a dynamic language for the JVM – very flexible, malleable, expressive and concise syntax – easy to learn for Java developers • deriving from the Java 5 grammar – provides powerful APIs to simplify the life of developers • possibility to dynamically enrich existing APIs – support for Groovlets and its own template engine Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 18 vendredi 17 décembre 2010
  • 24. Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 19 vendredi 17 décembre 2010
  • 25. Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 19 vendredi 17 décembre 2010
  • 26. Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 19 vendredi 17 décembre 2010
  • 27. Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 19 vendredi 17 décembre 2010
  • 28. Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 19 vendredi 17 décembre 2010
  • 29. Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 19 vendredi 17 décembre 2010
  • 30. Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 19 vendredi 17 décembre 2010
  • 31. Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 19 vendredi 17 décembre 2010
  • 32. Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 19 vendredi 17 décembre 2010
  • 33. Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 19 vendredi 17 décembre 2010
  • 34. Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 19 vendredi 17 décembre 2010
  • 35. First steps... • Go to http://gaelyk.appspot.com • Download the template project • Put your first Groovlet in /WEB-INF/groovy • And your templates in /WEB-INF/pages • And you’re ready to go! • Launch dev_appserver.sh • Go to http://localhost:8080/ vendredi 17 décembre 2010
  • 36. The web.xml "> <web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5 <servlet> <servlet-name>GroovletServlet</servlet-name> <servlet-class>groovyx.gaelyk.GaelykServlet</servlet-class> </servlet> <servlet> <servlet-name>TemplateServlet</servlet-name> -class> <servlet-class>groovyx.gaelyk.GaelykTemplateServlet</servlet </servlet> <servlet-mapping> <servlet-name>GroovletServlet</servlet-name> <url-pattern>*.groovy</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>TemplateServlet</servlet-name> <url-pattern>*.gtpl</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.gtpl</welcome-file> </welcome-file-list> </web-app> Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 21 vendredi 17 décembre 2010
  • 37. MVC: Groovlets and templates Groovlets Templates (controllers) (views) Entities (domain) Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. vendredi 17 décembre 2010 22
  • 38. A groovlet • Instead of writing full-blown servlets, just write Groovy scripts (aka Groovlets) def numbers = [1, 2, 3, 4] def now = new Date() html.html { body { numbers.each { number -> p number } p now } } Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 23 vendredi 17 décembre 2010
  • 39. A groovlet • Instead of writing full-blown servlets, just write Groovy scripts (aka Groovlets) def numbers = [1, 2, 3, 4] def now = new Date() html.html { body { numbers.each { number -> p number } p now } di ng oa } -rel to Au Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 23 vendredi 17 décembre 2010
  • 40. A template <html> <body> <p><% def message = "Hello World!" print message %> </p> <p><%= message %></p> <p>${message}</p> <ul> <% 3.times { %> <li>${message}</li> <% } %> </ul> </body> </html> Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 24 vendredi 17 décembre 2010
  • 41. A template <html> <body> <p><% def message = "Hello World!" print message %> </p> <p><%= message %></p> <p>${message}</p> <ul> <% 3.times { %> <li>${message}</li> <% } %> di ng </ul> el oa </body> to -r Au </html> Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 24 vendredi 17 décembre 2010
  • 42. Shortcuts • Google services • Variables available –datastore –request / response –blobstore –context / application –memcache –sessions –capabilities –params / headers –images –out / sout / html –urlFetch –localMode / app.* –mail –userService / user • Methods available –defaultQueue / queues –include / forward / –xmpp redirect –namespace –println / print Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 25 vendredi 17 décembre 2010
  • 43. D E M O 26 vendredi 17 décembre 2010
  • 44. Groovy sugar! vendredi 17 décembre 2010
  • 45. Sending emails with Gaelyk mail.send to: 'to@gmail.com', from: 'other@gmail.com', subject: 'Hello World', htmlBody: '<bold>Hello</bold>' Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 28 vendredi 17 décembre 2010
  • 46. ...compared to Java Properties props = new Properties(); , null); Sessio n session = Session.getDefaultInstance(props try { Message msg = new MimeMessage(session); om", "Admin"));     msg .setFrom(new InternetAddress("other@gmail.c O,     msg.addRecipient(Message.RecipientType.T , "Mr. User"));                      new InternetAddress("to@example.com"     msg.setSubject("Hello World");     msg.setText("<bold>Hello</bold>");     Transport.send(msg); } catch (AddressException e) {} } catch (MessagingException e) {} Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 29 vendredi 17 décembre 2010
  • 47. Accessing the datastore • Direct interaction with the low-level datastore API ty import com.google.appengine.api.datastore.Enti   Entity entity = new Entity("person")   map // subscript notation, like when accessing a entity['name'] = "Guillaume Laforge"   // normal property access notation entity.age = 32 entity.save() entity.delete() datastore.withTransaction { // do stuff with your entities // within the transaction } Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 30 vendredi 17 décembre 2010
  • 48. Querying to be improved... import com.google.appengine.api.datastore.* der.* import static com.google.appengine.api.datastore.FetchOptions.Buil   // query the scripts stored in the datastore def query = new Query("savedscript")   // sort results by descending order of the creation date query.addSort("dateCreated", Query.SortDirection.DESCENDING)   author // filters the entities so as to return only scripts by a certain r) query.addFilter("author", Query.FilterOperator.EQUAL, params.autho   PreparedQuery preparedQuery = datastore.prepare(query)   // return only the first 10 results def entities = preparedQuery.asList( withLimit(10) ) Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 31 vendredi 17 décembre 2010
  • 49. ...into something groovier? def entities = datastore.query { select all from savedscript sort desc by dateCreated where author == params.author limit 10 } as List Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 32 vendredi 17 décembre 2010
  • 50. ...into something groovier? def entities = datastore.query { select all from savedscript sort desc by dateCreated where author == params.author limit 10 te d! } as List m en p le et Im o tY N Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 32 vendredi 17 décembre 2010
  • 51. URL Routing system (1/3) • You can have friendly URL mappings with the URL routing system all "/blog/@year/@month/@day/@title", @day@title=@title" forward: "/blog.groovy?year=@year&month=@month@day= get "/blog/@year/@month/@day", @day" forward: "/blog.groovy?year=@year&month=@month@day= all "/aboutus", redirect: "/blog/2008/10/20/about-us" get "/book/isbn/@isbn", forward: "/book.groovy?isbn=@isbn", validate: { isbn ==~ /d{9}(d|X)/ } – You’ll have to configure the RouteFilter in web.xml Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 33 vendredi 17 décembre 2010
  • 52. URL Routing system (2/3) • You can also define caching times get "/aboutus", cache: 24.hours, forward: "/aboutus.gtpl" get "/breaking-news", cache: 1.minute, forward: "/news.groovy?last=10" – Nice for GAE’s infamous «loading requests» •less critical with GAE SDK 1.4 – ability to reserve 3 instances (billing) – warmup requests Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 34 vendredi 17 décembre 2010
  • 53. URL Routing system (3/3) • Namespace awareness: nice for multitenancy • Capability awareness: for graceful degradation // @cust customer variable could be « acme » post "/@cust/update", forward: "/update.groovy", namespace: { "ns-$cust" } es status // different destinations depending on the GAE servic get "/speakers", forward { to "/speakers.groovy" // default destination // when the datastore is not available to "/unavailable.gtpl" on DATASTORE not ENABLED // show some maintenance is upcoming to "/speakers.groovy?maintenance=true" on DATASTORE is SCHEDULED_MAINTENANCE } Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 35 vendredi 17 décembre 2010
  • 54. Capabilities • Google App Engine allows you to know the status and availability of the various services – DATASTORE, DATESTORE_WRITE, MEMCACHE... – ENABLED, DISABLED, UNKNOWN, SCHEDULED_MAINTENANCE – is() and not() methods if (capabilities[DATASTORE_WRITE].is(ENABLED)) { // write some content in the datastore } else { // otherwise, redirect to some maintenance page } Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 36 vendredi 17 décembre 2010
  • 55. Task queue API // access a configured queue using the subscript notation queues['dailyEmailQueue']   // or using the property access notation queues.dailyEmailQueue   // you can also access the default queue with: queues.default defaultQueue // add a task to the queue queue << [ countdownMillis: 1000, url: "/task/dailyEmail", taskName: "sendDailyEmailNewsletter", method: 'PUT', params: [date: '20090914'], payload: content ] Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 37 vendredi 17 décembre 2010
  • 56. Jabber / XMPP support (1/3) • Sending instant messages String recipient = "someone@gmail.com"   // check if the user is online if (xmpp.getPresence(recipient).isAvailable()) { // send the message def status = xmpp.send(to: recipient, body: "Hello, how are you?")   // checks the message was successfully // delivered to all the recipients assert status.isSuccessful() } Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 38 vendredi 17 décembre 2010
  • 57. Jabber / XMPP support (2/3) • Sending instant messages with an XML payload String recipient = "service@gmail.com"   // check if the service is online if (xmpp.getPresence(recipient).isAvailable()) { // send the message def status = xmpp.send(to: recipient, xml: { customers { customer(id: 1) { name 'Google' } } })   // checks the message was successfully delivered to the service assert status.isSuccessful() } Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 39 vendredi 17 décembre 2010
  • 58. Jabber / XMPP support (2/3) • Sending instant messages with an XML payload String recipient = "service@gmail.com"   // check if the service is online if (xmpp.getPresence(recipient).isAvailable()) { // send the message def status = xmpp.send(to: recipient, xml: { customers { customer(id: 1) { <customers> name 'Google' <customer id=’1’> } <name>Google</name> } </customer> </customers> })   // checks the message was successfully delivered to the service assert status.isSuccessful() } Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 39 vendredi 17 décembre 2010
  • 59. Jabber / XMPP support (3/3) • Receving incoming instant messages – Configure the XmppServlet in web.xml – Add the inbound message service in appengine-web.xml // get the body of the message message.body // get the sender Jabber ID message.from // get the list of recipients Jabber IDs message.recipients   // if the message is an XML document instead of a raw string message if (message.isXml()) { // get the raw XML message.stanza // get a document parsed with XmlSlurper message.xml } Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 40 vendredi 17 décembre 2010
  • 60. Memcache service • Map notation access to the cache } class Country implements Serialzable { String name   def countryFr = new Country(name: 'France')   in the cache // use the subscript notation to put a country object // (you can also use non-string keys) memcache['FR'] = countryFr   // check that a key is present in the cache if ('FR' in memcache) { the cache using a key // use the subscript notation to get an entry from def countryFromCache = memcache['FR'] } Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 41 vendredi 17 décembre 2010
  • 61. Closure memoization • Cache the return values for each dinstinct invocation (for a given arguments set) -> def countEntities = memcache.memoize { String kind datastore.prepare( new Query(kind) ) .countEntities() } // first call def totalPics = countEntityes('photos') // second call, hitting the cache totalPics = countEntityes('photos') Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 42 vendredi 17 décembre 2010
  • 62. Blobstore enhancements • The blobstore allows to store some large content – images, videos, etc. def blob = ... print blob.filename // contentType, creation, size // output the content of the blob to the response blob.serve response // read the content of the blob blob.withReader { Reader r -> ... } blob.withStream { InputStream is -> ... } // delete the blob blob.delete() Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 43 vendredi 17 décembre 2010
  • 63. Images service • Readable DSL for manipulating images def blobKey = ... def image = blobKey.image.transform { resize 1600, 1200 crop 0.1, 0.1, 0.9, 0.9 horizontal flip // vertical flip too rotate 90 feeling lucky // image corrections } def thumbnail = image.resize(100, 100) Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 44 vendredi 17 décembre 2010
  • 64. Channel Service • For Comet-style applications def token = hannel.createChannel('clientID') channel.send 'clientID', 'Hi!' • Then in the view, in JavaScript... channel = new goog.appengine.Channel(token); socket = channel.open(); socket.onmessage = function(msg) { ... } Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 45 vendredi 17 décembre 2010
  • 65. Simple plugin system (1/3) • Gaelyk features a simple plugin system for extending your apps and share commonalities • A plugin lets you – provide additional groovlets and templates – contribute new URL routes – add new categories – define variables in the binding – override existing binding variables (in 0.6) – provide any static content – add new libraries – do any initialization – add before/after request hooks (in 0.6) Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 46 vendredi 17 décembre 2010
  • 66. Simple plugin system (2/3) • A plugin is actually just a zip file! – Basically, just a Gaelyk application, minus... •the Groovy / Gaelyk / GAE JARs •the web.xml and appengine-web.xml descriptors – But with a /WEB-INF/plugins/myplugin.groovy descriptor • A plugin must be referenced in /WEB-INF/ plugins.groovy with – install myplugin •shortcut to /WEB-INF/plugins/myplugin.groovy Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 47 vendredi 17 décembre 2010
  • 67. Simple plugin system (3/3) • An example plugin descriptor – /WEB-INF/plugins/jsonPlugin.groovy import net.sf.json.* import net.sf.json.groovy.*   // add new variables in the binding binding { le jsonLibVersion = "2.3"          // a simple string variab  of a 3rd‐party JAR json = new JsonGroovyBuilder()  // an instance of a class }   // add new routes with the usual routing system format routes { get "/json", forward: "/json.groovy" }   // install a category you've developped categories jsonlib.JsonlibCategory before { req, resp ‐> ... } // or after, coming in 0.6   // any other initialization code you'd need Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 48 vendredi 17 décembre 2010
  • 68. a ry m m S u Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. vendredi 17 décembre 2010
  • 69. Summary • Easy access to a cloud solution –Deploying Java apps, as easily as you would with PHP • Familiar to Java folks –Your good old Servlet centric webapps style • Pretty cheap –You need a high-trafficed website to reach the quotas • Gaelyk provides a simplified approach to creating Servlet centric webapps in a productive manner –Leveraging Groovy’s servlet / template support and dynamic capabilities Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 50 vendredi 17 décembre 2010
  • 70. What’s coming next? • Expect more sugar around the Datastore – An SQL-like query DSL – Easier relationship management (builder?) – Support for the async datastore API • Perhaps pre-compiled groovlets and templates – Less needed since SDK 1.4 • (reserve 3 hot instances, warmup requests) • Testing facilities specific to Gaelyk –testing utility class, Spock-specific ones... • Anything that’ll come up in newer GAE SDK versions Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 51 vendredi 17 décembre 2010
  • 71. Thanks for your attention! e e Laforg velopment Gu illaum oovy De m of Gr e@gmail.co Head laforg E mail: g glaforge @ T witter: • References: • http://gaelyk.appspot.com/ • http://groovy.codehaus.org/ • http://code.google.com/ appengine/ Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 52 vendredi 17 décembre 2010
  • 72. Picture credits Light bulb: https://newsline.llnl.gov/retooling/mar/03.28.08_images/lightBulb.png Speed limit : http://www.morguefile.com/archive/display/18492 Warehouse : http://www.morguefile.com/archive/display/85628 Check mark: http://www.lnl.infn.it/~epics/WikiDumps/localhost/600px-symbol_ok.svg.png Puzzle: http://www.everystockphoto.com/photo.php?imageId=263521 Light bulb: https://newsline.llnl.gov/retooling/mar/03.28.08_images/lightBulb.png Clouds http://www.morguefile.com/archive/display/627059 http://www.morguefile.com/archive/display/625552 http://www.morguefile.com/archive/display/629785 Duke ok GAE http://weblogs.java.net/blog/felipegaucho/archive/ae_gwt_java.png Python logo : http://python.org/images/python-logo.gif Gaelyc cross with clouds : http://www.morguefile.com/archive/display/37889 Speed limit : http://www.morguefile.com/archive/display/18492 Warehouse : http://www.morguefile.com/archive/display/85628 Snow foot steps : http://www.flickr.com/photos/robinvanmourik/2875929243/ Sugar : http://www.flickr.com/photos/ayelie/441101223/sizes/l/ Press release: http://www.napleswebdesign.net/wp-content/uploads/2009/06/press_release_11.jpg Copyright 2010 SpringSource. Copying, publishing or distributing without express written permission is prohibited. 53 vendredi 17 décembre 2010