diff --git a/pom.xml b/pom.xml index 97ecd8b454..140054a69b 100644 --- a/pom.xml +++ b/pom.xml @@ -39,8 +39,10 @@ project core + objectstore extensions aws + rackspace diff --git a/rackspace/cloudfiles/core/pom.xml b/rackspace/cloudfiles/core/pom.xml new file mode 100644 index 0000000000..6abf7d8a3d --- /dev/null +++ b/rackspace/cloudfiles/core/pom.xml @@ -0,0 +1,48 @@ + + + + + org.jclouds + jclouds-cloudfiles-project + 1.0-SNAPSHOT + ../pom.xml + + 4.0.0 + org.jclouds + jclouds-cloudfiles-core + jclouds cloudfiles Components Core + jar + jclouds Core components to access cloudfiles + + + scm:svn:http://jclouds.googlecode.com/svn/trunk/rackspace/cloudfiles/core + scm:svn:https://jclouds.googlecode.com/svn/trunk/rackspace/cloudfiles/core + http://jclouds.googlecode.com/svn/trunk/rackspace/cloudfiles/core + + + diff --git a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/CloudFilesConnection.java b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/CloudFilesConnection.java new file mode 100644 index 0000000000..21612b4eac --- /dev/null +++ b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/CloudFilesConnection.java @@ -0,0 +1,40 @@ +/** + * + * Copyright (C) 2009 Global Cloud Specialists, Inc. + * + * ==================================================================== + * 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; + +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; + +/** + * Provides access to Cloud Files via their REST API. + *

+ * All commands return a Future of the result from Cloud Files. Any exceptions incurred during + * processing will be wrapped in an {@link ExecutionException} as documented in {@link Future#get()}. + * + * @see + * @author Adrian Cole + */ +public interface CloudFilesConnection { + +} diff --git a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/CloudFilesContext.java b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/CloudFilesContext.java new file mode 100644 index 0000000000..6ab0080c51 --- /dev/null +++ b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/CloudFilesContext.java @@ -0,0 +1,39 @@ +/** + * + * Copyright (C) 2009 Global Cloud Specialists, Inc. + * + * ==================================================================== + * 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; + +import org.jclouds.cloud.CloudContext; + +/** + * Represents an authenticated context to Cloud Files. + * + * @see + * @see CloudFilesConnection + * @see CloudContext + * @author Adrian Cole + * + */ +public interface CloudFilesContext extends CloudContext { + +} \ No newline at end of file diff --git a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/CloudFilesContextBuilder.java b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/CloudFilesContextBuilder.java new file mode 100644 index 0000000000..6d50582ad2 --- /dev/null +++ b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/CloudFilesContextBuilder.java @@ -0,0 +1,110 @@ +/** + * + * Copyright (C) 2009 Global Cloud Specialists, Inc. + * + * ==================================================================== + * 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; + +import static com.google.common.base.Preconditions.checkNotNull; +import static org.jclouds.command.pool.PoolConstants.PROPERTY_POOL_IO_WORKER_THREADS; +import static org.jclouds.command.pool.PoolConstants.PROPERTY_POOL_MAX_CONNECTIONS; +import static org.jclouds.command.pool.PoolConstants.PROPERTY_POOL_MAX_CONNECTION_REUSE; +import static org.jclouds.command.pool.PoolConstants.PROPERTY_POOL_MAX_SESSION_FAILURES; +import static org.jclouds.command.pool.PoolConstants.PROPERTY_POOL_REQUEST_INVOKER_THREADS; +import static org.jclouds.http.HttpConstants.PROPERTY_HTTP_ADDRESS; +import static org.jclouds.http.HttpConstants.PROPERTY_HTTP_MAX_REDIRECTS; +import static org.jclouds.http.HttpConstants.PROPERTY_HTTP_MAX_RETRIES; +import static org.jclouds.http.HttpConstants.PROPERTY_HTTP_SECURE; +import static org.jclouds.http.HttpConstants.PROPERTY_SAX_DEBUG; +import static org.jclouds.rackspace.reference.RackSpaceConstants.PROPERTY_RACKSPACE_KEY; +import static org.jclouds.rackspace.reference.RackSpaceConstants.PROPERTY_RACKSPACE_USER; + +import java.util.List; +import java.util.Properties; + +import org.jclouds.cloud.CloudContextBuilder; +import org.jclouds.http.config.JavaUrlHttpFutureCommandClientModule; +import org.jclouds.logging.jdk.config.JDKLoggingModule; + +import com.google.inject.Injector; +import com.google.inject.Module; + +/** + * Creates {@link CloudFilesContext} or {@link Injector} instances based on the most commonly + * requested arguments. + *

+ * Note that Threadsafe objects will be bound as singletons to the Injector or Context provided. + *

+ *

+ * If no Modules are specified, the default {@link JDKLoggingModule logging} and + * {@link JavaUrlHttpFutureCommandClientModule http transports} will be installed. + * + * @author Adrian Cole, Andrew Newdigate + * @see CloudFilesContext + */ +public class CloudFilesContextBuilder extends + CloudContextBuilder { + + public CloudFilesContextBuilder(Properties props) { + super(props); + } + + public static CloudFilesContextBuilder newBuilder(String id, String secret) { + Properties properties = new Properties(); + + properties.setProperty(PROPERTY_HTTP_ADDRESS, "api.mosso.com"); + properties.setProperty(PROPERTY_SAX_DEBUG, "false"); + properties.setProperty(PROPERTY_HTTP_SECURE, "true"); + properties.setProperty(PROPERTY_HTTP_MAX_RETRIES, "5"); + properties.setProperty(PROPERTY_HTTP_MAX_REDIRECTS, "5"); + properties.setProperty(PROPERTY_POOL_MAX_CONNECTION_REUSE, "75"); + properties.setProperty(PROPERTY_POOL_MAX_SESSION_FAILURES, "2"); + properties.setProperty(PROPERTY_POOL_REQUEST_INVOKER_THREADS, "1"); + properties.setProperty(PROPERTY_POOL_IO_WORKER_THREADS, "2"); + properties.setProperty(PROPERTY_POOL_MAX_CONNECTIONS, "12"); + + CloudFilesContextBuilder builder = new CloudFilesContextBuilder(properties); + builder.authenticate(id, secret); + return builder; + } + + public void authenticate(String id, String secret) { + properties.setProperty(PROPERTY_RACKSPACE_USER, checkNotNull(id, "user")); + properties.setProperty(PROPERTY_RACKSPACE_KEY, checkNotNull(secret, "key")); + } + + public CloudFilesContext buildContext() { + return buildInjector().getInstance(CloudFilesContext.class); + } + + protected void addParserModule(List modules) { + //TODO + } + + protected void addContextModule(List modules) { + //TODO + } + + protected void addConnectionModule(List modules) { + //TODO + } + +} diff --git a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/package-info.java b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/package-info.java new file mode 100644 index 0000000000..c30dae2cd8 --- /dev/null +++ b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/package-info.java @@ -0,0 +1,30 @@ +/** + * + * Copyright (C) 2009 Global Cloud Specialists, Inc. + * + * ==================================================================== + * 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. + * ==================================================================== + */ +/** + * This package contains an RackSpace Cloud Files client implemented by {@link org.jclouds.http.HttpFutureCommandClient} commands. + * + * @see + * @author Adrian Cole + */ +package org.jclouds.rackspace.cloudfiles; \ No newline at end of file diff --git a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/reference/CloudFilesConstants.java b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/reference/CloudFilesConstants.java new file mode 100644 index 0000000000..0890219f00 --- /dev/null +++ b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/reference/CloudFilesConstants.java @@ -0,0 +1,37 @@ +/** + * + * Copyright (C) 2009 Global Cloud Specialists, Inc. + * + * ==================================================================== + * 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.reference; + +import org.jclouds.objectstore.reference.ObjectStoreConstants; +import org.jclouds.rackspace.reference.RackSpaceConstants; + +/** + * Configuration properties and constants used in Cloud Files connections. + * + * @author Adrian Cole + */ +public interface CloudFilesConstants extends ObjectStoreConstants, RackSpaceConstants { + + +} diff --git a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/reference/CloudFilesHeaders.java b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/reference/CloudFilesHeaders.java new file mode 100644 index 0000000000..b00950429e --- /dev/null +++ b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/reference/CloudFilesHeaders.java @@ -0,0 +1,52 @@ +/** + * + * Copyright (C) 2009 Global Cloud Specialists, Inc. + * + * ==================================================================== + * 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.reference; + +import org.jclouds.http.HttpHeaders; + +/** + * Additional headers specified by RackSpace Cloud Files REST API. + * + * @see + * @author Adrian Cole + * + */ +public interface CloudFilesHeaders extends HttpHeaders { + + public static final String ACCOUNT_BYTES_USED = "X-Account-Bytes-Used"; + public static final String ACCOUNT_CONTAINER_COUNT = "X-Account-Container-Count"; + public static final String AUTH_KEY = "X-Auth-Key"; + public static final String AUTH_TOKEN = "X-Auth-Token"; + public static final String AUTH_USER = "X-Auth-User"; + public static final String CDN_ENABLED = "X-CDN-Enabled"; + public static final String CDN_MANAGEMENT_URL = "X-CDN-Management-URL"; + 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"; + public static final String CONTAINER_BYTES_USED = "X-Container-Bytes-Used"; + public static final String CONTAINER_OBJECT_COUNT = "X-Container-Object-Count"; + public static final String STORAGE_URL = "X-Storage-Url"; + +} \ No newline at end of file diff --git a/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/reference/package-info.java b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/reference/package-info.java new file mode 100644 index 0000000000..22ca57825b --- /dev/null +++ b/rackspace/cloudfiles/core/src/main/java/org/jclouds/rackspace/cloudfiles/reference/package-info.java @@ -0,0 +1,28 @@ +/** + * + * Copyright (C) 2009 Global Cloud Specialists, Inc. + * + * ==================================================================== + * 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. + * ==================================================================== + */ +/** + * This package contains properties and reference data used in RackSpace Cloud Files. + * @author Adrian Cole + */ +package org.jclouds.rackspace.cloudfiles.reference; \ No newline at end of file diff --git a/rackspace/cloudfiles/pom.xml b/rackspace/cloudfiles/pom.xml new file mode 100644 index 0000000000..ef6c3270f3 --- /dev/null +++ b/rackspace/cloudfiles/pom.xml @@ -0,0 +1,68 @@ + + + + + jclouds-rackspace-project + org.jclouds + 1.0-SNAPSHOT + ../pom.xml + + 4.0.0 + jclouds-cloudfiles-project + pom + jclouds cloudfiles project + + core + + + + ${project.groupId} + jclouds-objectstore-core + ${project.version} + + + ${project.groupId} + jclouds-objectstore-core + ${project.version} + test-jar + test + + + ${project.groupId} + jclouds-rackspace-core + ${project.version} + + + ${project.groupId} + jclouds-rackspace-core + ${project.version} + test-jar + test + + + diff --git a/rackspace/core/pom.xml b/rackspace/core/pom.xml new file mode 100644 index 0000000000..47b256a194 --- /dev/null +++ b/rackspace/core/pom.xml @@ -0,0 +1,48 @@ + + + + + org.jclouds + jclouds-rackspace-project + 1.0-SNAPSHOT + ../pom.xml + + 4.0.0 + org.jclouds + jclouds-rackspace-core + jclouds rackspace Components Core + jar + jclouds Core components to access rackspaces + + + scm:svn:http://jclouds.googlecode.com/svn/trunk/rackspace/core + scm:svn:https://jclouds.googlecode.com/svn/trunk/rackspace/core + http://jclouds.googlecode.com/svn/trunk/rackspace/core + + + diff --git a/rackspace/core/src/main/java/org/jclouds/rackspace/reference/RackSpaceConstants.java b/rackspace/core/src/main/java/org/jclouds/rackspace/reference/RackSpaceConstants.java new file mode 100644 index 0000000000..e9f08a8a89 --- /dev/null +++ b/rackspace/core/src/main/java/org/jclouds/rackspace/reference/RackSpaceConstants.java @@ -0,0 +1,36 @@ +/** + * + * Copyright (C) 2009 Global Cloud Specialists, Inc. + * + * ==================================================================== + * 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.reference; + +/** + * Configuration properties and constants used in RackSpace connections. + * + * @author Adrian Cole + */ +public interface RackSpaceConstants { + + public static final String PROPERTY_RACKSPACE_USER = "jclouds.rackspace.user"; + public static final String PROPERTY_RACKSPACE_KEY = "jclouds.rackspace.key"; + +} diff --git a/rackspace/core/src/main/java/org/jclouds/rackspace/reference/package-info.java b/rackspace/core/src/main/java/org/jclouds/rackspace/reference/package-info.java new file mode 100644 index 0000000000..2132f394d1 --- /dev/null +++ b/rackspace/core/src/main/java/org/jclouds/rackspace/reference/package-info.java @@ -0,0 +1,28 @@ +/** + * + * Copyright (C) 2009 Global Cloud Specialists, Inc. + * + * ==================================================================== + * 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. + * ==================================================================== + */ +/** + * This package contains properties and reference data used in RackSpace. + * @author Adrian Cole + */ +package org.jclouds.rackspace.reference; \ No newline at end of file diff --git a/rackspace/pom.xml b/rackspace/pom.xml new file mode 100644 index 0000000000..f273359d80 --- /dev/null +++ b/rackspace/pom.xml @@ -0,0 +1,69 @@ + + + + + jclouds-project + org.jclouds + 1.0-SNAPSHOT + ../project/pom.xml + + 4.0.0 + jclouds-rackspace-project + pom + jclouds rackspace project + + core + cloudfiles + + + + ${project.groupId} + jclouds-core + ${project.version} + + + ${project.groupId} + jclouds-core + ${project.version} + test-jar + test + + + log4j + log4j + 1.2.14 + test + + + ${project.groupId} + jclouds-log4j + ${project.version} + test + + +