SlideShare a Scribd company logo
1 of 25
Download to read offline
© Schalk W. Cronjé Greach 2014
Groovy VFS
Schalk W. Cronjé
@ysb33r
© Schalk W. Cronjé Greach 2014
Quickstart
def vfs = new VFS()
vfs {
cp “http://from.here/a.txt”, “sftp://to.there/b.txt”
}
© Schalk W. Cronjé Greach 2014
Groovy VFS
Current version: 0.5
Source: http://github.com/ysb33r/groovy-vfs
Wiki: https://github.com/ysb33r/groovy-vfs/wiki
Packages: https://bintray.com/ysb33r/grysb33r/groovy-vfs
Gradle Packages: https://bintray.com/ysb33r/grysb33r/vfs-gradle-plugin
License: Apache 2.0
Twitter: #groovyvfs
© Schalk W. Cronjé Greach 2014
Bootstrap
@Grapes([
@Grab( 'org.ysb33r.groovy:groovy-vfs:0.5' ),
// If you wantftp
@Grab( 'commons-net:commons-net:3.+' ),
// If you want http/https
@Grab( 'commons-httpclient:commons-httpclient:3.1'),
// If you want sftp
@Grab( 'com.jcraft:jsch:0.1.48' )
])
import org.ysb33r.groovy.dsl.vfs.VFS
© Schalk W. Cronjé Greach 2014
Create directory on remote server
vfs {
mkdir “ftp://a.server/pub/ysb33r”
}
© Schalk W. Cronjé Greach 2014
Directory Listing
vfs {
ls (“ftp://www.mirrorservice.org/sites”) {
println it.name
}
}
© Schalk W. Cronjé Greach 2014
Set Schema Options
vfs {
options {
ftp {
passiveMode true
userDirIsRoot false
}
}
}
© Schalk W. Cronjé Greach 2014
Modify Schema Option per Request
vfs {
ls (“ftp://www.mirrorservice.org/sites?vfs.ftp.passiveMode=1”) {
println it.name
}
}
220 Service ready for new user.
USER guest
331 User name okay, need password for guest.
PASS guest
230 User logged in, proceed.
TYPE I
200 Command TYPE okay.
CWD /
250 Directory changed to /
SYST
215 UNIX Type: Apache FtpServer
PASV
227 Entering Passive Mode (127,0,0,1,226,247)
LIST
150 File status okay; about to open data connection.
226 Closing data connection.
© Schalk W. Cronjé Greach 2014
Set Schema Options at Initialisation
def vfs = new VFS (
'vfs.ftp.passiveMode' : true,
'vfs.http.maxTotalConnections' : 4
)
© Schalk W. Cronjé Greach 2014
Schema Options
- Most Apache VFS filesystem options supported
- Follows Groovy property-over-setter/getter convention
Documentation:
https://github.com/ysb33r/groovy-vfs/wiki/Protocol-Options
© Schalk W. Cronjé Greach 2014
Copying & Moving
vfs {
cp “http://a.server/myFile.txt”,
“file:///home/scronje/MyFile.downloaded.txt”
mv “ftp://that.server/myFile.txt”,
“sftp://this.server/in-this-folder&vfs.sftp.userDirIsRoot=
}
© Schalk W. Cronjé Greach 2014
Copy DSL
vfs {
cp from_url,
to_url,
overwrite : false,
smash : false,
recursive : false,
filter : defaults_to_selecting_everything
}
Documentation:
https://github.com/ysb33r/groovy-vfs/wiki/VFS-Copy-Behaviour
© Schalk W. Cronjé Greach 2014
Interactive Copy
vfs {
cp from_url,
to_url,
overwrite : { from,to ->
println “Overwrite ${to}?”
System.in.readLine().startsWith('Y')
}
}
© Schalk W. Cronjé Greach 2014
Move DSL
vfs {
mv from_url,
to_url,
overwrite : false,
smash : false,
intermediates : true,
}
Documentation:
https://github.com/ysb33r/groovy-vfs/wiki/VFS-Move-Behaviour
© Schalk W. Cronjé Greach 2014
Download & Unpack
vfs {
cp “zip:ftp://a.server/with-archive.zip”,
“file:///home/scronje/unpacked”
}
Warning:
Large archives will cause slow-down due to performance bug in Apache VFS
© Schalk W. Cronjé Greach 2014
Working with Content
import java.security.MessageDigest
vfs {
MessageDigest md5 = MessageDigest.getInstance("MD5")
cat (“ftp://a.server/my-file.txt”) { strm →
strm.eachByte(8192) { buffer, nbytes ->
md5.update( buffer, 0, nbytes )
}
}
println md5.digest().encodeHex().toString()
.padLeft( 32, '0' )
} // From a conversation on groovy-user ML
© Schalk W. Cronjé Greach 2014
Local Files
- Prefix with 'file://'
- Use java.io.File instance
- Use org.apache.commons.vfs2.FileObject instance
vfs {
cp new File(“a.txt”), “ftp://to.server/pub”
}
© Schalk W. Cronjé Greach 2014
Authentication
vfs {
// clear password
cp new File(“a.txt”),
“ftp://${username}:${password}@to.server/pub”
// password encrypted with org.apache.commons.vfs2.util.EncryptUtil
cp new File('b.txt'),
'ftp://testuser:{D7B82198B272F5C93790FEB38A73C7B8}@to.server/pub'
}
Warning: User with caution (security …)
Enhancement: ISSUE-17 to provide better authentication DSL support
© Schalk W. Cronjé Greach 2014
Future Ideas For Investigation
●
Java 7 NIO
– java.nio.file.*
– Wait for Apache VFS or go native Groovy?
●
Direct SMB support?
– Apache VFS Sandbox
– jCIFS license is LGPL
© Schalk W. Cronjé Greach 2014
VFS Gradle Plugin
(experimental / incubating)
© Schalk W. Cronjé Greach 2014
Bootstrap
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.ysb33r.gradle:vfs-gradle-plugin:0.5'
classpath 'commons-net:commons-net:3.+' // ftp
classpath 'commons-httpclient:commons-httpclient:3.1' // http/https
classpath 'com.jcraft:jsch:0.1.48' // sftp
}
}
apply plugin : 'vfs'
© Schalk W. Cronjé Greach 2014
Available as Project Extension
task ftpCopy << {
vfs {
cp “ftp://a.server/file.txt”, buildDir
}
}
© Schalk W. Cronjé Greach 2014
Future Ideas For Investigation
●
vfsTree
– Akin toproject.tarTree
– Is it even possible to createFileTree?
●
Vfs Copy / Move Task
– How to define @Input etc. correctly
© Schalk W. Cronjé Greach 2014
Other Plugins ?
●
Grails & Griffon
– No plugin (yet)
●
Jenkins
– Time to consolidate various protocol
plugins
Who wants to write one?
© Schalk W. Cronjé Greach 2014
Groovy VFS
#groovyvfs
Schalk W. Cronjé
@ysb33r
http://github.com/ysb33r/groovy-vfs

More Related Content

What's hot

Ansible as a better shell script
Ansible as a better shell scriptAnsible as a better shell script
Ansible as a better shell scriptTakuya Nishimoto
 
K8s上の containerized cloud foundryとcontainerized open stackをprometheusで監視してみる
K8s上の containerized cloud foundryとcontainerized open stackをprometheusで監視してみるK8s上の containerized cloud foundryとcontainerized open stackをprometheusで監視してみる
K8s上の containerized cloud foundryとcontainerized open stackをprometheusで監視してみるJUNICHI YOSHISE
 
FreeBSD Document Project
FreeBSD Document ProjectFreeBSD Document Project
FreeBSD Document ProjectChinsan Huang
 
Automating Mendix application deployments with Nix
Automating Mendix application deployments with NixAutomating Mendix application deployments with Nix
Automating Mendix application deployments with NixSander van der Burg
 
[2019.03] 멀티 노드에서 Hyperledger Fabric 네트워크 구성하기
[2019.03] 멀티 노드에서 Hyperledger Fabric 네트워크 구성하기[2019.03] 멀티 노드에서 Hyperledger Fabric 네트워크 구성하기
[2019.03] 멀티 노드에서 Hyperledger Fabric 네트워크 구성하기Hyperledger Korea User Group
 
Смарт-контракты: базовые инструменты для разработки и тестирования. Спикер: Д...
Смарт-контракты: базовые инструменты для разработки и тестирования. Спикер: Д...Смарт-контракты: базовые инструменты для разработки и тестирования. Спикер: Д...
Смарт-контракты: базовые инструменты для разработки и тестирования. Спикер: Д...Cyber Fund
 
My journey from PHP to Node.js
My journey from PHP to Node.jsMy journey from PHP to Node.js
My journey from PHP to Node.jsValentin Lup
 
Frasco: Jekyll Starter Project
Frasco: Jekyll Starter ProjectFrasco: Jekyll Starter Project
Frasco: Jekyll Starter ProjectKite Koga
 
DevOps for Opensource Geospatial Applications
DevOps for Opensource Geospatial ApplicationsDevOps for Opensource Geospatial Applications
DevOps for Opensource Geospatial Applicationstlpinney
 
Hitchhikers guide to open stack toolchains
Hitchhikers guide to open stack toolchainsHitchhikers guide to open stack toolchains
Hitchhikers guide to open stack toolchainsstagr_lee
 
Inside Sqale's Backend at Sapporo Ruby Kaigi 2012
Inside Sqale's Backend at Sapporo Ruby Kaigi 2012Inside Sqale's Backend at Sapporo Ruby Kaigi 2012
Inside Sqale's Backend at Sapporo Ruby Kaigi 2012Gosuke Miyashita
 
Docker command
Docker commandDocker command
Docker commandEric Ahn
 
Docker deploy
Docker deployDocker deploy
Docker deployEric Ahn
 

What's hot (20)

Ansible as a better shell script
Ansible as a better shell scriptAnsible as a better shell script
Ansible as a better shell script
 
K8s上の containerized cloud foundryとcontainerized open stackをprometheusで監視してみる
K8s上の containerized cloud foundryとcontainerized open stackをprometheusで監視してみるK8s上の containerized cloud foundryとcontainerized open stackをprometheusで監視してみる
K8s上の containerized cloud foundryとcontainerized open stackをprometheusで監視してみる
 
HTTP/3 an early overview
HTTP/3 an early overviewHTTP/3 an early overview
HTTP/3 an early overview
 
DevStack
DevStackDevStack
DevStack
 
Just curl it!
Just curl it!Just curl it!
Just curl it!
 
FreeBSD Document Project
FreeBSD Document ProjectFreeBSD Document Project
FreeBSD Document Project
 
Automating Mendix application deployments with Nix
Automating Mendix application deployments with NixAutomating Mendix application deployments with Nix
Automating Mendix application deployments with Nix
 
DDEV - Extended
DDEV - ExtendedDDEV - Extended
DDEV - Extended
 
[2019.03] 멀티 노드에서 Hyperledger Fabric 네트워크 구성하기
[2019.03] 멀티 노드에서 Hyperledger Fabric 네트워크 구성하기[2019.03] 멀티 노드에서 Hyperledger Fabric 네트워크 구성하기
[2019.03] 멀티 노드에서 Hyperledger Fabric 네트워크 구성하기
 
Смарт-контракты: базовые инструменты для разработки и тестирования. Спикер: Д...
Смарт-контракты: базовые инструменты для разработки и тестирования. Спикер: Д...Смарт-контракты: базовые инструменты для разработки и тестирования. Спикер: Д...
Смарт-контракты: базовые инструменты для разработки и тестирования. Спикер: Д...
 
Vagrant
VagrantVagrant
Vagrant
 
My journey from PHP to Node.js
My journey from PHP to Node.jsMy journey from PHP to Node.js
My journey from PHP to Node.js
 
Frasco: Jekyll Starter Project
Frasco: Jekyll Starter ProjectFrasco: Jekyll Starter Project
Frasco: Jekyll Starter Project
 
DevOps for Opensource Geospatial Applications
DevOps for Opensource Geospatial ApplicationsDevOps for Opensource Geospatial Applications
DevOps for Opensource Geospatial Applications
 
Hyperledger Fabric v2.0: 새로운 기능
Hyperledger Fabric v2.0: 새로운 기능Hyperledger Fabric v2.0: 새로운 기능
Hyperledger Fabric v2.0: 새로운 기능
 
Hitchhikers guide to open stack toolchains
Hitchhikers guide to open stack toolchainsHitchhikers guide to open stack toolchains
Hitchhikers guide to open stack toolchains
 
Inside Sqale's Backend at Sapporo Ruby Kaigi 2012
Inside Sqale's Backend at Sapporo Ruby Kaigi 2012Inside Sqale's Backend at Sapporo Ruby Kaigi 2012
Inside Sqale's Backend at Sapporo Ruby Kaigi 2012
 
Docker practice
Docker practiceDocker practice
Docker practice
 
Docker command
Docker commandDocker command
Docker command
 
Docker deploy
Docker deployDocker deploy
Docker deploy
 

Similar to Groovy VFS

Usando o Cloud
Usando o CloudUsando o Cloud
Usando o CloudFabio Kung
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with CapistranoRamazan K
 
NAS Botnet Revealed - Mining Bitcoin
NAS Botnet Revealed - Mining Bitcoin NAS Botnet Revealed - Mining Bitcoin
NAS Botnet Revealed - Mining Bitcoin Davide Cioccia
 
2017-07-22 Common Workflow Language Viewer
2017-07-22 Common Workflow Language Viewer2017-07-22 Common Workflow Language Viewer
2017-07-22 Common Workflow Language ViewerStian Soiland-Reyes
 
Be ef presentation-securitybyte2011-michele_orru
Be ef presentation-securitybyte2011-michele_orruBe ef presentation-securitybyte2011-michele_orru
Be ef presentation-securitybyte2011-michele_orruMichele Orru
 
NetDevOps Developer Environments with Vagrant @ SCALE16x
NetDevOps Developer Environments with Vagrant @ SCALE16xNetDevOps Developer Environments with Vagrant @ SCALE16x
NetDevOps Developer Environments with Vagrant @ SCALE16xHank Preston
 
Automacao devops
Automacao devopsAutomacao devops
Automacao devopsFabio Kung
 
GroovyFX - Groove JavaFX
GroovyFX - Groove JavaFXGroovyFX - Groove JavaFX
GroovyFX - Groove JavaFXsascha_klein
 
Vagrant for real
Vagrant for realVagrant for real
Vagrant for realCodemotion
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Michele Orselli
 
Flutter for Webで値を保存する
Flutter for Webで値を保存するFlutter for Webで値を保存する
Flutter for Webで値を保存するshinya sakemoto
 
Deploying WP Multisite to Heroku
Deploying WP Multisite to HerokuDeploying WP Multisite to Heroku
Deploying WP Multisite to HerokuJussi Kinnula
 
Hacktivity2011 be ef-preso_micheleorru
Hacktivity2011 be ef-preso_micheleorruHacktivity2011 be ef-preso_micheleorru
Hacktivity2011 be ef-preso_micheleorruMichele Orru
 
Security of Go Modules and Vulnerability Scanning in GoCenter and VSCode
Security of Go Modules and Vulnerability Scanning in GoCenter and VSCodeSecurity of Go Modules and Vulnerability Scanning in GoCenter and VSCode
Security of Go Modules and Vulnerability Scanning in GoCenter and VSCodeDeep Datta
 
Security of Go Modules and Vulnerability Scanning in VSCode
Security of Go Modules and Vulnerability Scanning in VSCodeSecurity of Go Modules and Vulnerability Scanning in VSCode
Security of Go Modules and Vulnerability Scanning in VSCodeDeep Datta
 
New Security of Go modules and vulnerability scanning in GoCenter
New Security of Go modules and vulnerability scanning in GoCenterNew Security of Go modules and vulnerability scanning in GoCenter
New Security of Go modules and vulnerability scanning in GoCenterDeep Datta
 
Let's go HTTPS-only! - More Than Buying a Certificate
Let's go HTTPS-only! - More Than Buying a CertificateLet's go HTTPS-only! - More Than Buying a Certificate
Let's go HTTPS-only! - More Than Buying a CertificateSteffen Gebert
 
Workshop MSF4J - Getting Started with Microservices and Java
Workshop MSF4J - Getting Started with Microservices and JavaWorkshop MSF4J - Getting Started with Microservices and Java
Workshop MSF4J - Getting Started with Microservices and JavaEdgar Silva
 

Similar to Groovy VFS (20)

Usando o Cloud
Usando o CloudUsando o Cloud
Usando o Cloud
 
Control your deployments with Capistrano
Control your deployments with CapistranoControl your deployments with Capistrano
Control your deployments with Capistrano
 
NAS Botnet Revealed - Mining Bitcoin
NAS Botnet Revealed - Mining Bitcoin NAS Botnet Revealed - Mining Bitcoin
NAS Botnet Revealed - Mining Bitcoin
 
2017-07-22 Common Workflow Language Viewer
2017-07-22 Common Workflow Language Viewer2017-07-22 Common Workflow Language Viewer
2017-07-22 Common Workflow Language Viewer
 
Be ef presentation-securitybyte2011-michele_orru
Be ef presentation-securitybyte2011-michele_orruBe ef presentation-securitybyte2011-michele_orru
Be ef presentation-securitybyte2011-michele_orru
 
NetDevOps Developer Environments with Vagrant @ SCALE16x
NetDevOps Developer Environments with Vagrant @ SCALE16xNetDevOps Developer Environments with Vagrant @ SCALE16x
NetDevOps Developer Environments with Vagrant @ SCALE16x
 
Automacao devops
Automacao devopsAutomacao devops
Automacao devops
 
GroovyFX - Groove JavaFX
GroovyFX - Groove JavaFXGroovyFX - Groove JavaFX
GroovyFX - Groove JavaFX
 
Vagrant for real
Vagrant for realVagrant for real
Vagrant for real
 
Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)Vagrant for real (codemotion rome 2016)
Vagrant for real (codemotion rome 2016)
 
Flutter for Webで値を保存する
Flutter for Webで値を保存するFlutter for Webで値を保存する
Flutter for Webで値を保存する
 
Vagrant Up in 5 Easy Steps
Vagrant Up in 5 Easy StepsVagrant Up in 5 Easy Steps
Vagrant Up in 5 Easy Steps
 
Deploying WP Multisite to Heroku
Deploying WP Multisite to HerokuDeploying WP Multisite to Heroku
Deploying WP Multisite to Heroku
 
Hacktivity2011 be ef-preso_micheleorru
Hacktivity2011 be ef-preso_micheleorruHacktivity2011 be ef-preso_micheleorru
Hacktivity2011 be ef-preso_micheleorru
 
Security of Go Modules and Vulnerability Scanning in GoCenter and VSCode
Security of Go Modules and Vulnerability Scanning in GoCenter and VSCodeSecurity of Go Modules and Vulnerability Scanning in GoCenter and VSCode
Security of Go Modules and Vulnerability Scanning in GoCenter and VSCode
 
Vagrant
VagrantVagrant
Vagrant
 
Security of Go Modules and Vulnerability Scanning in VSCode
Security of Go Modules and Vulnerability Scanning in VSCodeSecurity of Go Modules and Vulnerability Scanning in VSCode
Security of Go Modules and Vulnerability Scanning in VSCode
 
New Security of Go modules and vulnerability scanning in GoCenter
New Security of Go modules and vulnerability scanning in GoCenterNew Security of Go modules and vulnerability scanning in GoCenter
New Security of Go modules and vulnerability scanning in GoCenter
 
Let's go HTTPS-only! - More Than Buying a Certificate
Let's go HTTPS-only! - More Than Buying a CertificateLet's go HTTPS-only! - More Than Buying a Certificate
Let's go HTTPS-only! - More Than Buying a Certificate
 
Workshop MSF4J - Getting Started with Microservices and Java
Workshop MSF4J - Getting Started with Microservices and JavaWorkshop MSF4J - Getting Started with Microservices and Java
Workshop MSF4J - Getting Started with Microservices and Java
 

More from Schalk Cronjé

DocuOps & Asciidoctor in a JVM World
DocuOps & Asciidoctor in a JVM WorldDocuOps & Asciidoctor in a JVM World
DocuOps & Asciidoctor in a JVM WorldSchalk Cronjé
 
What's new in Asciidoctor
What's new in AsciidoctorWhat's new in Asciidoctor
What's new in AsciidoctorSchalk Cronjé
 
Probability Management
Probability ManagementProbability Management
Probability ManagementSchalk Cronjé
 
Seeking Enligtenment - A journey of purpose rather than instruction
Seeking Enligtenment  - A journey of purpose rather than instructionSeeking Enligtenment  - A journey of purpose rather than instruction
Seeking Enligtenment - A journey of purpose rather than instructionSchalk Cronjé
 
Idiomatic Gradle Plugin Writing - GradleSummit 2016
Idiomatic Gradle Plugin Writing - GradleSummit 2016Idiomatic Gradle Plugin Writing - GradleSummit 2016
Idiomatic Gradle Plugin Writing - GradleSummit 2016Schalk Cronjé
 
Gradle in 45min - JBCN2-16 version
Gradle in 45min - JBCN2-16 versionGradle in 45min - JBCN2-16 version
Gradle in 45min - JBCN2-16 versionSchalk Cronjé
 
Cool Jvm Tools to Help you Test - Aylesbury Testers Version
Cool Jvm Tools to Help you Test - Aylesbury Testers VersionCool Jvm Tools to Help you Test - Aylesbury Testers Version
Cool Jvm Tools to Help you Test - Aylesbury Testers VersionSchalk Cronjé
 
Cool JVM Tools to Help You Test
Cool JVM Tools to Help You TestCool JVM Tools to Help You Test
Cool JVM Tools to Help You TestSchalk Cronjé
 
Using the Groovy Ecosystem for Rapid JVM Development
Using the Groovy Ecosystem for Rapid JVM DevelopmentUsing the Groovy Ecosystem for Rapid JVM Development
Using the Groovy Ecosystem for Rapid JVM DevelopmentSchalk Cronjé
 
Basic Gradle Plugin Writing
Basic Gradle Plugin WritingBasic Gradle Plugin Writing
Basic Gradle Plugin WritingSchalk Cronjé
 
Seeking Enligtenment - A journey of purpose rather tan instruction
Seeking Enligtenment - A journey of purpose rather tan instructionSeeking Enligtenment - A journey of purpose rather tan instruction
Seeking Enligtenment - A journey of purpose rather tan instructionSchalk Cronjé
 
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingIdiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingSchalk Cronjé
 
Beyond Estimates - Probability Management
Beyond Estimates - Probability ManagementBeyond Estimates - Probability Management
Beyond Estimates - Probability ManagementSchalk Cronjé
 
Documentation An Engineering Problem Unsolved
Documentation  An Engineering Problem UnsolvedDocumentation  An Engineering Problem Unsolved
Documentation An Engineering Problem UnsolvedSchalk Cronjé
 
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingIdiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingSchalk Cronjé
 
Gradle in a Polyglot World
Gradle in a Polyglot WorldGradle in a Polyglot World
Gradle in a Polyglot WorldSchalk Cronjé
 
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingIdiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingSchalk Cronjé
 
Death of Agile : Welcome to Value-focused Testing
Death of Agile : Welcome to Value-focused TestingDeath of Agile : Welcome to Value-focused Testing
Death of Agile : Welcome to Value-focused TestingSchalk Cronjé
 

More from Schalk Cronjé (20)

DocuOps & Asciidoctor in a JVM World
DocuOps & Asciidoctor in a JVM WorldDocuOps & Asciidoctor in a JVM World
DocuOps & Asciidoctor in a JVM World
 
DocuOps & Asciidoctor
DocuOps & AsciidoctorDocuOps & Asciidoctor
DocuOps & Asciidoctor
 
What's new in Asciidoctor
What's new in AsciidoctorWhat's new in Asciidoctor
What's new in Asciidoctor
 
Probability Management
Probability ManagementProbability Management
Probability Management
 
Seeking Enligtenment - A journey of purpose rather than instruction
Seeking Enligtenment  - A journey of purpose rather than instructionSeeking Enligtenment  - A journey of purpose rather than instruction
Seeking Enligtenment - A journey of purpose rather than instruction
 
Idiomatic Gradle Plugin Writing - GradleSummit 2016
Idiomatic Gradle Plugin Writing - GradleSummit 2016Idiomatic Gradle Plugin Writing - GradleSummit 2016
Idiomatic Gradle Plugin Writing - GradleSummit 2016
 
Gradle in 45min - JBCN2-16 version
Gradle in 45min - JBCN2-16 versionGradle in 45min - JBCN2-16 version
Gradle in 45min - JBCN2-16 version
 
Cool Jvm Tools to Help you Test - Aylesbury Testers Version
Cool Jvm Tools to Help you Test - Aylesbury Testers VersionCool Jvm Tools to Help you Test - Aylesbury Testers Version
Cool Jvm Tools to Help you Test - Aylesbury Testers Version
 
Cool JVM Tools to Help You Test
Cool JVM Tools to Help You TestCool JVM Tools to Help You Test
Cool JVM Tools to Help You Test
 
Using the Groovy Ecosystem for Rapid JVM Development
Using the Groovy Ecosystem for Rapid JVM DevelopmentUsing the Groovy Ecosystem for Rapid JVM Development
Using the Groovy Ecosystem for Rapid JVM Development
 
Gradle in 45min
Gradle in 45minGradle in 45min
Gradle in 45min
 
Basic Gradle Plugin Writing
Basic Gradle Plugin WritingBasic Gradle Plugin Writing
Basic Gradle Plugin Writing
 
Seeking Enligtenment - A journey of purpose rather tan instruction
Seeking Enligtenment - A journey of purpose rather tan instructionSeeking Enligtenment - A journey of purpose rather tan instruction
Seeking Enligtenment - A journey of purpose rather tan instruction
 
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingIdiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin Writing
 
Beyond Estimates - Probability Management
Beyond Estimates - Probability ManagementBeyond Estimates - Probability Management
Beyond Estimates - Probability Management
 
Documentation An Engineering Problem Unsolved
Documentation  An Engineering Problem UnsolvedDocumentation  An Engineering Problem Unsolved
Documentation An Engineering Problem Unsolved
 
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingIdiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin Writing
 
Gradle in a Polyglot World
Gradle in a Polyglot WorldGradle in a Polyglot World
Gradle in a Polyglot World
 
Idiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin WritingIdiomatic Gradle Plugin Writing
Idiomatic Gradle Plugin Writing
 
Death of Agile : Welcome to Value-focused Testing
Death of Agile : Welcome to Value-focused TestingDeath of Agile : Welcome to Value-focused Testing
Death of Agile : Welcome to Value-focused Testing
 

Recently uploaded

SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 

Recently uploaded (20)

SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 

Groovy VFS

  • 1. © Schalk W. Cronjé Greach 2014 Groovy VFS Schalk W. Cronjé @ysb33r
  • 2. © Schalk W. Cronjé Greach 2014 Quickstart def vfs = new VFS() vfs { cp “http://from.here/a.txt”, “sftp://to.there/b.txt” }
  • 3. © Schalk W. Cronjé Greach 2014 Groovy VFS Current version: 0.5 Source: http://github.com/ysb33r/groovy-vfs Wiki: https://github.com/ysb33r/groovy-vfs/wiki Packages: https://bintray.com/ysb33r/grysb33r/groovy-vfs Gradle Packages: https://bintray.com/ysb33r/grysb33r/vfs-gradle-plugin License: Apache 2.0 Twitter: #groovyvfs
  • 4. © Schalk W. Cronjé Greach 2014 Bootstrap @Grapes([ @Grab( 'org.ysb33r.groovy:groovy-vfs:0.5' ), // If you wantftp @Grab( 'commons-net:commons-net:3.+' ), // If you want http/https @Grab( 'commons-httpclient:commons-httpclient:3.1'), // If you want sftp @Grab( 'com.jcraft:jsch:0.1.48' ) ]) import org.ysb33r.groovy.dsl.vfs.VFS
  • 5. © Schalk W. Cronjé Greach 2014 Create directory on remote server vfs { mkdir “ftp://a.server/pub/ysb33r” }
  • 6. © Schalk W. Cronjé Greach 2014 Directory Listing vfs { ls (“ftp://www.mirrorservice.org/sites”) { println it.name } }
  • 7. © Schalk W. Cronjé Greach 2014 Set Schema Options vfs { options { ftp { passiveMode true userDirIsRoot false } } }
  • 8. © Schalk W. Cronjé Greach 2014 Modify Schema Option per Request vfs { ls (“ftp://www.mirrorservice.org/sites?vfs.ftp.passiveMode=1”) { println it.name } } 220 Service ready for new user. USER guest 331 User name okay, need password for guest. PASS guest 230 User logged in, proceed. TYPE I 200 Command TYPE okay. CWD / 250 Directory changed to / SYST 215 UNIX Type: Apache FtpServer PASV 227 Entering Passive Mode (127,0,0,1,226,247) LIST 150 File status okay; about to open data connection. 226 Closing data connection.
  • 9. © Schalk W. Cronjé Greach 2014 Set Schema Options at Initialisation def vfs = new VFS ( 'vfs.ftp.passiveMode' : true, 'vfs.http.maxTotalConnections' : 4 )
  • 10. © Schalk W. Cronjé Greach 2014 Schema Options - Most Apache VFS filesystem options supported - Follows Groovy property-over-setter/getter convention Documentation: https://github.com/ysb33r/groovy-vfs/wiki/Protocol-Options
  • 11. © Schalk W. Cronjé Greach 2014 Copying & Moving vfs { cp “http://a.server/myFile.txt”, “file:///home/scronje/MyFile.downloaded.txt” mv “ftp://that.server/myFile.txt”, “sftp://this.server/in-this-folder&vfs.sftp.userDirIsRoot= }
  • 12. © Schalk W. Cronjé Greach 2014 Copy DSL vfs { cp from_url, to_url, overwrite : false, smash : false, recursive : false, filter : defaults_to_selecting_everything } Documentation: https://github.com/ysb33r/groovy-vfs/wiki/VFS-Copy-Behaviour
  • 13. © Schalk W. Cronjé Greach 2014 Interactive Copy vfs { cp from_url, to_url, overwrite : { from,to -> println “Overwrite ${to}?” System.in.readLine().startsWith('Y') } }
  • 14. © Schalk W. Cronjé Greach 2014 Move DSL vfs { mv from_url, to_url, overwrite : false, smash : false, intermediates : true, } Documentation: https://github.com/ysb33r/groovy-vfs/wiki/VFS-Move-Behaviour
  • 15. © Schalk W. Cronjé Greach 2014 Download & Unpack vfs { cp “zip:ftp://a.server/with-archive.zip”, “file:///home/scronje/unpacked” } Warning: Large archives will cause slow-down due to performance bug in Apache VFS
  • 16. © Schalk W. Cronjé Greach 2014 Working with Content import java.security.MessageDigest vfs { MessageDigest md5 = MessageDigest.getInstance("MD5") cat (“ftp://a.server/my-file.txt”) { strm → strm.eachByte(8192) { buffer, nbytes -> md5.update( buffer, 0, nbytes ) } } println md5.digest().encodeHex().toString() .padLeft( 32, '0' ) } // From a conversation on groovy-user ML
  • 17. © Schalk W. Cronjé Greach 2014 Local Files - Prefix with 'file://' - Use java.io.File instance - Use org.apache.commons.vfs2.FileObject instance vfs { cp new File(“a.txt”), “ftp://to.server/pub” }
  • 18. © Schalk W. Cronjé Greach 2014 Authentication vfs { // clear password cp new File(“a.txt”), “ftp://${username}:${password}@to.server/pub” // password encrypted with org.apache.commons.vfs2.util.EncryptUtil cp new File('b.txt'), 'ftp://testuser:{D7B82198B272F5C93790FEB38A73C7B8}@to.server/pub' } Warning: User with caution (security …) Enhancement: ISSUE-17 to provide better authentication DSL support
  • 19. © Schalk W. Cronjé Greach 2014 Future Ideas For Investigation ● Java 7 NIO – java.nio.file.* – Wait for Apache VFS or go native Groovy? ● Direct SMB support? – Apache VFS Sandbox – jCIFS license is LGPL
  • 20. © Schalk W. Cronjé Greach 2014 VFS Gradle Plugin (experimental / incubating)
  • 21. © Schalk W. Cronjé Greach 2014 Bootstrap buildscript { repositories { jcenter() } dependencies { classpath 'org.ysb33r.gradle:vfs-gradle-plugin:0.5' classpath 'commons-net:commons-net:3.+' // ftp classpath 'commons-httpclient:commons-httpclient:3.1' // http/https classpath 'com.jcraft:jsch:0.1.48' // sftp } } apply plugin : 'vfs'
  • 22. © Schalk W. Cronjé Greach 2014 Available as Project Extension task ftpCopy << { vfs { cp “ftp://a.server/file.txt”, buildDir } }
  • 23. © Schalk W. Cronjé Greach 2014 Future Ideas For Investigation ● vfsTree – Akin toproject.tarTree – Is it even possible to createFileTree? ● Vfs Copy / Move Task – How to define @Input etc. correctly
  • 24. © Schalk W. Cronjé Greach 2014 Other Plugins ? ● Grails & Griffon – No plugin (yet) ● Jenkins – Time to consolidate various protocol plugins Who wants to write one?
  • 25. © Schalk W. Cronjé Greach 2014 Groovy VFS #groovyvfs Schalk W. Cronjé @ysb33r http://github.com/ysb33r/groovy-vfs