名古屋SGGAE/J勉強会 Grails、Gaelykでハンズオン
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

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

  • 2,856 views
Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
2,856
On Slideshare
2,369
From Embeds
487
Number of Embeds
4

Actions

Shares
Downloads
6
Comments
0
Likes
0

Embeds 487

http://d.hatena.ne.jp 474
http://webcache.googleusercontent.com 6
http://www.slideshare.net 5
http://hatenatunnel.appspot.com 2

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. 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
  • 2. Grails CMS
  • 3. 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()); } }
  • 4. 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()); } }
  • 5. 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()) } }
  • 6. 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()) } }
  • 7. public class HelloWorld { String name public String greet(){ return "Hello "+name } } HelloWorld helloWorld = new HelloWorld() helloWorld.setName("Groovy") System.out.println(helloWorld.greet())
  • 8. class HelloWorld { String name def greet(){ return "Hello "+name } } def helloWorld = new HelloWorld() helloWorld.setName("Groovy") println(helloWorld.greet())
  • 9. class HelloWorld { String name def greet(){ return "Hello "+name } } def helloWorld = new HelloWorld() helloWorld.name = "Groovy" println helloWorld.greet()
  • 10. class HelloWorld { String name def greet(){ "Hello $name"} } def helloWorld = new HelloWorld() helloWorld.name = "Groovy" println helloWorld.greet()
  • 11. class HelloWorld { String name def greet(){ "Hello $name"} } def helloWorld = new HelloWorld(name: "Groovy") println helloWorld.greet()
  • 12. def arr = [1,2,3,'hoge'] def map = [a:1,b:2,c:'hoge']
  • 13. @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
  • 14. GAE/J+Grails PermGen
  • 15. http://gist.github.com/263610
  • 16. grails create-app myapp cd myapp grails create-domain-class jp.grails.Todo grails create-controller jp.grails.Todo
  • 17. http://gist.github.com/263610
  • 18. grails install-plugin app-engine jpa/jdo ”jpa”
  • 19. grails install-plugin gorm-jpa
  • 20. google.appengine.application="mygaeapp"
  • 21. 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
  • 22. s/Groovy/Grails/ Gr stringchararrayaccessor.disabled=true
  • 23. grails.project.plugins.dir="plugins"
  • 24. 11
  • 25. 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>
  • 26. $ 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
  • 27. 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
  • 28. Grails/Groovy http://www.jggug.org/