Issue 897: moved clojure off Factory -> Builder

This commit is contained in:
Adrian Cole 2012-04-12 17:07:13 -06:00
parent 2c4f9c23d4
commit c56c2d2f72
2 changed files with 16 additions and 16 deletions

View File

@ -26,7 +26,7 @@ Current supported services are:
eucalyptus-partnercloud-s3, cloudfiles-us, cloudfiles-uk, swift,
scality-rs2, hosteurope-storage, tiscali-storage]
Here's a quick example of how to viewresources in rackspace
Here's a quick example of how to view resources in rackspace
(use 'org.jclouds.blobstore2)
@ -46,7 +46,7 @@ See http://code.google.com/p/jclouds for details."
java.util.Properties
[org.jclouds.blobstore
AsyncBlobStore domain.BlobBuilder BlobStore BlobStoreContext
BlobStoreContextFactory domain.BlobMetadata domain.StorageMetadata
BlobStoreContextBuilder domain.BlobMetadata domain.StorageMetadata
domain.Blob domain.internal.BlobBuilderImpl options.PutOptions
options.PutOptions$Builder
options.CreateContainerOptions options.ListContainerOptions]
@ -112,13 +112,12 @@ Options can also be specified for extension modules
(let [module-keys (set (keys module-lookup))
ext-modules (filter #(module-keys %) options)
opts (apply hash-map (filter #(not (module-keys %)) options))]
(let [context (.. (BlobStoreContextFactory.)
(createContext
provider provider-identity provider-credential
(apply modules
(concat ext-modules (opts :extensions)))
(reduce #(do (.put %1 (name (first %2)) (second %2)) %1)
(Properties.) (dissoc opts :extensions))))]
(let [context (.. (BlobStoreContextBuilder/newBuilder provider)
(credentials provider-identity provider-credential)
(modules (apply modules (concat ext-modules (opts :extensions))))
(overrides (reduce #(do (.put %1 (name (first %2)) (second %2)) %1)
(Properties.) (dissoc opts :extensions)))
(build))]
(if (some #(= :async %) options)
(.getAsyncBlobStore context)
(.getBlobStore context)))))

View File

@ -29,6 +29,7 @@
You can inquire about which providers are loaded via the following:
(seq (org.jclouds.providers.Providers/allCompute))
(seq (org.jclouds.apis.Apis/allCompute))
Here's an example of getting some compute configuration from rackspace:
@ -65,7 +66,7 @@ Here's an example of creating and running a small linux node in the group webser
java.util.Properties
[org.jclouds.domain Location]
[org.jclouds.compute
ComputeService ComputeServiceContext ComputeServiceContextFactory]
ComputeService ComputeServiceContext ComputeServiceContextBuilder]
[org.jclouds.compute.domain
Template TemplateBuilder ComputeMetadata NodeMetadata Hardware
OsFamily Image]
@ -83,12 +84,12 @@ Here's an example of creating and running a small linux node in the group webser
(let [module-keys (set (keys module-lookup))
ext-modules (filter #(module-keys %) options)
opts (apply hash-map (filter #(not (module-keys %)) options))]
(.. (ComputeServiceContextFactory.)
(createContext
provider provider-identity provider-credential
(apply modules (concat ext-modules (opts :extensions)))
(reduce #(do (.put %1 (name (first %2)) (second %2)) %1)
(.. (ComputeServiceContextBuilder/newBuilder provider)
(credentials provider-identity provider-credential)
(modules (apply modules (concat ext-modules (opts :extensions))))
(overrides (reduce #(do (.put %1 (name (first %2)) (second %2)) %1)
(Properties.) (dissoc opts :extensions)))
(build)
(getComputeService))))
([#^ComputeServiceContext compute-context]
(.getComputeService compute-context)))