Created
April 1, 2014 15:50
-
-
Save ysb33r/9916940 to your computer and use it in GitHub Desktop.
How the plugin extension DSL will look like for Groovy VFS. No need to struggle with Apachae VFS vfs-provider.xml files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.ysb33r.groovy.dsl.vfs.VFS | |
def vfs = new VFS() | |
// --------------------------------- | |
// Adding new providers with schemes | |
// --------------------------------- | |
vfs { | |
extend { | |
// Adding provider with no external dependencies | |
// (className must be on classpath) | |
provider className : 'org.apache.commons.vfs2.provider.gzip.GzipFileProvider',schemes : ['gz'] | |
// Adding provider that also relies on other libraries | |
// (className and dependsOnClasses must be on classpath) | |
provider className : 'org.apache.commons.vfs2.provider.tar.TarFileProvider', | |
schemes : ['tar'], | |
dependsOnClasses : ['org.apache.commons.vfs2.provider.tar.TarInputStream'] | |
// Adding provider that requires other providers to already be in place | |
// (className must be on classpath) | |
provider className : 'org.apache.commons.vfs2.provider.tar.TarFileProvider', | |
schemes : ['tgz'], | |
dependsOnSchemes : ['tar','gz'] | |
} | |
} | |
// -------------------------------------- | |
// Adding operation providers for schemes | |
// -------------------------------------- | |
vfs { | |
extend { | |
operationProvider className : "acl.AclOperationsProvider", | |
schemes : ["s3","aws"] | |
} | |
} | |
// -------------------------------------- | |
// Adding maps | |
// -------------------------------------- | |
vfs { | |
extend { | |
// Adding a MIME Type mapping | |
// Second parameter is te scheme | |
mimeType 'application/zip', 'zip' | |
// Adding a file extension mapping | |
// Second parameter is the scheme | |
ext 'gzip', 'gz' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment