Skip to content
Permalink
Browse files
Merge remote-tracking branch 'promote-jclouds-labs-openstack-local/pr…
…omote-rackspace-cloudfiles-moved' into 1.9.x
  • Loading branch information
zack-shoylev committed Apr 9, 2015
2 parents b2d409c + 565a102 commit 9d387f81e409afe34f4fd22c04a15a9979476dd4
Show file tree
Hide file tree
Showing 59 changed files with 4,302 additions and 0 deletions.
@@ -0,0 +1,22 @@
Rackspace Cloud Files
==========================

The new Rackspace Cloud Files multi-region based service API.

This new "rackspace-cloudfiles" API supercedes the jclouds "cloudfiles" API, which will eventually be deprecated.

With this multi-region support, each BlobStore can be isolated to a specific region:

RegionScopedBlobStoreContext ctx =
contextBuilder.buildView(RegionScopedBlobStoreContext.class);

Set<String> regionIds = ctx.configuredRegions();

// isolated to a specific region
BlobStore dfwBlobStore = ctx.blobStoreInRegion("DFW");
BlobStore iadBlobStore = ctx.blobStoreInRegion("IAD");

Production ready?
Beta

This API is new to jclouds and hence is in Beta. That means we need people to use it and give us feedback. Based on that feedback, minor changes to the interfaces may happen. This code will replace org.jclouds.openstack.swift.SwiftClient in jclouds 2.0 and it is recommended you adopt it sooner than later.
@@ -0,0 +1,176 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF 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.apache.jclouds</groupId>
<artifactId>jclouds-project</artifactId>
<version>2.0.0-SNAPSHOT</version>
<relativePath />
</parent>

<!-- TODO: when out of labs, switch to org.jclouds.api -->
<groupId>org.apache.jclouds.labs</groupId>
<artifactId>rackspace-cloudfiles</artifactId>
<version>2.0.0-SNAPSHOT</version>
<name>jclouds rackspace-cloudfiles api</name>
<description>jclouds components to access Rackspace Cloud Files</description>
<packaging>bundle</packaging>

<properties>
<!-- identity endpoint -->
<test.rackspace-cloudfiles.endpoint>https://identity.api.rackspacecloud.com/v2.0/</test.rackspace-cloudfiles.endpoint>
<test.rackspace-cloudfiles.api-version>1</test.rackspace-cloudfiles.api-version>
<test.rackspace-cloudfiles.build-version />
<test.rackspace-cloudfiles.identity>FIXME_IDENTITY</test.rackspace-cloudfiles.identity>
<test.rackspace-cloudfiles.credential>FIXME_CREDENTIALS</test.rackspace-cloudfiles.credential>
<jclouds.osgi.export>org.jclouds.rackspace.cloudfiles.v1*;version="${project.version}"</jclouds.osgi.export>
<jclouds.osgi.import>org.jclouds*;version="${project.version}",*</jclouds.osgi.import>
</properties>

<repositories>
<repository>
<id>apache-snapshots</id>
<url>https://repository.apache.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.apache.jclouds.api</groupId>
<artifactId>openstack-swift</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.apache.jclouds.api</groupId>
<artifactId>openstack-swift</artifactId>
<version>${project.parent.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jclouds.api</groupId>
<artifactId>openstack-keystone</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.apache.jclouds.api</groupId>
<artifactId>openstack-keystone</artifactId>
<version>${project.parent.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jclouds.api</groupId>
<artifactId>rackspace-cloudidentity</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-core</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-core</artifactId>
<version>${project.parent.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jclouds</groupId>
<artifactId>jclouds-blobstore</artifactId>
<version>${project.parent.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap</groupId>
<artifactId>shrinkwrap-depchain</artifactId>
<version>1.2.0</version>
<type>pom</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.jclouds.driver</groupId>
<artifactId>jclouds-slf4j</artifactId>
<version>${project.parent.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp</groupId>
<artifactId>mockwebserver</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.auto.service</groupId>
<artifactId>auto-service</artifactId>
<scope>provided</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>
<systemPropertyVariables>
<jclouds.blobstore.httpstream.url>${jclouds.blobstore.httpstream.url}</jclouds.blobstore.httpstream.url>
<jclouds.blobstore.httpstream.md5>${jclouds.blobstore.httpstream.md5}</jclouds.blobstore.httpstream.md5>
<test.rackspace-cloudfiles.endpoint>${test.rackspace-cloudfiles.endpoint}</test.rackspace-cloudfiles.endpoint>
<test.rackspace-cloudfiles.api-version>${test.rackspace-cloudfiles.api-version}</test.rackspace-cloudfiles.api-version>
<test.rackspace-cloudfiles.build-version>${test.rackspace-cloudfiles.build-version}</test.rackspace-cloudfiles.build-version>
<test.rackspace-cloudfiles.identity>${test.rackspace-cloudfiles.identity}</test.rackspace-cloudfiles.identity>
<test.rackspace-cloudfiles.credential>${test.rackspace-cloudfiles.credential}</test.rackspace-cloudfiles.credential>
<jclouds.blobstore.httpstream.url>${jclouds.blobstore.httpstream.url}</jclouds.blobstore.httpstream.url>
<jclouds.blobstore.httpstream.md5>${jclouds.blobstore.httpstream.md5}</jclouds.blobstore.httpstream.md5>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
@@ -0,0 +1,51 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF 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.rackspace.cloudfiles.v1;

import org.jclouds.openstack.swift.v1.SwiftApi;
import org.jclouds.rackspace.cloudfiles.v1.features.CDNApi;
import org.jclouds.rackspace.cloudfiles.v1.functions.RegionToCDNEndpoint;
import org.jclouds.rest.annotations.Delegate;
import org.jclouds.rest.annotations.EndpointParam;

import com.google.common.annotations.Beta;

/**
* Rackspace Cloud Files is an affordable, redundant, scalable, and dynamic storage service
* offering. The core storage system is designed to provide a secure, network-accessible way to
* store an unlimited number of files. Each file can be as large as 5 gigabytes.
* <p/>
* Additionally, Cloud Files provides a simple yet powerful way to publish and distribute content
* behind a Content Distribution Network.
*
* @see CDNApi
* @see SwiftApi
*/
@Beta
public interface CloudFilesApi extends SwiftApi {

/**
* Provides access to Cloud Files CDN features.
*
* @param region the region to access the CDN API.
*
* @return the {@link CDNApi} for the specified region.
*/
@Delegate
CDNApi getCDNApi(@EndpointParam(parser = RegionToCDNEndpoint.class) String region);

}
@@ -0,0 +1,104 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF 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.rackspace.cloudfiles.v1;

import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.CREDENTIAL_TYPE;
import static org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties.SERVICE_TYPE;
import static org.jclouds.reflect.Reflection2.typeToken;

import java.net.URI;
import java.util.Properties;

import org.jclouds.apis.ApiMetadata;
import org.jclouds.openstack.keystone.v2_0.config.KeystoneAuthenticationModule.RegionModule;
import org.jclouds.openstack.swift.v1.SwiftApiMetadata;
import org.jclouds.openstack.swift.v1.blobstore.RegionScopedBlobStoreContext;
import org.jclouds.openstack.swift.v1.blobstore.config.SignUsingTemporaryUrls;
import org.jclouds.openstack.swift.v1.blobstore.config.SwiftBlobStoreContextModule;
import org.jclouds.openstack.swift.v1.config.SwiftTypeAdapters;
import org.jclouds.openstack.v2_0.ServiceType;
import org.jclouds.rackspace.cloudfiles.v1.config.CloudFilesHttpApiModule;
import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityAuthenticationApiModule;
import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityAuthenticationModule;
import org.jclouds.rackspace.cloudidentity.v2_0.config.CloudIdentityCredentialTypes;
import org.jclouds.rest.internal.BaseHttpApiMetadata;

import com.google.auto.service.AutoService;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Module;

/**
* Implementation of {@link ApiMetadata} for Cloud Files.
*/
@AutoService(ApiMetadata.class)
public class CloudFilesApiMetadata extends BaseHttpApiMetadata<CloudFilesApi> {

@Override
public Builder toBuilder() {
return new Builder().fromApiMetadata(this);
}

public CloudFilesApiMetadata() {
this(new Builder());
}

protected CloudFilesApiMetadata(Builder builder) {
super(builder);
}

public static Properties defaultProperties() {
Properties properties = SwiftApiMetadata.defaultProperties();
properties.setProperty(CREDENTIAL_TYPE, CloudIdentityCredentialTypes.API_KEY_CREDENTIALS);
properties.setProperty(SERVICE_TYPE, ServiceType.OBJECT_STORE);
return properties;
}

public static class Builder extends BaseHttpApiMetadata.Builder<CloudFilesApi, Builder> {

protected Builder() {
id("rackspace-cloudfiles")
.name("Rackspace Cloud Files API")
.identityName("${userName}")
.credentialName("${apiKey}")
.documentation(URI.create("http://docs.rackspace.com/files/api/v1/cf-devguide/content/index.html"))
.version("1.0")
.endpointName("Rackspace Cloud Identity service URL ending in /v2.0/")
.defaultEndpoint("https://identity.api.rackspacecloud.com/v2.0/")
.defaultProperties(CloudFilesApiMetadata.defaultProperties())
.view(typeToken(RegionScopedBlobStoreContext.class))
.defaultModules(ImmutableSet.<Class<? extends Module>>builder()
.add(CloudIdentityAuthenticationApiModule.class)
.add(CloudIdentityAuthenticationModule.class)
.add(RegionModule.class)
.add(SwiftTypeAdapters.class)
.add(CloudFilesHttpApiModule.class)
.add(SwiftBlobStoreContextModule.class)
.add(SignUsingTemporaryUrls.class)
.build());
}

@Override
public CloudFilesApiMetadata build() {
return new CloudFilesApiMetadata(this);
}

@Override
protected Builder self() {
return this;
}
}
}

0 comments on commit 9d387f8

Please sign in to comment.