You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by ab...@apache.org on 2013/05/10 23:53:24 UTC
[15/18] JCLOUDS-25. Remove oprhaned sandbox-* from repo
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNClientLiveTest.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNClientLiveTest.java b/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNClientLiveTest.java
deleted file mode 100644
index 3daa9fb..0000000
--- a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/SDNClientLiveTest.java
+++ /dev/null
@@ -1,101 +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.nirvanix.sdn;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.Map;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeoutException;
-
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest;
-import org.jclouds.encryption.internal.Base64;
-import org.jclouds.io.Payloads;
-import org.jclouds.logging.log4j.config.Log4JLoggingModule;
-import org.jclouds.nirvanix.sdn.domain.UploadInfo;
-import org.jclouds.rest.RestContext;
-import org.jclouds.rest.RestContextFactory;
-import org.testng.annotations.BeforeGroups;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.inject.Module;
-
-/**
- * Tests behavior of {@code SDNClient}
- *
- * @author Adrian Cole
- */
-@Test(groups = "live", sequential = true, testName = "sdn.SDNClientLiveTest")
-public class SDNClientLiveTest {
-
- protected SDNClient connection;
- private String containerPrefix = BaseBlobStoreIntegrationTest.CONTAINER_PREFIX;
-
- URI container1;
- URI container2;
- private RestContext<SDNClient, SDNAsyncClient> context;
-
- @BeforeGroups(groups = { "live" })
- public void setupClient() {
-
- String identity = checkNotNull(System.getProperty("jclouds.test.identity"), "jclouds.test.identity");
- String credential = checkNotNull(System.getProperty("jclouds.test.credential"), "jclouds.test.credential");
-
- this.context = new RestContextFactory().createContext("sdn", identity, credential, ImmutableSet
- .<Module> of(new Log4JLoggingModule()));
- this.connection = context.getApi();
- }
-
- public void testUploadToken() throws InterruptedException, ExecutionException, TimeoutException, IOException {
- String containerName = containerPrefix + ".testObjectOperations";
- long size = 1024;
-
- UploadInfo uploadInfo = connection.getStorageNode(containerName, size);
- assertNotNull(uploadInfo.getHost());
- assertNotNull(uploadInfo.getToken());
-
- Blob blob = connection.newBlob();
- blob.getMetadata().setName("test.txt");
- blob.setPayload("value");
- Payloads.calculateMD5(blob);
-
- byte[] md5 = blob.getMetadata().getContentMetadata().getContentMD5();
- connection.upload(uploadInfo.getHost(), uploadInfo.getToken(), containerName, blob);
-
- Map<String, String> metadata = connection.getMetadata(containerName + "/test.txt");
- assertEquals(metadata.get("MD5"), Base64.encodeBytes(md5));
-
- String content = connection.getFile(containerName + "/test.txt");
- assertEquals(content, "value");
-
- metadata = ImmutableMap.of("chef", "sushi", "foo", "bar");
- connection.setMetadata(containerName + "/test.txt", metadata);
-
- metadata = connection.getMetadata(containerName + "/test.txt");
- assertEquals(metadata.get("MD5"), Base64.encodeBytes(md5));
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/binders/BindMetadataToQueryParamsTest.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/binders/BindMetadataToQueryParamsTest.java b/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/binders/BindMetadataToQueryParamsTest.java
deleted file mode 100644
index 6fa5ff4..0000000
--- a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/binders/BindMetadataToQueryParamsTest.java
+++ /dev/null
@@ -1,79 +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.nirvanix.sdn.binders;
-
-import static org.easymock.classextension.EasyMock.createMock;
-import static org.testng.Assert.assertEquals;
-
-import java.io.File;
-import java.net.URI;
-
-import javax.inject.Provider;
-import javax.ws.rs.HttpMethod;
-import javax.ws.rs.core.UriBuilder;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.internal.GeneratedHttpRequest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableMap;
-import com.sun.jersey.api.uri.UriBuilderImpl;
-
-/**
- * Tests behavior of {@code BindMetadataToQueryParams}
- *
- * @author Adrian Cole
- */
-@Test(groups = "unit", testName = "sdn.BindMetadataToQueryParamsTest")
-public class BindMetadataToQueryParamsTest {
-
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testMustBeMap() {
- BindMetadataToQueryParams binder = new BindMetadataToQueryParams(null);
- HttpRequest request = new HttpRequest(HttpMethod.POST, URI.create("http://localhost"), new char[] { '/', ':' });
- binder.bindToRequest(request, new File("foo"));
- }
-
- @Test
- public void testCorrect() throws SecurityException, NoSuchMethodException {
-
- HttpRequest request = new HttpRequest("GET", URI.create("http://momma/"), new char[] { '/', ':' });
-
- BindMetadataToQueryParams binder = new BindMetadataToQueryParams(new Provider<UriBuilder>() {
-
- @Override
- public UriBuilder get() {
- return new UriBuilderImpl();
- }
-
- });
-
- request = binder.bindToRequest(request, ImmutableMap.of("imageName", "foo", "serverId", "2"));
-
- assertEquals(request.getRequestLine(), "GET http://momma/?metadata=imagename:foo&metadata=serverid:2 HTTP/1.1");
-
- }
-
- @Test(expectedExceptions = { NullPointerException.class, IllegalStateException.class })
- public void testNullIsBad() {
- BindMetadataToQueryParams binder = new BindMetadataToQueryParams(null);
- GeneratedHttpRequest<?> request = createMock(GeneratedHttpRequest.class);
- binder.bindToRequest(request, null);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/filters/AddSessionTokenToRequestTest.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/filters/AddSessionTokenToRequestTest.java b/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/filters/AddSessionTokenToRequestTest.java
deleted file mode 100644
index fc02dec..0000000
--- a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/filters/AddSessionTokenToRequestTest.java
+++ /dev/null
@@ -1,132 +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.nirvanix.sdn.filters;
-
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.net.URI;
-import java.util.Properties;
-
-import javax.ws.rs.POST;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.RequiresHttp;
-import org.jclouds.nirvanix.sdn.SDNAsyncClient;
-import org.jclouds.nirvanix.sdn.SDNClient;
-import org.jclouds.nirvanix.sdn.SessionToken;
-import org.jclouds.nirvanix.sdn.config.SDNRestClientModule;
-import org.jclouds.nirvanix.sdn.reference.SDNConstants;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.RestClientTest;
-import org.jclouds.rest.RestContextFactory;
-import org.jclouds.rest.RestContextSpec;
-import org.jclouds.rest.annotations.EndpointParam;
-import org.jclouds.rest.internal.RestAnnotationProcessor;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-import com.google.inject.Key;
-import com.google.inject.Module;
-import com.google.inject.TypeLiteral;
-import com.google.inject.name.Names;
-
-@Test(groups = "unit", testName = "AddSessionTokenToRequestTest")
-public class AddSessionTokenToRequestTest extends RestClientTest<SDNAsyncClient> {
-
- private static interface TestService {
- @POST
- public void foo(@EndpointParam URI endpoint);
- }
-
- @DataProvider
- public Object[][] dataProvider() throws SecurityException, NoSuchMethodException {
-
- RestAnnotationProcessor<TestService> factory = injector.getInstance(Key
- .get(new TypeLiteral<RestAnnotationProcessor<TestService>>() {
- }));
-
- Method method = TestService.class.getMethod("foo", URI.class);
- return new Object[][] { { factory.createRequest(method, new Object[] { URI.create("https://host:443") }) },
- { factory.createRequest(method, new Object[] { URI.create("https://host/path") }) },
- { factory.createRequest(method, new Object[] { URI.create("https://host/?query") })
-
- } };
- }
-
- @Test(dataProvider = "dataProvider")
- public void testRequests(HttpRequest request) {
- String token = filter.getSessionToken();
- String query = request.getEndpoint().getQuery();
- request = filter.filter(request);
- assertEquals(request.getEndpoint().getQuery(), query == null ? "sessionToken=" + token : query + "&sessionToken="
- + token);
- }
-
- @Test
- void testUpdatesOnlyOncePerSecond() throws NoSuchMethodException, InterruptedException {
- String token = filter.getSessionToken();
- for (int i = 0; i < 10; i++)
- filter.updateIfTimeOut();
- assert token.equals(filter.getSessionToken());
- }
-
- @Override
- protected void checkFilters(HttpRequest request) {
- }
-
- private AddSessionTokenToRequest filter;
-
- @BeforeClass
- @Override
- protected void setupFactory() throws IOException {
- super.setupFactory();
- filter = injector.getInstance(AddSessionTokenToRequest.class);
- }
-
- @Override
- protected TypeLiteral<RestAnnotationProcessor<SDNAsyncClient>> createTypeLiteral() {
- return new TypeLiteral<RestAnnotationProcessor<SDNAsyncClient>>() {
- };
- }
-
- protected Module createModule() {
- return new TestSDNRestClientModule();
- }
-
- @RequiresHttp
- @ConfiguresRestClient
- static class TestSDNRestClientModule extends SDNRestClientModule {
- @Override
- public void configure() {
- bind(String.class).annotatedWith(SessionToken.class).toInstance("sessiontoken");
- bind(String.class).annotatedWith(Names.named(SDNConstants.PROPERTY_SDN_APPKEY)).toInstance("appKey");
- bind(String.class).annotatedWith(Names.named(SDNConstants.PROPERTY_SDN_APPNAME)).toInstance("appname");
- bind(String.class).annotatedWith(Names.named(SDNConstants.PROPERTY_SDN_USERNAME)).toInstance("username");
- }
-
- }
-
- @Override
- public RestContextSpec<SDNClient, SDNAsyncClient> createContextSpec() {
- return new RestContextFactory().createContextSpec("sdn", "user", "password", new Properties());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/filters/InsertUserContextIntoPathTest.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/filters/InsertUserContextIntoPathTest.java b/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/filters/InsertUserContextIntoPathTest.java
deleted file mode 100644
index 3d278d6..0000000
--- a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/filters/InsertUserContextIntoPathTest.java
+++ /dev/null
@@ -1,130 +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.nirvanix.sdn.filters;
-
-import static org.testng.Assert.assertEquals;
-
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.net.URI;
-import java.util.Properties;
-
-import javax.ws.rs.POST;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.RequiresHttp;
-import org.jclouds.nirvanix.sdn.SDNAsyncClient;
-import org.jclouds.nirvanix.sdn.SDNClient;
-import org.jclouds.nirvanix.sdn.SessionToken;
-import org.jclouds.nirvanix.sdn.config.SDNRestClientModule;
-import org.jclouds.nirvanix.sdn.reference.SDNConstants;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.RestClientTest;
-import org.jclouds.rest.RestContextFactory;
-import org.jclouds.rest.RestContextSpec;
-import org.jclouds.rest.annotations.EndpointParam;
-import org.jclouds.rest.internal.RestAnnotationProcessor;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Throwables;
-import com.google.inject.Module;
-import com.google.inject.TypeLiteral;
-import com.google.inject.name.Names;
-
-@Test(groups = "unit", singleThreaded = true, testName = "sdn.InsertUserContextIntoPathTest")
-// sequential as easymock isn't threadsafe
-public class InsertUserContextIntoPathTest extends RestClientTest<TestService> {
-
- private Method method;
-
- public void testRequestInvalid() {
- GeneratedHttpRequest request = processor.createRequest(method, URI.create("https://host/path"));
- request = filter.filter(request);
- request = filter.filter(request);
- assertEquals(request.getEndpoint().getPath(), "/sessiontoken/appname/username/path");
- assertEquals(request.getEndpoint().getHost(), "host");
- }
-
- public void testRequestNoSession() {
- GeneratedHttpRequest request = processor.createRequest(method, URI.create("https://host/path"));
- request = filter.filter(request);
- assertEquals(request.getEndpoint().getPath(), "/sessiontoken/appname/username/path");
- assertEquals(request.getEndpoint().getHost(), "host");
- }
-
- public void testRequestAlreadyHasSession() {
- GeneratedHttpRequest request = processor.createRequest(method, URI.create("https://host/sessiontoken/appname/username/path"));
- request = filter.filter(request);
- assertEquals(request.getEndpoint().getPath(), "/sessiontoken/appname/username/path");
- assertEquals(request.getEndpoint().getHost(), "host");
- }
-
- private InsertUserContextIntoPath filter;
-
- @BeforeClass
- @Override
- protected void setupFactory() throws IOException {
- super.setupFactory();
- filter = injector.getInstance(InsertUserContextIntoPath.class);
- try {
- method = TestService.class.getMethod("foo", URI.class);
- } catch (Exception e) {
- Throwables.propagate(e);
- }
- }
-
- @Override
- protected TypeLiteral<RestAnnotationProcessor<TestService>> createTypeLiteral() {
- return new TypeLiteral<RestAnnotationProcessor<TestService>>() {
- };
- }
-
- protected Module createModule() {
- return new TestSDNRestClientModule();
- }
-
- @RequiresHttp
- @ConfiguresRestClient
- static class TestSDNRestClientModule extends SDNRestClientModule {
- @Override
- public void configure() {
- bind(String.class).annotatedWith(SessionToken.class).toInstance("sessiontoken");
- bind(String.class).annotatedWith(Names.named(SDNConstants.PROPERTY_SDN_APPKEY)).toInstance("appKey");
- bind(String.class).annotatedWith(Names.named(SDNConstants.PROPERTY_SDN_APPNAME)).toInstance("appname");
- bind(String.class).annotatedWith(Names.named(SDNConstants.PROPERTY_SDN_USERNAME)).toInstance("username");
- }
-
- }
-
- @Override
- public RestContextSpec<SDNClient, SDNAsyncClient> createContextSpec() {
- return new RestContextFactory().createContextSpec("sdn", "user", "password", new Properties());
- }
-
- @Override
- protected void checkFilters(HttpRequest request) {
-
- }
-}
-
-interface TestService {
- @POST
- public void foo(@EndpointParam URI endpoint);
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/functions/ParseMetadataFromJsonResponseTest.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/functions/ParseMetadataFromJsonResponseTest.java b/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/functions/ParseMetadataFromJsonResponseTest.java
deleted file mode 100644
index 844c050..0000000
--- a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/functions/ParseMetadataFromJsonResponseTest.java
+++ /dev/null
@@ -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.nirvanix.sdn.functions;
-
-import static org.testng.Assert.assertEquals;
-
-import java.io.InputStream;
-import java.net.UnknownHostException;
-import java.util.Map;
-
-import org.jclouds.http.HttpResponse;
-import org.jclouds.io.Payloads;
-import org.jclouds.json.config.GsonModule;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-/**
- * Tests behavior of {@code ParseMetadataFromJsonResponse}
- *
- * @author Adrian Cole
- */
-@Test(groups = "unit", testName = "sdn.ParseMetadataFromJsonResponseTest")
-public class ParseMetadataFromJsonResponseTest {
-
- Injector i = Guice.createInjector(new GsonModule());
-
- public void testApplyInputStreamDetails() throws UnknownHostException {
- InputStream is = getClass().getResourceAsStream("/metadata.json");
-
- ParseMetadataFromJsonResponse parser = i.getInstance(ParseMetadataFromJsonResponse.class);
- Map<String, String> response = parser.apply(new HttpResponse(200, "ok", Payloads.newInputStreamPayload(is)));
- assertEquals(response, ImmutableMap.of("MD5", "IGPBYI1uC6+AJJxC4r5YBA==", "test", "1"));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/functions/ParseSessionTokenFromJsonResponseTest.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/functions/ParseSessionTokenFromJsonResponseTest.java b/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/functions/ParseSessionTokenFromJsonResponseTest.java
deleted file mode 100644
index 0126459..0000000
--- a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/functions/ParseSessionTokenFromJsonResponseTest.java
+++ /dev/null
@@ -1,52 +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.nirvanix.sdn.functions;
-
-import static org.testng.Assert.assertEquals;
-
-import java.io.InputStream;
-import java.net.UnknownHostException;
-
-import org.jclouds.http.HttpResponse;
-import org.jclouds.io.Payloads;
-import org.jclouds.json.config.GsonModule;
-import org.testng.annotations.Test;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-/**
- * Tests behavior of {@code ParseSessionTokenFromJsonResponse}
- *
- * @author Adrian Cole
- */
-@Test(groups = "unit", testName = "sdn.ParseSessionTokenFromJsonResponseTest")
-public class ParseSessionTokenFromJsonResponseTest {
-
- Injector i = Guice.createInjector(new GsonModule());
-
- public void testApplyInputStreamDetails() throws UnknownHostException {
- InputStream is = getClass().getResourceAsStream("/login.json");
-
- ParseSessionTokenFromJsonResponse parser = i.getInstance(ParseSessionTokenFromJsonResponse.class);
- String response = parser.apply(new HttpResponse(200, "ok", Payloads.newInputStreamPayload(is)));
- assertEquals(response, "e4b08449-4501-4b7a-af6a-d4e1e1bd7919");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/functions/ParseUploadInfoFromJsonResponseTest.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/functions/ParseUploadInfoFromJsonResponseTest.java b/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/functions/ParseUploadInfoFromJsonResponseTest.java
deleted file mode 100644
index 3205bbb..0000000
--- a/sandbox-apis/nirvanix/src/test/java/org/jclouds/nirvanix/sdn/functions/ParseUploadInfoFromJsonResponseTest.java
+++ /dev/null
@@ -1,55 +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.nirvanix.sdn.functions;
-
-import static org.testng.Assert.assertEquals;
-
-import java.io.InputStream;
-import java.net.URI;
-import java.net.UnknownHostException;
-
-import org.jclouds.http.HttpResponse;
-import org.jclouds.io.Payloads;
-import org.jclouds.json.config.GsonModule;
-import org.jclouds.nirvanix.sdn.domain.UploadInfo;
-import org.testng.annotations.Test;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-/**
- * Tests behavior of {@code ParseUploadInfoFromJsonResponse}
- *
- * @author Adrian Cole
- */
-@Test(groups = "unit", testName = "sdn.ParseUploadInfoFromJsonResponse")
-public class ParseUploadInfoFromJsonResponseTest {
-
- Injector i = Guice.createInjector(new GsonModule());
-
- public void testApplyInputStreamDetails() throws UnknownHostException {
- InputStream is = getClass().getResourceAsStream("/authtoken.json");
-
- ParseUploadInfoFromJsonResponse parser = i.getInstance(ParseUploadInfoFromJsonResponse.class);
- UploadInfo response = parser.apply(new HttpResponse(200, "ok", Payloads.newInputStreamPayload(is)));
- assertEquals(response.getHost(), URI.create("https://node1.nirvanix.com"));
- assertEquals(response.getToken(), "siR-ALYd~BEcJ8GR2tE~oX3SEHO8~2WXKT5xjFk~YLS5OvJyHI21TN34rQ");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/test/resources/authtoken.json
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/test/resources/authtoken.json b/sandbox-apis/nirvanix/src/test/resources/authtoken.json
deleted file mode 100644
index 7e25889..0000000
--- a/sandbox-apis/nirvanix/src/test/resources/authtoken.json
+++ /dev/null
@@ -1 +0,0 @@
-{"ResponseCode":0,"GetStorageNode":{"UploadHost":"node1.nirvanix.com","UploadToken":"siR-ALYd~BEcJ8GR2tE~oX3SEHO8~2WXKT5xjFk~YLS5OvJyHI21TN34rQ"}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/test/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/test/resources/log4j.xml b/sandbox-apis/nirvanix/src/test/resources/log4j.xml
deleted file mode 100644
index 0e2c1b2..0000000
--- a/sandbox-apis/nirvanix/src/test/resources/log4j.xml
+++ /dev/null
@@ -1,90 +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>
-
- <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>
-
- <!-- ================ -->
- <!-- 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>
-
- <category name="jclouds.wire">
- <priority value="DEBUG" />
- <appender-ref ref="ASYNCWIRE" />
- </category>
-
- <!-- ======================= -->
- <!-- Setup the Root category -->
- <!-- ======================= -->
-
- <root>
- <priority value="WARN" />
- </root>
-
-</log4j:configuration>
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/test/resources/login.json
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/test/resources/login.json b/sandbox-apis/nirvanix/src/test/resources/login.json
deleted file mode 100644
index 33f4833..0000000
--- a/sandbox-apis/nirvanix/src/test/resources/login.json
+++ /dev/null
@@ -1 +0,0 @@
-{"ResponseCode":0,"SessionToken":"e4b08449-4501-4b7a-af6a-d4e1e1bd7919"}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/nirvanix/src/test/resources/metadata.json
----------------------------------------------------------------------
diff --git a/sandbox-apis/nirvanix/src/test/resources/metadata.json b/sandbox-apis/nirvanix/src/test/resources/metadata.json
deleted file mode 100644
index c3a66ae..0000000
--- a/sandbox-apis/nirvanix/src/test/resources/metadata.json
+++ /dev/null
@@ -1 +0,0 @@
-{"ResponseCode":0,"Metadata":[{"Type":"MD5","Value":"IGPBYI1uC6+AJJxC4r5YBA=="},{"Type":"test","Value":"1"}]}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/pcs/README.txt
----------------------------------------------------------------------
diff --git a/sandbox-apis/pcs/README.txt b/sandbox-apis/pcs/README.txt
deleted file mode 100644
index 4bc91fa..0000000
--- a/sandbox-apis/pcs/README.txt
+++ /dev/null
@@ -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 provider for Mezeo Cloud Storage (http://www.mezeo.com/the-platform).
-#
-# TODO: Implementation status.
-# TODO: Supported features.
-# TODO: Usage example.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/pcs/pom.xml
----------------------------------------------------------------------
diff --git a/sandbox-apis/pcs/pom.xml b/sandbox-apis/pcs/pom.xml
deleted file mode 100644
index a12bfb6..0000000
--- a/sandbox-apis/pcs/pom.xml
+++ /dev/null
@@ -1,126 +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.7.0-SNAPSHOT</version>
- <relativePath>../../project/pom.xml</relativePath>
- </parent>
- <groupId>org.jclouds.api</groupId>
- <artifactId>pcs</artifactId>
- <name>jclouds mezeo cloud storage platform core</name>
- <description>jclouds Core components to access mezeo pcs2</description>
- <packaging>bundle</packaging>
-
- <!-- bootstrapping: need to fetch the project POM -->
- <repositories>
- <repository>
- <id>jclouds-sona-snapshots-nexus</id>
- <url>https://oss.sonatype.org/content/repositories/snapshots</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </repository>
- </repositories>
-
- <properties>
- <test.pcs.endpoint>FIXME</test.pcs.endpoint>
- <test.pcs.api-version>2</test.pcs.api-version>
- <test.pcs.build-version></test.pcs.build-version>
- <test.pcs.identity>FIXME</test.pcs.identity>
- <test.pcs.credential>FIXME</test.pcs.credential>
-
- <jclouds.osgi.export>org.jclouds.mezeo.pcs*;version="${project.version}"</jclouds.osgi.export>
- <jclouds.osgi.import>org.jclouds*;version="${project.version}",*</jclouds.osgi.import>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.jclouds</groupId>
- <artifactId>jclouds-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jclouds</groupId>
- <artifactId>jclouds-blobstore</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</groupId>
- <artifactId>jclouds-blobstore</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jclouds.driver</groupId>
- <artifactId>jclouds-log4j</artifactId>
- <version>${project.version}</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>
- <systemPropertyVariables>
- <test.pcs.endpoint>${test.pcs.endpoint}</test.pcs.endpoint>
- <test.pcs.api-version>${test.pcs.api-version}</test.pcs.api-version>
- <test.pcs.build-version>${test.pcs.build-version}</test.pcs.build-version>
- <test.pcs.identity>${test.pcs.identity}</test.pcs.identity>
- <test.pcs.credential>${test.pcs.credential}</test.pcs.credential>
- </systemPropertyVariables>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
-</project>
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSAsyncClient.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSAsyncClient.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSAsyncClient.java
deleted file mode 100644
index 85931d0..0000000
--- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSAsyncClient.java
+++ /dev/null
@@ -1,179 +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.mezeo.pcs;
-
-import java.io.InputStream;
-import java.net.URI;
-import java.util.Map;
-
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-
-import org.jclouds.blobstore.functions.ReturnNullOnKeyNotFound;
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.mezeo.pcs.binders.BindContainerNameToXmlPayload;
-import org.jclouds.mezeo.pcs.binders.BindFileInfoToXmlPayload;
-import org.jclouds.mezeo.pcs.binders.BindPCSFileToMultipartForm;
-import org.jclouds.mezeo.pcs.domain.ContainerList;
-import org.jclouds.mezeo.pcs.domain.FileInfoWithMetadata;
-import org.jclouds.mezeo.pcs.domain.PCSFile;
-import org.jclouds.mezeo.pcs.endpoints.RootContainer;
-import org.jclouds.mezeo.pcs.functions.AddMetadataItemIntoMap;
-import org.jclouds.mezeo.pcs.options.PutBlockOptions;
-import org.jclouds.mezeo.pcs.xml.ContainerHandler;
-import org.jclouds.mezeo.pcs.xml.FileHandler;
-import org.jclouds.rest.annotations.BinderParam;
-import org.jclouds.rest.annotations.Endpoint;
-import org.jclouds.rest.annotations.EndpointParam;
-import org.jclouds.rest.annotations.ExceptionParser;
-import org.jclouds.rest.annotations.Headers;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.ResponseParser;
-import org.jclouds.rest.annotations.SkipEncoding;
-import org.jclouds.rest.annotations.XMLResponseParser;
-import org.jclouds.rest.binders.BindToStringPayload;
-import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides asynchronous access to Mezeo PCS via their REST API.
- * <p/>
- *
- * @see PCSClient
- * @see <a href=
- * "http://developer.mezeo.com/mezeo-developer-center/documentation/howto-using-curl-to-access-api"
- * />
- * @author Adrian Cole
- */
-@SkipEncoding('/')
-@RequestFilters(BasicAuthentication.class)
-public interface PCSAsyncClient {
- PCSFile newFile();
-
- /**
- * @see PCSAsyncClient#list()
- */
- @GET
- @XMLResponseParser(ContainerHandler.class)
- @Headers(keys = "X-Cloud-Depth", values = "2")
- @Endpoint(RootContainer.class)
- ListenableFuture<? extends ContainerList> list();
-
- /**
- * @see PCSAsyncClient#list(URI)
- */
- @GET
- @XMLResponseParser(ContainerHandler.class)
- @Headers(keys = "X-Cloud-Depth", values = "2")
- ListenableFuture<? extends ContainerList> list(@EndpointParam URI container);
-
- /**
- * @see PCSAsyncClient#createContainer
- */
- @POST
- @Path("/contents")
- @Endpoint(RootContainer.class)
- @Produces("application/vnd.csp.container-info+xml")
- ListenableFuture<URI> createContainer(@BinderParam(BindContainerNameToXmlPayload.class) String container);
-
- /**
- * @see PCSAsyncClient#createContainer
- */
- @POST
- @Path("/contents")
- ListenableFuture<URI> createContainer(@EndpointParam URI parent,
- @BinderParam(BindContainerNameToXmlPayload.class) String container);
-
- /**
- * @see PCSAsyncClient#deleteContainer
- */
- @DELETE
- @ExceptionParser(ReturnVoidOnNotFoundOr404.class)
- ListenableFuture<Void> deleteContainer(@EndpointParam URI container);
-
- /**
- * @see PCSAsyncClient#uploadFile
- */
- @POST
- @Path("/contents")
- ListenableFuture<URI> uploadFile(@EndpointParam URI container,
- @BinderParam(BindPCSFileToMultipartForm.class) PCSFile object);
-
- /**
- * @see PCSAsyncClient#createFile
- */
- @POST
- @Path("/contents")
- ListenableFuture<URI> createFile(@EndpointParam URI container,
- @BinderParam(BindFileInfoToXmlPayload.class) PCSFile object);
-
- /**
- * @see PCSAsyncClient#uploadBlock
- */
- @PUT
- @Path("/content")
- ListenableFuture<Void> uploadBlock(@EndpointParam URI file, PCSFile object, PutBlockOptions... options);
-
- /**
- * @see PCSAsyncClient#deleteFile
- */
- @DELETE
- @ExceptionParser(ReturnVoidOnNotFoundOr404.class)
- ListenableFuture<Void> deleteFile(@EndpointParam URI file);
-
- /**
- * @see PCSAsyncClient#downloadFile
- */
- @GET
- @ExceptionParser(ReturnNullOnKeyNotFound.class)
- @Path("/content")
- ListenableFuture<InputStream> downloadFile(@EndpointParam URI file);
-
- /**
- * @see PCSAsyncClient#getFileInfo
- */
- @GET
- @ExceptionParser(ReturnNullOnKeyNotFound.class)
- @XMLResponseParser(FileHandler.class)
- @Headers(keys = "X-Cloud-Depth", values = "2")
- ListenableFuture<FileInfoWithMetadata> getFileInfo(@EndpointParam URI file);
-
- /**
- * @see PCSAsyncClient#putMetadataItem
- */
- @PUT
- @Path("/metadata/{key}")
- ListenableFuture<Void> putMetadataItem(@EndpointParam URI resource, @PathParam("key") String key,
- @BinderParam(BindToStringPayload.class) String value);
-
- /**
- * @see PCSAsyncClient#addMetadataItemToMap
- */
- @GET
- @ResponseParser(AddMetadataItemIntoMap.class)
- @Path("/metadata/{key}")
- ListenableFuture<Void> addMetadataItemToMap(@EndpointParam URI resource, @PathParam("key") String key,
- Map<String, String> map);
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSClient.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSClient.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSClient.java
deleted file mode 100644
index 5087d81..0000000
--- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSClient.java
+++ /dev/null
@@ -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.mezeo.pcs;
-
-import java.io.InputStream;
-import java.net.URI;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
-import org.jclouds.concurrent.Timeout;
-import org.jclouds.mezeo.pcs.domain.ContainerList;
-import org.jclouds.mezeo.pcs.domain.FileInfoWithMetadata;
-import org.jclouds.mezeo.pcs.domain.PCSFile;
-import org.jclouds.mezeo.pcs.options.PutBlockOptions;
-
-/**
- * Provides access to Mezeo PCS via their REST API.
- * <p/>
- *
- * @see <a href=
- * "http://developer.mezeo.com/mezeo-developer-center/documentation/howto-using-curl-to-access-api"
- * />
- * @author Adrian Cole
- */
-@Timeout(duration = 30, timeUnit = TimeUnit.SECONDS)
-public interface PCSClient {
- PCSFile newFile();
-
- ContainerList list();
-
- ContainerList list(URI container);
-
- URI createContainer(String container);
-
- URI createContainer(URI parent, String container);
-
- void deleteContainer(URI container);
-
- URI uploadFile(URI container, PCSFile object);
-
- URI createFile(URI container, PCSFile object);
-
- void uploadBlock(URI file, PCSFile object, PutBlockOptions... options);
-
- void deleteFile(URI file);
-
- InputStream downloadFile(URI file);
-
- FileInfoWithMetadata getFileInfo(URI file);
-
- void putMetadataItem(URI resource, String key, String value);
-
- void addMetadataItemToMap(URI resource, String key, Map<String, String> map);
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSCloudAsyncClient.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSCloudAsyncClient.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSCloudAsyncClient.java
deleted file mode 100644
index 1da8fda..0000000
--- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSCloudAsyncClient.java
+++ /dev/null
@@ -1,76 +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.mezeo.pcs;
-
-import java.net.URI;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-
-import org.jclouds.http.filters.BasicAuthentication;
-import org.jclouds.mezeo.pcs.endpoints.Contacts;
-import org.jclouds.mezeo.pcs.endpoints.Metacontainers;
-import org.jclouds.mezeo.pcs.endpoints.Projects;
-import org.jclouds.mezeo.pcs.endpoints.Recyclebin;
-import org.jclouds.mezeo.pcs.endpoints.RootContainer;
-import org.jclouds.mezeo.pcs.endpoints.Shares;
-import org.jclouds.mezeo.pcs.endpoints.Tags;
-import org.jclouds.mezeo.pcs.xml.CloudXlinkHandler;
-import org.jclouds.rest.annotations.RequestFilters;
-import org.jclouds.rest.annotations.XMLResponseParser;
-
-import com.google.common.util.concurrent.ListenableFuture;
-
-/**
- * Provides URIs to PCS services via their REST API.
- * <p/>
- *
- * @author Adrian Cole
- */
-@RequestFilters(BasicAuthentication.class)
-public interface PCSCloudAsyncClient {
-
- public interface Response {
- @RootContainer
- URI getRootContainerUrl();
-
- @Contacts
- URI getContactsUrl();
-
- @Shares
- URI getSharesUrl();
-
- @Projects
- URI getProjectsUrl();
-
- @Metacontainers
- URI getMetacontainersUrl();
-
- @Recyclebin
- URI getRecyclebinUrl();
-
- @Tags
- URI getTagsUrl();
- }
-
- @GET
- @XMLResponseParser(CloudXlinkHandler.class)
- @Path("/v{jclouds.api-version}")
- ListenableFuture<Response> authenticate();
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSContextBuilder.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSContextBuilder.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSContextBuilder.java
deleted file mode 100644
index 878104e..0000000
--- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSContextBuilder.java
+++ /dev/null
@@ -1,42 +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.mezeo.pcs;
-
-import java.util.List;
-import java.util.Properties;
-
-import org.jclouds.mezeo.pcs.config.PCSRestClientModule;
-import org.jclouds.rest.RestContextBuilder;
-
-import com.google.inject.Module;
-
-/**
- *
- * @author Adrian Cole
- */
-public class PCSContextBuilder extends RestContextBuilder<PCSClient, PCSAsyncClient> {
-
- public PCSContextBuilder(Properties props) {
- super(PCSClient.class, PCSAsyncClient.class, props);
- }
-
- protected void addClientModule(List<Module> modules) {
- modules.add(new PCSRestClientModule());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSPropertiesBuilder.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSPropertiesBuilder.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSPropertiesBuilder.java
deleted file mode 100644
index c90698a..0000000
--- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/PCSPropertiesBuilder.java
+++ /dev/null
@@ -1,44 +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.mezeo.pcs;
-
-import static org.jclouds.Constants.PROPERTY_API_VERSION;
-
-import java.util.Properties;
-
-import org.jclouds.PropertiesBuilder;
-
-/**
- * Builds properties used in PCS Connections
- *
- * @author Adrian Cole
- */
-public class PCSPropertiesBuilder extends PropertiesBuilder {
- @Override
- protected Properties defaultProperties() {
- Properties properties = super.defaultProperties();
- properties.setProperty(PROPERTY_API_VERSION, "2");
- return properties;
- }
-
- public PCSPropertiesBuilder(Properties properties) {
- super(properties);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/binders/BindContainerNameToXmlPayload.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/binders/BindContainerNameToXmlPayload.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/binders/BindContainerNameToXmlPayload.java
deleted file mode 100644
index fe00cf4..0000000
--- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/binders/BindContainerNameToXmlPayload.java
+++ /dev/null
@@ -1,39 +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.mezeo.pcs.binders;
-
-import javax.inject.Singleton;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.rest.Binder;
-
-/**
- *
- * @author Adrian Cole
- *
- */
-@Singleton
-public class BindContainerNameToXmlPayload implements Binder {
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object input) {
- String container = String.format("<container><name>%s</name></container>", input);
- request.setPayload(container);
- return request;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/binders/BindFileInfoToXmlPayload.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/binders/BindFileInfoToXmlPayload.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/binders/BindFileInfoToXmlPayload.java
deleted file mode 100644
index 9373b04..0000000
--- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/binders/BindFileInfoToXmlPayload.java
+++ /dev/null
@@ -1,50 +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.mezeo.pcs.binders;
-
-import java.io.File;
-
-import javax.inject.Singleton;
-import javax.ws.rs.core.HttpHeaders;
-
-import org.jclouds.http.HttpRequest;
-import org.jclouds.http.utils.ModifyRequest;
-import org.jclouds.mezeo.pcs.domain.PCSFile;
-import org.jclouds.rest.Binder;
-
-import com.google.common.collect.ImmutableMultimap;
-
-/**
- *
- * @author Adrian Cole
- *
- */
-@Singleton
-public class BindFileInfoToXmlPayload implements Binder {
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object input) {
- PCSFile blob = (PCSFile) input;
- String file = String.format("<file><name>%s</name><mime_type>%s</mime_type><public>false</public></file>",
- new File(blob.getMetadata().getName()).getName(), blob.getMetadata().getMimeType());
- request.setPayload(file);
- return ModifyRequest.replaceHeaders(request, ImmutableMultimap.<String, String> of(HttpHeaders.CONTENT_LENGTH,
- file.getBytes().length + "", HttpHeaders.CONTENT_TYPE, "application/vnd.csp.file-info+xml"));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/binders/BindPCSFileToMultipartForm.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/binders/BindPCSFileToMultipartForm.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/binders/BindPCSFileToMultipartForm.java
deleted file mode 100644
index 4b379db..0000000
--- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/binders/BindPCSFileToMultipartForm.java
+++ /dev/null
@@ -1,52 +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.mezeo.pcs.binders;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.blobstore.binders.BindBlobToMultipartForm;
-import org.jclouds.http.HttpRequest;
-import org.jclouds.mezeo.pcs.blobstore.functions.PCSFileToBlob;
-import org.jclouds.mezeo.pcs.domain.PCSFile;
-import org.jclouds.rest.Binder;
-
-@Singleton
-public class BindPCSFileToMultipartForm implements Binder {
- private final BindBlobToMultipartForm blobBinder;
- private final PCSFileToBlob file2Blob;
-
- @Inject
- public BindPCSFileToMultipartForm(PCSFileToBlob file2Blob, BindBlobToMultipartForm blobBinder) {
- this.blobBinder = blobBinder;
- this.file2Blob = file2Blob;
- }
-
- @Override
- public <R extends HttpRequest> R bindToRequest(R request, Object input) {
- PCSFile file = (PCSFile) input;
- checkNotNull(file.getPayload().getContentMetadata().getContentLength(), "contentLength");
- checkArgument(file.getPayload().getContentMetadata().getContentLength() <= 2l * 1024 * 1024 * 1024,
- "maximum size for POST request is 2GB");
- return blobBinder.bindToRequest(request, file2Blob.apply(file));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/BlobToFileInfo.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/BlobToFileInfo.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/BlobToFileInfo.java
deleted file mode 100644
index bf91521..0000000
--- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/BlobToFileInfo.java
+++ /dev/null
@@ -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.mezeo.pcs.blobstore.functions;
-
-import javax.inject.Singleton;
-
-import org.jclouds.blobstore.domain.BlobMetadata;
-import org.jclouds.mezeo.pcs.domain.MutableFileInfo;
-import org.jclouds.mezeo.pcs.domain.internal.MutableFileInfoImpl;
-
-import com.google.common.base.Function;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class BlobToFileInfo implements Function<BlobMetadata, MutableFileInfo> {
- @Override
- public MutableFileInfo apply(BlobMetadata base) {
- MutableFileInfo to = new MutableFileInfoImpl();
- to.setUrl(base.getUri());
- to.setMimeType(base.getContentMetadata().getContentType());
- to.setName(base.getName());
- to.setModified(base.getLastModified());
- if (base.getContentMetadata().getContentLength() != null)
- to.setBytes(base.getContentMetadata().getContentLength());
- return to;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/BlobToPCSFile.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/BlobToPCSFile.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/BlobToPCSFile.java
deleted file mode 100644
index 556ce49..0000000
--- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/BlobToPCSFile.java
+++ /dev/null
@@ -1,49 +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.mezeo.pcs.blobstore.functions;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.mezeo.pcs.domain.PCSFile;
-
-import com.google.common.base.Function;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class BlobToPCSFile implements Function<Blob, PCSFile> {
- private final BlobToFileInfo blob2ObjectMd;
- private final PCSFile.Factory objectProvider;
-
- @Inject
- BlobToPCSFile(BlobToFileInfo blob2ObjectMd, PCSFile.Factory objectProvider) {
- this.blob2ObjectMd = blob2ObjectMd;
- this.objectProvider = objectProvider;
- }
-
- public PCSFile apply(Blob from) {
- PCSFile object = objectProvider.create(blob2ObjectMd.apply(from.getMetadata()));
- object.setPayload(from.getPayload());
- object.setAllHeaders(from.getAllHeaders());
- return object;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/FileInfoToBlobMetadata.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/FileInfoToBlobMetadata.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/FileInfoToBlobMetadata.java
deleted file mode 100644
index 800bf1b..0000000
--- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/FileInfoToBlobMetadata.java
+++ /dev/null
@@ -1,57 +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.mezeo.pcs.blobstore.functions;
-
-import java.util.regex.Pattern;
-
-import javax.inject.Singleton;
-
-import org.jclouds.blobstore.domain.MutableBlobMetadata;
-import org.jclouds.blobstore.domain.StorageType;
-import org.jclouds.blobstore.domain.internal.MutableBlobMetadataImpl;
-import org.jclouds.mezeo.pcs.domain.FileInfo;
-import org.jclouds.util.Strings2;
-
-import com.google.common.base.Function;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class FileInfoToBlobMetadata implements Function<FileInfo, MutableBlobMetadata> {
- public static final Pattern OBJECTS_PATTERN = Pattern.compile(".*objects/");
-
- @Override
- public MutableBlobMetadata apply(FileInfo from) {
- MutableBlobMetadata to = new MutableBlobMetadataImpl();
- if (from.getUrl() != null) {
- to.setId(Strings2.replaceAll(from.getUrl().getPath(), OBJECTS_PATTERN, ""));
- }
- to.setUri(from.getUrl());
- to.setName(from.getName());
- if (from.getMimeType() != null)
- to.getContentMetadata().setContentType(from.getMimeType());
- if (from.getModified() != null)
- to.setLastModified(from.getModified());
- if (from.getBytes() != null)
- to.getContentMetadata().setContentLength(from.getBytes());
- to.setType(StorageType.BLOB);
- return to;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/PCSFileToBlob.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/PCSFileToBlob.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/PCSFileToBlob.java
deleted file mode 100644
index 48779c6..0000000
--- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/blobstore/functions/PCSFileToBlob.java
+++ /dev/null
@@ -1,50 +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.mezeo.pcs.blobstore.functions;
-
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.jclouds.blobstore.domain.Blob;
-import org.jclouds.blobstore.domain.Blob.Factory;
-import org.jclouds.mezeo.pcs.domain.PCSFile;
-
-import com.google.common.base.Function;
-
-/**
- * @author Adrian Cole
- */
-@Singleton
-public class PCSFileToBlob implements Function<PCSFile, Blob> {
- private final Blob.Factory blobFactory;
- private final FileInfoToBlobMetadata info2BlobMd;
-
- @Inject
- PCSFileToBlob(Factory blobFactory, FileInfoToBlobMetadata info2BlobMd) {
- this.blobFactory = blobFactory;
- this.info2BlobMd = info2BlobMd;
- }
-
- public Blob apply(PCSFile from) {
- Blob blob = blobFactory.create(info2BlobMd.apply(from.getMetadata()));
- blob.setPayload(from.getPayload());
- blob.setAllHeaders(from.getAllHeaders());
- return blob;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/config/PCSObjectModule.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/config/PCSObjectModule.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/config/PCSObjectModule.java
deleted file mode 100644
index 6a5c3d0..0000000
--- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/config/PCSObjectModule.java
+++ /dev/null
@@ -1,64 +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.mezeo.pcs.config;
-
-import javax.inject.Inject;
-import javax.inject.Provider;
-
-import org.jclouds.blobstore.config.BlobStoreObjectModule;
-import org.jclouds.mezeo.pcs.domain.MutableFileInfo;
-import org.jclouds.mezeo.pcs.domain.PCSFile;
-import org.jclouds.mezeo.pcs.domain.internal.PCSFileImpl;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Provides;
-import com.google.inject.Scopes;
-
-/**
- * Configures the domain object mappings needed for all PCS implementations
- *
- * @author Adrian Cole
- */
-public class PCSObjectModule extends AbstractModule {
-
- /**
- * explicit factories are created here as it has been shown that Assisted Inject is extremely
- * inefficient. http://code.google.com/p/google-guice/issues/detail?id=435
- */
- @Override
- protected void configure() {
- // for adapters
- install(new BlobStoreObjectModule());
- bind(PCSFile.Factory.class).to(PCSFileFactory.class).in(Scopes.SINGLETON);
- }
-
- private static class PCSFileFactory implements PCSFile.Factory {
- @Inject
- Provider<MutableFileInfo> metadataProvider;
-
- public PCSFile create(MutableFileInfo metadata) {
- return new PCSFileImpl(metadata != null ? metadata : metadataProvider.get());
- }
- }
-
- @Provides
- PCSFile providePCSFile(PCSFile.Factory factory) {
- return factory.create(null);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/config/PCSRestClientModule.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/config/PCSRestClientModule.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/config/PCSRestClientModule.java
deleted file mode 100644
index 63cb875..0000000
--- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/config/PCSRestClientModule.java
+++ /dev/null
@@ -1,139 +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.mezeo.pcs.config;
-
-import java.net.URI;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-import javax.inject.Named;
-import javax.inject.Singleton;
-
-import org.jclouds.Constants;
-import org.jclouds.http.HttpRetryHandler;
-import org.jclouds.http.RequiresHttp;
-import org.jclouds.http.annotation.ClientError;
-import org.jclouds.mezeo.pcs.PCSAsyncClient;
-import org.jclouds.mezeo.pcs.PCSClient;
-import org.jclouds.mezeo.pcs.PCSCloudAsyncClient;
-import org.jclouds.mezeo.pcs.PCSCloudAsyncClient.Response;
-import org.jclouds.mezeo.pcs.endpoints.Contacts;
-import org.jclouds.mezeo.pcs.endpoints.Metacontainers;
-import org.jclouds.mezeo.pcs.endpoints.Projects;
-import org.jclouds.mezeo.pcs.endpoints.Recyclebin;
-import org.jclouds.mezeo.pcs.endpoints.RootContainer;
-import org.jclouds.mezeo.pcs.endpoints.Shares;
-import org.jclouds.mezeo.pcs.endpoints.Tags;
-import org.jclouds.mezeo.pcs.endpoints.WebDAV;
-import org.jclouds.mezeo.pcs.handlers.PCSClientErrorRetryHandler;
-import org.jclouds.rest.AsyncClientFactory;
-import org.jclouds.rest.ConfiguresRestClient;
-import org.jclouds.rest.config.RestClientModule;
-
-import com.google.inject.Provides;
-
-/**
- * Configures the PCSCloudModule authentication service connection.
- *
- * @author Adrian Cole
- */
-@RequiresHttp
-@ConfiguresRestClient
-public class PCSRestClientModule extends RestClientModule<PCSClient, PCSAsyncClient> {
-
- @Override
- protected void configure() {
- install(new PCSObjectModule());
- super.configure();
- }
-
- public PCSRestClientModule() {
- super(PCSClient.class, PCSAsyncClient.class);
- }
-
- @Provides
- @Singleton
- protected Response provideCloudResponse(AsyncClientFactory factory) throws InterruptedException, ExecutionException,
- TimeoutException {
- return factory.create(PCSCloudAsyncClient.class).authenticate().get(10, TimeUnit.SECONDS);
- }
-
- @Provides
- @Singleton
- @WebDAV
- protected URI provideWebDAVURI(@Named(Constants.PROPERTY_ENDPOINT) String endpoint) {
- return URI.create(endpoint + "/dav");
- }
-
- @Provides
- @Singleton
- @Contacts
- protected URI provideContactsUrl(Response response) {
- return response.getContactsUrl();
- }
-
- @Provides
- @Singleton
- @Metacontainers
- protected URI provideMetacontainersUrl(Response response) {
- return response.getMetacontainersUrl();
- }
-
- @Provides
- @Singleton
- @Projects
- protected URI provideProjectsUrl(Response response) {
- return response.getProjectsUrl();
- }
-
- @Provides
- @Singleton
- @Recyclebin
- protected URI provideRecyclebinUrl(Response response) {
- return response.getRecyclebinUrl();
- }
-
- @Provides
- @Singleton
- @RootContainer
- protected URI provideRootContainerUrl(Response response) {
- return response.getRootContainerUrl();
- }
-
- @Provides
- @Singleton
- @Shares
- protected URI provideSharesUrl(Response response) {
- return response.getSharesUrl();
- }
-
- @Provides
- @Singleton
- @Tags
- protected URI provideTagsUrl(Response response) {
- return response.getTagsUrl();
- }
-
- @Override
- protected void bindRetryHandlers() {
- bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(PCSClientErrorRetryHandler.class);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/ContainerInfo.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/ContainerInfo.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/ContainerInfo.java
deleted file mode 100644
index 2feac3f..0000000
--- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/ContainerInfo.java
+++ /dev/null
@@ -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.mezeo.pcs.domain;
-
-import java.net.URI;
-
-import org.jclouds.mezeo.pcs.domain.internal.ContainerInfoImpl;
-
-import com.google.inject.ImplementedBy;
-
-/**
- *
- * @author Adrian Cole
- *
- */
-@ImplementedBy(ContainerInfoImpl.class)
-public interface ContainerInfo extends ResourceInfo {
-
- URI getContents();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/ContainerList.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/ContainerList.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/ContainerList.java
deleted file mode 100644
index 759db0b..0000000
--- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/ContainerList.java
+++ /dev/null
@@ -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.mezeo.pcs.domain;
-
-import java.net.URI;
-import java.util.Map;
-import java.util.SortedSet;
-
-import org.jclouds.mezeo.pcs.domain.internal.ContainerListImpl;
-
-import com.google.inject.ImplementedBy;
-
-/**
- *
- * @author Adrian Cole
- *
- */
-@ImplementedBy(ContainerListImpl.class)
-public interface ContainerList extends ResourceInfo, SortedSet<ResourceInfo> {
- Map<String, URI> getMetadataItems();
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/FileInfo.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/FileInfo.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/FileInfo.java
deleted file mode 100644
index c77d656..0000000
--- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/FileInfo.java
+++ /dev/null
@@ -1,44 +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.mezeo.pcs.domain;
-
-import java.net.URI;
-
-import org.jclouds.mezeo.pcs.domain.internal.FileInfoImpl;
-
-import com.google.inject.ImplementedBy;
-
-/**
- *
- * @author Adrian Cole
- *
- */
-@ImplementedBy(FileInfoImpl.class)
-public interface FileInfo extends ResourceInfo {
-
- Boolean isPublic();
-
- String getMimeType();
-
- URI getContent();
-
- URI getPermissions();
-
- URI getThumbnail();
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/FileInfoWithMetadata.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/FileInfoWithMetadata.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/FileInfoWithMetadata.java
deleted file mode 100644
index 8015fa4..0000000
--- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/FileInfoWithMetadata.java
+++ /dev/null
@@ -1,36 +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.mezeo.pcs.domain;
-
-import java.net.URI;
-import java.util.Map;
-
-import org.jclouds.mezeo.pcs.domain.internal.FileInfoWithMetadataImpl;
-
-import com.google.inject.ImplementedBy;
-
-/**
- *
- * @author Adrian Cole
- *
- */
-@ImplementedBy(FileInfoWithMetadataImpl.class)
-public interface FileInfoWithMetadata extends FileInfo {
- Map<String, URI> getMetadataItems();
-}
http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/23d9d901/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/MutableFileInfo.java
----------------------------------------------------------------------
diff --git a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/MutableFileInfo.java b/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/MutableFileInfo.java
deleted file mode 100644
index c71cf4b..0000000
--- a/sandbox-apis/pcs/src/main/java/org/jclouds/mezeo/pcs/domain/MutableFileInfo.java
+++ /dev/null
@@ -1,44 +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.mezeo.pcs.domain;
-
-import java.net.URI;
-
-import org.jclouds.mezeo.pcs.domain.internal.MutableFileInfoImpl;
-
-import com.google.inject.ImplementedBy;
-
-/**
- *
- * @author Adrian Cole
- *
- */
-@ImplementedBy(MutableFileInfoImpl.class)
-public interface MutableFileInfo extends FileInfo, MutableResourceInfo {
-
- void setPublic(Boolean isPublic);
-
- void setMimeType(String value);
-
- void setContent(URI value);
-
- void setPermissions(URI value);
-
- void setThumbnail(URI value);
-}