SlideShare ist ein Scribd-Unternehmen logo
1 von 66
Downloaden Sie, um offline zu lesen
Side-B: Technical Part
groovyserver
based on: Ver 0.4-SNAPSHOT(7/24)
!"#$%&'()*
based on: Ver 0.4-SNAPSHOT(7/24)
$ groovyserver
GroovyServer   main()
ServerSocket    Listen
               1961
$ groovyclient -e “println(‘Hello, GroovyServ!’)”




      groovyclient




       1961(default)          groovyserver
RequestWorker   start()
ClientConnection#openSession()
                      InvocationRequest
groovyclient   Groovy
Groovy
+,-./012345
67389:3467;5
  <=6#+,4

  based on: Ver 0.4-SNAPSHOT(7/24)
$ groovyserver
GroovyServer   main()
System.in/out/err
!
~/.groovy/groovyserv/cookie
ServerSocket    Listen
               1961
$ groovyclient -e “println(‘Hello, GroovyServ!’)”



      ./groovy/groovyserv/cookie
                              Cookie



   groovyclient

                     Cookie: 425ba835cb32688b1




    1961(default)            groovyserver
Socket   Loopback Address
  RequestWorker
RequestWorker



  ClientConnection




                     CientConnection
                                   ThreadGroup
                       Singleton
RequestWorker   start()
ClientConnection#openSession()
                      InvocationRequest




                           Cookie
groovyclient
        System.in
groovyclient   Groovy
groovyclient
(CWD)            JVM
1.                   “user.dir”
2. JNA         JVM                CWD
3. CWD
GroovyMain
GroovyMain2   Groovy
>?@A4BCDE3:2
-




       (CWD)




    CTRL+C
-




       (CWD)




    CTRL+C
-

       System.out(err)



       System.in



HTTP
System.out(err)
            !script"
println “Hello, GroovyServ!”




                                        Socket
            System.out
                           OutputStream#write()     ClientConnection
         (StreamResponse
          OutputStream)
                                                     OutputStream




 ClientConnectionRepository                        groovyclient
       ThreadGroup
   ClientConnection            if Channel        ==”out”    if Channel   ==”err”
                                    "                         "




                                            Hello, GroovyServ!
groovyclient               StreamRequestHandler
                                      Socket.inputStream.read()


                                     pipedOutputStream.write()

      ClientConnection

     PipedOutputStream                         ClientConnection
                                                  Repository

                                                    ThreadGroup
                                                ClientConnection
        PipedInputStream


                  ClientConnection                System.in
               PipedInputStream          (StreamRequestInputStream)


        System.in

                                                  !script"
                                     System.in.eachLine { ... }
Piped
[    ]                            Size:-1

[   A] StreamRequestInputStream
Socket#getInputStream()

    System.in




[   B] StreamRequestInputStream      PipedInputStream()
Request

   InvocationRequest

                       Groovy

   StreamRequest



Response

   StreamResponse
InvocationRequest
'Cwd:' <cwd> LF
'Arg:' <argn> LF
'Arg:' <arg1> LF
'Arg:' <arg2> LF
'Cp:' <classpath> LF
'Cookie:' <cookie> LF
LF

where:
 <cwd> is current working directory.
 <arg1><arg2>.. are commandline arguments(optional).
 <classpath>.. is the value of environment variable
CLASSPATH(optional).
 <cookie> is authentication value which certify client is
the user who invoked the server.
 LF is line feed (0x0a, 'n').
StreamRequest

'Size:' <size> LF
LF
<data from STDIN>

where:
 <size> is the size of data to send to server. <size>==-1
means client exited.
 <data from STDIN> is byte sequence from standard input.
StreamResponse
'Status:' <status> LF
'Channel:' <id> LF
'Size:' <size> LF
LF
<data for STDERR/STDOUT>

where:
 <status> is exit status of invoked groovy script.
 <id> is 'out' or 'err', where 'out' means standard output
of the program. 'err' means standard error of the program.
 <size> is the size of chunk.
 <data from STDERR/STDOUT> is byte sequence from standard
output/error.
-




       (CWD)




    CTRL+C
Cookie / Loopback only
                         2
 Only from Loopback address


             InetAddress#isLoopbackAddress()
 Cookie
      Loopback address
                                  NG
    HTTP    Cookie
                                               ~/.groovy/groovyserv/
    cookie


    Cookie


          Authentication failed
-




       (CWD)




    CTRL+C
CLASSPATH
       CLASSPATH

InvocationRequest   Cp

GroovyMain2                “groovy.classpath”
          GroovyMain2



        groovy.classpath



                             groovyserver -r

       -cp

InvocationRequest   Arg



      GroovyMain2
-




       (CWD)




    CTRL+C
CWD(Current Working Directory)


       Java

       GroovyServ                                   CWD
                  CWD

$ cd /tmp
$ groovyserver -r
$ cd /home/kobo
$ cat > hoge.txt
HOGE!!
^C
$ groovyclient -e ‘println(new File(“hoge.txt”).text)’
Caught: java.io.FileNotFoundException: hoge.txt (No such file or directory)
   ...SNIP...
“user.dir”

      File#getAbsolutePath()

      “"user.dir", which is initialized during jvm
      startup, should be used as an informative/readonly
      system property” posted 2008-08-18

         http://bugs.sun.com/bugdatabase/view_bug.do;:YfiG?bug_id=4117557

JNA            JVM                 CWD

      “user.dir”
      FileInputStream

 CWD

Groovy
JNA   cwd               POM

            <dependency>
              <groupId>net.java.dev.jna</groupId>
              <artifactId>jna</artifactId>
              <version>3.2.2</version>
            </dependency>

                                            #   OK

import com.sun.jna.Library
import com.sun.jna.Native
import com.sun.jna.Platform

interface CLibrary extends Library {
    String libname = (Platform.isWindows() ? "msvcrt" : "c")
    CLibrary INSTANCE = Native.loadLibrary(libname, CLibrary.class)
    int chdir(String dir)
    int _chdir(String dir)
}
-




       (CWD)




    CTRL+C
groovyserver



  Windows        groovyserver.bat

PID             Linux/MacOSX        PID
                     kill

Windows                             Address already in
use

  BAT     PID
-




       (CWD)




    CTRL+C
CTRL+C

groovyclient
        CTRL+C

“Size: -1”

        StreamRequestHandler
-




       (CWD)




    CTRL+C
java.util.concurrent
             2


   StreamRequestHandler
  Groovy
   GroovyInvokeHandler
NW
Groovy




         CTRL+C
System.exit()

                JVM
Maven + GMaven
Maven + GMaven

  GMaven

          Gradle             Gradle

0.4-SNAPSHOT       groovy



  groovyc                     JDK   API   private
                            IncompatibleClassChange
  Error
IntegrationTest
GroovyServ

                          groovyclient



maven-failsafe-plugin                              “mvn integration-
test”

             http://maven.apache.org/plugins/maven-failsafe-plugin/
   index.html

                                     mvn
How to Build
Maven2
  $ cd groovyserv-<Version>
  $ mvn clean verify

              :
  target/groovyserv-<Version>-<OS>-<arch>-bin.zip

Integration-Test
 target/groovyserv-<Version>-<OS>-<arch>.dir/groovyserv-<Version>-<OS>-<arch>

                   :

   EncodeIT                                                   UTF-8
     $ export _JAVA_OPTIONS=-Dfile.encoding=UTF-8


     $ mvn -Dmaven.test.skip=true clean package

Windows                  Cygwin   gcc
>?:')DFFFF
Remote GroovyServ

  OFF

Only Loopback adress

Cookie
3

groovyserver
  Loopback Address

  Cookie

grovyclient
                  “localhost”=>


              A



  groovyserver

                    B

  groovyclient
GroovyServ




         GitHub          clone/fork




  Welcome

GroovyServ

  http://kobo.github.com/groovyserv
GitHub
  http://github.com/kobo/groovyserv

Weitere ähnliche Inhalte

Was ist angesagt?

Codified PostgreSQL Schema
Codified PostgreSQL SchemaCodified PostgreSQL Schema
Codified PostgreSQL SchemaSean Chittenden
 
Source Code of Building Linux IPv6 DNS Server (Complete Sourcecode)
Source Code of Building Linux IPv6 DNS Server (Complete Sourcecode)Source Code of Building Linux IPv6 DNS Server (Complete Sourcecode)
Source Code of Building Linux IPv6 DNS Server (Complete Sourcecode)Hari
 
Security and dev ops for high velocity organizations
Security and dev ops for high velocity organizationsSecurity and dev ops for high velocity organizations
Security and dev ops for high velocity organizationsChef
 
2011-03 Developing Windows Exploits
2011-03 Developing Windows Exploits 2011-03 Developing Windows Exploits
2011-03 Developing Windows Exploits Raleigh ISSA
 
Работа с реляционными базами данных в C++
Работа с реляционными базами данных в C++Работа с реляционными базами данных в C++
Работа с реляционными базами данных в C++corehard_by
 
Getting started with TDD - Confoo 2014
Getting started with TDD - Confoo 2014Getting started with TDD - Confoo 2014
Getting started with TDD - Confoo 2014Eric Hogue
 
Continuous testing In PHP
Continuous testing In PHPContinuous testing In PHP
Continuous testing In PHPEric Hogue
 
Feldo: Function Event Listing and Dynamic Observing for Detecting and Prevent...
Feldo: Function Event Listing and Dynamic Observing for Detecting and Prevent...Feldo: Function Event Listing and Dynamic Observing for Detecting and Prevent...
Feldo: Function Event Listing and Dynamic Observing for Detecting and Prevent...Tzung-Bi Shih
 
Commencer avec le TDD
Commencer avec le TDDCommencer avec le TDD
Commencer avec le TDDEric Hogue
 
Guarding Your Code Against Bugs with Continuous Testing
Guarding Your Code Against Bugs with Continuous TestingGuarding Your Code Against Bugs with Continuous Testing
Guarding Your Code Against Bugs with Continuous TestingEric Hogue
 
Varnish Cache and Django (Falcon, Flask etc)
Varnish Cache and Django (Falcon, Flask etc)Varnish Cache and Django (Falcon, Flask etc)
Varnish Cache and Django (Falcon, Flask etc)Данил Иванов
 
Piratte installation
Piratte installationPiratte installation
Piratte installationKampa Lavanya
 
Functional Operations (Functional Programming at Comcast Labs Connect)
Functional Operations (Functional Programming at Comcast Labs Connect)Functional Operations (Functional Programming at Comcast Labs Connect)
Functional Operations (Functional Programming at Comcast Labs Connect)Susan Potter
 
Node.js Event Loop & EventEmitter
Node.js Event Loop & EventEmitterNode.js Event Loop & EventEmitter
Node.js Event Loop & EventEmitterSimen Li
 
Come configurare Liferay 6.0 per Oracle
Come configurare Liferay 6.0 per OracleCome configurare Liferay 6.0 per Oracle
Come configurare Liferay 6.0 per OracleAntonio Musarra
 

Was ist angesagt? (20)

Codified PostgreSQL Schema
Codified PostgreSQL SchemaCodified PostgreSQL Schema
Codified PostgreSQL Schema
 
Source Code of Building Linux IPv6 DNS Server (Complete Sourcecode)
Source Code of Building Linux IPv6 DNS Server (Complete Sourcecode)Source Code of Building Linux IPv6 DNS Server (Complete Sourcecode)
Source Code of Building Linux IPv6 DNS Server (Complete Sourcecode)
 
Security and dev ops for high velocity organizations
Security and dev ops for high velocity organizationsSecurity and dev ops for high velocity organizations
Security and dev ops for high velocity organizations
 
2011-03 Developing Windows Exploits
2011-03 Developing Windows Exploits 2011-03 Developing Windows Exploits
2011-03 Developing Windows Exploits
 
Learning Dtrace
Learning DtraceLearning Dtrace
Learning Dtrace
 
Работа с реляционными базами данных в C++
Работа с реляционными базами данных в C++Работа с реляционными базами данных в C++
Работа с реляционными базами данных в C++
 
Getting started with TDD - Confoo 2014
Getting started with TDD - Confoo 2014Getting started with TDD - Confoo 2014
Getting started with TDD - Confoo 2014
 
Testing with Node.js
Testing with Node.jsTesting with Node.js
Testing with Node.js
 
Continuous testing In PHP
Continuous testing In PHPContinuous testing In PHP
Continuous testing In PHP
 
Feldo: Function Event Listing and Dynamic Observing for Detecting and Prevent...
Feldo: Function Event Listing and Dynamic Observing for Detecting and Prevent...Feldo: Function Event Listing and Dynamic Observing for Detecting and Prevent...
Feldo: Function Event Listing and Dynamic Observing for Detecting and Prevent...
 
Commencer avec le TDD
Commencer avec le TDDCommencer avec le TDD
Commencer avec le TDD
 
Guarding Your Code Against Bugs with Continuous Testing
Guarding Your Code Against Bugs with Continuous TestingGuarding Your Code Against Bugs with Continuous Testing
Guarding Your Code Against Bugs with Continuous Testing
 
Varnish Cache and Django (Falcon, Flask etc)
Varnish Cache and Django (Falcon, Flask etc)Varnish Cache and Django (Falcon, Flask etc)
Varnish Cache and Django (Falcon, Flask etc)
 
Piratte installation
Piratte installationPiratte installation
Piratte installation
 
Functional Operations (Functional Programming at Comcast Labs Connect)
Functional Operations (Functional Programming at Comcast Labs Connect)Functional Operations (Functional Programming at Comcast Labs Connect)
Functional Operations (Functional Programming at Comcast Labs Connect)
 
Node.js Event Loop & EventEmitter
Node.js Event Loop & EventEmitterNode.js Event Loop & EventEmitter
Node.js Event Loop & EventEmitter
 
Come configurare Liferay 6.0 per Oracle
Come configurare Liferay 6.0 per OracleCome configurare Liferay 6.0 per Oracle
Come configurare Liferay 6.0 per Oracle
 
Zone IDA Proc
Zone IDA ProcZone IDA Proc
Zone IDA Proc
 
Code as Risk
Code as RiskCode as Risk
Code as Risk
 
Shell Script
Shell ScriptShell Script
Shell Script
 

Ähnlich wie GroovyServ - Technical Part

What the CRaC - Superfast JVM startup
What the CRaC - Superfast JVM startupWhat the CRaC - Superfast JVM startup
What the CRaC - Superfast JVM startupGerrit Grunwald
 
Jenkins and Groovy
Jenkins and GroovyJenkins and Groovy
Jenkins and GroovyKiyotaka Oku
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVMSylvain Wallez
 
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGeneBang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGeneDroidConTLV
 
Marvel of Annotation Preprocessing in Java by Alexey Buzdin
Marvel of Annotation Preprocessing in Java by Alexey BuzdinMarvel of Annotation Preprocessing in Java by Alexey Buzdin
Marvel of Annotation Preprocessing in Java by Alexey BuzdinJava User Group Latvia
 
Silicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsSilicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsAzul Systems, Inc.
 
Virtualizing Java in Java (jug.ru)
Virtualizing Java in Java (jug.ru)Virtualizing Java in Java (jug.ru)
Virtualizing Java in Java (jug.ru)aragozin
 
commit => #GitHub => #CircleCI => #Docker => #Kubernetes #AWS cluster
commit => #GitHub => #CircleCI => #Docker => #Kubernetes #AWS clustercommit => #GitHub => #CircleCI => #Docker => #Kubernetes #AWS cluster
commit => #GitHub => #CircleCI => #Docker => #Kubernetes #AWS clusterJakub Kulhan
 
No dark magic - Byte code engineering in the real world
No dark magic - Byte code engineering in the real worldNo dark magic - Byte code engineering in the real world
No dark magic - Byte code engineering in the real worldtcurdt
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?Doug Hawkins
 
Node.js - async for the rest of us.
Node.js - async for the rest of us.Node.js - async for the rest of us.
Node.js - async for the rest of us.Mike Brevoort
 
お題でGroovyプログラミング: Part A
お題でGroovyプログラミング: Part Aお題でGroovyプログラミング: Part A
お題でGroovyプログラミング: Part AKazuchika Sekiya
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesLindsay Holmwood
 
Drive chrome(headless) with puppeteer
Drive chrome(headless) with puppeteerDrive chrome(headless) with puppeteer
Drive chrome(headless) with puppeteerVodqaBLR
 
HBaseCon 2013: A Developer’s Guide to Coprocessors
HBaseCon 2013: A Developer’s Guide to CoprocessorsHBaseCon 2013: A Developer’s Guide to Coprocessors
HBaseCon 2013: A Developer’s Guide to CoprocessorsCloudera, Inc.
 
Год в Github bugbounty, опыт участия
Год в Github bugbounty, опыт участияГод в Github bugbounty, опыт участия
Год в Github bugbounty, опыт участияdefcon_kz
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierCarlos Sanchez
 
.gradle 파일 정독해보기
.gradle 파일 정독해보기.gradle 파일 정독해보기
.gradle 파일 정독해보기경주 전
 

Ähnlich wie GroovyServ - Technical Part (20)

What the CRaC - Superfast JVM startup
What the CRaC - Superfast JVM startupWhat the CRaC - Superfast JVM startup
What the CRaC - Superfast JVM startup
 
Jenkins and Groovy
Jenkins and GroovyJenkins and Groovy
Jenkins and Groovy
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVM
 
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGeneBang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
 
Marvel of Annotation Preprocessing in Java by Alexey Buzdin
Marvel of Annotation Preprocessing in Java by Alexey BuzdinMarvel of Annotation Preprocessing in Java by Alexey Buzdin
Marvel of Annotation Preprocessing in Java by Alexey Buzdin
 
FreeBSD: Dev to Prod
FreeBSD: Dev to ProdFreeBSD: Dev to Prod
FreeBSD: Dev to Prod
 
Silicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsSilicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM Mechanics
 
Virtualizing Java in Java (jug.ru)
Virtualizing Java in Java (jug.ru)Virtualizing Java in Java (jug.ru)
Virtualizing Java in Java (jug.ru)
 
commit => #GitHub => #CircleCI => #Docker => #Kubernetes #AWS cluster
commit => #GitHub => #CircleCI => #Docker => #Kubernetes #AWS clustercommit => #GitHub => #CircleCI => #Docker => #Kubernetes #AWS cluster
commit => #GitHub => #CircleCI => #Docker => #Kubernetes #AWS cluster
 
No dark magic - Byte code engineering in the real world
No dark magic - Byte code engineering in the real worldNo dark magic - Byte code engineering in the real world
No dark magic - Byte code engineering in the real world
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
 
Node.js - async for the rest of us.
Node.js - async for the rest of us.Node.js - async for the rest of us.
Node.js - async for the rest of us.
 
Intro to PSGI and Plack
Intro to PSGI and PlackIntro to PSGI and Plack
Intro to PSGI and Plack
 
お題でGroovyプログラミング: Part A
お題でGroovyプログラミング: Part Aお題でGroovyプログラミング: Part A
お題でGroovyプログラミング: Part A
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
Drive chrome(headless) with puppeteer
Drive chrome(headless) with puppeteerDrive chrome(headless) with puppeteer
Drive chrome(headless) with puppeteer
 
HBaseCon 2013: A Developer’s Guide to Coprocessors
HBaseCon 2013: A Developer’s Guide to CoprocessorsHBaseCon 2013: A Developer’s Guide to Coprocessors
HBaseCon 2013: A Developer’s Guide to Coprocessors
 
Год в Github bugbounty, опыт участия
Год в Github bugbounty, опыт участияГод в Github bugbounty, опыт участия
Год в Github bugbounty, опыт участия
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
 
.gradle 파일 정독해보기
.gradle 파일 정독해보기.gradle 파일 정독해보기
.gradle 파일 정독해보기
 

Mehr von Yasuharu Nakano

Java開発の強力な相棒として今すぐ使えるGroovy
Java開発の強力な相棒として今すぐ使えるGroovyJava開発の強力な相棒として今すぐ使えるGroovy
Java開発の強力な相棒として今すぐ使えるGroovyYasuharu Nakano
 
OSS Product feat. Gradle
OSS Product feat. GradleOSS Product feat. Gradle
OSS Product feat. GradleYasuharu Nakano
 
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx PluginGr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx PluginYasuharu Nakano
 
The report of JavaOne2011 about groovy
The report of JavaOne2011 about groovyThe report of JavaOne2011 about groovy
The report of JavaOne2011 about groovyYasuharu Nakano
 
JavaSE7 Launch Event: Java7xGroovy
JavaSE7 Launch Event: Java7xGroovyJavaSE7 Launch Event: Java7xGroovy
JavaSE7 Launch Event: Java7xGroovyYasuharu Nakano
 
レッツゴーデベロッパー2011「プログラミングGroovy〜G*エコシステム編」
レッツゴーデベロッパー2011「プログラミングGroovy〜G*エコシステム編」レッツゴーデベロッパー2011「プログラミングGroovy〜G*エコシステム編」
レッツゴーデベロッパー2011「プログラミングGroovy〜G*エコシステム編」Yasuharu Nakano
 
JavaOne2010 Groovy/Spring Roo
JavaOne2010 Groovy/Spring RooJavaOne2010 Groovy/Spring Roo
JavaOne2010 Groovy/Spring RooYasuharu Nakano
 

Mehr von Yasuharu Nakano (9)

Java開発の強力な相棒として今すぐ使えるGroovy
Java開発の強力な相棒として今すぐ使えるGroovyJava開発の強力な相棒として今すぐ使えるGroovy
Java開発の強力な相棒として今すぐ使えるGroovy
 
OSS Product feat. Gradle
OSS Product feat. GradleOSS Product feat. Gradle
OSS Product feat. Gradle
 
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx PluginGr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
 
The report of JavaOne2011 about groovy
The report of JavaOne2011 about groovyThe report of JavaOne2011 about groovy
The report of JavaOne2011 about groovy
 
JavaSE7 Launch Event: Java7xGroovy
JavaSE7 Launch Event: Java7xGroovyJavaSE7 Launch Event: Java7xGroovy
JavaSE7 Launch Event: Java7xGroovy
 
レッツゴーデベロッパー2011「プログラミングGroovy〜G*エコシステム編」
レッツゴーデベロッパー2011「プログラミングGroovy〜G*エコシステム編」レッツゴーデベロッパー2011「プログラミングGroovy〜G*エコシステム編」
レッツゴーデベロッパー2011「プログラミングGroovy〜G*エコシステム編」
 
How about Gradle?
How about Gradle?How about Gradle?
How about Gradle?
 
Groovy's Builder
Groovy's BuilderGroovy's Builder
Groovy's Builder
 
JavaOne2010 Groovy/Spring Roo
JavaOne2010 Groovy/Spring RooJavaOne2010 Groovy/Spring Roo
JavaOne2010 Groovy/Spring Roo
 

Kürzlich hochgeladen

How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
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
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
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
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 

Kürzlich hochgeladen (20)

How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
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
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 

GroovyServ - Technical Part

  • 3.
  • 4.
  • 5. based on: Ver 0.4-SNAPSHOT(7/24)
  • 6.
  • 7. !"#$%&'()* based on: Ver 0.4-SNAPSHOT(7/24)
  • 9. GroovyServer main()
  • 10. ServerSocket Listen 1961
  • 11. $ groovyclient -e “println(‘Hello, GroovyServ!’)” groovyclient 1961(default) groovyserver
  • 12. RequestWorker start()
  • 13. ClientConnection#openSession() InvocationRequest
  • 14. groovyclient Groovy
  • 16. +,-./012345 67389:3467;5 <=6#+,4 based on: Ver 0.4-SNAPSHOT(7/24)
  • 18. GroovyServer main()
  • 21. ServerSocket Listen 1961
  • 22. $ groovyclient -e “println(‘Hello, GroovyServ!’)” ./groovy/groovyserv/cookie Cookie groovyclient Cookie: 425ba835cb32688b1 1961(default) groovyserver
  • 23. Socket Loopback Address RequestWorker
  • 24. RequestWorker ClientConnection CientConnection ThreadGroup Singleton
  • 25. RequestWorker start()
  • 26. ClientConnection#openSession() InvocationRequest Cookie
  • 27. groovyclient System.in
  • 28. groovyclient Groovy
  • 29. groovyclient (CWD) JVM 1. “user.dir” 2. JNA JVM CWD 3. CWD
  • 32. - (CWD) CTRL+C
  • 33. - (CWD) CTRL+C
  • 34. - System.out(err) System.in HTTP
  • 35. System.out(err) !script" println “Hello, GroovyServ!” Socket System.out OutputStream#write() ClientConnection (StreamResponse OutputStream) OutputStream ClientConnectionRepository groovyclient ThreadGroup ClientConnection if Channel ==”out” if Channel ==”err” " " Hello, GroovyServ!
  • 36. groovyclient StreamRequestHandler Socket.inputStream.read() pipedOutputStream.write() ClientConnection PipedOutputStream ClientConnection Repository ThreadGroup ClientConnection PipedInputStream ClientConnection System.in PipedInputStream (StreamRequestInputStream) System.in !script" System.in.eachLine { ... }
  • 37. Piped [ ] Size:-1 [ A] StreamRequestInputStream Socket#getInputStream() System.in [ B] StreamRequestInputStream PipedInputStream()
  • 38. Request InvocationRequest Groovy StreamRequest Response StreamResponse
  • 39. InvocationRequest 'Cwd:' <cwd> LF 'Arg:' <argn> LF 'Arg:' <arg1> LF 'Arg:' <arg2> LF 'Cp:' <classpath> LF 'Cookie:' <cookie> LF LF where: <cwd> is current working directory. <arg1><arg2>.. are commandline arguments(optional). <classpath>.. is the value of environment variable CLASSPATH(optional). <cookie> is authentication value which certify client is the user who invoked the server. LF is line feed (0x0a, 'n').
  • 40. StreamRequest 'Size:' <size> LF LF <data from STDIN> where: <size> is the size of data to send to server. <size>==-1 means client exited. <data from STDIN> is byte sequence from standard input.
  • 41. StreamResponse 'Status:' <status> LF 'Channel:' <id> LF 'Size:' <size> LF LF <data for STDERR/STDOUT> where: <status> is exit status of invoked groovy script. <id> is 'out' or 'err', where 'out' means standard output of the program. 'err' means standard error of the program. <size> is the size of chunk. <data from STDERR/STDOUT> is byte sequence from standard output/error.
  • 42. - (CWD) CTRL+C
  • 43. Cookie / Loopback only 2 Only from Loopback address InetAddress#isLoopbackAddress() Cookie Loopback address NG HTTP Cookie ~/.groovy/groovyserv/ cookie Cookie Authentication failed
  • 44. - (CWD) CTRL+C
  • 45. CLASSPATH CLASSPATH InvocationRequest Cp GroovyMain2 “groovy.classpath” GroovyMain2 groovy.classpath groovyserver -r -cp InvocationRequest Arg GroovyMain2
  • 46. - (CWD) CTRL+C
  • 47. CWD(Current Working Directory) Java GroovyServ CWD CWD $ cd /tmp $ groovyserver -r $ cd /home/kobo $ cat > hoge.txt HOGE!! ^C $ groovyclient -e ‘println(new File(“hoge.txt”).text)’ Caught: java.io.FileNotFoundException: hoge.txt (No such file or directory) ...SNIP...
  • 48. “user.dir” File#getAbsolutePath() “"user.dir", which is initialized during jvm startup, should be used as an informative/readonly system property” posted 2008-08-18 http://bugs.sun.com/bugdatabase/view_bug.do;:YfiG?bug_id=4117557 JNA JVM CWD “user.dir” FileInputStream CWD Groovy
  • 49. JNA cwd POM <dependency> <groupId>net.java.dev.jna</groupId> <artifactId>jna</artifactId> <version>3.2.2</version> </dependency> # OK import com.sun.jna.Library import com.sun.jna.Native import com.sun.jna.Platform interface CLibrary extends Library { String libname = (Platform.isWindows() ? "msvcrt" : "c") CLibrary INSTANCE = Native.loadLibrary(libname, CLibrary.class) int chdir(String dir) int _chdir(String dir) }
  • 50. - (CWD) CTRL+C
  • 51. groovyserver Windows groovyserver.bat PID Linux/MacOSX PID kill Windows Address already in use BAT PID
  • 52. - (CWD) CTRL+C
  • 53. CTRL+C groovyclient CTRL+C “Size: -1” StreamRequestHandler
  • 54. - (CWD) CTRL+C
  • 55. java.util.concurrent 2 StreamRequestHandler Groovy GroovyInvokeHandler
  • 56. NW Groovy CTRL+C
  • 58.
  • 59. Maven + GMaven Maven + GMaven GMaven Gradle Gradle 0.4-SNAPSHOT groovy groovyc JDK API private IncompatibleClassChange Error
  • 60. IntegrationTest GroovyServ groovyclient maven-failsafe-plugin “mvn integration- test” http://maven.apache.org/plugins/maven-failsafe-plugin/ index.html mvn
  • 61. How to Build Maven2 $ cd groovyserv-<Version> $ mvn clean verify : target/groovyserv-<Version>-<OS>-<arch>-bin.zip Integration-Test target/groovyserv-<Version>-<OS>-<arch>.dir/groovyserv-<Version>-<OS>-<arch> : EncodeIT UTF-8 $ export _JAVA_OPTIONS=-Dfile.encoding=UTF-8 $ mvn -Dmaven.test.skip=true clean package Windows Cygwin gcc
  • 63. Remote GroovyServ OFF Only Loopback adress Cookie
  • 64. 3 groovyserver Loopback Address Cookie grovyclient “localhost”=> A groovyserver B groovyclient
  • 65.
  • 66. GroovyServ GitHub clone/fork Welcome GroovyServ http://kobo.github.com/groovyserv GitHub http://github.com/kobo/groovyserv