SlideShare una empresa de Scribd logo
1 de 48
Descargar para leer sin conexión
JGGUG
                                      japan grails/groovy user group




              DTP
   Web        80%   Grails
     Struts


JGGUG(                )
 Grails               9-11
                Grails Acegi Plugin
http://d.hatena.ne.jp/mottsnite/
twitter @tyama
Grails
         CMS
public class HelloWorld {
  String name;

    public void setName(String name){
      this.name = name;
    }
    public String getName(){
      return name;
    }

    public String greet(){
      return "Hello "+name;
    }

    public static void main(String[] args){
      HelloWorld helloWorld = new HelloWorld();
      helloWorld.setName("Groovy");
      System.out.println(helloWorld.greet());
    }
}
public class HelloWorld {
  String name;

    public void setName(String name){
      this.name = name;
    }
    public String getName(){
      return name;
    }

    public String greet(){
      return "Hello "+name;
    }

    public static void main(String[] args){
      HelloWorld helloWorld = new HelloWorld();
      helloWorld.setName("Groovy");
      System.out.println(helloWorld.greet());
    }
}
public class HelloWorld {
  String name

    public void setName(String name){
      this.name = name
    }
    public String getName(){
      return name
    }

    public String greet(){
      return "Hello "+name
    }

    public static void main(String[] args){
      HelloWorld helloWorld = new HelloWorld()
      helloWorld.setName("Groovy")
      System.out.println(helloWorld.greet())
    }
}
public class HelloWorld {
  String name

    public String greet(){
      return "Hello "+name
    }

    public static void main(String[] args){
      HelloWorld helloWorld = new HelloWorld()
      helloWorld.setName("Groovy")
      System.out.println(helloWorld.greet())
    }
}
public class HelloWorld {
  String name

    public String greet(){
      return "Hello "+name
    }
}

HelloWorld helloWorld = new HelloWorld()
helloWorld.setName("Groovy")
System.out.println(helloWorld.greet())
class HelloWorld {
  String name

    def greet(){
      return "Hello "+name
    }
}

def helloWorld = new HelloWorld()
helloWorld.setName("Groovy")
println(helloWorld.greet())
class HelloWorld {
  String name

    def greet(){
      return "Hello "+name
    }
}

def helloWorld = new HelloWorld()
helloWorld.name = "Groovy"
println helloWorld.greet()
class HelloWorld {
  String name

    def greet(){ "Hello $name"}
}

def helloWorld = new HelloWorld()
helloWorld.name = "Groovy"
println helloWorld.greet()
class HelloWorld {
  String name
  def greet(){ "Hello $name"}
}

def helloWorld = new HelloWorld(name: "Groovy")
println helloWorld.greet()
def arr = [1,2,3,'hoge']
def map = [a:1,b:2,c:'hoge']
@Grab('net.homeip.yusuke:twitter4j:[2.0,)')
import twitter4j.*
def user="username",pass="pass"
new Twitter(user,pass).friendsTimeline.each {
  println "${it.user.name}: ${it.text}"
}



                     maven
GAE/J+Grails




PermGen
http://gist.github.com/263610
grails create-app myapp
 cd myapp



grails create-domain-class jp.grails.Todo




grails create-controller jp.grails.Todo
http://gist.github.com/263610
grails install-plugin app-engine
   jpa/jdo                 ”jpa”
grails install-plugin gorm-jpa
google.appengine.application="mygaeapp"
http://gist.github.com/263511
@Entity
class Chat implements Serializable {

  @Id
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  Long id

  @Column                               ...                 ...
  String message    JPA
                                        class Chat {
...   ...                                 String message
                                         ...   ...




grails generate-all jp.grails.Chat
                                               app-engine
s/Groovy/Grails/



                      Gr




stringchararrayaccessor.disabled=true
grails.project.plugins.dir="plugins"
11
http://gist.github.com/263509
import groovy.xml.StreamingMarkupBuilder
import groovy.xml.MarkupBuilder

includeTargets << new File("${appEnginePluginDir}/scripts/_AppEngineCommon.groovy")

eventStatusFinal = { msg ->
   def appXmlFile = new File("$stagingDir/WEB-INF/appengine-web.xml")
   def xml = new XmlSlurper().parse(appXmlFile)
   xml."system-properties".appendNode {
       property(name:"stringchararrayaccessor.disabled",value:"true")
   }
   def smb = new StreamingMarkupBuilder()
   def result = smb.bind{
     mkp.declareNamespace("":"http://appengine.google.com/ns/1.0")
     mkp.yield xml
   }
   new FileOutputStream(appXmlFile).withWriter('UTF8'){w-> w << result }
}




        <appengine-web-app xmlns='http://appengine.google.com/ns/1.0'>
          <application>jggugv4</application>
          <version>2</version>
          <sessions-enabled>true</sessions-enabled>
          <ssl-enabled>true</ssl-enabled>
          <system-properties>
          <property name='stringchararrayaccessor.disabled' value='true'/>
        </appengine-web-app>
$ grails app-engine run




                   = GAE
grails set-version 1

GAE
grails app-engine package

GAE SDK
$APPENGINE_HOME/bin/appcfg.sh update ./target/war




                            grails app-engine deploy
APPENGINE_HOME
export APPENGINE_HOME=/opt/appengine-java-sdk-1.3.0


grails install-plugin app-engine
grails install-plugin gorm-jpa

grails app-engine run


grails set-version 1
grails app-engine package

GAE SDK
$APPENGINE_HOME/bin/appcfg.sh update ./target/war


grails app-engine package
$APPENGINE_HOME/bin/appcfg.sh update ./target/war
Grails/Groovy
http://www.jggug.org/

Más contenido relacionado

La actualidad más candente

Javascript Continues Integration in Jenkins with AngularJS
Javascript Continues Integration in Jenkins with AngularJSJavascript Continues Integration in Jenkins with AngularJS
Javascript Continues Integration in Jenkins with AngularJS
Ladislav Prskavec
 

La actualidad más candente (20)

GPars For Beginners
GPars For BeginnersGPars For Beginners
GPars For Beginners
 
お題でGroovyプログラミング: Part A
お題でGroovyプログラミング: Part Aお題でGroovyプログラミング: Part A
お題でGroovyプログラミング: Part A
 
World of Logging
World of LoggingWorld of Logging
World of Logging
 
Bootstrap
BootstrapBootstrap
Bootstrap
 
Cycle.js: Functional and Reactive
Cycle.js: Functional and ReactiveCycle.js: Functional and Reactive
Cycle.js: Functional and Reactive
 
Programming with Python and PostgreSQL
Programming with Python and PostgreSQLProgramming with Python and PostgreSQL
Programming with Python and PostgreSQL
 
Psycopg2 - Connect to PostgreSQL using Python Script
Psycopg2 - Connect to PostgreSQL using Python ScriptPsycopg2 - Connect to PostgreSQL using Python Script
Psycopg2 - Connect to PostgreSQL using Python Script
 
"PostgreSQL and Python" Lightning Talk @EuroPython2014
"PostgreSQL and Python" Lightning Talk @EuroPython2014"PostgreSQL and Python" Lightning Talk @EuroPython2014
"PostgreSQL and Python" Lightning Talk @EuroPython2014
 
Python postgre sql a wonderful wedding
Python postgre sql   a wonderful weddingPython postgre sql   a wonderful wedding
Python postgre sql a wonderful wedding
 
Elm: give it a try
Elm: give it a tryElm: give it a try
Elm: give it a try
 
Grails queries
Grails   queriesGrails   queries
Grails queries
 
Config BuildConfig
Config BuildConfigConfig BuildConfig
Config BuildConfig
 
Javascript Continues Integration in Jenkins with AngularJS
Javascript Continues Integration in Jenkins with AngularJSJavascript Continues Integration in Jenkins with AngularJS
Javascript Continues Integration in Jenkins with AngularJS
 
Javascript ES6 generators
Javascript ES6 generatorsJavascript ES6 generators
Javascript ES6 generators
 
ES6 generators
ES6 generatorsES6 generators
ES6 generators
 
Simplifying java with lambdas (short)
Simplifying java with lambdas (short)Simplifying java with lambdas (short)
Simplifying java with lambdas (short)
 
AJUG April 2011 Raw hadoop example
AJUG April 2011 Raw hadoop exampleAJUG April 2011 Raw hadoop example
AJUG April 2011 Raw hadoop example
 
Miracle of std lib
Miracle of std libMiracle of std lib
Miracle of std lib
 
CouchDB Day NYC 2017: MapReduce Views
CouchDB Day NYC 2017: MapReduce ViewsCouchDB Day NYC 2017: MapReduce Views
CouchDB Day NYC 2017: MapReduce Views
 
Python in the database
Python in the databasePython in the database
Python in the database
 

Similar a 名古屋SGGAE/J勉強会 Grails、Gaelykでハンズオン

Boosting Your Testing Productivity with Groovy
Boosting Your Testing Productivity with GroovyBoosting Your Testing Productivity with Groovy
Boosting Your Testing Productivity with Groovy
James Williams
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best Practices
Yekmer Simsek
 
JJUG CCC 2011 Spring
JJUG CCC 2011 SpringJJUG CCC 2011 Spring
JJUG CCC 2011 Spring
Kiyotaka Oku
 
Jenkins and Groovy
Jenkins and GroovyJenkins and Groovy
Jenkins and Groovy
Kiyotaka Oku
 

Similar a 名古屋SGGAE/J勉強会 Grails、Gaelykでハンズオン (20)

Griffon @ Svwjug
Griffon @ SvwjugGriffon @ Svwjug
Griffon @ Svwjug
 
Groovy & Grails: Scripting for Modern Web Applications
Groovy & Grails: Scripting for Modern Web ApplicationsGroovy & Grails: Scripting for Modern Web Applications
Groovy & Grails: Scripting for Modern Web Applications
 
Spring hibernate jsf_primefaces_intergration
Spring hibernate jsf_primefaces_intergrationSpring hibernate jsf_primefaces_intergration
Spring hibernate jsf_primefaces_intergration
 
Androidaop 170105090257
Androidaop 170105090257Androidaop 170105090257
Androidaop 170105090257
 
Os Secoske
Os SecoskeOs Secoske
Os Secoske
 
Symfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technologySymfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technology
 
Android workshop
Android workshopAndroid workshop
Android workshop
 
Grailsでドメイン駆動設計を実践する時の勘所
Grailsでドメイン駆動設計を実践する時の勘所Grailsでドメイン駆動設計を実践する時の勘所
Grailsでドメイン駆動設計を実践する時の勘所
 
Boosting Your Testing Productivity with Groovy
Boosting Your Testing Productivity with GroovyBoosting Your Testing Productivity with Groovy
Boosting Your Testing Productivity with Groovy
 
Javaone2008 Bof 5101 Groovytesting
Javaone2008 Bof 5101 GroovytestingJavaone2008 Bof 5101 Groovytesting
Javaone2008 Bof 5101 Groovytesting
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best Practices
 
JJUG CCC 2011 Spring
JJUG CCC 2011 SpringJJUG CCC 2011 Spring
JJUG CCC 2011 Spring
 
Groovy for Java Developers
Groovy for Java DevelopersGroovy for Java Developers
Groovy for Java Developers
 
Jenkins and Groovy
Jenkins and GroovyJenkins and Groovy
Jenkins and Groovy
 
Code generation for alternative languages
Code generation for alternative languagesCode generation for alternative languages
Code generation for alternative languages
 
Vaadin7
Vaadin7Vaadin7
Vaadin7
 
Presentatie - Introductie in Groovy
Presentatie - Introductie in GroovyPresentatie - Introductie in Groovy
Presentatie - Introductie in Groovy
 
Reason and GraphQL
Reason and GraphQLReason and GraphQL
Reason and GraphQL
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
 
Jersey Guice AOP
Jersey Guice AOPJersey Guice AOP
Jersey Guice AOP
 

Más de Tsuyoshi Yamamoto

Más de Tsuyoshi Yamamoto (20)

JJUG CCC 20150411 grails3 Spring-boot
JJUG CCC 20150411 grails3 Spring-bootJJUG CCC 20150411 grails3 Spring-boot
JJUG CCC 20150411 grails3 Spring-boot
 
Groovy Grails eXchage 2014 報告
Groovy Grails eXchage 2014 報告Groovy Grails eXchage 2014 報告
Groovy Grails eXchage 2014 報告
 
JGGUG grails-spring-boot
JGGUG grails-spring-bootJGGUG grails-spring-boot
JGGUG grails-spring-boot
 
Grailsx@London 2011 報告
Grailsx@London 2011 報告Grailsx@London 2011 報告
Grailsx@London 2011 報告
 
Grails 2.0.0.M1の話
Grails 2.0.0.M1の話 Grails 2.0.0.M1の話
Grails 2.0.0.M1の話
 
Grails 1.4.0.M1 メモLT
Grails 1.4.0.M1 メモLTGrails 1.4.0.M1 メモLT
Grails 1.4.0.M1 メモLT
 
G * magazine 1
G * magazine 1G * magazine 1
G * magazine 1
 
G * magazine 0
G * magazine 0G * magazine 0
G * magazine 0
 
JGGUG 2011-02 LT
JGGUG 2011-02 LTJGGUG 2011-02 LT
JGGUG 2011-02 LT
 
Grailsx@ロンドンへ行ってきた報告。
Grailsx@ロンドンへ行ってきた報告。Grailsx@ロンドンへ行ってきた報告。
Grailsx@ロンドンへ行ってきた報告。
 
Grailsのススメ(仮)
Grailsのススメ(仮)Grailsのススメ(仮)
Grailsのススメ(仮)
 
G*ワークショップ in 仙台 Grails(とことん)入門
G*ワークショップ in 仙台 Grails(とことん)入門G*ワークショップ in 仙台 Grails(とことん)入門
G*ワークショップ in 仙台 Grails(とことん)入門
 
groovyプラプラとか「はやい、はやいよ」
groovyプラプラとか「はやい、はやいよ」groovyプラプラとか「はやい、はやいよ」
groovyプラプラとか「はやい、はやいよ」
 
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
第3回Grails/Groovy勉強会名古屋「Grails名古屋座談会」
 
第1回名古屋Grails/Groogy勉強会「Grailsを始めてみよう!」
第1回名古屋Grails/Groogy勉強会「Grailsを始めてみよう!」第1回名古屋Grails/Groogy勉強会「Grailsを始めてみよう!」
第1回名古屋Grails/Groogy勉強会「Grailsを始めてみよう!」
 
Groovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトークGroovy ネタ NGK 忘年会2009 ライトニングトーク
Groovy ネタ NGK 忘年会2009 ライトニングトーク
 
JGGUG Camp 2009 いっぽう熱海では、
JGGUG Camp 2009 いっぽう熱海では、JGGUG Camp 2009 いっぽう熱海では、
JGGUG Camp 2009 いっぽう熱海では、
 
ExtJS勉強会@名古屋
ExtJS勉強会@名古屋ExtJS勉強会@名古屋
ExtJS勉強会@名古屋
 
はじめてのGroovy
はじめてのGroovyはじめてのGroovy
はじめてのGroovy
 
GrailsでSpringをGroovyにしよう!
GrailsでSpringをGroovyにしよう!GrailsでSpringをGroovyにしよう!
GrailsでSpringをGroovyにしよう!
 

名古屋SGGAE/J勉強会 Grails、Gaelykでハンズオン

  • 1.
  • 2. JGGUG japan grails/groovy user group DTP Web 80% Grails Struts JGGUG( ) Grails 9-11 Grails Acegi Plugin http://d.hatena.ne.jp/mottsnite/ twitter @tyama
  • 3.
  • 4.
  • 5. Grails CMS
  • 6.
  • 7.
  • 8. public class HelloWorld { String name; public void setName(String name){ this.name = name; } public String getName(){ return name; } public String greet(){ return "Hello "+name; } public static void main(String[] args){ HelloWorld helloWorld = new HelloWorld(); helloWorld.setName("Groovy"); System.out.println(helloWorld.greet()); } }
  • 9. public class HelloWorld { String name; public void setName(String name){ this.name = name; } public String getName(){ return name; } public String greet(){ return "Hello "+name; } public static void main(String[] args){ HelloWorld helloWorld = new HelloWorld(); helloWorld.setName("Groovy"); System.out.println(helloWorld.greet()); } }
  • 10. public class HelloWorld { String name public void setName(String name){ this.name = name } public String getName(){ return name } public String greet(){ return "Hello "+name } public static void main(String[] args){ HelloWorld helloWorld = new HelloWorld() helloWorld.setName("Groovy") System.out.println(helloWorld.greet()) } }
  • 11. public class HelloWorld { String name public String greet(){ return "Hello "+name } public static void main(String[] args){ HelloWorld helloWorld = new HelloWorld() helloWorld.setName("Groovy") System.out.println(helloWorld.greet()) } }
  • 12. public class HelloWorld { String name public String greet(){ return "Hello "+name } } HelloWorld helloWorld = new HelloWorld() helloWorld.setName("Groovy") System.out.println(helloWorld.greet())
  • 13. class HelloWorld { String name def greet(){ return "Hello "+name } } def helloWorld = new HelloWorld() helloWorld.setName("Groovy") println(helloWorld.greet())
  • 14. class HelloWorld { String name def greet(){ return "Hello "+name } } def helloWorld = new HelloWorld() helloWorld.name = "Groovy" println helloWorld.greet()
  • 15. class HelloWorld { String name def greet(){ "Hello $name"} } def helloWorld = new HelloWorld() helloWorld.name = "Groovy" println helloWorld.greet()
  • 16. class HelloWorld { String name def greet(){ "Hello $name"} } def helloWorld = new HelloWorld(name: "Groovy") println helloWorld.greet()
  • 17.
  • 18. def arr = [1,2,3,'hoge'] def map = [a:1,b:2,c:'hoge']
  • 19. @Grab('net.homeip.yusuke:twitter4j:[2.0,)') import twitter4j.* def user="username",pass="pass" new Twitter(user,pass).friendsTimeline.each { println "${it.user.name}: ${it.text}" } maven
  • 20.
  • 21.
  • 22.
  • 25.
  • 26. grails create-app myapp cd myapp grails create-domain-class jp.grails.Todo grails create-controller jp.grails.Todo
  • 28.
  • 29.
  • 30. grails install-plugin app-engine jpa/jdo ”jpa”
  • 33.
  • 34. http://gist.github.com/263511 @Entity class Chat implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) Long id @Column ... ... String message JPA class Chat { ... ... String message ... ... grails generate-all jp.grails.Chat app-engine
  • 35. s/Groovy/Grails/ Gr stringchararrayaccessor.disabled=true
  • 36.
  • 37.
  • 39.
  • 40.
  • 41. 11
  • 42. http://gist.github.com/263509 import groovy.xml.StreamingMarkupBuilder import groovy.xml.MarkupBuilder includeTargets << new File("${appEnginePluginDir}/scripts/_AppEngineCommon.groovy") eventStatusFinal = { msg -> def appXmlFile = new File("$stagingDir/WEB-INF/appengine-web.xml") def xml = new XmlSlurper().parse(appXmlFile) xml."system-properties".appendNode { property(name:"stringchararrayaccessor.disabled",value:"true") } def smb = new StreamingMarkupBuilder() def result = smb.bind{ mkp.declareNamespace("":"http://appengine.google.com/ns/1.0") mkp.yield xml } new FileOutputStream(appXmlFile).withWriter('UTF8'){w-> w << result } } <appengine-web-app xmlns='http://appengine.google.com/ns/1.0'> <application>jggugv4</application> <version>2</version> <sessions-enabled>true</sessions-enabled> <ssl-enabled>true</ssl-enabled> <system-properties> <property name='stringchararrayaccessor.disabled' value='true'/> </appengine-web-app>
  • 43.
  • 44. $ grails app-engine run = GAE grails set-version 1 GAE grails app-engine package GAE SDK $APPENGINE_HOME/bin/appcfg.sh update ./target/war grails app-engine deploy
  • 45. APPENGINE_HOME export APPENGINE_HOME=/opt/appengine-java-sdk-1.3.0 grails install-plugin app-engine grails install-plugin gorm-jpa grails app-engine run grails set-version 1 grails app-engine package GAE SDK $APPENGINE_HOME/bin/appcfg.sh update ./target/war grails app-engine package $APPENGINE_HOME/bin/appcfg.sh update ./target/war
  • 46.
  • 47.