mirror of https://github.com/apache/jclouds.git
Issue 879:keystone v2 hpcloud-objectstorage provider
This commit is contained in:
parent
c3dd362b4b
commit
33fa1ec555
|
@ -28,7 +28,7 @@ our compute api supports: aws-ec2, gogrid, cloudservers-us, stub (in-memory), de
|
||||||
to all of these providers
|
to all of these providers
|
||||||
|
|
||||||
our blobstore api supports: aws-s3, cloudfiles-us, cloudfiles-uk, filesystem,
|
our blobstore api supports: aws-s3, cloudfiles-us, cloudfiles-uk, filesystem,
|
||||||
azureblob, atmos (generic), synaptic-storage, hpcloud-objectstorage-las,
|
azureblob, atmos (generic), synaptic-storage, hpcloud-objectstorage,
|
||||||
cloudonestorage, walrus(generic), ninefold-storage,
|
cloudonestorage, walrus(generic), ninefold-storage,
|
||||||
eucalyptus-partnercloud-s3, swift (generic), transient (in-mem)
|
eucalyptus-partnercloud-s3, swift (generic), transient (in-mem)
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jclouds.provider</groupId>
|
<groupId>org.jclouds.provider</groupId>
|
||||||
<artifactId>hpcloud-objectstorage-lvs</artifactId>
|
<artifactId>hpcloud-objectstorage</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
<module>elb</module>
|
<module>elb</module>
|
||||||
<module>aws-elb</module>
|
<module>aws-elb</module>
|
||||||
<module>savvis-symphonyvpdc</module>
|
<module>savvis-symphonyvpdc</module>
|
||||||
<module>hpcloud-objectstorage</module>
|
|
||||||
<module>hpcloud-compute</module>
|
<module>hpcloud-compute</module>
|
||||||
<module>trystack-nova</module>
|
<module>trystack-nova</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
|
@ -1,25 +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.
|
|
||||||
====
|
|
||||||
|
|
||||||
#
|
|
||||||
# The jclouds API for HP Cloud Object Storage (https://manage.hpcloud.com/pages/build/docs/object-storage/overview).
|
|
||||||
#
|
|
||||||
# TODO: Implementation status.
|
|
||||||
# TODO: Supported features.
|
|
||||||
# TODO: Usage example.
|
|
|
@ -1,169 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!--
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
-->
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<parent>
|
|
||||||
<groupId>org.jclouds</groupId>
|
|
||||||
<artifactId>jclouds-project</artifactId>
|
|
||||||
<version>1.5.0-SNAPSHOT</version>
|
|
||||||
<relativePath>../../project/pom.xml</relativePath>
|
|
||||||
</parent>
|
|
||||||
<groupId>org.jclouds.provider</groupId>
|
|
||||||
<artifactId>hpcloud-objectstorage-lvs</artifactId>
|
|
||||||
<name>jclouds HP Cloud Object Storage in Las Vegas (SuperNAP)</name>
|
|
||||||
<description>jclouds components to access HP Cloud Services Object Storage in Las Vegas (SuperNAP)</description>
|
|
||||||
<packaging>bundle</packaging>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<test.initializer>org.jclouds.hpcloud.objectstorage.lvs.blobstore.integration.HPCloudObjectStorageLasVegasTestInitializer</test.initializer>
|
|
||||||
<test.hpcloud-objectstorage-lvs.endpoint>https://region-a.geo-1.identity.hpcloudsvc.com:35357</test.hpcloud-objectstorage-lvs.endpoint>
|
|
||||||
<test.hpcloud-objectstorage-lvs.api-version>1.0</test.hpcloud-objectstorage-lvs.api-version>
|
|
||||||
<test.hpcloud-objectstorage-lvs.build-version></test.hpcloud-objectstorage-lvs.build-version>
|
|
||||||
<test.hpcloud-objectstorage-lvs.identity>FIXME_IDENTITY</test.hpcloud-objectstorage-lvs.identity>
|
|
||||||
<test.hpcloud-objectstorage-lvs.credential>FIXME_CREDENTIAL</test.hpcloud-objectstorage-lvs.credential>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jclouds.api</groupId>
|
|
||||||
<artifactId>swift</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jclouds</groupId>
|
|
||||||
<artifactId>jclouds-core</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<type>test-jar</type>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jclouds.common</groupId>
|
|
||||||
<artifactId>openstack-common</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<type>test-jar</type>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jclouds</groupId>
|
|
||||||
<artifactId>jclouds-blobstore</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<type>test-jar</type>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jclouds.api</groupId>
|
|
||||||
<artifactId>swift</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<type>test-jar</type>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jclouds.driver</groupId>
|
|
||||||
<artifactId>jclouds-log4j</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>log4j</groupId>
|
|
||||||
<artifactId>log4j</artifactId>
|
|
||||||
<version>1.2.16</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<profiles>
|
|
||||||
<profile>
|
|
||||||
<id>live</id>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>integration</id>
|
|
||||||
<phase>integration-test</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>test</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<systemProperties>
|
|
||||||
<property>
|
|
||||||
<name>test.hpcloud-objectstorage-lvs.endpoint</name>
|
|
||||||
<value>${test.hpcloud-objectstorage-lvs.endpoint}</value>
|
|
||||||
</property>
|
|
||||||
<property>
|
|
||||||
<name>test.hpcloud-objectstorage-lvs.api-version</name>
|
|
||||||
<value>${test.hpcloud-objectstorage-lvs.api-version}</value>
|
|
||||||
</property>
|
|
||||||
<property>
|
|
||||||
<name>test.hpcloud-objectstorage-lvs.build-version</name>
|
|
||||||
<value>${test.hpcloud-objectstorage-lvs.build-version}</value>
|
|
||||||
</property>
|
|
||||||
<property>
|
|
||||||
<name>test.hpcloud-objectstorage-lvs.identity</name>
|
|
||||||
<value>${test.hpcloud-objectstorage-lvs.identity}</value>
|
|
||||||
</property>
|
|
||||||
<property>
|
|
||||||
<name>test.hpcloud-objectstorage-lvs.credential</name>
|
|
||||||
<value>${test.hpcloud-objectstorage-lvs.credential}</value>
|
|
||||||
</property>
|
|
||||||
<property>
|
|
||||||
<name>test.initializer</name>
|
|
||||||
<value>${test.initializer}</value>
|
|
||||||
</property>
|
|
||||||
<property>
|
|
||||||
<name>jclouds.blobstore.httpstream.url</name>
|
|
||||||
<value>${jclouds.blobstore.httpstream.url}</value>
|
|
||||||
</property>
|
|
||||||
<property>
|
|
||||||
<name>jclouds.blobstore.httpstream.md5</name>
|
|
||||||
<value>${jclouds.blobstore.httpstream.md5}</value>
|
|
||||||
</property>
|
|
||||||
</systemProperties>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</profile>
|
|
||||||
</profiles>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.felix</groupId>
|
|
||||||
<artifactId>maven-bundle-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<instructions>
|
|
||||||
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
|
|
||||||
<Export-Package>org.jclouds.hpcloud.objectstorage.lvs*;version="${project.version}"</Export-Package>
|
|
||||||
<Import-Package>org.jclouds*;version="${project.version}",*</Import-Package>
|
|
||||||
</instructions>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
|
|
|
@ -1,40 +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.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 <a href="https://manage.hpcloud.com/pages/build/docs/object-storage/api">HP Cloud Object Storage API</a>
|
|
||||||
* @author Jeremy Daggett
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Retention(value = RetentionPolicy.RUNTIME)
|
|
||||||
@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
|
|
||||||
@Qualifier
|
|
||||||
public @interface CDNManagement {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,160 +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.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.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;
|
|
||||||
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;
|
|
||||||
|
|
||||||
import com.google.common.annotations.Beta;
|
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides asynchronous access to HP Cloud Object StorageLasVegas via the REST API.
|
|
||||||
*
|
|
||||||
* <p/>All commands return a ListenableFuture of the result. Any exceptions incurred
|
|
||||||
* during processing will be wrapped in an {@link ExecutionException} as documented in
|
|
||||||
* {@link ListenableFuture#get()}.
|
|
||||||
*
|
|
||||||
* @see HPCloudObjectStorageLasVegasClient
|
|
||||||
* @see <a href="https://manage.hpcloud.com/pages/build/docs/objectstorage-lvs/api">HP Cloud Object StorageLasVegas API</a>
|
|
||||||
* @author Jeremy Daggett
|
|
||||||
*/
|
|
||||||
@SkipEncoding('/')
|
|
||||||
@RequestFilters(AuthenticateRequest.class)
|
|
||||||
@Endpoint(ObjectStore.class)
|
|
||||||
public interface HPCloudObjectStorageLasVegasAsyncClient extends CommonSwiftAsyncClient {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see HPCloudObjectStorageLasVegasClient#getCDNMetadata(String)
|
|
||||||
*/
|
|
||||||
@Beta
|
|
||||||
@HEAD
|
|
||||||
@ResponseParser(ParseContainerMetadataFromHeaders.class)
|
|
||||||
@ExceptionParser(ReturnNullOnContainerNotFound.class)
|
|
||||||
@Path("/{container}")
|
|
||||||
ListenableFuture<ContainerMetadata> getContainerMetadata(@PathParam("container") String container);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see HPCloudObjectStorageLasVegasClient#createContainer
|
|
||||||
*/
|
|
||||||
@PUT
|
|
||||||
@Path("/{container}")
|
|
||||||
ListenableFuture<Boolean> createContainer(@PathParam("container") String container,
|
|
||||||
CreateContainerOptions... options);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see HPCloudObjectStorageClient#listCDNContainers(ListCDNContainerOptions)
|
|
||||||
*/
|
|
||||||
@Beta
|
|
||||||
@GET
|
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
|
||||||
@QueryParams(keys = "format", values = "json")
|
|
||||||
@Path("/")
|
|
||||||
@Endpoint(HPExtensionCDN.class)
|
|
||||||
ListenableFuture<? extends Set<ContainerCDNMetadata>> listCDNContainers(ListCDNContainerOptions... options);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see HPCloudObjectStorageClient#getCDNMetadata(String)
|
|
||||||
*/
|
|
||||||
@Beta
|
|
||||||
@HEAD
|
|
||||||
@ResponseParser(ParseContainerCDNMetadataFromHeaders.class)
|
|
||||||
@ExceptionParser(ReturnNullOnContainerNotFound.class)
|
|
||||||
@Path("/{container}")
|
|
||||||
@Endpoint(HPExtensionCDN.class)
|
|
||||||
ListenableFuture<ContainerCDNMetadata> 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(HPExtensionCDN.class)
|
|
||||||
ListenableFuture<URI> 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(HPExtensionCDN.class)
|
|
||||||
ListenableFuture<URI> enableCDN(@PathParam("container") String container);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see HPCloudObjectStorageClient#updateCDN(String, long)
|
|
||||||
*/
|
|
||||||
@Beta
|
|
||||||
@POST
|
|
||||||
@Path("/{container}")
|
|
||||||
@ResponseParser(ParseCDNUriFromHeaders.class)
|
|
||||||
@Endpoint(HPExtensionCDN.class)
|
|
||||||
ListenableFuture<URI> 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(HPExtensionCDN.class)
|
|
||||||
ListenableFuture<Boolean> disableCDN(@PathParam("container") String container);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,73 +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.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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Provides synchronous access to HP Cloud Object StorageLasVegas via the REST API.
|
|
||||||
*
|
|
||||||
* <p/>
|
|
||||||
* All commands return a ListenableFuture of the result. Any exceptions incurred during processing
|
|
||||||
* will be wrapped in an {@link ExecutionException} as documented in {@link ListenableFuture#get()}.
|
|
||||||
*
|
|
||||||
* @see HPCloudObjectStorageLasVegasClient
|
|
||||||
* @see <a href="https://manage.hpcloud.com/pages/build/docs/objectstorage-lvs/api">HP Cloud Object
|
|
||||||
* StorageLasVegas API</a>
|
|
||||||
* @author Jeremy Daggett
|
|
||||||
*/
|
|
||||||
@Timeout(duration = 120, timeUnit = TimeUnit.SECONDS)
|
|
||||||
public interface HPCloudObjectStorageLasVegasClient extends CommonSwiftClient {
|
|
||||||
|
|
||||||
boolean createContainer(String container, CreateContainerOptions... options);
|
|
||||||
|
|
||||||
ContainerMetadata getContainerMetadata(String container);
|
|
||||||
|
|
||||||
@Beta
|
|
||||||
Set<ContainerCDNMetadata> 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);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,61 +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.hpcloud.objectstorage.lvs;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.jclouds.blobstore.BlobStoreContextBuilder;
|
|
||||||
import org.jclouds.hpcloud.objectstorage.lvs.blobstore.config.HPCloudObjectStorageLasVegasBlobStoreContextModule;
|
|
||||||
import org.jclouds.hpcloud.objectstorage.lvs.config.HPCloudObjectStorageLasVegasRestClientModule;
|
|
||||||
import org.jclouds.http.config.JavaUrlHttpCommandExecutorServiceModule;
|
|
||||||
import org.jclouds.logging.jdk.config.JDKLoggingModule;
|
|
||||||
|
|
||||||
import com.google.inject.Injector;
|
|
||||||
import com.google.inject.Module;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates {@link HPCloudObjectStorageLasVegasBlobStore} or {@link Injector} instances based on the most
|
|
||||||
* commonly requested arguments.
|
|
||||||
* <p/>
|
|
||||||
* Note that Threadsafe objects will be bound as singletons to the Injector or Context provided.
|
|
||||||
* <p/>
|
|
||||||
* <p/>
|
|
||||||
* If no <code>Module</code>s are specified, the default {@link JDKLoggingModule logging} and
|
|
||||||
* {@link JavaUrlHttpCommandExecutorServiceModule http transports} will be installed.
|
|
||||||
*
|
|
||||||
* @author Adrian Cole, Andrew Newdigate
|
|
||||||
* @see HPCloudObjectStorageLasVegasBlobStore
|
|
||||||
*/
|
|
||||||
public class HPCloudObjectStorageLasVegasContextBuilder extends BlobStoreContextBuilder<HPCloudObjectStorageLasVegasClient, HPCloudObjectStorageLasVegasAsyncClient> {
|
|
||||||
|
|
||||||
public HPCloudObjectStorageLasVegasContextBuilder(Properties props) {
|
|
||||||
super(HPCloudObjectStorageLasVegasClient.class, HPCloudObjectStorageLasVegasAsyncClient.class, props);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addContextModule(List<Module> modules) {
|
|
||||||
modules.add(new HPCloudObjectStorageLasVegasBlobStoreContextModule());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addClientModule(List<Module> modules) {
|
|
||||||
modules.add(new HPCloudObjectStorageLasVegasRestClientModule());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,51 +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.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 java.util.Properties;
|
|
||||||
|
|
||||||
import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties;
|
|
||||||
import org.jclouds.openstack.services.ServiceType;
|
|
||||||
import org.jclouds.openstack.swift.SwiftPropertiesBuilder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Jeremy Daggett
|
|
||||||
*/
|
|
||||||
public class HPCloudObjectStorageLasVegasPropertiesBuilder extends SwiftPropertiesBuilder {
|
|
||||||
|
|
||||||
public HPCloudObjectStorageLasVegasPropertiesBuilder(Properties properties) {
|
|
||||||
super(properties);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Properties defaultProperties() {
|
|
||||||
Properties properties = super.defaultProperties();
|
|
||||||
properties.setProperty(KeystoneProperties.SERVICE_TYPE, ServiceType.OBJECT_STORE);
|
|
||||||
properties.setProperty(PROPERTY_ISO3166_CODES, "US-NV");
|
|
||||||
properties.setProperty(PROPERTY_ENDPOINT, "https://region-a.geo-1.identity.hpcloudsvc.com");
|
|
||||||
properties.setProperty(PROPERTY_API_VERSION, "2.0");
|
|
||||||
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,116 +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.hpcloud.objectstorage.lvs;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.jclouds.providers.BaseProviderMetadata;
|
|
||||||
import org.jclouds.providers.ProviderMetadata;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implementation of {@link org.jclouds.providers.ProviderMetadata} for HP Cloud Services Object StorageLasVegas
|
|
||||||
*
|
|
||||||
* @author Jeremy Daggett
|
|
||||||
*/
|
|
||||||
public class HPCloudObjectStorageLasVegasProviderMetadata extends BaseProviderMetadata {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String getId() {
|
|
||||||
return "hpcloud-objectstorage-lvs";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String getType() {
|
|
||||||
return ProviderMetadata.BLOBSTORE_TYPE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "HP Cloud Services Object StorageLasVegas";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String getIdentityName() {
|
|
||||||
return "email:tenantId";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String getCredentialName() {
|
|
||||||
return "API Key";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public URI getHomepage() {
|
|
||||||
return URI.create("http://hpcloud.com");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public URI getConsole() {
|
|
||||||
return URI.create("https://manage.hpcloud.com/objects/us-west");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public URI getApiDocumentation() {
|
|
||||||
return URI.create("TODO");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Set<String> getLinkedServices() {
|
|
||||||
return ImmutableSet.of("hpcloud-compute", "hpcloud-objectstorage-lvs");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Set<String> getIso3166Codes() {
|
|
||||||
return ImmutableSet.of("US-NV");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,95 +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.hpcloud.objectstorage.lvs.blobstore;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Named;
|
|
||||||
import javax.inject.Provider;
|
|
||||||
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;
|
|
||||||
import org.jclouds.openstack.swift.blobstore.functions.ContainerToResourceList;
|
|
||||||
import org.jclouds.openstack.swift.blobstore.functions.ContainerToResourceMetadata;
|
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class HPCloudObjectStorageLasVegasAsyncBlobStore extends SwiftAsyncBlobStore {
|
|
||||||
private final EnableCDNAndCache enableCDNAndCache;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
protected HPCloudObjectStorageLasVegasAsyncBlobStore(BlobStoreContext context, BlobUtils blobUtils,
|
|
||||||
@Named(Constants.PROPERTY_USER_THREADS) ExecutorService service, Supplier<Location> defaultLocation,
|
|
||||||
@Memoized Supplier<Set<? extends Location>> locations, HPCloudObjectStorageLasVegasClient sync, HPCloudObjectStorageLasVegasAsyncClient async,
|
|
||||||
ContainerToResourceMetadata container2ResourceMd,
|
|
||||||
BlobStoreListContainerOptionsToListContainerOptions container2ContainerListOptions,
|
|
||||||
ContainerToResourceList container2ResourceList, ObjectToBlob object2Blob, BlobToObject blob2Object,
|
|
||||||
ObjectToBlobMetadata object2BlobMd, BlobToHttpGetOptions blob2ObjectGetOptions,
|
|
||||||
Provider<FetchBlobMetadata> 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<Boolean> createContainerInLocation(Location location, final String container,
|
|
||||||
CreateContainerOptions options) {
|
|
||||||
|
|
||||||
ListenableFuture<Boolean> returnVal = createContainerInLocation(location, container);
|
|
||||||
if (options.isPublicRead())
|
|
||||||
return Futures.compose(createContainerInLocation(location, container), new Function<Boolean, Boolean>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean apply(Boolean input) {
|
|
||||||
if (Boolean.TRUE.equals(input)) {
|
|
||||||
return enableCDNAndCache.apply(container) != null;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}, service);
|
|
||||||
return returnVal;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,80 +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.hpcloud.objectstorage.lvs.blobstore;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Provider;
|
|
||||||
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;
|
|
||||||
import org.jclouds.openstack.swift.blobstore.functions.BlobToObject;
|
|
||||||
import org.jclouds.openstack.swift.blobstore.functions.ContainerToResourceList;
|
|
||||||
import org.jclouds.openstack.swift.blobstore.functions.ContainerToResourceMetadata;
|
|
||||||
import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlob;
|
|
||||||
import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlobMetadata;
|
|
||||||
|
|
||||||
import com.google.common.base.Supplier;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class HPCloudObjectStorageLasVegasBlobStore extends SwiftBlobStore {
|
|
||||||
|
|
||||||
private EnableCDNAndCache enableCDNAndCache;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
protected HPCloudObjectStorageLasVegasBlobStore(BlobStoreContext context, BlobUtils blobUtils,
|
|
||||||
Supplier<Location> defaultLocation, @Memoized Supplier<Set<? extends Location>> locations,
|
|
||||||
CommonSwiftClient sync, ContainerToResourceMetadata container2ResourceMd,
|
|
||||||
BlobStoreListContainerOptionsToListContainerOptions container2ContainerListOptions,
|
|
||||||
ContainerToResourceList container2ResourceList, ObjectToBlob object2Blob, BlobToObject blob2Object,
|
|
||||||
ObjectToBlobMetadata object2BlobMd, BlobToHttpGetOptions blob2ObjectGetOptions,
|
|
||||||
Provider<FetchBlobMetadata> 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,97 +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.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<String, URI> {
|
|
||||||
@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<String, URI> cdnContainer(GetCDNMetadata loader) {
|
|
||||||
return CacheBuilder.newBuilder().expireAfterWrite(30, TimeUnit.SECONDS).build(loader);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void configure() {
|
|
||||||
super.configure();
|
|
||||||
bind(SwiftBlobStore.class).to(HPCloudObjectStorageLasVegasBlobStore.class);
|
|
||||||
bind(SwiftAsyncBlobStore.class).to(HPCloudObjectStorageLasVegasAsyncBlobStore.class);
|
|
||||||
bind(ObjectToBlobMetadata.class).to(HPCloudObjectStorageLasVegasObjectToBlobMetadata.class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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.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<String, URI> {
|
|
||||||
private final LoadingCache<String, URI> cdnContainer;
|
|
||||||
private final HPCloudObjectStorageLasVegasClient sync;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
public EnableCDNAndCache(HPCloudObjectStorageLasVegasClient sync, LoadingCache<String, URI> cdnContainer) {
|
|
||||||
this.sync = sync;
|
|
||||||
this.cdnContainer = cdnContainer;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public URI apply(String input) {
|
|
||||||
URI uri = sync.enableCDN(input);
|
|
||||||
cdnContainer.put(input, uri);
|
|
||||||
return uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -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.hpcloud.objectstorage.lvs.blobstore.functions;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
import org.jclouds.blobstore.domain.MutableBlobMetadata;
|
|
||||||
import org.jclouds.blobstore.strategy.IfDirectoryReturnNameStrategy;
|
|
||||||
import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlobMetadata;
|
|
||||||
import org.jclouds.openstack.swift.domain.ObjectInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Singleton
|
|
||||||
public class HPCloudObjectStorageLasVegasObjectToBlobMetadata extends ObjectToBlobMetadata {
|
|
||||||
|
|
||||||
private final PublicUriForObjectInfo publicUriForObjectInfo;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,63 +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.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<ObjectInfo, URI> {
|
|
||||||
private final LoadingCache<String, URI> cdnContainer;
|
|
||||||
private final Provider<UriBuilder> uriBuilders;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
public PublicUriForObjectInfo(LoadingCache<String, URI> cdnContainer, Provider<UriBuilder> 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,113 +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.hpcloud.objectstorage.lvs.config;
|
|
||||||
|
|
||||||
import static org.jclouds.util.Suppliers2.getLastValueInMap;
|
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
|
|
||||||
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.RequiresHttp;
|
|
||||||
import org.jclouds.http.annotation.ClientError;
|
|
||||||
import org.jclouds.http.annotation.Redirection;
|
|
||||||
import org.jclouds.http.annotation.ServerError;
|
|
||||||
import org.jclouds.json.config.GsonModule.DateAdapter;
|
|
||||||
import org.jclouds.json.config.GsonModule.Iso8601DateAdapter;
|
|
||||||
import org.jclouds.location.suppliers.RegionIdToURISupplier;
|
|
||||||
import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule;
|
|
||||||
import org.jclouds.openstack.services.ServiceType;
|
|
||||||
import org.jclouds.openstack.swift.CommonSwiftAsyncClient;
|
|
||||||
import org.jclouds.openstack.swift.CommonSwiftClient;
|
|
||||||
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.annotations.ApiVersion;
|
|
||||||
import org.jclouds.rest.config.RestClientModule;
|
|
||||||
|
|
||||||
import com.google.common.base.Supplier;
|
|
||||||
import com.google.inject.Provides;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@ConfiguresRestClient
|
|
||||||
@RequiresHttp
|
|
||||||
public class HPCloudObjectStorageLasVegasRestClientModule extends
|
|
||||||
RestClientModule<HPCloudObjectStorageLasVegasClient, HPCloudObjectStorageLasVegasAsyncClient> {
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
|
||||||
@Singleton
|
|
||||||
CommonSwiftClient provideCommonSwiftClient(HPCloudObjectStorageLasVegasClient in) {
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
|
||||||
@Singleton
|
|
||||||
CommonSwiftAsyncClient provideCommonSwiftClient(HPCloudObjectStorageLasVegasAsyncClient in) {
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
|
||||||
@Singleton
|
|
||||||
@HPExtensionCDN
|
|
||||||
protected Supplier<URI> provideCDNUrl(RegionIdToURISupplier.Factory factory, @ApiVersion String apiVersion) {
|
|
||||||
return getLastValueInMap(factory.createForApiTypeAndVersion(HPExtentionServiceType.CDN, apiVersion));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
|
||||||
@Singleton
|
|
||||||
@Storage
|
|
||||||
protected Supplier<URI> provideStorageUrl(RegionIdToURISupplier.Factory factory, @ApiVersion String apiVersion) {
|
|
||||||
return getLastValueInMap(factory.createForApiTypeAndVersion(ServiceType.OBJECT_STORE, apiVersion));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,120 +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.hpcloud.objectstorage.lvs.domain;
|
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author James Murty
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class ContainerCDNMetadata implements Comparable<ContainerCDNMetadata> {
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
private boolean cdn_enabled;
|
|
||||||
private long ttl;
|
|
||||||
@SerializedName("x-cdn-uri")
|
|
||||||
private URI cdn_uri;
|
|
||||||
private String referrer_acl;
|
|
||||||
private String useragent_acl;
|
|
||||||
private boolean log_retention;
|
|
||||||
|
|
||||||
public ContainerCDNMetadata(String name, boolean cdnEnabled, long ttl, URI cdnUri) {
|
|
||||||
this.name = name;
|
|
||||||
this.cdn_enabled = cdnEnabled;
|
|
||||||
this.ttl = ttl;
|
|
||||||
this.cdn_uri = cdnUri;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ContainerCDNMetadata() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Beware: The container name is not available from HEAD CDN responses and will be null. return
|
|
||||||
* the name of the container to which these CDN settings apply.
|
|
||||||
*/
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public URI getCDNUri() {
|
|
||||||
return cdn_uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getTTL() {
|
|
||||||
return ttl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCDNEnabled() {
|
|
||||||
return cdn_enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int compareTo(ContainerCDNMetadata o) {
|
|
||||||
if (getName() == null)
|
|
||||||
return -1;
|
|
||||||
return (this == o) ? 0 : getName().compareTo(o.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
final int prime = 31;
|
|
||||||
int result = 1;
|
|
||||||
result = prime * result + ((cdn_uri == null) ? 0 : cdn_uri.hashCode());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj)
|
|
||||||
return true;
|
|
||||||
if (obj == null)
|
|
||||||
return false;
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
return false;
|
|
||||||
ContainerCDNMetadata other = (ContainerCDNMetadata) obj;
|
|
||||||
if (cdn_uri == null) {
|
|
||||||
if (other.cdn_uri != null)
|
|
||||||
return false;
|
|
||||||
} else if (!cdn_uri.equals(other.cdn_uri))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getReferrerACL() {
|
|
||||||
return referrer_acl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUseragentACL() {
|
|
||||||
return useragent_acl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isLogRetention() {
|
|
||||||
return log_retention;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return String.format(
|
|
||||||
"[name=%s, cdn_uri=%s, cdn_enabled=%s, log_retention=%s, referrer_acl=%s, ttl=%s, useragent_acl=%s]",
|
|
||||||
name, cdn_uri, cdn_enabled, log_retention, referrer_acl, ttl, useragent_acl);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,46 +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.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<HttpResponse, URI> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,74 +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.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<HttpResponse, ContainerCDNMetadata>, InvocationContext<ParseContainerCDNMetadataFromHeaders> {
|
|
||||||
|
|
||||||
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<String> 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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,77 +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.hpcloud.objectstorage.lvs.functions;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
|
||||||
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import org.jclouds.http.HttpRequest;
|
|
||||||
import org.jclouds.http.HttpResponse;
|
|
||||||
import org.jclouds.openstack.swift.domain.ContainerMetadata;
|
|
||||||
import org.jclouds.openstack.swift.reference.SwiftHeaders;
|
|
||||||
import org.jclouds.rest.InvocationContext;
|
|
||||||
import org.jclouds.rest.internal.GeneratedHttpRequest;
|
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This parses @{link {@link org.jclouds.hpcloud.objectstorage.lvs.domain.ContainerMetadata} from
|
|
||||||
* HTTP headers.
|
|
||||||
*
|
|
||||||
* @author Jeremy Daggett
|
|
||||||
*/
|
|
||||||
public class ParseContainerMetadataFromHeaders implements Function<HttpResponse, ContainerMetadata>,
|
|
||||||
InvocationContext<ParseContainerMetadataFromHeaders> {
|
|
||||||
private GeneratedHttpRequest<?> request;
|
|
||||||
|
|
||||||
public ContainerMetadata apply(HttpResponse from) {
|
|
||||||
ContainerMetadata to = new ContainerMetadata();
|
|
||||||
|
|
||||||
to.setName(request.getArgs().get(0).toString());
|
|
||||||
|
|
||||||
to.setReadACL(from.getFirstHeaderOrNull(SwiftHeaders.CONTAINER_READ));
|
|
||||||
|
|
||||||
to.setBytes(new Long(from.getFirstHeaderOrNull(SwiftHeaders.CONTAINER_BYTES_USED)));
|
|
||||||
to.setCount(new Long(from.getFirstHeaderOrNull(SwiftHeaders.CONTAINER_OBJECT_COUNT)));
|
|
||||||
|
|
||||||
addUserMetadataTo(from, to);
|
|
||||||
|
|
||||||
return to;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@VisibleForTesting
|
|
||||||
void addUserMetadataTo(HttpResponse from, ContainerMetadata metadata) {
|
|
||||||
for (Entry<String, String> header : from.getHeaders().entries()) {
|
|
||||||
if (header.getKey() != null && header.getKey().startsWith(SwiftHeaders.CONTAINER_METADATA_PREFIX))
|
|
||||||
metadata.getMetadata().put((header.getKey().substring(SwiftHeaders.CONTAINER_METADATA_PREFIX.length())).toLowerCase(),
|
|
||||||
header.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ParseContainerMetadataFromHeaders setContext(HttpRequest request) {
|
|
||||||
checkArgument(request instanceof GeneratedHttpRequest<?>, "note this handler requires a GeneratedHttpRequest");
|
|
||||||
this.request = (GeneratedHttpRequest<?>) request;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,81 +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.hpcloud.objectstorage.lvs.options;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import org.jclouds.http.options.BaseHttpRequestOptions;
|
|
||||||
import org.jclouds.openstack.swift.reference.SwiftHeaders;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Contains options supported in the REST API for the Create Container operation.
|
|
||||||
*
|
|
||||||
* This specifically enabes the Swift ACL for public reads using the 'X-Container-Read'
|
|
||||||
* header. This should be refactored into the Swift API.
|
|
||||||
*
|
|
||||||
* @author Jeremy Daggett
|
|
||||||
*/
|
|
||||||
public class CreateContainerOptions extends BaseHttpRequestOptions {
|
|
||||||
public static final CreateContainerOptions NONE = new CreateContainerOptions();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A name-value pair to associate with the container as metadata.
|
|
||||||
*/
|
|
||||||
public CreateContainerOptions withMetadata(Map<String, String> metadata) {
|
|
||||||
for (Entry<String, String> entry : metadata.entrySet()) {
|
|
||||||
if (entry.getKey().startsWith(SwiftHeaders.CONTAINER_METADATA_PREFIX)) {
|
|
||||||
this.headers.put(entry.getKey(), entry.getValue());
|
|
||||||
} else {
|
|
||||||
this.headers.put(SwiftHeaders.CONTAINER_METADATA_PREFIX + entry.getKey(),
|
|
||||||
entry.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates whether a container may be accessed publicly
|
|
||||||
*/
|
|
||||||
public CreateContainerOptions withPublicAccess() {
|
|
||||||
this.headers.put(SwiftHeaders.CONTAINER_READ, ".r:*,.rlistings");
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Builder {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see CreateContainerOptions#withPublicAccess
|
|
||||||
*/
|
|
||||||
public static CreateContainerOptions withPublicAccess() {
|
|
||||||
CreateContainerOptions options = new CreateContainerOptions();
|
|
||||||
return options.withPublicAccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see CreateContainerOptions#withMetadata(Multimap<String, String>)
|
|
||||||
*/
|
|
||||||
public static CreateContainerOptions withMetadata(Map<String, String> metadata) {
|
|
||||||
CreateContainerOptions options = new CreateContainerOptions();
|
|
||||||
return (CreateContainerOptions) options.withMetadata(metadata);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,86 +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.hpcloud.objectstorage.lvs.options;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
import static com.google.common.base.Preconditions.checkState;
|
|
||||||
|
|
||||||
import org.jclouds.http.options.BaseHttpRequestOptions;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Contains options supported in the REST API for the GET CDN containers operation.
|
|
||||||
*/
|
|
||||||
public class ListCDNContainerOptions extends BaseHttpRequestOptions {
|
|
||||||
public static final ListCDNContainerOptions NONE = new ListCDNContainerOptions();
|
|
||||||
|
|
||||||
public ListCDNContainerOptions enabledOnly() {
|
|
||||||
queryParameters.put("enabled_only", "true");
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates where to begin listing the identity's containers. The list will only include
|
|
||||||
* containers whose names occur lexicographically after the marker. This is convenient for
|
|
||||||
* pagination: To get the next page of results use the last container name of the current
|
|
||||||
* page as the marker.
|
|
||||||
*/
|
|
||||||
public ListCDNContainerOptions afterMarker(String marker) {
|
|
||||||
queryParameters.put("marker", checkNotNull(marker, "marker"));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The maximum number of containers that will be included in the response body.
|
|
||||||
* The server might return fewer than this many containers, but will not return more.
|
|
||||||
*/
|
|
||||||
public ListCDNContainerOptions maxResults(int limit) {
|
|
||||||
checkState(limit >= 0, "limit must be >= 0");
|
|
||||||
checkState(limit <= 10000, "limit must be <= 10000");
|
|
||||||
queryParameters.put("limit", Integer.toString(limit));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Builder {
|
|
||||||
|
|
||||||
public static ListCDNContainerOptions enabledOnly() {
|
|
||||||
ListCDNContainerOptions options = new ListCDNContainerOptions();
|
|
||||||
return options.enabledOnly();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ListCDNContainerOptions#afterMarker(String)
|
|
||||||
*/
|
|
||||||
public static ListCDNContainerOptions afterMarker(String marker) {
|
|
||||||
ListCDNContainerOptions options = new ListCDNContainerOptions();
|
|
||||||
return options.afterMarker(marker);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ListCDNContainerOptions#limit(int)
|
|
||||||
*/
|
|
||||||
public static ListCDNContainerOptions maxResults(int limit) {
|
|
||||||
ListCDNContainerOptions options = new ListCDNContainerOptions();
|
|
||||||
return options.maxResults(limit);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,27 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This package contains an HP Cloud Object StorageLasVegas client implemented by {@link org.jclouds.http.HttpCommandExecutorService} commands.
|
|
||||||
*
|
|
||||||
* @see <a href="https://manage.hpcloud.com/pages/build/docs/objectstorage-lvs/api" />
|
|
||||||
*
|
|
||||||
* @author Jeremy Daggett
|
|
||||||
*/
|
|
||||||
package org.jclouds.hpcloud.objectstorage.lvs;
|
|
|
@ -1,32 +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.hpcloud.objectstorage.lvs.reference;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configuration properties and constants used by HP Cloud Object StorageLasVegas.
|
|
||||||
*
|
|
||||||
* @author Jeremy Daggett
|
|
||||||
*/
|
|
||||||
public interface HPCloudObjectStorageLasVegasConstants {
|
|
||||||
/**
|
|
||||||
* The CDN Endpoint property
|
|
||||||
*/
|
|
||||||
public static final String PROPERTY_CDN_ENDPOINT = "jclouds.hpcloud-objectstorage-lvs.cdn.endpoint";
|
|
||||||
}
|
|
|
@ -1,40 +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.hpcloud.objectstorage.lvs.reference;
|
|
||||||
|
|
||||||
import org.jclouds.openstack.swift.reference.SwiftHeaders;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Additional headers specified by HP Cloud Object StorageLasVegas REST API.
|
|
||||||
*
|
|
||||||
* @see <a href="https://manage.hpcloud.com/pages/build/docs/objectstorage-lvs/api" />
|
|
||||||
* @author Jeremy Daggett
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
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";
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,25 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This package contains properties and reference data used in HP Cloud Object StorageLasVegas.
|
|
||||||
*
|
|
||||||
* @author Jeremy Daggett
|
|
||||||
*/
|
|
||||||
package org.jclouds.hpcloud.objectstorage.lvs.reference;
|
|
|
@ -1,41 +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.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 <a href="http://docs.openstack.org/api/openstack-typeentity-service/2.0/content/Identity-Service-Concepts-e1362.html"
|
|
||||||
* />
|
|
||||||
* @see HPExtensionServiceType#BLOCK_STORE
|
|
||||||
*/
|
|
||||||
@Retention(value = RetentionPolicy.RUNTIME)
|
|
||||||
@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
|
|
||||||
@Qualifier
|
|
||||||
public @interface HPExtensionBlockStore {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,41 +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.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 <a href="http://docs.openstack.org/api/openstack-typeentity-service/2.0/content/Identity-Service-Concepts-e1362.html"
|
|
||||||
* />
|
|
||||||
* @see HPExtensionServiceType#CDN
|
|
||||||
*/
|
|
||||||
@Retention(value = RetentionPolicy.RUNTIME)
|
|
||||||
@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD })
|
|
||||||
@Qualifier
|
|
||||||
public @interface HPExtensionCDN {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,43 +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, 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 <a href="http://docs.openstack.org/api/openstack-typeentity-service/2.0/content/Identity-Service-Concepts-e1362.html"
|
|
||||||
* />
|
|
||||||
*/
|
|
||||||
public interface HPExtentionServiceType extends ServiceType {
|
|
||||||
/**
|
|
||||||
* CDN
|
|
||||||
*/
|
|
||||||
public static final String CDN = "hpext:cdn";
|
|
||||||
/**
|
|
||||||
* Block Storage
|
|
||||||
*/
|
|
||||||
public static final String BLOCK_STORE = "hpext:block-store";
|
|
||||||
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
org.jclouds.hpcloud.objectstorage.lvs.HPCloudObjectStorageLasVegasProviderMetadata
|
|
|
@ -1,145 +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.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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Test(groups = "live", testName = "HPCloudObjectStorageLasVegasClientLiveTest")
|
|
||||||
public class HPCloudObjectStorageLasVegasClientLiveTest extends CommonSwiftClientLiveTest<HPCloudObjectStorageLasVegasClient> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HPCloudObjectStorageLasVegasClient getApi() {
|
|
||||||
return (HPCloudObjectStorageLasVegasClient) context.getProviderSpecificContext().getApi();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void testGetObjectContentType(SwiftObject getBlob) {
|
|
||||||
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<ContainerCDNMetadata> 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<ContainerCDNMetadata>() { 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,37 +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.hpcloud.objectstorage.lvs;
|
|
||||||
|
|
||||||
import org.jclouds.providers.BaseProviderMetadataTest;
|
|
||||||
import org.jclouds.providers.ProviderMetadata;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The HPCloudObjectStorageLasVegasProviderTest tests the {@link org.jclouds.hpcloud.objectstorage.lvs.HPCloudObjectStorageLasVegasProviderMetadata} class.
|
|
||||||
*
|
|
||||||
* @author Jeremy Daggett
|
|
||||||
*/
|
|
||||||
@Test(groups = "unit", testName = "HPCloudObjectStorageLasVegasProviderTest")
|
|
||||||
public class HPCloudObjectStorageLasVegasProviderTest extends BaseProviderMetadataTest {
|
|
||||||
|
|
||||||
public HPCloudObjectStorageLasVegasProviderTest() {
|
|
||||||
super(new HPCloudObjectStorageLasVegasProviderMetadata(), ProviderMetadata.BLOBSTORE_TYPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,38 +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.hpcloud.objectstorage.lvs.blobstore.integration;
|
|
||||||
|
|
||||||
import org.jclouds.blobstore.domain.Blob;
|
|
||||||
import org.jclouds.openstack.swift.blobstore.integration.SwiftBlobIntegrationLiveTest;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Jeremy Daggett
|
|
||||||
*/
|
|
||||||
@Test(groups = "live")
|
|
||||||
public class HPCloudObjectStorageLasVegasBlobIntegrationLiveTest extends SwiftBlobIntegrationLiveTest {
|
|
||||||
@Override
|
|
||||||
protected void checkContentDisposition(Blob blob, String contentDisposition) {
|
|
||||||
assert blob.getPayload().getContentMetadata().getContentDisposition().startsWith(contentDisposition) : blob
|
|
||||||
.getPayload().getContentMetadata().getContentDisposition();
|
|
||||||
assert blob.getMetadata().getContentMetadata().getContentDisposition().startsWith(contentDisposition) : blob
|
|
||||||
.getMetadata().getContentMetadata().getContentDisposition();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,30 +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.hpcloud.objectstorage.lvs.blobstore.integration;
|
|
||||||
|
|
||||||
import org.jclouds.openstack.swift.blobstore.integration.SwiftBlobLiveTest;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Jeremy Daggett
|
|
||||||
*/
|
|
||||||
@Test(groups = { "live" })
|
|
||||||
public class HPCloudObjectStorageLasVegasBlobLiveTest extends SwiftBlobLiveTest {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,30 +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.hpcloud.objectstorage.lvs.blobstore.integration;
|
|
||||||
|
|
||||||
import org.jclouds.openstack.swift.blobstore.integration.SwiftBlobMapIntegrationLiveTest;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Jeremy Daggett
|
|
||||||
*/
|
|
||||||
@Test(groups = "live")
|
|
||||||
public class HPCloudObjectStorageLasVegasBlobMapIntegrationLiveTest extends SwiftBlobMapIntegrationLiveTest {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,30 +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.hpcloud.objectstorage.lvs.blobstore.integration;
|
|
||||||
|
|
||||||
import org.jclouds.openstack.swift.blobstore.integration.SwiftBlobSignerLiveTest;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Jeremy Daggett
|
|
||||||
*/
|
|
||||||
@Test(groups = { "live" })
|
|
||||||
public class HPCloudObjectStorageLasVegasBlobSignerLiveTest extends SwiftBlobSignerLiveTest {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,30 +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.hpcloud.objectstorage.lvs.blobstore.integration;
|
|
||||||
|
|
||||||
import org.jclouds.openstack.swift.blobstore.integration.SwiftContainerIntegrationLiveTest;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Jeremy Daggett
|
|
||||||
*/
|
|
||||||
@Test(groups = "live")
|
|
||||||
public class HPCloudObjectStorageLasVegasContainerIntegrationLiveTest extends SwiftContainerIntegrationLiveTest {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,38 +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.hpcloud.objectstorage.lvs.blobstore.integration;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
|
|
||||||
import org.jclouds.blobstore.integration.internal.BaseContainerLiveTest;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Jeremy Daggett
|
|
||||||
*/
|
|
||||||
@Test(groups = { "live" })
|
|
||||||
public class HPCloudObjectStorageLasVegasContainerLiveTest extends BaseContainerLiveTest {
|
|
||||||
|
|
||||||
@Test(enabled = false)
|
|
||||||
//@Test(expectedExceptions=UnsupportedOperationException.class)
|
|
||||||
public void testPublicAccess() throws MalformedURLException, InterruptedException, IOException {
|
|
||||||
super.testPublicAccess();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,30 +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.hpcloud.objectstorage.lvs.blobstore.integration;
|
|
||||||
|
|
||||||
import org.jclouds.openstack.swift.blobstore.integration.SwiftInputStreamMapIntegrationLiveTest;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Jeremy Daggett
|
|
||||||
*/
|
|
||||||
@Test(groups = "live")
|
|
||||||
public class HPCloudObjectStorageLasVegasInputStreamMapIntegrationLiveTest extends SwiftInputStreamMapIntegrationLiveTest {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,38 +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.hpcloud.objectstorage.lvs.blobstore.integration;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.jclouds.openstack.swift.blobstore.integration.SwiftServiceIntegrationLiveTest;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Jeremy Daggett
|
|
||||||
*/
|
|
||||||
@Test(groups = "live")
|
|
||||||
public class HPCloudObjectStorageLasVegasServiceIntegrationLiveTest extends SwiftServiceIntegrationLiveTest {
|
|
||||||
@Override
|
|
||||||
protected Set<String> getIso3166Codes() {
|
|
||||||
return ImmutableSet.<String> of("US-NV");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,32 +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.hpcloud.objectstorage.lvs.blobstore.integration;
|
|
||||||
|
|
||||||
import org.jclouds.openstack.swift.blobstore.integration.SwiftTestInitializer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Jeremy Daggett
|
|
||||||
*/
|
|
||||||
public class HPCloudObjectStorageLasVegasTestInitializer extends SwiftTestInitializer {
|
|
||||||
|
|
||||||
public HPCloudObjectStorageLasVegasTestInitializer() {
|
|
||||||
provider = "hpcloud-objectstorage-lvs";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,69 +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.hpcloud.objectstorage.lvs.functions;
|
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
|
||||||
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.net.URI;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.SortedSet;
|
|
||||||
|
|
||||||
import org.jclouds.hpcloud.objectstorage.lvs.domain.ContainerCDNMetadata;
|
|
||||||
import org.jclouds.http.HttpResponse;
|
|
||||||
import org.jclouds.http.functions.ParseJson;
|
|
||||||
import org.jclouds.io.Payloads;
|
|
||||||
import org.jclouds.json.config.GsonModule;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSortedSet;
|
|
||||||
import com.google.inject.Guice;
|
|
||||||
import com.google.inject.Injector;
|
|
||||||
import com.google.inject.Key;
|
|
||||||
import com.google.inject.TypeLiteral;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests behavior of {@code ParseContainerCDNMetadataListFromJsonResponse}
|
|
||||||
*
|
|
||||||
* @author Jeremy Daggett
|
|
||||||
*/
|
|
||||||
@Test(groups = "unit")
|
|
||||||
public class ParseContainerCDNMetadataListFromJsonResponseTest {
|
|
||||||
Injector i = Guice.createInjector(new GsonModule());
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testApplyInputStream() {
|
|
||||||
|
|
||||||
InputStream is = getClass().getResourceAsStream("/test_list_cdn.json");
|
|
||||||
|
|
||||||
Set<ContainerCDNMetadata> expects = ImmutableSortedSet.of(
|
|
||||||
new ContainerCDNMetadata("hpcloud-blobstore.testCDNOperationsContainerWithCDN", false, 3600,
|
|
||||||
URI.create("https://cdnmgmt.hpcloud.net:8080/v1/AUTH_test/")),
|
|
||||||
new ContainerCDNMetadata("hpcloud-blobstore5", true, 28800,
|
|
||||||
URI.create("https://cdnmgmt.hpcloud.net:8080/v1/AUTH_test/")),
|
|
||||||
new ContainerCDNMetadata("hpcloud-cfcdnint.testCDNOperationsContainerWithCDN", false, 3600,
|
|
||||||
URI.create("https://cdnmgmt.hpcloud.net:8080/v1/AUTH_test/")));
|
|
||||||
|
|
||||||
ParseJson<SortedSet<ContainerCDNMetadata>> parser = i.getInstance(Key
|
|
||||||
.get(new TypeLiteral<ParseJson<SortedSet<ContainerCDNMetadata>>>() {
|
|
||||||
}));
|
|
||||||
|
|
||||||
assertEquals(parser.apply(new HttpResponse(200, "ok", Payloads.newInputStreamPayload(is))), expects);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,70 +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.hpcloud.objectstorage.lvs.options;
|
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
|
||||||
|
|
||||||
import org.jclouds.openstack.swift.reference.SwiftHeaders;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests behavior of {@code CreateContainerOptions}
|
|
||||||
*
|
|
||||||
* @author Adrian Cole
|
|
||||||
*/
|
|
||||||
@Test(groups = "unit")
|
|
||||||
public class CreateContainerOptionsTest {
|
|
||||||
|
|
||||||
public void testPublicAccess() {
|
|
||||||
CreateContainerOptions options = new CreateContainerOptions().withPublicAccess();
|
|
||||||
assertEquals(ImmutableList.of(".r:*,.rlistings"),
|
|
||||||
options.buildRequestHeaders().get("X-Container-Read"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testPublicAccessStatic() {
|
|
||||||
CreateContainerOptions options = CreateContainerOptions.Builder.withPublicAccess();
|
|
||||||
assertEquals(ImmutableList.of(".r:*,.rlistings"),
|
|
||||||
options.buildRequestHeaders().get("X-Container-Read"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testMetadata() {
|
|
||||||
CreateContainerOptions options = new CreateContainerOptions().withMetadata(ImmutableMap
|
|
||||||
.of("test", "foo"));
|
|
||||||
assertEquals(ImmutableList.of("foo"), options.buildRequestHeaders().get(
|
|
||||||
SwiftHeaders.CONTAINER_METADATA_PREFIX + "test"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testMetadataAlreadyPrefixed() {
|
|
||||||
CreateContainerOptions options = new CreateContainerOptions().withMetadata(ImmutableMap
|
|
||||||
.of(SwiftHeaders.CONTAINER_METADATA_PREFIX + "test", "foo"));
|
|
||||||
assertEquals(ImmutableList.of("foo"), options.buildRequestHeaders().get(
|
|
||||||
SwiftHeaders.CONTAINER_METADATA_PREFIX + "test"));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testMetadataStatic() {
|
|
||||||
CreateContainerOptions options = CreateContainerOptions.Builder
|
|
||||||
.withMetadata(ImmutableMap.of("test", "foo"));
|
|
||||||
assertEquals(ImmutableList.of("foo"), options.buildRequestHeaders().get(
|
|
||||||
SwiftHeaders.CONTAINER_METADATA_PREFIX + "test"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,110 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
|
||||||
|
|
||||||
<!--
|
|
||||||
For more configuration infromation and examples see the Apache
|
|
||||||
Log4j website: http://logging.apache.org/log4j/
|
|
||||||
-->
|
|
||||||
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
|
|
||||||
debug="false">
|
|
||||||
|
|
||||||
<!-- A time/date based rolling appender -->
|
|
||||||
<appender name="WIREFILE" class="org.apache.log4j.DailyRollingFileAppender">
|
|
||||||
<param name="File" value="target/test-data/jclouds-wire.log" />
|
|
||||||
<param name="Append" value="true" />
|
|
||||||
|
|
||||||
<!-- Rollover at midnight each day -->
|
|
||||||
<param name="DatePattern" value="'.'yyyy-MM-dd" />
|
|
||||||
|
|
||||||
<param name="Threshold" value="TRACE" />
|
|
||||||
|
|
||||||
<layout class="org.apache.log4j.PatternLayout">
|
|
||||||
<!-- The default pattern: Date Priority [Category] Message\n -->
|
|
||||||
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
|
|
||||||
|
|
||||||
<!--
|
|
||||||
The full pattern: Date MS Priority [Category]
|
|
||||||
(Thread:NDC) Message\n <param name="ConversionPattern"
|
|
||||||
value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
|
|
||||||
-->
|
|
||||||
</layout>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<!-- A time/date based rolling appender -->
|
|
||||||
<appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
|
|
||||||
<param name="File" value="target/test-data/jclouds.log" />
|
|
||||||
<param name="Append" value="true" />
|
|
||||||
|
|
||||||
<!-- Rollover at midnight each day -->
|
|
||||||
<param name="DatePattern" value="'.'yyyy-MM-dd" />
|
|
||||||
|
|
||||||
<param name="Threshold" value="TRACE" />
|
|
||||||
|
|
||||||
<layout class="org.apache.log4j.PatternLayout">
|
|
||||||
<!-- The default pattern: Date Priority [Category] Message\n -->
|
|
||||||
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
|
|
||||||
|
|
||||||
<!--
|
|
||||||
The full pattern: Date MS Priority [Category]
|
|
||||||
(Thread:NDC) Message\n <param name="ConversionPattern"
|
|
||||||
value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
|
|
||||||
-->
|
|
||||||
</layout>
|
|
||||||
</appender>
|
|
||||||
<!-- A time/date based rolling appender -->
|
|
||||||
<appender name="BLOBSTOREFILE" class="org.apache.log4j.DailyRollingFileAppender">
|
|
||||||
<param name="File" value="target/test-data/jclouds-blobstore.log" />
|
|
||||||
<param name="Append" value="true" />
|
|
||||||
<param name="DatePattern" value="'.'yyyy-MM-dd" />
|
|
||||||
<param name="Threshold" value="TRACE" />
|
|
||||||
<layout class="org.apache.log4j.PatternLayout">
|
|
||||||
<param name="ConversionPattern" value="%d %-5p [%c] (%t) %m%n" />
|
|
||||||
</layout>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
|
|
||||||
<appender-ref ref="FILE" />
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<appender name="ASYNCWIRE" class="org.apache.log4j.AsyncAppender">
|
|
||||||
<appender-ref ref="WIREFILE" />
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<appender name="ASYNCBLOBSTORE" class="org.apache.log4j.AsyncAppender">
|
|
||||||
<appender-ref ref="BLOBSTOREFILE" />
|
|
||||||
</appender>
|
|
||||||
<!-- ================ -->
|
|
||||||
<!-- Limit categories -->
|
|
||||||
<!-- ================ -->
|
|
||||||
|
|
||||||
<category name="org.jclouds">
|
|
||||||
<priority value="DEBUG" />
|
|
||||||
<appender-ref ref="ASYNC" />
|
|
||||||
</category>
|
|
||||||
|
|
||||||
<category name="jclouds.headers">
|
|
||||||
<priority value="DEBUG" />
|
|
||||||
<appender-ref ref="ASYNCWIRE" />
|
|
||||||
</category>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
NOTE!! enabling this logger will cause the following test to
|
|
||||||
fail BaseBlobIntegrationTest.testPutObjectStream <category
|
|
||||||
name="jclouds.wire"> <priority value="DEBUG" /> <appender-ref
|
|
||||||
ref="ASYNCWIRE" /> </category>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<category name="jclouds.blobstore">
|
|
||||||
<priority value="DEBUG" />
|
|
||||||
<appender-ref ref="ASYNCBLOBSTORE" />
|
|
||||||
</category>
|
|
||||||
|
|
||||||
<!-- ======================= -->
|
|
||||||
<!-- Setup the Root category -->
|
|
||||||
<!-- ======================= -->
|
|
||||||
|
|
||||||
<root>
|
|
||||||
<priority value="WARN" />
|
|
||||||
</root>
|
|
||||||
|
|
||||||
</log4j:configuration>
|
|
|
@ -1,5 +0,0 @@
|
||||||
[
|
|
||||||
{"name":"hpcloud-blobstore.testCDNOperationsContainerWithCDN","cdn_enabled":"false","ttl":3600,"cdn_uri":"https://cdnmgmt.hpcloud.net:8080/v1/AUTH_test/","referrer_acl":"","useragent_acl":"", "log_retention":"false"},
|
|
||||||
{"name":"hpcloud-blobstore5","cdn_enabled":"true","ttl":28800,"cdn_uri":"https://cdnmgmt.hpcloud.net:8080/v1/AUTH_test/","referrer_acl":"","useragent_acl":"", "log_retention":"false"},
|
|
||||||
{"name":"hpcloud-cfcdnint.testCDNOperationsContainerWithCDN","cdn_enabled":"false","ttl":3600,"cdn_uri":"https://cdnmgmt.hpcloud.net:8080/v1/AUTH_test/","referrer_acl":"","useragent_acl":"", "log_retention":"false"}
|
|
||||||
]
|
|
|
@ -27,7 +27,7 @@
|
||||||
<version>1.5.0-SNAPSHOT</version>
|
<version>1.5.0-SNAPSHOT</version>
|
||||||
<relativePath>../../project/pom.xml</relativePath>
|
<relativePath>../../project/pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>org.jclouds.labs</groupId>
|
<groupId>org.jclouds.provider</groupId>
|
||||||
<artifactId>hpcloud-objectstorage</artifactId>
|
<artifactId>hpcloud-objectstorage</artifactId>
|
||||||
<name>jclouds HP Cloud Object Storage</name>
|
<name>jclouds HP Cloud Object Storage</name>
|
||||||
<description>jclouds components to access HP Cloud Services Object Storage</description>
|
<description>jclouds components to access HP Cloud Services Object Storage</description>
|
|
@ -68,6 +68,6 @@
|
||||||
<module>go2cloud-jhb1</module>
|
<module>go2cloud-jhb1</module>
|
||||||
<module>softlayer</module>
|
<module>softlayer</module>
|
||||||
<module>ninefold-compute</module>
|
<module>ninefold-compute</module>
|
||||||
<module>hpcloud-objectstorage-lvs</module>
|
<module>hpcloud-objectstorage</module>
|
||||||
</modules>
|
</modules>
|
||||||
</project>
|
</project>
|
||||||
|
|
Loading…
Reference in New Issue