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

View File

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