From 96ff7d137a1ad8e4d6f3fe255aed747c6a7af400 Mon Sep 17 00:00:00 2001 From: Jeremy Daggett Date: Wed, 25 Jan 2012 08:10:09 -0800 Subject: [PATCH 1/8] Added HP CDN support back --- .../objectstorage/lvs/CDNManagement.java | 40 ++++++++++ ...CloudObjectStorageLasVegasAsyncClient.java | 79 +++++++++++++++++++ .../HPCloudObjectStorageLasVegasClient.java | 23 ++++++ .../functions/EnableCDNAndCache.java | 53 +++++++++++++ .../functions/PublicUriForObjectInfo.java | 63 +++++++++++++++ .../lvs/functions/ParseCDNUriFromHeaders.java | 46 +++++++++++ .../ParseContainerCDNMetadataFromHeaders.java | 74 +++++++++++++++++ 7 files changed, 378 insertions(+) create mode 100644 providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/CDNManagement.java create mode 100644 providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/functions/EnableCDNAndCache.java create mode 100644 providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/functions/PublicUriForObjectInfo.java create mode 100644 providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/functions/ParseCDNUriFromHeaders.java create mode 100644 providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/functions/ParseContainerCDNMetadataFromHeaders.java diff --git a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/CDNManagement.java b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/CDNManagement.java new file mode 100644 index 0000000000..b4b544fc62 --- /dev/null +++ b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/CDNManagement.java @@ -0,0 +1,40 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jclouds.hpcloud.objectstorage.lvs; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import javax.inject.Qualifier; + +/** + * Represents a component related to HP Cloud Services Content Delivery Network. + * + * @see HP Cloud Object Storage API + * @author Jeremy Daggett + * + */ +@Retention(value = RetentionPolicy.RUNTIME) +@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) +@Qualifier +public @interface CDNManagement { + +} \ No newline at end of file diff --git a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasAsyncClient.java b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasAsyncClient.java index a31addcc3d..9956b05b64 100644 --- a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasAsyncClient.java +++ b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasAsyncClient.java @@ -18,22 +18,36 @@ */ package org.jclouds.hpcloud.objectstorage.lvs; +import java.net.URI; +import java.util.Set; import java.util.concurrent.ExecutionException; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; import javax.ws.rs.HEAD; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; +import javax.ws.rs.core.MediaType; import org.jclouds.blobstore.functions.ReturnNullOnContainerNotFound; +import org.jclouds.hpcloud.objectstorage.lvs.domain.ContainerCDNMetadata; +import org.jclouds.hpcloud.objectstorage.lvs.functions.ParseCDNUriFromHeaders; +import org.jclouds.hpcloud.objectstorage.lvs.functions.ParseContainerCDNMetadataFromHeaders; import org.jclouds.hpcloud.objectstorage.lvs.functions.ParseContainerMetadataFromHeaders; import org.jclouds.hpcloud.objectstorage.lvs.options.CreateContainerOptions; +import org.jclouds.hpcloud.objectstorage.lvs.options.ListCDNContainerOptions; +import org.jclouds.hpcloud.objectstorage.lvs.reference.HPCloudObjectStorageLasVegasHeaders; import org.jclouds.openstack.filters.AuthenticateRequest; import org.jclouds.openstack.swift.CommonSwiftAsyncClient; import org.jclouds.openstack.swift.Storage; import org.jclouds.openstack.swift.domain.ContainerMetadata; import org.jclouds.rest.annotations.Endpoint; import org.jclouds.rest.annotations.ExceptionParser; +import org.jclouds.rest.annotations.Headers; +import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.ResponseParser; import org.jclouds.rest.annotations.SkipEncoding; @@ -75,5 +89,70 @@ public interface HPCloudObjectStorageLasVegasAsyncClient extends CommonSwiftAsyn ListenableFuture createContainer(@PathParam("container") String container, CreateContainerOptions... options); + /** + * @see HPCloudObjectStorageClient#listCDNContainers(ListCDNContainerOptions) + */ + @Beta + @GET + @Consumes(MediaType.APPLICATION_JSON) + @QueryParams(keys = "format", values = "json") + @Path("/") + @Endpoint(CDNManagement.class) + ListenableFuture> listCDNContainers(ListCDNContainerOptions... options); + + /** + * @see HPCloudObjectStorageClient#getCDNMetadata(String) + */ + @Beta + @HEAD + @ResponseParser(ParseContainerCDNMetadataFromHeaders.class) + @ExceptionParser(ReturnNullOnContainerNotFound.class) + @Path("/{container}") + @Endpoint(CDNManagement.class) + ListenableFuture getCDNMetadata(@PathParam("container") String container); + + /** + * @see HPCloudObjectStorageClient#enableCDN(String, long) + */ + @Beta + @PUT + @Path("/{container}") + @Headers(keys = HPCloudObjectStorageLasVegasHeaders.CDN_ENABLED, values = "True") + @ResponseParser(ParseCDNUriFromHeaders.class) + @Endpoint(CDNManagement.class) + ListenableFuture enableCDN(@PathParam("container") String container, + @HeaderParam(HPCloudObjectStorageLasVegasHeaders.CDN_TTL) long ttl); + + /** + * @see HPCloudObjectStorageClient#enableCDN(String) + */ + @Beta + @PUT + @Path("/{container}") + @Headers(keys = HPCloudObjectStorageLasVegasHeaders.CDN_ENABLED, values = "True") + @ResponseParser(ParseCDNUriFromHeaders.class) + @Endpoint(CDNManagement.class) + ListenableFuture enableCDN(@PathParam("container") String container); + + /** + * @see HPCloudObjectStorageClient#updateCDN(String, long) + */ + @Beta + @POST + @Path("/{container}") + @ResponseParser(ParseCDNUriFromHeaders.class) + @Endpoint(CDNManagement.class) + ListenableFuture updateCDN(@PathParam("container") String container, + @HeaderParam(HPCloudObjectStorageLasVegasHeaders.CDN_TTL) long ttl); + + /** + * @see HPCloudObjectStorageClient#disableCDN(String) + */ + @Beta + @PUT + @Path("/{container}") + @Headers(keys = HPCloudObjectStorageLasVegasHeaders.CDN_ENABLED, values = "False") + @Endpoint(CDNManagement.class) + ListenableFuture disableCDN(@PathParam("container") String container); } diff --git a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasClient.java b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasClient.java index a9305e9797..30469b1c6f 100644 --- a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasClient.java +++ b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasClient.java @@ -18,14 +18,19 @@ */ package org.jclouds.hpcloud.objectstorage.lvs; +import java.net.URI; +import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import org.jclouds.concurrent.Timeout; +import org.jclouds.hpcloud.objectstorage.lvs.domain.ContainerCDNMetadata; import org.jclouds.hpcloud.objectstorage.lvs.options.CreateContainerOptions; +import org.jclouds.hpcloud.objectstorage.lvs.options.ListCDNContainerOptions; import org.jclouds.openstack.swift.CommonSwiftClient; import org.jclouds.openstack.swift.domain.ContainerMetadata; +import com.google.common.annotations.Beta; import com.google.common.util.concurrent.ListenableFuture; /** @@ -47,4 +52,22 @@ public interface HPCloudObjectStorageLasVegasClient extends CommonSwiftClient { ContainerMetadata getContainerMetadata(String container); + @Beta + Set listCDNContainers(ListCDNContainerOptions... options); + + @Beta + ContainerCDNMetadata getCDNMetadata(String container); + + @Beta + URI enableCDN(String container, long ttl); + + @Beta + URI enableCDN(String container); + + @Beta + URI updateCDN(String container, long ttl); + + @Beta + boolean disableCDN(String container); + } diff --git a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/functions/EnableCDNAndCache.java b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/functions/EnableCDNAndCache.java new file mode 100644 index 0000000000..f76512103a --- /dev/null +++ b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/functions/EnableCDNAndCache.java @@ -0,0 +1,53 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jclouds.hpcloud.objectstorage.lvs.blobstore.functions; + +import java.net.URI; + +import javax.inject.Inject; +import javax.inject.Singleton; + +import org.jclouds.hpcloud.objectstorage.lvs.HPCloudObjectStorageLasVegasClient; + +import com.google.common.base.Function; +import com.google.common.cache.LoadingCache; + +/** + * + * @author Adrian Cole + */ +@Singleton +public class EnableCDNAndCache implements Function { + private final LoadingCache cdnContainer; + private final HPCloudObjectStorageLasVegasClient sync; + + @Inject + public EnableCDNAndCache(HPCloudObjectStorageLasVegasClient sync, LoadingCache cdnContainer) { + this.sync = sync; + this.cdnContainer = cdnContainer; + } + + @Override + public URI apply(String input) { + URI uri = sync.enableCDN(input); + cdnContainer.put(input, uri); + return uri; + } + +} \ No newline at end of file diff --git a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/functions/PublicUriForObjectInfo.java b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/functions/PublicUriForObjectInfo.java new file mode 100644 index 0000000000..f0091fc91c --- /dev/null +++ b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/functions/PublicUriForObjectInfo.java @@ -0,0 +1,63 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jclouds.hpcloud.objectstorage.lvs.blobstore.functions; + +import java.net.URI; + +import javax.inject.Inject; +import javax.inject.Provider; +import javax.inject.Singleton; +import javax.ws.rs.core.UriBuilder; + +import org.jclouds.openstack.swift.domain.ObjectInfo; + +import com.google.common.base.Function; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; + +/** + * @author Adrian Cole + */ +@Singleton +public class PublicUriForObjectInfo implements Function { + private final LoadingCache cdnContainer; + private final Provider uriBuilders; + + @Inject + public PublicUriForObjectInfo(LoadingCache cdnContainer, Provider uriBuilders) { + this.cdnContainer = cdnContainer; + this.uriBuilders = uriBuilders; + } + + public URI apply(ObjectInfo from) { + if (from == null) + return null; + try { + return uriBuilders.get().uri(cdnContainer.getUnchecked(from.getContainer())).path(from.getName()).replaceQuery("") + .build(); + } catch (CacheLoader.InvalidCacheLoadException e) { + // nulls not permitted from cache loader + return null; + } catch (NullPointerException e) { + // nulls not permitted from cache loader + // TODO this shouldn't occur when the above exception is reliably presented + return null; + } + } +} \ No newline at end of file diff --git a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/functions/ParseCDNUriFromHeaders.java b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/functions/ParseCDNUriFromHeaders.java new file mode 100644 index 0000000000..062744036a --- /dev/null +++ b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/functions/ParseCDNUriFromHeaders.java @@ -0,0 +1,46 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jclouds.hpcloud.objectstorage.lvs.functions; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.net.URI; + +import org.jclouds.hpcloud.objectstorage.lvs.reference.HPCloudObjectStorageLasVegasHeaders; +import org.jclouds.http.HttpResponse; +import org.jclouds.openstack.swift.domain.AccountMetadata; + +import com.google.common.base.Function; + +/** + * This parses {@link AccountMetadata} from HTTP headers. + * + * @author James Murty + */ +public class ParseCDNUriFromHeaders implements Function { + + /** + * parses the http response headers to provide the CDN URI string. + */ + public URI apply(final HttpResponse from) { + String cdnUri = checkNotNull(from.getFirstHeaderOrNull(HPCloudObjectStorageLasVegasHeaders.CDN_URI), + HPCloudObjectStorageLasVegasHeaders.CDN_URI); + return URI.create(cdnUri); + } +} \ No newline at end of file diff --git a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/functions/ParseContainerCDNMetadataFromHeaders.java b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/functions/ParseContainerCDNMetadataFromHeaders.java new file mode 100644 index 0000000000..f18a96729f --- /dev/null +++ b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/functions/ParseContainerCDNMetadataFromHeaders.java @@ -0,0 +1,74 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jclouds.hpcloud.objectstorage.lvs.functions; + +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.collect.Lists.newArrayList; + +import java.net.URI; +import java.util.List; + +import org.jclouds.hpcloud.objectstorage.lvs.domain.ContainerCDNMetadata; +import org.jclouds.hpcloud.objectstorage.lvs.reference.HPCloudObjectStorageLasVegasHeaders; +import org.jclouds.http.HttpRequest; +import org.jclouds.http.HttpResponse; +import org.jclouds.openstack.swift.domain.AccountMetadata; +import org.jclouds.rest.InvocationContext; + +import com.google.common.base.Function; +import com.google.common.base.Splitter; + +/** + * This parses {@link AccountMetadata} from HTTP headers. + * + * @author James Murty + */ +public class ParseContainerCDNMetadataFromHeaders implements + Function, InvocationContext { + + private HttpRequest request; + + /** + * parses the http response headers to create a new {@link ContainerCDNMetadata} object. + */ + public ContainerCDNMetadata apply(final HttpResponse from) { + String cdnUri = checkNotNull(from.getFirstHeaderOrNull(HPCloudObjectStorageLasVegasHeaders.CDN_URI), + HPCloudObjectStorageLasVegasHeaders.CDN_URI); + String cdnTTL = checkNotNull(from.getFirstHeaderOrNull(HPCloudObjectStorageLasVegasHeaders.CDN_TTL), + HPCloudObjectStorageLasVegasHeaders.CDN_TTL); + String cdnEnabled = checkNotNull(from.getFirstHeaderOrNull(HPCloudObjectStorageLasVegasHeaders.CDN_ENABLED), + HPCloudObjectStorageLasVegasHeaders.CDN_ENABLED); + if (cdnUri == null) { + // CDN is not enabled for this container. + return null; + } else { + // just need the name from the path + List parts = newArrayList(Splitter.on('/').split(request.getEndpoint().getPath())); + + return new ContainerCDNMetadata(parts.get(parts.size()-1), Boolean + .parseBoolean(cdnEnabled), Long.parseLong(cdnTTL), URI.create(cdnUri)); + } + } + + @Override + public ParseContainerCDNMetadataFromHeaders setContext(HttpRequest request) { + this.request = request; + return this; + } +} \ No newline at end of file From 4241c9239a433cdd4c2684d49dc7413bb1fb7f38 Mon Sep 17 00:00:00 2001 From: Jeremy Daggett Date: Wed, 25 Jan 2012 08:13:21 -0800 Subject: [PATCH 2/8] Additional CDN changes --- ...bjectStorageLasVegasPropertiesBuilder.java | 8 ++ ...udObjectStorageLasVegasAsyncBlobStore.java | 28 ++++- ...HPCloudObjectStorageLasVegasBlobStore.java | 19 +++- ...StorageLasVegasBlobStoreContextModule.java | 55 ++++++++++ ...ctStorageLasVegasObjectToBlobMetadata.java | 9 +- ...ObjectStorageLasVegasRestClientModule.java | 19 ++++ ...HPCloudObjectStorageLasVegasConstants.java | 5 +- .../HPCloudObjectStorageLasVegasHeaders.java | 7 ++ ...udObjectStorageLasVegasClientLiveTest.java | 101 ++++++++++++++++++ ...bjectStorageLasVegasContainerLiveTest.java | 3 +- 10 files changed, 249 insertions(+), 5 deletions(-) diff --git a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasPropertiesBuilder.java b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasPropertiesBuilder.java index 931f59fb9c..ae4e30d82c 100644 --- a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasPropertiesBuilder.java +++ b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasPropertiesBuilder.java @@ -21,6 +21,7 @@ package org.jclouds.hpcloud.objectstorage.lvs; import static org.jclouds.Constants.PROPERTY_API_VERSION; import static org.jclouds.Constants.PROPERTY_ENDPOINT; import static org.jclouds.Constants.PROPERTY_ISO3166_CODES; +import static org.jclouds.hpcloud.objectstorage.lvs.reference.HPCloudObjectStorageLasVegasConstants.PROPERTY_CDN_ENDPOINT; import java.util.Properties; @@ -42,6 +43,13 @@ public class HPCloudObjectStorageLasVegasPropertiesBuilder extends SwiftProperti properties.setProperty(PROPERTY_ISO3166_CODES, "US-NV"); properties.setProperty(PROPERTY_ENDPOINT, "https://region-a.geo-1.objects.hpcloudsvc.com/auth"); properties.setProperty(PROPERTY_API_VERSION, OpenStackAuthAsyncClient.VERSION); + properties.setProperty(PROPERTY_CDN_ENDPOINT, "https://region-a.geo-1.cdnmgmt.hpcloudsvc.com"); + return properties; } + + protected HPCloudObjectStorageLasVegasPropertiesBuilder withCDNEndpoint(String endpoint) { + properties.setProperty(PROPERTY_CDN_ENDPOINT, endpoint); + return this; + } } diff --git a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/HPCloudObjectStorageLasVegasAsyncBlobStore.java b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/HPCloudObjectStorageLasVegasAsyncBlobStore.java index 8701e815b0..d29ff2e6d6 100644 --- a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/HPCloudObjectStorageLasVegasAsyncBlobStore.java +++ b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/HPCloudObjectStorageLasVegasAsyncBlobStore.java @@ -29,12 +29,15 @@ import javax.inject.Singleton; import org.jclouds.Constants; import org.jclouds.blobstore.BlobStoreContext; import org.jclouds.blobstore.functions.BlobToHttpGetOptions; +import org.jclouds.blobstore.options.CreateContainerOptions; import org.jclouds.blobstore.strategy.internal.FetchBlobMetadata; import org.jclouds.blobstore.util.BlobUtils; import org.jclouds.collect.Memoized; +import org.jclouds.concurrent.Futures; import org.jclouds.domain.Location; import org.jclouds.hpcloud.objectstorage.lvs.HPCloudObjectStorageLasVegasAsyncClient; import org.jclouds.hpcloud.objectstorage.lvs.HPCloudObjectStorageLasVegasClient; +import org.jclouds.hpcloud.objectstorage.lvs.blobstore.functions.EnableCDNAndCache; import org.jclouds.openstack.swift.blobstore.SwiftAsyncBlobStore; import org.jclouds.openstack.swift.blobstore.functions.BlobStoreListContainerOptionsToListContainerOptions; import org.jclouds.openstack.swift.blobstore.functions.BlobToObject; @@ -43,7 +46,9 @@ import org.jclouds.openstack.swift.blobstore.functions.ContainerToResourceMetada import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlob; import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlobMetadata; +import com.google.common.base.Function; import com.google.common.base.Supplier; +import com.google.common.util.concurrent.ListenableFuture; /** * @@ -51,6 +56,7 @@ import com.google.common.base.Supplier; */ @Singleton public class HPCloudObjectStorageLasVegasAsyncBlobStore extends SwiftAsyncBlobStore { + private final EnableCDNAndCache enableCDNAndCache; @Inject protected HPCloudObjectStorageLasVegasAsyncBlobStore(BlobStoreContext context, BlobUtils blobUtils, @@ -60,10 +66,30 @@ public class HPCloudObjectStorageLasVegasAsyncBlobStore extends SwiftAsyncBlobSt BlobStoreListContainerOptionsToListContainerOptions container2ContainerListOptions, ContainerToResourceList container2ResourceList, ObjectToBlob object2Blob, BlobToObject blob2Object, ObjectToBlobMetadata object2BlobMd, BlobToHttpGetOptions blob2ObjectGetOptions, - Provider fetchBlobMetadataProvider) { + Provider fetchBlobMetadataProvider, EnableCDNAndCache enableCDNAndCache) { super(context, blobUtils, service, defaultLocation, locations, sync, async, container2ResourceMd, container2ContainerListOptions, container2ResourceList, object2Blob, blob2Object, object2BlobMd, blob2ObjectGetOptions, fetchBlobMetadataProvider); + this.enableCDNAndCache = enableCDNAndCache; } + @Override + public ListenableFuture createContainerInLocation(Location location, final String container, + CreateContainerOptions options) { + + ListenableFuture returnVal = createContainerInLocation(location, container); + if (options.isPublicRead()) + return Futures.compose(createContainerInLocation(location, container), new Function() { + + @Override + public Boolean apply(Boolean input) { + if (Boolean.TRUE.equals(input)) { + return enableCDNAndCache.apply(container) != null; + } + return false; + } + + }, service); + return returnVal; + } } diff --git a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/HPCloudObjectStorageLasVegasBlobStore.java b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/HPCloudObjectStorageLasVegasBlobStore.java index b9f5c0c35a..15cd7a3fa0 100644 --- a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/HPCloudObjectStorageLasVegasBlobStore.java +++ b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/HPCloudObjectStorageLasVegasBlobStore.java @@ -26,10 +26,12 @@ import javax.inject.Singleton; import org.jclouds.blobstore.BlobStoreContext; import org.jclouds.blobstore.functions.BlobToHttpGetOptions; +import org.jclouds.blobstore.options.CreateContainerOptions; import org.jclouds.blobstore.strategy.internal.FetchBlobMetadata; import org.jclouds.blobstore.util.BlobUtils; import org.jclouds.collect.Memoized; import org.jclouds.domain.Location; +import org.jclouds.hpcloud.objectstorage.lvs.blobstore.functions.EnableCDNAndCache; import org.jclouds.openstack.swift.CommonSwiftClient; import org.jclouds.openstack.swift.blobstore.SwiftBlobStore; import org.jclouds.openstack.swift.blobstore.functions.BlobStoreListContainerOptionsToListContainerOptions; @@ -48,6 +50,8 @@ import com.google.common.base.Supplier; @Singleton public class HPCloudObjectStorageLasVegasBlobStore extends SwiftBlobStore { + private EnableCDNAndCache enableCDNAndCache; + @Inject protected HPCloudObjectStorageLasVegasBlobStore(BlobStoreContext context, BlobUtils blobUtils, Supplier defaultLocation, @Memoized Supplier> locations, @@ -55,9 +59,22 @@ public class HPCloudObjectStorageLasVegasBlobStore extends SwiftBlobStore { BlobStoreListContainerOptionsToListContainerOptions container2ContainerListOptions, ContainerToResourceList container2ResourceList, ObjectToBlob object2Blob, BlobToObject blob2Object, ObjectToBlobMetadata object2BlobMd, BlobToHttpGetOptions blob2ObjectGetOptions, - Provider fetchBlobMetadataProvider) { + Provider fetchBlobMetadataProvider, EnableCDNAndCache enableCDNAndCache) { super(context, blobUtils, defaultLocation, locations, sync, container2ResourceMd, container2ContainerListOptions, container2ResourceList, object2Blob, blob2Object, object2BlobMd, blob2ObjectGetOptions, fetchBlobMetadataProvider); + this.enableCDNAndCache = enableCDNAndCache; + } + + @Override + public boolean createContainerInLocation(Location location, String container, CreateContainerOptions options) { + try { + return createContainerInLocation(location, container); + } finally { + if (options.isPublicRead()) + enableCDNAndCache.apply(container); + } + } + } diff --git a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/config/HPCloudObjectStorageLasVegasBlobStoreContextModule.java b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/config/HPCloudObjectStorageLasVegasBlobStoreContextModule.java index 53037d96ab..01f0b30d54 100644 --- a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/config/HPCloudObjectStorageLasVegasBlobStoreContextModule.java +++ b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/config/HPCloudObjectStorageLasVegasBlobStoreContextModule.java @@ -18,20 +18,75 @@ */ package org.jclouds.hpcloud.objectstorage.lvs.blobstore.config; +import java.net.URI; +import java.util.concurrent.TimeUnit; + +import javax.annotation.Resource; +import javax.inject.Inject; +import javax.inject.Singleton; + +import org.jclouds.hpcloud.objectstorage.lvs.HPCloudObjectStorageLasVegasClient; import org.jclouds.hpcloud.objectstorage.lvs.blobstore.HPCloudObjectStorageLasVegasAsyncBlobStore; import org.jclouds.hpcloud.objectstorage.lvs.blobstore.HPCloudObjectStorageLasVegasBlobStore; import org.jclouds.hpcloud.objectstorage.lvs.blobstore.functions.HPCloudObjectStorageLasVegasObjectToBlobMetadata; +import org.jclouds.hpcloud.objectstorage.lvs.domain.ContainerCDNMetadata; +import org.jclouds.http.HttpResponseException; import org.jclouds.openstack.swift.blobstore.SwiftAsyncBlobStore; import org.jclouds.openstack.swift.blobstore.SwiftBlobStore; import org.jclouds.openstack.swift.blobstore.config.SwiftBlobStoreContextModule; import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlobMetadata; +import com.google.common.annotations.Beta; +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; +import com.google.inject.Provides; + +import org.jclouds.logging.Logger; + /** * * @author Adrian Cole */ public class HPCloudObjectStorageLasVegasBlobStoreContextModule extends SwiftBlobStoreContextModule { + @Beta + @Singleton + public static final class GetCDNMetadata extends CacheLoader { + @Resource + protected Logger logger = Logger.NULL; + + private final HPCloudObjectStorageLasVegasClient client; + + @Inject + public GetCDNMetadata(HPCloudObjectStorageLasVegasClient client) { + this.client = client; + } + + @Override + public URI load(String container) { + try { + ContainerCDNMetadata md = client.getCDNMetadata(container); + return md != null ? md.getCDNUri() : null; + } catch (HttpResponseException e) { + // TODO: this is due to beta status + logger.trace("couldn't get cdn metadata for %s: %s", container, e.getMessage()); + return null; + } + } + + @Override + public String toString() { + return "getCDNMetadata()"; + } + } + + @Provides + @Singleton + protected LoadingCache cdnContainer(GetCDNMetadata loader) { + return CacheBuilder.newBuilder().expireAfterWrite(30, TimeUnit.SECONDS).build(loader); + } + @Override protected void configure() { super.configure(); diff --git a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/functions/HPCloudObjectStorageLasVegasObjectToBlobMetadata.java b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/functions/HPCloudObjectStorageLasVegasObjectToBlobMetadata.java index e645191dd8..934b24e1a0 100644 --- a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/functions/HPCloudObjectStorageLasVegasObjectToBlobMetadata.java +++ b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/functions/HPCloudObjectStorageLasVegasObjectToBlobMetadata.java @@ -32,15 +32,22 @@ import org.jclouds.openstack.swift.domain.ObjectInfo; @Singleton public class HPCloudObjectStorageLasVegasObjectToBlobMetadata extends ObjectToBlobMetadata { + private final PublicUriForObjectInfo publicUriForObjectInfo; + @Inject - public HPCloudObjectStorageLasVegasObjectToBlobMetadata(IfDirectoryReturnNameStrategy ifDirectoryReturnName) { + public HPCloudObjectStorageLasVegasObjectToBlobMetadata(IfDirectoryReturnNameStrategy ifDirectoryReturnName, + PublicUriForObjectInfo publicUriForObjectInfo) { super(ifDirectoryReturnName); + this.publicUriForObjectInfo = publicUriForObjectInfo; + } public MutableBlobMetadata apply(ObjectInfo from) { if (from == null) return null; MutableBlobMetadata to = super.apply(from); + to.setPublicUri(publicUriForObjectInfo.apply(from)); + return to; } } diff --git a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/config/HPCloudObjectStorageLasVegasRestClientModule.java b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/config/HPCloudObjectStorageLasVegasRestClientModule.java index bf39983442..8475215f4d 100644 --- a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/config/HPCloudObjectStorageLasVegasRestClientModule.java +++ b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/config/HPCloudObjectStorageLasVegasRestClientModule.java @@ -18,11 +18,19 @@ */ package org.jclouds.hpcloud.objectstorage.lvs.config; +import static org.jclouds.hpcloud.objectstorage.lvs.reference.HPCloudObjectStorageLasVegasConstants.PROPERTY_CDN_ENDPOINT; + +import java.net.URI; + +import javax.inject.Named; import javax.inject.Singleton; +import org.jclouds.hpcloud.objectstorage.lvs.CDNManagement; import org.jclouds.hpcloud.objectstorage.lvs.HPCloudObjectStorageLasVegasAsyncClient; import org.jclouds.hpcloud.objectstorage.lvs.HPCloudObjectStorageLasVegasClient; import org.jclouds.http.RequiresHttp; +import org.jclouds.openstack.OpenStackAuthAsyncClient.AuthenticationResponse; +import org.jclouds.openstack.reference.AuthHeaders; import org.jclouds.openstack.swift.CommonSwiftAsyncClient; import org.jclouds.openstack.swift.CommonSwiftClient; import org.jclouds.openstack.swift.config.BaseSwiftRestClientModule; @@ -55,4 +63,15 @@ public class HPCloudObjectStorageLasVegasRestClientModule extends return in; } + @Provides + @Singleton + @CDNManagement + protected URI provideCDNUrl(AuthenticationResponse response, @Named(PROPERTY_CDN_ENDPOINT) String cdnEndpoint) { + + if (response.getServices().get(AuthHeaders.CDN_MANAGEMENT_URL) == null) { + return URI.create(cdnEndpoint + response.getServices().get(AuthHeaders.STORAGE_URL).getPath()); + } + // Placeholder for when the Object Storage service returns the CDN Management URL in the headers + return response.getServices().get(AuthHeaders.CDN_MANAGEMENT_URL); + } } diff --git a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/reference/HPCloudObjectStorageLasVegasConstants.java b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/reference/HPCloudObjectStorageLasVegasConstants.java index 70ef5f5ba0..6167afa1af 100644 --- a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/reference/HPCloudObjectStorageLasVegasConstants.java +++ b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/reference/HPCloudObjectStorageLasVegasConstants.java @@ -25,5 +25,8 @@ package org.jclouds.hpcloud.objectstorage.lvs.reference; * @author Jeremy Daggett */ public interface HPCloudObjectStorageLasVegasConstants { - + /** + * The CDN Endpoint property + */ + public static final String PROPERTY_CDN_ENDPOINT = "jclouds.hpcloud-objectstorage-lvs.cdn.endpoint"; } diff --git a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/reference/HPCloudObjectStorageLasVegasHeaders.java b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/reference/HPCloudObjectStorageLasVegasHeaders.java index 2e805b13f6..99403094d8 100644 --- a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/reference/HPCloudObjectStorageLasVegasHeaders.java +++ b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/reference/HPCloudObjectStorageLasVegasHeaders.java @@ -30,4 +30,11 @@ import org.jclouds.openstack.swift.reference.SwiftHeaders; */ public interface HPCloudObjectStorageLasVegasHeaders extends SwiftHeaders { + public static final String CDN_ENABLED = "X-Cdn-Enabled"; + public static final String CDN_LOG_RETENTION = "X-Log-Retention"; + public static final String CDN_REFERRER_ACL = "X-Referrer-ACL"; + public static final String CDN_TTL = "X-Ttl"; + public static final String CDN_URI = "X-Cdn-Uri"; + public static final String CDN_USER_AGENT_ACL = "X-User-Agent-ACL"; + } diff --git a/providers/hpcloud-objectstorage-lvs/src/test/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasClientLiveTest.java b/providers/hpcloud-objectstorage-lvs/src/test/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasClientLiveTest.java index 3f598ace2a..0c394d4139 100644 --- a/providers/hpcloud-objectstorage-lvs/src/test/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasClientLiveTest.java +++ b/providers/hpcloud-objectstorage-lvs/src/test/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasClientLiveTest.java @@ -19,7 +19,13 @@ package org.jclouds.hpcloud.objectstorage.lvs; import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; +import java.net.URI; +import java.util.Set; + +import org.jclouds.hpcloud.objectstorage.lvs.domain.ContainerCDNMetadata; +import org.jclouds.hpcloud.objectstorage.lvs.options.ListCDNContainerOptions; import org.jclouds.openstack.swift.CommonSwiftClientLiveTest; import org.jclouds.openstack.swift.domain.SwiftObject; import org.testng.annotations.Test; @@ -41,4 +47,99 @@ public class HPCloudObjectStorageLasVegasClientLiveTest extends CommonSwiftClien assertEquals(getBlob.getInfo().getContentType(), "application/x-www-form-urlencoded"); } + // CDN service due to go live Q1 2012 + @Test(enabled = true) + public void testCDNOperations() throws Exception { + final long minimumTTL = 60 * 60; // The minimum TTL is 1 hour + + // Create two new containers for testing + final String containerNameWithCDN = getContainerName(); + final String containerNameWithoutCDN = getContainerName(); + try { + try { + getApi().disableCDN(containerNameWithCDN); + getApi().disableCDN(containerNameWithoutCDN); + } catch (Exception e) { + e.printStackTrace(); + } + ContainerCDNMetadata cdnMetadata = null; + + // Enable CDN with PUT for one container + final URI cdnUri = getApi().enableCDN(containerNameWithCDN); + assertTrue(cdnUri != null); + + // Confirm CDN is enabled via HEAD request and has default TTL + cdnMetadata = getApi().getCDNMetadata(containerNameWithCDN); + + assertTrue(cdnMetadata.isCDNEnabled()); + + assertEquals(cdnMetadata.getCDNUri(), cdnUri); + + cdnMetadata = getApi().getCDNMetadata(containerNameWithoutCDN); + assert cdnMetadata == null || !cdnMetadata.isCDNEnabled() : containerNameWithoutCDN + + " should not have metadata"; + + assert getApi().getCDNMetadata("DoesNotExist") == null; + + // List CDN metadata for containers, and ensure all CDN info is + // available for enabled + // container + Set cdnMetadataList = getApi().listCDNContainers(); + assertTrue(cdnMetadataList.size() >= 1); + + final long initialTTL = cdnMetadata.getTTL(); + assertTrue(cdnMetadataList.contains(new ContainerCDNMetadata(containerNameWithCDN, true, initialTTL, cdnUri))); + + /* + * Test listing with options FIXFIX cdnMetadataList = + * getApi().listCDNContainers(ListCDNContainerOptions.Builder.enabledOnly()); + * assertTrue(Iterables.all(cdnMetadataList, new Predicate() { public + * boolean apply(ContainerCDNMetadata cdnMetadata) { return cdnMetadata.isCDNEnabled(); } + * })); + */ + + cdnMetadataList = getApi().listCDNContainers( + ListCDNContainerOptions.Builder.afterMarker( + containerNameWithCDN.substring(0, containerNameWithCDN.length() - 1)).maxResults(1)); + assertEquals(cdnMetadataList.size(), 1); + + // Enable CDN with PUT for the same container, this time with a custom + // TTL + long ttl = 4000; + getApi().enableCDN(containerNameWithCDN, ttl); + + cdnMetadata = getApi().getCDNMetadata(containerNameWithCDN); + + assertTrue(cdnMetadata.isCDNEnabled()); + + assertEquals(cdnMetadata.getTTL(), ttl); + + // Check POST by updating TTL settings + ttl = minimumTTL; + getApi().updateCDN(containerNameWithCDN, minimumTTL); + + cdnMetadata = getApi().getCDNMetadata(containerNameWithCDN); + assertTrue(cdnMetadata.isCDNEnabled()); + + assertEquals(cdnMetadata.getTTL(), minimumTTL); + + // Confirm that minimum allowed value for TTL is 3600, lower values are + // ignored. + getApi().updateCDN(containerNameWithCDN, 3599L); + cdnMetadata = getApi().getCDNMetadata(containerNameWithCDN); + assertEquals(cdnMetadata.getTTL(), 3599L); + + // Disable CDN with POST + assertTrue(getApi().disableCDN(containerNameWithCDN)); + + cdnMetadata = getApi().getCDNMetadata(containerNameWithCDN); + assertEquals(cdnMetadata.isCDNEnabled(), false); + } catch (Exception e) { + e.printStackTrace(); + } finally { + recycleContainer(containerNameWithCDN); + recycleContainer(containerNameWithoutCDN); + } + } + } diff --git a/providers/hpcloud-objectstorage-lvs/src/test/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/integration/HPCloudObjectStorageLasVegasContainerLiveTest.java b/providers/hpcloud-objectstorage-lvs/src/test/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/integration/HPCloudObjectStorageLasVegasContainerLiveTest.java index 84583af635..1e765bca0f 100644 --- a/providers/hpcloud-objectstorage-lvs/src/test/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/integration/HPCloudObjectStorageLasVegasContainerLiveTest.java +++ b/providers/hpcloud-objectstorage-lvs/src/test/java/org/jclouds/hpcloud/objectstorage/lvs/blobstore/integration/HPCloudObjectStorageLasVegasContainerLiveTest.java @@ -30,7 +30,8 @@ import org.testng.annotations.Test; @Test(groups = { "live" }) public class HPCloudObjectStorageLasVegasContainerLiveTest extends BaseContainerLiveTest { - @Test(expectedExceptions=UnsupportedOperationException.class) + @Test(enabled = false) + //@Test(expectedExceptions=UnsupportedOperationException.class) public void testPublicAccess() throws MalformedURLException, InterruptedException, IOException { super.testPublicAccess(); } From 676e15308002c6abd78f1aac8c9697e24bf84dce Mon Sep 17 00:00:00 2001 From: Jeremy Daggett Date: Wed, 25 Jan 2012 18:35:24 -0800 Subject: [PATCH 3/8] Added support Keystone style auth --- ...t.java => IdentityServiceAsyncClient.java} | 26 +++++- ...Client.java => IdentityServiceClient.java} | 4 +- .../v2_0/binders/BindAuthToJsonPayload.java | 9 +- .../config/KeyStoneAuthenticationModule.java | 8 +- ...CloudObjectStorageLasVegasAsyncClient.java | 16 ++-- ...bjectStorageLasVegasPropertiesBuilder.java | 7 +- ...ObjectStorageLasVegasRestClientModule.java | 87 ++++++++++++++++--- .../services/HPExtensionBlockStore.java | 41 +++++++++ .../hpcloud/services/HPExtensionCDN.java | 41 +++++++++ .../services/HPExtentionServiceType.java | 43 +++++++++ 10 files changed, 248 insertions(+), 34 deletions(-) rename common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/{ServiceAsyncClient.java => IdentityServiceAsyncClient.java} (76%) rename common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/{ServiceClient.java => IdentityServiceClient.java} (95%) create mode 100644 providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/services/HPExtensionBlockStore.java create mode 100644 providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/services/HPExtensionCDN.java create mode 100644 providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/services/HPExtentionServiceType.java diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/ServiceAsyncClient.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/IdentityServiceAsyncClient.java similarity index 76% rename from common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/ServiceAsyncClient.java rename to common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/IdentityServiceAsyncClient.java index c4b7a9624f..db6ea55d5a 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/ServiceAsyncClient.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/IdentityServiceAsyncClient.java @@ -18,18 +18,24 @@ */ package org.jclouds.openstack.keystone.v2_0; +import java.util.Set; + import javax.ws.rs.Consumes; +import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.core.MediaType; import org.jclouds.Constants; +import org.jclouds.openstack.filters.AuthenticateRequest; import org.jclouds.openstack.keystone.v2_0.binders.BindAuthToJsonPayload; import org.jclouds.openstack.keystone.v2_0.domain.Access; import org.jclouds.openstack.keystone.v2_0.domain.ApiAccessKeyCredentials; import org.jclouds.openstack.keystone.v2_0.domain.PasswordCredentials; +import org.jclouds.openstack.keystone.v2_0.domain.Tenant; import org.jclouds.rest.annotations.MapBinder; import org.jclouds.rest.annotations.PayloadParam; +import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.rest.annotations.SelectJson; import com.google.common.util.concurrent.ListenableFuture; @@ -38,16 +44,16 @@ import com.google.common.util.concurrent.ListenableFuture; * Provides asynchronous access to Service via their REST API. *

* - * @see ServiceClient + * @see IdentityServiceClient * @see * @author Adrian Cole */ @Path("/v{" + Constants.PROPERTY_API_VERSION + "}") -public interface ServiceAsyncClient { +public interface IdentityServiceAsyncClient { /** - * @see ServiceClient#authenticateTenantWithCredentials(String,PasswordCredentials) + * @see IdentityServiceClient#authenticateTenantWithCredentials(String,PasswordCredentials) */ @POST @SelectJson("access") @@ -58,7 +64,7 @@ public interface ServiceAsyncClient { PasswordCredentials passwordCredentials); /** - * @see ServiceClient#authenticateTenantWithCredentials(String,ApiAccessKeyCredentials) + * @see IdentityServiceClient#authenticateTenantWithCredentials(String,ApiAccessKeyCredentials) */ @POST @SelectJson("access") @@ -67,4 +73,16 @@ public interface ServiceAsyncClient { @MapBinder(BindAuthToJsonPayload.class) ListenableFuture authenticateTenantWithCredentials(@PayloadParam("tenantId") String tenantId, ApiAccessKeyCredentials apiAccessKeyCredentials); + + /** + * @see IdentityServiceClient#getTenants() + */ + @GET + @SelectJson("tenants") + @Consumes(MediaType.APPLICATION_JSON) + @Path("/tenants") + @RequestFilters(AuthenticateRequest.class) + ListenableFuture> getTenants(); + + } diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/ServiceClient.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/IdentityServiceClient.java similarity index 95% rename from common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/ServiceClient.java rename to common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/IdentityServiceClient.java index 3fed20b001..a3d2567082 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/ServiceClient.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/IdentityServiceClient.java @@ -29,13 +29,13 @@ import org.jclouds.openstack.keystone.v2_0.domain.PasswordCredentials; * Provides synchronous access to the KeyStone Service API. *

* - * @see ServiceAsyncClient + * @see IdentityServiceAsyncClient * @see * @author Adrian Cole */ @Timeout(duration = 30, timeUnit = TimeUnit.SECONDS) -public interface ServiceClient { +public interface IdentityServiceClient { /** * Authenticate to generate a token. diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/binders/BindAuthToJsonPayload.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/binders/BindAuthToJsonPayload.java index 8b1325eb98..b644c5bb3d 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/binders/BindAuthToJsonPayload.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/binders/BindAuthToJsonPayload.java @@ -55,10 +55,10 @@ public class BindAuthToJsonPayload extends BindToJsonPayload implements MapBinde throw new IllegalStateException("BindAuthToJsonPayload needs parameters"); } - protected void addCredentialsInArgsOrNull(GeneratedHttpRequest gRequest, Builder builder) { + protected void addCredentialsInArgsOrNull(GeneratedHttpRequest gRequest, Builder builder, String tenantId) { for (Object arg : gRequest.getArgs()) { if (arg instanceof PasswordCredentials) { - builder.put("auth", ImmutableMap.of("passwordCredentials", PasswordCredentials.class.cast(arg))); + builder.put("auth", ImmutableMap.of("passwordCredentials", PasswordCredentials.class.cast(arg), "tenantId", tenantId)); } else if (arg instanceof ApiAccessKeyCredentials) { builder.put("auth", ImmutableMap.of("apiAccessKeyCredentials", ApiAccessKeyCredentials.class.cast(arg))); } @@ -73,8 +73,9 @@ public class BindAuthToJsonPayload extends BindToJsonPayload implements MapBinde checkState(gRequest.getArgs() != null, "args should be initialized at this point"); Builder builder = ImmutableMap. builder(); - builder.put("tenantId", postParams.get("tenantId")); - addCredentialsInArgsOrNull(gRequest, builder); + //builder.put("tenantId", postParams.get("tenantId")); + + addCredentialsInArgsOrNull(gRequest, builder, postParams.get("tenantId")); return super.bindToRequest(request, builder.build()); } diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeyStoneAuthenticationModule.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeyStoneAuthenticationModule.java index a8e0e301d1..d5faf53198 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeyStoneAuthenticationModule.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeyStoneAuthenticationModule.java @@ -34,7 +34,7 @@ import org.jclouds.domain.Credentials; import org.jclouds.http.RequiresHttp; import org.jclouds.location.Provider; import org.jclouds.openstack.Authentication; -import org.jclouds.openstack.keystone.v2_0.ServiceAsyncClient; +import org.jclouds.openstack.keystone.v2_0.IdentityServiceAsyncClient; import org.jclouds.openstack.keystone.v2_0.domain.Access; import org.jclouds.openstack.keystone.v2_0.domain.PasswordCredentials; import org.jclouds.rest.AsyncClientFactory; @@ -81,8 +81,8 @@ public class KeyStoneAuthenticationModule extends AbstractModule { @Provides @Singleton - protected ServiceAsyncClient provideServiceClient(AsyncClientFactory factory) { - return factory.create(ServiceAsyncClient.class); + protected IdentityServiceAsyncClient provideServiceClient(AsyncClientFactory factory) { + return factory.create(IdentityServiceAsyncClient.class); } @Provides @@ -96,7 +96,7 @@ public class KeyStoneAuthenticationModule extends AbstractModule { public static class GetAccess extends RetryOnTimeOutExceptionFunction { @Inject - public GetAccess(final ServiceAsyncClient client) { + public GetAccess(final IdentityServiceAsyncClient client) { super(new Function() { @Override diff --git a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasAsyncClient.java b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasAsyncClient.java index 9956b05b64..467fa3716b 100644 --- a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasAsyncClient.java +++ b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasAsyncClient.java @@ -40,7 +40,9 @@ import org.jclouds.hpcloud.objectstorage.lvs.functions.ParseContainerMetadataFro import org.jclouds.hpcloud.objectstorage.lvs.options.CreateContainerOptions; import org.jclouds.hpcloud.objectstorage.lvs.options.ListCDNContainerOptions; import org.jclouds.hpcloud.objectstorage.lvs.reference.HPCloudObjectStorageLasVegasHeaders; +import org.jclouds.hpcloud.services.HPExtensionCDN; import org.jclouds.openstack.filters.AuthenticateRequest; +import org.jclouds.openstack.services.ObjectStore; import org.jclouds.openstack.swift.CommonSwiftAsyncClient; import org.jclouds.openstack.swift.Storage; import org.jclouds.openstack.swift.domain.ContainerMetadata; @@ -68,7 +70,7 @@ import com.google.common.util.concurrent.ListenableFuture; */ @SkipEncoding('/') @RequestFilters(AuthenticateRequest.class) -@Endpoint(Storage.class) +@Endpoint(ObjectStore.class) public interface HPCloudObjectStorageLasVegasAsyncClient extends CommonSwiftAsyncClient { /** @@ -97,7 +99,7 @@ public interface HPCloudObjectStorageLasVegasAsyncClient extends CommonSwiftAsyn @Consumes(MediaType.APPLICATION_JSON) @QueryParams(keys = "format", values = "json") @Path("/") - @Endpoint(CDNManagement.class) + @Endpoint(HPExtensionCDN.class) ListenableFuture> listCDNContainers(ListCDNContainerOptions... options); /** @@ -108,7 +110,7 @@ public interface HPCloudObjectStorageLasVegasAsyncClient extends CommonSwiftAsyn @ResponseParser(ParseContainerCDNMetadataFromHeaders.class) @ExceptionParser(ReturnNullOnContainerNotFound.class) @Path("/{container}") - @Endpoint(CDNManagement.class) + @Endpoint(HPExtensionCDN.class) ListenableFuture getCDNMetadata(@PathParam("container") String container); /** @@ -119,7 +121,7 @@ public interface HPCloudObjectStorageLasVegasAsyncClient extends CommonSwiftAsyn @Path("/{container}") @Headers(keys = HPCloudObjectStorageLasVegasHeaders.CDN_ENABLED, values = "True") @ResponseParser(ParseCDNUriFromHeaders.class) - @Endpoint(CDNManagement.class) + @Endpoint(HPExtensionCDN.class) ListenableFuture enableCDN(@PathParam("container") String container, @HeaderParam(HPCloudObjectStorageLasVegasHeaders.CDN_TTL) long ttl); @@ -131,7 +133,7 @@ public interface HPCloudObjectStorageLasVegasAsyncClient extends CommonSwiftAsyn @Path("/{container}") @Headers(keys = HPCloudObjectStorageLasVegasHeaders.CDN_ENABLED, values = "True") @ResponseParser(ParseCDNUriFromHeaders.class) - @Endpoint(CDNManagement.class) + @Endpoint(HPExtensionCDN.class) ListenableFuture enableCDN(@PathParam("container") String container); /** @@ -141,7 +143,7 @@ public interface HPCloudObjectStorageLasVegasAsyncClient extends CommonSwiftAsyn @POST @Path("/{container}") @ResponseParser(ParseCDNUriFromHeaders.class) - @Endpoint(CDNManagement.class) + @Endpoint(HPExtensionCDN.class) ListenableFuture updateCDN(@PathParam("container") String container, @HeaderParam(HPCloudObjectStorageLasVegasHeaders.CDN_TTL) long ttl); @@ -152,7 +154,7 @@ public interface HPCloudObjectStorageLasVegasAsyncClient extends CommonSwiftAsyn @PUT @Path("/{container}") @Headers(keys = HPCloudObjectStorageLasVegasHeaders.CDN_ENABLED, values = "False") - @Endpoint(CDNManagement.class) + @Endpoint(HPExtensionCDN.class) ListenableFuture disableCDN(@PathParam("container") String container); } diff --git a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasPropertiesBuilder.java b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasPropertiesBuilder.java index ae4e30d82c..10b2d7127b 100644 --- a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasPropertiesBuilder.java +++ b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasPropertiesBuilder.java @@ -42,14 +42,17 @@ public class HPCloudObjectStorageLasVegasPropertiesBuilder extends SwiftProperti Properties properties = super.defaultProperties(); properties.setProperty(PROPERTY_ISO3166_CODES, "US-NV"); properties.setProperty(PROPERTY_ENDPOINT, "https://region-a.geo-1.objects.hpcloudsvc.com/auth"); - properties.setProperty(PROPERTY_API_VERSION, OpenStackAuthAsyncClient.VERSION); - properties.setProperty(PROPERTY_CDN_ENDPOINT, "https://region-a.geo-1.cdnmgmt.hpcloudsvc.com"); + properties.setProperty(PROPERTY_API_VERSION, "2.0"); + //properties.setProperty(PROPERTY_CDN_ENDPOINT, "https://region-a.geo-1.cdnmgmt.hpcloudsvc.com"); return properties; } + /* protected HPCloudObjectStorageLasVegasPropertiesBuilder withCDNEndpoint(String endpoint) { properties.setProperty(PROPERTY_CDN_ENDPOINT, endpoint); return this; } + */ + } diff --git a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/config/HPCloudObjectStorageLasVegasRestClientModule.java b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/config/HPCloudObjectStorageLasVegasRestClientModule.java index 8475215f4d..fe726a2bf8 100644 --- a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/config/HPCloudObjectStorageLasVegasRestClientModule.java +++ b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/config/HPCloudObjectStorageLasVegasRestClientModule.java @@ -18,24 +18,37 @@ */ package org.jclouds.hpcloud.objectstorage.lvs.config; -import static org.jclouds.hpcloud.objectstorage.lvs.reference.HPCloudObjectStorageLasVegasConstants.PROPERTY_CDN_ENDPOINT; - import java.net.URI; -import javax.inject.Named; import javax.inject.Singleton; -import org.jclouds.hpcloud.objectstorage.lvs.CDNManagement; import org.jclouds.hpcloud.objectstorage.lvs.HPCloudObjectStorageLasVegasAsyncClient; import org.jclouds.hpcloud.objectstorage.lvs.HPCloudObjectStorageLasVegasClient; +import org.jclouds.hpcloud.services.HPExtensionCDN; +import org.jclouds.hpcloud.services.HPExtentionServiceType; +import org.jclouds.http.HttpErrorHandler; +import org.jclouds.http.HttpRetryHandler; import org.jclouds.http.RequiresHttp; -import org.jclouds.openstack.OpenStackAuthAsyncClient.AuthenticationResponse; -import org.jclouds.openstack.reference.AuthHeaders; +import org.jclouds.http.annotation.ClientError; +import org.jclouds.http.annotation.Redirection; +import org.jclouds.http.annotation.ServerError; +import org.jclouds.http.handlers.BackoffLimitedRetryHandler; +import org.jclouds.json.config.GsonModule.DateAdapter; +import org.jclouds.json.config.GsonModule.Iso8601DateAdapter; +import org.jclouds.openstack.keystone.v2_0.config.KeyStoneAuthenticationModule; +import org.jclouds.openstack.keystone.v2_0.domain.Access; +import org.jclouds.openstack.keystone.v2_0.domain.Service; +import org.jclouds.openstack.services.ServiceType; import org.jclouds.openstack.swift.CommonSwiftAsyncClient; import org.jclouds.openstack.swift.CommonSwiftClient; -import org.jclouds.openstack.swift.config.BaseSwiftRestClientModule; +import org.jclouds.openstack.swift.Storage; +import org.jclouds.openstack.swift.config.SwiftObjectModule; +import org.jclouds.openstack.swift.handlers.ParseSwiftErrorFromHttpResponse; import org.jclouds.rest.ConfiguresRestClient; +import org.jclouds.rest.config.RestClientModule; +import com.google.common.base.Predicate; +import com.google.common.collect.Iterables; import com.google.inject.Provides; /** @@ -45,10 +58,36 @@ import com.google.inject.Provides; @ConfiguresRestClient @RequiresHttp public class HPCloudObjectStorageLasVegasRestClientModule extends - BaseSwiftRestClientModule { + RestClientModule { + + private final KeyStoneAuthenticationModule authModule; public HPCloudObjectStorageLasVegasRestClientModule() { + this(new KeyStoneAuthenticationModule()); + } + + public HPCloudObjectStorageLasVegasRestClientModule(KeyStoneAuthenticationModule authModule) { super(HPCloudObjectStorageLasVegasClient.class, HPCloudObjectStorageLasVegasAsyncClient.class); + this.authModule = authModule; + } + + protected void configure() { + install(authModule); + install(new SwiftObjectModule()); + bind(DateAdapter.class).to(Iso8601DateAdapter.class); + super.configure(); + } + + @Override + protected void bindErrorHandlers() { + bind(HttpErrorHandler.class).annotatedWith(Redirection.class).to(ParseSwiftErrorFromHttpResponse.class); + bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to(ParseSwiftErrorFromHttpResponse.class); + bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(ParseSwiftErrorFromHttpResponse.class); + } + + @Override + protected void bindRetryHandlers() { + bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(BackoffLimitedRetryHandler.class); } @Provides @@ -65,13 +104,39 @@ public class HPCloudObjectStorageLasVegasRestClientModule extends @Provides @Singleton - @CDNManagement - protected URI provideCDNUrl(AuthenticationResponse response, @Named(PROPERTY_CDN_ENDPOINT) String cdnEndpoint) { - + @Storage + protected URI provideStorageUrl(Access response) { + return Iterables.getOnlyElement(Iterables.find(response.getServiceCatalog(), new Predicate(){ + + @Override + public boolean apply(Service input) { + return input.getId().equals(ServiceType.OBJECT_STORE); + } + + }).getEndpoints()).getPublicURL(); + } + + + @Provides + @Singleton + @HPExtensionCDN + protected URI provideCDNUrl(Access response) { + /* if (response.getServices().get(AuthHeaders.CDN_MANAGEMENT_URL) == null) { return URI.create(cdnEndpoint + response.getServices().get(AuthHeaders.STORAGE_URL).getPath()); } // Placeholder for when the Object Storage service returns the CDN Management URL in the headers return response.getServices().get(AuthHeaders.CDN_MANAGEMENT_URL); + */ + + return Iterables.getOnlyElement(Iterables.find(response.getServiceCatalog(), new Predicate(){ + + @Override + public boolean apply(Service input) { + return input.getId().equals(HPExtentionServiceType.CDN); + } + + }).getEndpoints()).getPublicURL(); + } } diff --git a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/services/HPExtensionBlockStore.java b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/services/HPExtensionBlockStore.java new file mode 100644 index 0000000000..333aa3ad5c --- /dev/null +++ b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/services/HPExtensionBlockStore.java @@ -0,0 +1,41 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jclouds.hpcloud.services; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import javax.inject.Qualifier; + +/** + * HP Extension Block Store Service + * + * @author Jeremy Daggett + * @see + * @see HPExtensionServiceType#BLOCK_STORE + */ +@Retention(value = RetentionPolicy.RUNTIME) +@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) +@Qualifier +public @interface HPExtensionBlockStore { + +} \ No newline at end of file diff --git a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/services/HPExtensionCDN.java b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/services/HPExtensionCDN.java new file mode 100644 index 0000000000..5922838983 --- /dev/null +++ b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/services/HPExtensionCDN.java @@ -0,0 +1,41 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jclouds.hpcloud.services; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import javax.inject.Qualifier; + +/** + * CDN + * + * @author Jeremy Daggett + * @see + * @see HPExtensionServiceType#CDN + */ +@Retention(value = RetentionPolicy.RUNTIME) +@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD }) +@Qualifier +public @interface HPExtensionCDN { + +} \ No newline at end of file diff --git a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/services/HPExtentionServiceType.java b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/services/HPExtentionServiceType.java new file mode 100644 index 0000000000..311117a390 --- /dev/null +++ b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/services/HPExtentionServiceType.java @@ -0,0 +1,43 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Name 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.jclouds.hpcloud.services; + +import org.jclouds.openstack.services.ServiceType; + +/** + * An HP Extension Service, such as CDN, or Block Store Service. + * A service provides one or more endpoints through which users can access resources and perform + * (presumably useful) operations. + * + * @author Jeremy Daggett + * @see + */ +public interface HPExtentionServiceType extends ServiceType { + /** + * CDN + */ + public static final String CDN = "hpext:cdn"; + /** + * Block Storage + */ + public static final String BLOCK_STORE = "hpext:block-store"; + +} \ No newline at end of file From bf58be7a6d6c601ebb6f82ff743d353e09544fb6 Mon Sep 17 00:00:00 2001 From: Jeremy Daggett Date: Thu, 26 Jan 2012 09:55:19 -0800 Subject: [PATCH 4/8] Fixed broken test --- .../keystone/v2_0/config/KeyStoneAuthenticationModule.java | 2 +- .../v2_0/internal/BaseKeyStoneRestClientExpectTest.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeyStoneAuthenticationModule.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeyStoneAuthenticationModule.java index d5faf53198..9c38624202 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeyStoneAuthenticationModule.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeyStoneAuthenticationModule.java @@ -81,7 +81,7 @@ public class KeyStoneAuthenticationModule extends AbstractModule { @Provides @Singleton - protected IdentityServiceAsyncClient provideServiceClient(AsyncClientFactory factory) { + protected IdentityServiceAsyncClient provideIdentityServiceClient(AsyncClientFactory factory) { return factory.create(IdentityServiceAsyncClient.class); } diff --git a/common/openstack/src/test/java/org/jclouds/openstack/keystone/v2_0/internal/BaseKeyStoneRestClientExpectTest.java b/common/openstack/src/test/java/org/jclouds/openstack/keystone/v2_0/internal/BaseKeyStoneRestClientExpectTest.java index 5924752008..9bca082c22 100644 --- a/common/openstack/src/test/java/org/jclouds/openstack/keystone/v2_0/internal/BaseKeyStoneRestClientExpectTest.java +++ b/common/openstack/src/test/java/org/jclouds/openstack/keystone/v2_0/internal/BaseKeyStoneRestClientExpectTest.java @@ -37,7 +37,7 @@ public class BaseKeyStoneRestClientExpectTest extends BaseRestClientExpectTes public BaseKeyStoneRestClientExpectTest() { // username:tenantId - identity = "user@jclouds.org:12346637803162"; + identity = "user@jclouds.org:40806637803162"; credential = "Password1234"; } @@ -48,7 +48,7 @@ public class BaseKeyStoneRestClientExpectTest extends BaseRestClientExpectTes .headers(ImmutableMultimap.of(HttpHeaders.ACCEPT, "application/json")) .payload( payloadFromStringWithContentType( - "{\"tenantId\":\"12346637803162\",\"auth\":{\"passwordCredentials\":{\"username\":\"user@jclouds.org\",\"password\":\"Password1234\"}}}", + "{\"auth\":{\"passwordCredentials\":{\"username\":\"user@jclouds.org\",\"password\":\"Password1234\"},\"tenantId\":\"40806637803162\"}}", "application/json")).build(); protected String authToken = "Auth_4f173437e4b013bee56d1007"; From e4c32bc00b050ac2bcfc85b2d892b9df394d0318 Mon Sep 17 00:00:00 2001 From: Jeremy Daggett Date: Wed, 1 Feb 2012 22:39:29 -0800 Subject: [PATCH 5/8] Fixed files before merge --- .../keystone/v2_0/IdentityServiceClient.java | 53 ------------------- ...yncClient.java => ServiceAsyncClient.java} | 10 ++-- .../keystone/v2_0/ServiceClient.java | 0 .../v2_0/binders/BindAuthToJsonPayload.java | 15 +++--- ...java => KeystoneAuthenticationModule.java} | 10 ++-- 5 files changed, 18 insertions(+), 70 deletions(-) delete mode 100644 common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/IdentityServiceClient.java rename common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/{IdentityServiceAsyncClient.java => ServiceAsyncClient.java} (89%) create mode 100644 common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/ServiceClient.java rename common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/config/{KeyStoneAuthenticationModule.java => KeystoneAuthenticationModule.java} (93%) diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/IdentityServiceClient.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/IdentityServiceClient.java deleted file mode 100644 index a3d2567082..0000000000 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/IdentityServiceClient.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.jclouds.openstack.keystone.v2_0; - -import java.util.concurrent.TimeUnit; - -import org.jclouds.concurrent.Timeout; -import org.jclouds.openstack.keystone.v2_0.domain.Access; -import org.jclouds.openstack.keystone.v2_0.domain.ApiAccessKeyCredentials; -import org.jclouds.openstack.keystone.v2_0.domain.PasswordCredentials; - -/** - * Provides synchronous access to the KeyStone Service API. - *

- * - * @see IdentityServiceAsyncClient - * @see - * @author Adrian Cole - */ -@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS) -public interface IdentityServiceClient { - - /** - * Authenticate to generate a token. - * - * @return access with token - */ - Access authenticateTenantWithCredentials(String tenantId, PasswordCredentials passwordCredentials); - - /** - * Authenticate to generate a token. - * - * @return access with token - */ - Access authenticateTenantWithCredentials(String tenantId, ApiAccessKeyCredentials passwordCredentials); -} diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/IdentityServiceAsyncClient.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/ServiceAsyncClient.java similarity index 89% rename from common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/IdentityServiceAsyncClient.java rename to common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/ServiceAsyncClient.java index db6ea55d5a..683d4af0c3 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/IdentityServiceAsyncClient.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/ServiceAsyncClient.java @@ -44,16 +44,16 @@ import com.google.common.util.concurrent.ListenableFuture; * Provides asynchronous access to Service via their REST API. *

* - * @see IdentityServiceClient + * @see ServiceClient * @see * @author Adrian Cole */ @Path("/v{" + Constants.PROPERTY_API_VERSION + "}") -public interface IdentityServiceAsyncClient { +public interface ServiceAsyncClient { /** - * @see IdentityServiceClient#authenticateTenantWithCredentials(String,PasswordCredentials) + * @see ServiceClient#authenticateTenantWithCredentials(String,PasswordCredentials) */ @POST @SelectJson("access") @@ -64,7 +64,7 @@ public interface IdentityServiceAsyncClient { PasswordCredentials passwordCredentials); /** - * @see IdentityServiceClient#authenticateTenantWithCredentials(String,ApiAccessKeyCredentials) + * @see ServiceClient#authenticateTenantWithCredentials(String,ApiAccessKeyCredentials) */ @POST @SelectJson("access") @@ -75,7 +75,7 @@ public interface IdentityServiceAsyncClient { ApiAccessKeyCredentials apiAccessKeyCredentials); /** - * @see IdentityServiceClient#getTenants() + * @see ServiceClient#getTenants() */ @GET @SelectJson("tenants") diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/ServiceClient.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/ServiceClient.java new file mode 100644 index 0000000000..e69de29bb2 diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/binders/BindAuthToJsonPayload.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/binders/BindAuthToJsonPayload.java index b644c5bb3d..533817a807 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/binders/BindAuthToJsonPayload.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/binders/BindAuthToJsonPayload.java @@ -35,6 +35,7 @@ import org.jclouds.rest.MapBinder; import org.jclouds.rest.binders.BindToJsonPayload; import org.jclouds.rest.internal.GeneratedHttpRequest; +import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap.Builder; @@ -55,12 +56,12 @@ public class BindAuthToJsonPayload extends BindToJsonPayload implements MapBinde throw new IllegalStateException("BindAuthToJsonPayload needs parameters"); } - protected void addCredentialsInArgsOrNull(GeneratedHttpRequest gRequest, Builder builder, String tenantId) { + protected void addCredentialsInArgsOrNull(GeneratedHttpRequest gRequest, Builder builder) { for (Object arg : gRequest.getArgs()) { if (arg instanceof PasswordCredentials) { - builder.put("auth", ImmutableMap.of("passwordCredentials", PasswordCredentials.class.cast(arg), "tenantId", tenantId)); + builder.put("passwordCredentials", PasswordCredentials.class.cast(arg)); } else if (arg instanceof ApiAccessKeyCredentials) { - builder.put("auth", ImmutableMap.of("apiAccessKeyCredentials", ApiAccessKeyCredentials.class.cast(arg))); + builder.put("apiAccessKeyCredentials", ApiAccessKeyCredentials.class.cast(arg)); } } } @@ -73,10 +74,10 @@ public class BindAuthToJsonPayload extends BindToJsonPayload implements MapBinde checkState(gRequest.getArgs() != null, "args should be initialized at this point"); Builder builder = ImmutableMap. builder(); - //builder.put("tenantId", postParams.get("tenantId")); - - addCredentialsInArgsOrNull(gRequest, builder, postParams.get("tenantId")); - return super.bindToRequest(request, builder.build()); + addCredentialsInArgsOrNull(gRequest, builder); + if (Strings.emptyToNull(postParams.get("tenantId")) != null) + builder.put("tenantId", postParams.get("tenantId")); + return super.bindToRequest(request, ImmutableMap.of("auth", builder.build())); } } diff --git a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeyStoneAuthenticationModule.java b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneAuthenticationModule.java similarity index 93% rename from common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeyStoneAuthenticationModule.java rename to common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneAuthenticationModule.java index d5faf53198..343246b187 100644 --- a/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeyStoneAuthenticationModule.java +++ b/common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0/config/KeystoneAuthenticationModule.java @@ -34,7 +34,7 @@ import org.jclouds.domain.Credentials; import org.jclouds.http.RequiresHttp; import org.jclouds.location.Provider; import org.jclouds.openstack.Authentication; -import org.jclouds.openstack.keystone.v2_0.IdentityServiceAsyncClient; +import org.jclouds.openstack.keystone.v2_0.ServiceAsyncClient; import org.jclouds.openstack.keystone.v2_0.domain.Access; import org.jclouds.openstack.keystone.v2_0.domain.PasswordCredentials; import org.jclouds.rest.AsyncClientFactory; @@ -56,7 +56,7 @@ import com.google.inject.TypeLiteral; * @author Adrian Cole */ @RequiresHttp -public class KeyStoneAuthenticationModule extends AbstractModule { +public class KeystoneAuthenticationModule extends AbstractModule { @Override protected void configure() { @@ -81,8 +81,8 @@ public class KeyStoneAuthenticationModule extends AbstractModule { @Provides @Singleton - protected IdentityServiceAsyncClient provideServiceClient(AsyncClientFactory factory) { - return factory.create(IdentityServiceAsyncClient.class); + protected ServiceAsyncClient provideServiceClient(AsyncClientFactory factory) { + return factory.create(ServiceAsyncClient.class); } @Provides @@ -96,7 +96,7 @@ public class KeyStoneAuthenticationModule extends AbstractModule { public static class GetAccess extends RetryOnTimeOutExceptionFunction { @Inject - public GetAccess(final IdentityServiceAsyncClient client) { + public GetAccess(final ServiceAsyncClient client) { super(new Function() { @Override From fa51a2734c5f4330e5a7bae6e7002078c327a202 Mon Sep 17 00:00:00 2001 From: Jeremy Daggett Date: Wed, 1 Feb 2012 22:42:09 -0800 Subject: [PATCH 6/8] Fixed rename of files --- .../v2_0/internal/BaseKeyStoneRestClientExpectTest.java | 4 ++-- .../openstack/nova/v1_1/config/NovaRestClientModule.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common/openstack/src/test/java/org/jclouds/openstack/keystone/v2_0/internal/BaseKeyStoneRestClientExpectTest.java b/common/openstack/src/test/java/org/jclouds/openstack/keystone/v2_0/internal/BaseKeyStoneRestClientExpectTest.java index 5924752008..cc341575d0 100644 --- a/common/openstack/src/test/java/org/jclouds/openstack/keystone/v2_0/internal/BaseKeyStoneRestClientExpectTest.java +++ b/common/openstack/src/test/java/org/jclouds/openstack/keystone/v2_0/internal/BaseKeyStoneRestClientExpectTest.java @@ -22,7 +22,7 @@ import java.net.URI; import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpResponse; -import org.jclouds.openstack.keystone.v2_0.config.KeyStoneAuthenticationModule; +import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule; import org.jclouds.rest.BaseRestClientExpectTest; import com.google.common.collect.ImmutableMultimap; @@ -60,7 +60,7 @@ public class BaseKeyStoneRestClientExpectTest extends BaseRestClientExpectTes /** * in case you need to override anything */ - public static class TestKeyStoneAuthenticationModule extends KeyStoneAuthenticationModule { + public static class TestKeyStoneAuthenticationModule extends KeystoneAuthenticationModule { @Override protected void configure() { super.configure(); diff --git a/labs/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/config/NovaRestClientModule.java b/labs/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/config/NovaRestClientModule.java index 100a8d75fc..0af0e3f5d1 100644 --- a/labs/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/config/NovaRestClientModule.java +++ b/labs/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/config/NovaRestClientModule.java @@ -30,7 +30,7 @@ import org.jclouds.http.annotation.ClientError; import org.jclouds.http.annotation.Redirection; import org.jclouds.http.annotation.ServerError; import org.jclouds.http.handlers.BackoffLimitedRetryHandler; -import org.jclouds.openstack.keystone.v2_0.config.KeyStoneAuthenticationModule; +import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule; import org.jclouds.openstack.keystone.v2_0.domain.Access; import org.jclouds.openstack.keystone.v2_0.domain.Service; import org.jclouds.openstack.nova.v1_1.NovaAsyncClient; @@ -61,13 +61,13 @@ public class NovaRestClientModule extends RestClientModule Date: Wed, 1 Feb 2012 22:44:37 -0800 Subject: [PATCH 7/8] Missed HP Cloud RestClientodule --- .../HPCloudObjectStorageLasVegasRestClientModule.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/config/HPCloudObjectStorageLasVegasRestClientModule.java b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/config/HPCloudObjectStorageLasVegasRestClientModule.java index fe726a2bf8..f1d9ee9354 100644 --- a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/config/HPCloudObjectStorageLasVegasRestClientModule.java +++ b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/config/HPCloudObjectStorageLasVegasRestClientModule.java @@ -35,7 +35,7 @@ import org.jclouds.http.annotation.ServerError; import org.jclouds.http.handlers.BackoffLimitedRetryHandler; import org.jclouds.json.config.GsonModule.DateAdapter; import org.jclouds.json.config.GsonModule.Iso8601DateAdapter; -import org.jclouds.openstack.keystone.v2_0.config.KeyStoneAuthenticationModule; +import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule; import org.jclouds.openstack.keystone.v2_0.domain.Access; import org.jclouds.openstack.keystone.v2_0.domain.Service; import org.jclouds.openstack.services.ServiceType; @@ -60,13 +60,13 @@ import com.google.inject.Provides; public class HPCloudObjectStorageLasVegasRestClientModule extends RestClientModule { - private final KeyStoneAuthenticationModule authModule; + private final KeystoneAuthenticationModule authModule; public HPCloudObjectStorageLasVegasRestClientModule() { - this(new KeyStoneAuthenticationModule()); + this(new KeystoneAuthenticationModule()); } - public HPCloudObjectStorageLasVegasRestClientModule(KeyStoneAuthenticationModule authModule) { + public HPCloudObjectStorageLasVegasRestClientModule(KeystoneAuthenticationModule authModule) { super(HPCloudObjectStorageLasVegasClient.class, HPCloudObjectStorageLasVegasAsyncClient.class); this.authModule = authModule; } From d2a4bfa2a95e1f97ed4af433a554133e2dc02463 Mon Sep 17 00:00:00 2001 From: Jeremy Daggett Date: Mon, 6 Feb 2012 11:18:53 -0800 Subject: [PATCH 8/8] Updated NOTICE.txt and inserted correct production URL for PropertiesBuilder --- ...loudObjectStorageLasVegasPropertiesBuilder.java | 14 ++------------ resources/NOTICE.txt | 4 ++++ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasPropertiesBuilder.java b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasPropertiesBuilder.java index 10b2d7127b..c713c805a0 100644 --- a/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasPropertiesBuilder.java +++ b/providers/hpcloud-objectstorage-lvs/src/main/java/org/jclouds/hpcloud/objectstorage/lvs/HPCloudObjectStorageLasVegasPropertiesBuilder.java @@ -21,11 +21,9 @@ package org.jclouds.hpcloud.objectstorage.lvs; import static org.jclouds.Constants.PROPERTY_API_VERSION; import static org.jclouds.Constants.PROPERTY_ENDPOINT; import static org.jclouds.Constants.PROPERTY_ISO3166_CODES; -import static org.jclouds.hpcloud.objectstorage.lvs.reference.HPCloudObjectStorageLasVegasConstants.PROPERTY_CDN_ENDPOINT; import java.util.Properties; -import org.jclouds.openstack.OpenStackAuthAsyncClient; import org.jclouds.openstack.swift.SwiftPropertiesBuilder; /** @@ -41,18 +39,10 @@ public class HPCloudObjectStorageLasVegasPropertiesBuilder extends SwiftProperti protected Properties defaultProperties() { Properties properties = super.defaultProperties(); properties.setProperty(PROPERTY_ISO3166_CODES, "US-NV"); - properties.setProperty(PROPERTY_ENDPOINT, "https://region-a.geo-1.objects.hpcloudsvc.com/auth"); + properties.setProperty(PROPERTY_ENDPOINT, "https://region-a.geo-1.identity.hpcloudsvc.com"); properties.setProperty(PROPERTY_API_VERSION, "2.0"); - //properties.setProperty(PROPERTY_CDN_ENDPOINT, "https://region-a.geo-1.cdnmgmt.hpcloudsvc.com"); return properties; } - - /* - protected HPCloudObjectStorageLasVegasPropertiesBuilder withCDNEndpoint(String endpoint) { - properties.setProperty(PROPERTY_CDN_ENDPOINT, endpoint); - return this; - } - */ - + } diff --git a/resources/NOTICE.txt b/resources/NOTICE.txt index 03b15270e5..b0a56c74b6 100644 --- a/resources/NOTICE.txt +++ b/resources/NOTICE.txt @@ -60,3 +60,7 @@ distributed under the GNU Lesser GPL License, Version 3.0. This product includes aopalliance (http://aopalliance.sourceforge.net/) distributed in the Public Domain + +This product includes software developed at Hewlett-Packard +Copyright (c) 2011-2012 Hewlett-Packard Development Company, L.P +