mirror of https://github.com/apache/jclouds.git
issue 15: first cut at module for jets3t
git-svn-id: http://jclouds.googlecode.com/svn/trunk@245 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
613709d24c
commit
4f3ac2ead6
|
@ -0,0 +1,108 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
$HeadURL$
|
||||
$Revision$
|
||||
$Date$
|
||||
|
||||
Copyright (C) 2009 Adrian Cole <adriancole@jclouds.org>
|
||||
|
||||
====================================================================
|
||||
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.html
|
||||
|
||||
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">
|
||||
<parent>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-project</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<relativePath>../../project/pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.jclouds</groupId>
|
||||
<artifactId>jclouds-jets3t</artifactId>
|
||||
<name>JetS3t plug-in implemented by JClouds</name>
|
||||
<packaging>jar</packaging>
|
||||
<description>JetS3t plug-in implemented by JClouds</description>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://jclouds.googlecode.com/svn/trunk/extensions/jets3t</connection>
|
||||
<developerConnection>scm:svn:https://jclouds.googlecode.com/svn/trunk/extensions/jets3t</developerConnection>
|
||||
<url>http://jclouds.googlecode.com/svn/trunk/extensions/jets3t</url>
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<jclouds.aws.accesskeyid></jclouds.aws.accesskeyid>
|
||||
<jclouds.aws.secretaccesskey></jclouds.aws.secretaccesskey>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.java.dev.jets3t</groupId>
|
||||
<artifactId>jets3t</artifactId>
|
||||
<version>0.7.0</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>jclouds-gae</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>jclouds-s3</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>jclouds-s3</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<name>jets3t</name>
|
||||
<id>jets3t</id>
|
||||
<url>http://jets3t.s3.amazonaws.com/maven2</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<systemProperties>
|
||||
<property>
|
||||
<name>jclouds.aws.accesskeyid</name>
|
||||
<value>${jclouds.aws.accesskeyid}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>jclouds.aws.secretaccesskey</name>
|
||||
<value>${jclouds.aws.secretaccesskey}</value>
|
||||
</property>
|
||||
</systemProperties>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,230 @@
|
|||
/**
|
||||
*
|
||||
* Copyright (C) 2009 Adrian Cole <adriancole@jclouds.org>
|
||||
*
|
||||
* ====================================================================
|
||||
* 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.aws.s3.jets3t;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.jclouds.aws.s3.S3Context;
|
||||
import org.jclouds.aws.s3.S3ContextFactory;
|
||||
import org.jets3t.service.S3ObjectsChunk;
|
||||
import org.jets3t.service.S3Service;
|
||||
import org.jets3t.service.S3ServiceException;
|
||||
import org.jets3t.service.acl.AccessControlList;
|
||||
import org.jets3t.service.model.S3Bucket;
|
||||
import org.jets3t.service.model.S3BucketLoggingStatus;
|
||||
import org.jets3t.service.model.S3Object;
|
||||
import org.jets3t.service.security.AWSCredentials;
|
||||
|
||||
import com.google.inject.Module;
|
||||
|
||||
/**
|
||||
* A JetS3t S3Service implemented by JClouds
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*
|
||||
*/
|
||||
public class JCloudsS3Service extends S3Service {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final S3Context context;
|
||||
private final long requestTimeoutMilliseconds = 10000;
|
||||
|
||||
protected JCloudsS3Service(AWSCredentials awsCredentials, Module... modules)
|
||||
throws S3ServiceException {
|
||||
super(awsCredentials);
|
||||
if (modules == null || modules.length == 0)
|
||||
modules = new Module[] { new org.jclouds.gae.config.URLFetchServiceClientModule() };
|
||||
context = S3ContextFactory.createS3Context(awsCredentials
|
||||
.getAccessKey(), awsCredentials.getSecretKey(), modules);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkBucketStatus(String bucketName) throws S3ServiceException {
|
||||
// TODO Unimplemented
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map copyObjectImpl(String sourceBucketName,
|
||||
String sourceObjectKey, String destinationBucketName,
|
||||
String destinationObjectKey, AccessControlList acl,
|
||||
Map destinationMetadata, Calendar ifModifiedSince,
|
||||
Calendar ifUnmodifiedSince, String[] ifMatchTags,
|
||||
String[] ifNoneMatchTags) throws S3ServiceException {
|
||||
// TODO Unimplemented
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected S3Bucket createBucketImpl(String bucketName, String location,
|
||||
AccessControlList acl) throws S3ServiceException {
|
||||
// TODO Unimplemented
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void deleteBucketImpl(String bucketName)
|
||||
throws S3ServiceException {
|
||||
try {
|
||||
context.getConnection().deleteBucket(
|
||||
new org.jclouds.aws.s3.domain.S3Bucket(bucketName)).get(
|
||||
requestTimeoutMilliseconds, TimeUnit.MILLISECONDS);
|
||||
} catch (Exception e) {
|
||||
throw new S3ServiceException(
|
||||
"error deleting bucket: " + bucketName, e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void deleteObjectImpl(String bucketName, String objectKey)
|
||||
throws S3ServiceException {
|
||||
// TODO Unimplemented
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AccessControlList getBucketAclImpl(String bucketName)
|
||||
throws S3ServiceException {
|
||||
// TODO Unimplemented
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBucketLocationImpl(String bucketName)
|
||||
throws S3ServiceException {
|
||||
// TODO Unimplemented
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected S3BucketLoggingStatus getBucketLoggingStatusImpl(String bucketName)
|
||||
throws S3ServiceException {
|
||||
// TODO Unimplemented
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AccessControlList getObjectAclImpl(String bucketName,
|
||||
String objectKey) throws S3ServiceException {
|
||||
// TODO Unimplemented
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected S3Object getObjectDetailsImpl(String bucketName,
|
||||
String objectKey, Calendar ifModifiedSince,
|
||||
Calendar ifUnmodifiedSince, String[] ifMatchTags,
|
||||
String[] ifNoneMatchTags) throws S3ServiceException {
|
||||
// TODO Unimplemented
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected S3Object getObjectImpl(String bucketName, String objectKey,
|
||||
Calendar ifModifiedSince, Calendar ifUnmodifiedSince,
|
||||
String[] ifMatchTags, String[] ifNoneMatchTags,
|
||||
Long byteRangeStart, Long byteRangeEnd) throws S3ServiceException {
|
||||
// TODO Unimplemented
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBucketAccessible(String bucketName)
|
||||
throws S3ServiceException {
|
||||
// TODO Unimplemented
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isRequesterPaysBucketImpl(String bucketName)
|
||||
throws S3ServiceException {
|
||||
// TODO Unimplemented
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected S3Bucket[] listAllBucketsImpl() throws S3ServiceException {
|
||||
// TODO Unimplemented
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected S3ObjectsChunk listObjectsChunkedImpl(String bucketName,
|
||||
String prefix, String delimiter, long maxListingLength,
|
||||
String priorLastKey, boolean completeListing)
|
||||
throws S3ServiceException {
|
||||
// TODO Unimplemented
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected S3Object[] listObjectsImpl(String bucketName, String prefix,
|
||||
String delimiter, long maxListingLength) throws S3ServiceException {
|
||||
// TODO Unimplemented
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void putBucketAclImpl(String bucketName, AccessControlList acl)
|
||||
throws S3ServiceException {
|
||||
// TODO Unimplemented
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void putObjectAclImpl(String bucketName, String objectKey,
|
||||
AccessControlList acl) throws S3ServiceException {
|
||||
// TODO Unimplemented
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected S3Object putObjectImpl(String bucketName, S3Object object)
|
||||
throws S3ServiceException {
|
||||
// TODO Unimplemented
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setBucketLoggingStatusImpl(String bucketName,
|
||||
S3BucketLoggingStatus status) throws S3ServiceException {
|
||||
// TODO Unimplemented
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setRequesterPaysBucketImpl(String bucketName,
|
||||
boolean requesterPays) throws S3ServiceException {
|
||||
// TODO Unimplemented
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,178 @@
|
|||
/**
|
||||
*
|
||||
* Copyright (C) 2009 Adrian Cole <adriancole@jclouds.org>
|
||||
*
|
||||
* ====================================================================
|
||||
* 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.aws.s3.jets3t;
|
||||
|
||||
import static org.testng.Assert.fail;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.jclouds.aws.s3.S3Context;
|
||||
import org.jclouds.aws.s3.S3IntegrationTest;
|
||||
import org.jets3t.service.S3Service;
|
||||
import org.jets3t.service.S3ServiceException;
|
||||
import org.jets3t.service.model.S3Bucket;
|
||||
import org.jets3t.service.security.AWSCredentials;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Tests to cover JCloudsS3Service
|
||||
*
|
||||
* @author Adrian Cole
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public class JCloudsS3ServiceTest extends S3IntegrationTest {
|
||||
AWSCredentials credentials;
|
||||
S3Service service;
|
||||
|
||||
@Override
|
||||
protected S3Context createS3Context(String AWSAccessKeyId,
|
||||
String AWSSecretAccessKey) {
|
||||
credentials = new AWSCredentials(AWSAccessKeyId, AWSSecretAccessKey);
|
||||
return super.createS3Context(AWSAccessKeyId, AWSSecretAccessKey);
|
||||
}
|
||||
|
||||
@BeforeMethod
|
||||
public void testJCloudsS3Service() throws S3ServiceException {
|
||||
service = new JCloudsS3Service(
|
||||
credentials,
|
||||
new org.jclouds.http.config.JavaUrlHttpFutureCommandClientModule());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCheckBucketStatusString() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCopyObjectImplStringStringStringStringAccessControlListMapCalendarCalendarStringArrayStringArray() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateBucketImplStringStringAccessControlList() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteBucketImplString() throws S3ServiceException,
|
||||
InterruptedException, ExecutionException, TimeoutException {
|
||||
String name = bucketPrefix + ".testDeleteBucketImplString";
|
||||
org.jclouds.aws.s3.domain.S3Bucket jcloudsBucket = new org.jclouds.aws.s3.domain.S3Bucket(
|
||||
name);
|
||||
client.createBucketIfNotExists(jcloudsBucket).get(10, TimeUnit.SECONDS);
|
||||
service.deleteBucket(new S3Bucket(name));
|
||||
assert !client.bucketExists(jcloudsBucket).get(10, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteObjectImplStringString() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetBucketAclImplString() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetBucketLocationImplString() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetBucketLoggingStatusImplString() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetObjectAclImplStringString() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetObjectDetailsImplStringStringCalendarCalendarStringArrayStringArray() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetObjectImplStringStringCalendarCalendarStringArrayStringArrayLongLong() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsBucketAccessibleString() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsRequesterPaysBucketImplString() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testListAllBucketsImpl() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testListObjectsChunkedImplStringStringStringLongStringBoolean() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testListObjectsImplStringStringStringLong() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPutBucketAclImplStringAccessControlList() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPutObjectAclImplStringStringAccessControlList() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPutObjectImplStringS3Object() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetBucketLoggingStatusImplStringS3BucketLoggingStatus() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetRequesterPaysBucketImplStringBoolean() {
|
||||
fail("Not yet implemented");
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue