mirror of https://github.com/apache/jclouds.git
made demo more readable
git-svn-id: http://jclouds.googlecode.com/svn/trunk@2590 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
e14135e535
commit
ada30747ea
|
@ -109,16 +109,22 @@ class ShrinkBlob < Task
|
||||||
end
|
end
|
||||||
|
|
||||||
def execute
|
def execute
|
||||||
# correct the classloader so that extensions can be found
|
# correct the ant classloader so that extensions can be found
|
||||||
java.lang.Thread.currentThread().setContextClassLoader(ServiceExtensionLoader.new().getClass().getClassLoader())
|
java.lang.Thread.currentThread().setContextClassLoader(ServiceExtensionLoader.new().getClass().getClassLoader())
|
||||||
|
|
||||||
print "creating the archive from ",@dir,"\n"
|
print "creating the archive from ",@dir,"\n"
|
||||||
zipStream = Archives.create(@zip, ZipExporter.java_class).as(ExplodedImporter.java_class).importDirectory(@dir).as(ZipExporter.java_class).exportZip()
|
zipStream = Archives.create(@zip, ZipExporter.java_class).as(ExplodedImporter.java_class).importDirectory(@dir).as(ZipExporter.java_class).exportZip()
|
||||||
|
|
||||||
destination = HttpUtils.createUri(@blobstore)
|
destination = HttpUtils.createUri(@blobstore)
|
||||||
print "connecting to service ",destination.getHost(),"/",@container,"\n"
|
print "connecting to service ",destination.getHost(),"/",@container,"\n"
|
||||||
|
|
||||||
|
# array thing is a weird hack since jruby doesn't understand varargs
|
||||||
context = BlobStoreContextFactory.new().createContext(destination, java.lang.reflect.Array.newInstance(com.google.inject.Module.java_class,0))
|
context = BlobStoreContextFactory.new().createContext(destination, java.lang.reflect.Array.newInstance(com.google.inject.Module.java_class,0))
|
||||||
context.getBlobStore().createContainer(@container)
|
context.getBlobStore().createContainer(@container)
|
||||||
|
|
||||||
print "uploading to ",destination.getHost(),"/",@container,"/",@zip,"\n"
|
print "uploading to ",destination.getHost(),"/",@container,"/",@zip,"\n"
|
||||||
context.createInputStreamMap(@container).put(@zip,zipStream);
|
context.createInputStreamMap(@container).put(@zip,zipStream);
|
||||||
|
|
||||||
context.close();
|
context.close();
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue