From 13be94e72b34afd23dac95f0690aa6dfb24b2bb6 Mon Sep 17 00:00:00 2001 From: "adrian.f.cole" Date: Wed, 11 Nov 2009 07:14:47 +0000 Subject: [PATCH] Issue 61: removed sun cloud support git-svn-id: http://jclouds.googlecode.com/svn/trunk@2250 3d8758e0-26b5-11de-8745-db77d3ebf521 --- aws/extensions/suncloud/pom.xml | 49 ----------- .../config/SunCloudS3ConnectionModule.java | 50 ----------- .../s3/suncloud/domain/SunCloudS3Error.java | 33 ------- .../ParseSunCloudS3ErrorFromXmlContent.java | 86 ------------------- .../reference/SunCloudS3Constants.java | 35 -------- .../suncloud/xml/SunCloudS3ErrorHandler.java | 61 ------------- .../xml/config/SunCloudS3ParserModule.java | 50 ----------- .../SunCloudS3ConnectionLiveTest.java | 48 ----------- 8 files changed, 412 deletions(-) delete mode 100644 aws/extensions/suncloud/pom.xml delete mode 100755 aws/extensions/suncloud/src/main/java/org/jclouds/aws/s3/suncloud/config/SunCloudS3ConnectionModule.java delete mode 100755 aws/extensions/suncloud/src/main/java/org/jclouds/aws/s3/suncloud/domain/SunCloudS3Error.java delete mode 100755 aws/extensions/suncloud/src/main/java/org/jclouds/aws/s3/suncloud/handlers/ParseSunCloudS3ErrorFromXmlContent.java delete mode 100755 aws/extensions/suncloud/src/main/java/org/jclouds/aws/s3/suncloud/reference/SunCloudS3Constants.java delete mode 100755 aws/extensions/suncloud/src/main/java/org/jclouds/aws/s3/suncloud/xml/SunCloudS3ErrorHandler.java delete mode 100755 aws/extensions/suncloud/src/main/java/org/jclouds/aws/s3/suncloud/xml/config/SunCloudS3ParserModule.java delete mode 100755 aws/extensions/suncloud/src/test/java/org/jclouds/aws/s3/suncloud/SunCloudS3ConnectionLiveTest.java diff --git a/aws/extensions/suncloud/pom.xml b/aws/extensions/suncloud/pom.xml deleted file mode 100644 index 4b49255815..0000000000 --- a/aws/extensions/suncloud/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - org.jclouds - jclouds-aws-extensions-project - 1.0-SNAPSHOT - ../pom.xml - - 4.0.0 - org.jclouds - jclouds-s3-suncloud - jclouds s3 Sun Cloud Storage Adapter - jar - jclouds s3 Sun Cloud Storage Adapter - - - scm:svn:http://jclouds.googlecode.com/svn/trunk/aws/extensions/suncloud - scm:svn:https://jclouds.googlecode.com/svn/trunk/aws/extensions/suncloud - http://jclouds.googlecode.com/svn/trunk/aws/extensions/suncloud - - - diff --git a/aws/extensions/suncloud/src/main/java/org/jclouds/aws/s3/suncloud/config/SunCloudS3ConnectionModule.java b/aws/extensions/suncloud/src/main/java/org/jclouds/aws/s3/suncloud/config/SunCloudS3ConnectionModule.java deleted file mode 100755 index 57e648c058..0000000000 --- a/aws/extensions/suncloud/src/main/java/org/jclouds/aws/s3/suncloud/config/SunCloudS3ConnectionModule.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * - * Copyright (C) 2009 Cloud Conscious, LLC. - * - * ==================================================================== - * 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.suncloud.config; - -import org.jclouds.aws.s3.config.RestS3ConnectionModule; -import org.jclouds.aws.s3.suncloud.handlers.ParseSunCloudS3ErrorFromXmlContent; -import org.jclouds.cloud.ConfiguresCloudConnection; -import org.jclouds.http.HttpErrorHandler; -import org.jclouds.http.annotation.ClientError; -import org.jclouds.http.annotation.ServerError; - -import com.google.inject.Scopes; - -/** - * Configures the Sun Cloud S3 connection, including logging and http transport. - * - * @author Adrian Cole - */ -@ConfiguresCloudConnection -public class SunCloudS3ConnectionModule extends RestS3ConnectionModule { - - protected void bindErrorHandlers() { - bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to( - ParseSunCloudS3ErrorFromXmlContent.class).in(Scopes.SINGLETON); - bind(HttpErrorHandler.class).annotatedWith(ClientError.class).to( - ParseSunCloudS3ErrorFromXmlContent.class).in(Scopes.SINGLETON); - } - -} \ No newline at end of file diff --git a/aws/extensions/suncloud/src/main/java/org/jclouds/aws/s3/suncloud/domain/SunCloudS3Error.java b/aws/extensions/suncloud/src/main/java/org/jclouds/aws/s3/suncloud/domain/SunCloudS3Error.java deleted file mode 100755 index 1c0f9351da..0000000000 --- a/aws/extensions/suncloud/src/main/java/org/jclouds/aws/s3/suncloud/domain/SunCloudS3Error.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * - * Copyright (C) 2009 Cloud Conscious, LLC. - * - * ==================================================================== - * 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.suncloud.domain; - -import org.jclouds.aws.domain.AWSError; - -/** - * @author Adrian Cole - * - */ -public class SunCloudS3Error extends AWSError { -} diff --git a/aws/extensions/suncloud/src/main/java/org/jclouds/aws/s3/suncloud/handlers/ParseSunCloudS3ErrorFromXmlContent.java b/aws/extensions/suncloud/src/main/java/org/jclouds/aws/s3/suncloud/handlers/ParseSunCloudS3ErrorFromXmlContent.java deleted file mode 100755 index 51af8e9d39..0000000000 --- a/aws/extensions/suncloud/src/main/java/org/jclouds/aws/s3/suncloud/handlers/ParseSunCloudS3ErrorFromXmlContent.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * - * Copyright (C) 2009 Cloud Conscious, LLC. - * - * ==================================================================== - * 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.suncloud.handlers; - -import java.io.InputStream; - -import javax.annotation.Resource; - -import org.apache.commons.io.IOUtils; -import org.jclouds.aws.AWSResponseException; -import org.jclouds.aws.s3.reference.S3Headers; -import org.jclouds.aws.s3.suncloud.domain.SunCloudS3Error; -import org.jclouds.aws.s3.xml.S3ParserFactory; -import org.jclouds.http.HttpCommand; -import org.jclouds.http.HttpErrorHandler; -import org.jclouds.http.HttpResponse; -import org.jclouds.logging.Logger; -import org.jclouds.util.Utils; - -import com.google.inject.Inject; - -/** - * This will parse and set an appropriate exception on the command object. - * - * @see SunCloudS3Error - * @author Adrian Cole - * - */ -public class ParseSunCloudS3ErrorFromXmlContent implements HttpErrorHandler { - @Resource - protected Logger logger = Logger.NULL; - - private final S3ParserFactory parserFactory; - - @Inject - public ParseSunCloudS3ErrorFromXmlContent(S3ParserFactory parserFactory) { - this.parserFactory = parserFactory; - } - - public void handleError(HttpCommand command, HttpResponse response) { - SunCloudS3Error error = new SunCloudS3Error(); - error.setRequestId(response.getFirstHeaderOrNull(S3Headers.REQUEST_ID)); - error.setRequestToken(response.getFirstHeaderOrNull(S3Headers.REQUEST_TOKEN)); - InputStream errorStream = response.getContent(); - try { - if (errorStream != null) { - error.setMessage(Utils.toStringAndClose(errorStream)); - // TODO parse the Sun Cloud error. - - // error = parserFactory.createErrorParser().parse(errorStream); - // if ("SignatureDoesNotMatch".equals(error.getCode())) - // error.setStringSigned(RequestAuthorizeSignature - // .createStringToSign(command.getRequest())); - // error.setRequestToken(response - // .getFirstHeaderOrNull(S3Headers.REQUEST_TOKEN)); - } - } catch (Exception e) { - logger.warn(e, "error parsing XML reponse: %1$s", response); - } finally { - command.setException(new AWSResponseException(command, response, error)); - IOUtils.closeQuietly(errorStream); - } - } - -} \ No newline at end of file diff --git a/aws/extensions/suncloud/src/main/java/org/jclouds/aws/s3/suncloud/reference/SunCloudS3Constants.java b/aws/extensions/suncloud/src/main/java/org/jclouds/aws/s3/suncloud/reference/SunCloudS3Constants.java deleted file mode 100755 index 54c322a096..0000000000 --- a/aws/extensions/suncloud/src/main/java/org/jclouds/aws/s3/suncloud/reference/SunCloudS3Constants.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * - * Copyright (C) 2009 Cloud Conscious, LLC. - * - * ==================================================================== - * 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.suncloud.reference; - -import org.jclouds.aws.s3.reference.S3Constants; - -/** - * Configuration properties and constants used in S3 connections from Sun Cloud Storage - * - * @author Adrian Cole - */ -public interface SunCloudS3Constants extends S3Constants { - -} diff --git a/aws/extensions/suncloud/src/main/java/org/jclouds/aws/s3/suncloud/xml/SunCloudS3ErrorHandler.java b/aws/extensions/suncloud/src/main/java/org/jclouds/aws/s3/suncloud/xml/SunCloudS3ErrorHandler.java deleted file mode 100755 index fc01129594..0000000000 --- a/aws/extensions/suncloud/src/main/java/org/jclouds/aws/s3/suncloud/xml/SunCloudS3ErrorHandler.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * - * Copyright (C) 2009 Cloud Conscious, LLC. - * - * ==================================================================== - * 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.suncloud.xml; - -import org.jclouds.aws.domain.AWSError; -import org.jclouds.aws.s3.suncloud.domain.SunCloudS3Error; -import org.jclouds.http.functions.ParseSax; - -/** - * Parses the error from the Sun Cloud S3 REST API. - * - * @author Adrian Cole - */ -public class SunCloudS3ErrorHandler extends ParseSax.HandlerWithResult { - - private SunCloudS3Error error = new SunCloudS3Error(); - private StringBuilder currentText = new StringBuilder(); - - public AWSError getResult() { - return error; - } - - public void endElement(String uri, String name, String qName) { - // TODO parse the actual error coming back from Sun Cloud - if (qName.equals("Code")) { - error.setCode(currentText.toString()); - } else if (qName.equals("Message")) { - error.setMessage(currentText.toString()); - } else if (qName.equalsIgnoreCase("RequestId")) { - error.setRequestId(currentText.toString()); - } else if (!qName.equals("Error")) { - error.getDetails().put(qName, currentText.toString()); - } - currentText = new StringBuilder(); - } - - public void characters(char ch[], int start, int length) { - currentText.append(ch, start, length); - } -} diff --git a/aws/extensions/suncloud/src/main/java/org/jclouds/aws/s3/suncloud/xml/config/SunCloudS3ParserModule.java b/aws/extensions/suncloud/src/main/java/org/jclouds/aws/s3/suncloud/xml/config/SunCloudS3ParserModule.java deleted file mode 100755 index 5e4f5a04a0..0000000000 --- a/aws/extensions/suncloud/src/main/java/org/jclouds/aws/s3/suncloud/xml/config/SunCloudS3ParserModule.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * - * Copyright (C) 2009 Cloud Conscious, LLC. - * - * ==================================================================== - * 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.suncloud.xml.config; - -import org.jclouds.aws.domain.AWSError; -import org.jclouds.aws.s3.suncloud.xml.SunCloudS3ErrorHandler; -import org.jclouds.aws.s3.xml.S3ParserFactory; -import org.jclouds.aws.s3.xml.config.S3ParserModule; -import org.jclouds.http.functions.ParseSax; - -import com.google.inject.TypeLiteral; -import com.google.inject.assistedinject.FactoryProvider; - -/** - * Creates the factories needed to interpret S3 responses from Sun Cloud Storage Object Service - * - * @author Adrian Cole - */ -public class SunCloudS3ParserModule extends S3ParserModule { - protected void bindErrorHandler() { - TypeLiteral> errorTypeLiteral = new TypeLiteral>() { - }; - bind(new TypeLiteral>() { - }).to(SunCloudS3ErrorHandler.class); - bind(errorTypeLiteral).toProvider( - FactoryProvider.newFactory(errorTypeLiteral, new TypeLiteral>() { - })); - } -} \ No newline at end of file diff --git a/aws/extensions/suncloud/src/test/java/org/jclouds/aws/s3/suncloud/SunCloudS3ConnectionLiveTest.java b/aws/extensions/suncloud/src/test/java/org/jclouds/aws/s3/suncloud/SunCloudS3ConnectionLiveTest.java deleted file mode 100755 index 265be40d8e..0000000000 --- a/aws/extensions/suncloud/src/test/java/org/jclouds/aws/s3/suncloud/SunCloudS3ConnectionLiveTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * - * Copyright (C) 2009 Cloud Conscious, LLC. - * - * ==================================================================== - * 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.suncloud; - -import org.jclouds.aws.s3.S3ConnectionLiveTest; -import org.jclouds.aws.s3.S3ContextBuilder; -import org.jclouds.aws.s3.suncloud.config.SunCloudS3ConnectionModule; -import org.jclouds.aws.s3.suncloud.xml.config.SunCloudS3ParserModule; -import org.testng.annotations.Test; - -/** - * This performs the same test as {@link S3ConnectionLiveTest}, except using Sun Cloud Storage. - * - * @author Adrian Cole - */ -@Test(enabled = false, groups = { "live" }, testName = "s3.suncloud.SunCloudS3ConnectionLiveTest") -public class SunCloudS3ConnectionLiveTest extends S3ConnectionLiveTest { - - @Override - protected S3ContextBuilder buildS3ContextFactory(String AWSAccessKeyId, String AWSSecretAccessKey) { - return (S3ContextBuilder) S3ContextBuilder.newBuilder(AWSAccessKeyId, AWSSecretAccessKey) - .withModules(new SunCloudS3ConnectionModule(), new SunCloudS3ParserModule()) - .withHttpAddress("object.storage.network.com").withHttpSecure(false) - .withHttpPort(80); - } - -}