diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ReferenceType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ReferenceType.java index 314890c5fe..f568c8785f 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ReferenceType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ReferenceType.java @@ -43,7 +43,7 @@ import com.google.common.base.Objects.ToStringHelper; CatalogReference.class, Reference.class }) -public class ReferenceType> implements URISupplier { +public class ReferenceType> { public static > Builder builder() { return new Builder(); @@ -176,14 +176,6 @@ public class ReferenceType> implements URISupplier { return type; } - /** - * @see URISupplier#getURI() - */ - @Override - public URI getURI() { - return getHref(); - } - @Override public boolean equals(Object o) { if (this == o) diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceType.java index 69100b0e2a..42f14c1189 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/ResourceType.java @@ -28,8 +28,6 @@ import java.util.Set; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; -import org.jclouds.vcloud.director.v1_5.domain.EntityType.NewBuilder; - import com.google.common.base.Objects; import com.google.common.base.Objects.ToStringHelper; import com.google.common.collect.ImmutableSet; @@ -46,7 +44,7 @@ import com.google.common.collect.Sets; * * @author Adrian Cole */ -public abstract class ResourceType> implements URISupplier { +public abstract class ResourceType> { public NewBuilder toNewBuilder() { throw new UnsupportedOperationException("New builder not yet implemented for this class"); @@ -179,14 +177,6 @@ public abstract class ResourceType> implements URISupp return href; } - /** - * @see URISupplier#getURI() - */ - @Override - public URI getURI() { - return getHref(); - } - /** * Contains the type of the the entity. *

diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/URISupplier.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/URISupplier.java deleted file mode 100644 index 3f5066b81d..0000000000 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/URISupplier.java +++ /dev/null @@ -1,47 +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.vcloud.director.v1_5.domain; - -import java.net.URI; - -/** - * @author grkvlt@apache.org - */ -public interface URISupplier { - - /** - * This returns the {@link URI} for a particular {@link ReferenceType} or {@link ResourceType} object. - * - * @see ResourceType#getHref() - * @see ReferenceType#getHref() - */ - public URI getURI(); - - public static class SingleURI { - public static URISupplier fromURI(final URI uri) { - return new URISupplier(){ - @Override - public URI getURI() { - return uri; - } - }; - } - } - -} diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MetadataAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MetadataAsyncClient.java index fe2dfb46c3..b6f9bc3284 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MetadataAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/MetadataAsyncClient.java @@ -39,7 +39,6 @@ import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.domain.Metadata; import org.jclouds.vcloud.director.v1_5.domain.MetadataValue; import org.jclouds.vcloud.director.v1_5.domain.Task; -import org.jclouds.vcloud.director.v1_5.domain.URISupplier; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest; import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/TaskAsyncClient.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/TaskAsyncClient.java index 99a92fb54f..1c5dc927ce 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/TaskAsyncClient.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/features/TaskAsyncClient.java @@ -31,7 +31,6 @@ import org.jclouds.rest.annotations.JAXBResponseParser; import org.jclouds.rest.annotations.RequestFilters; import org.jclouds.vcloud.director.v1_5.domain.Task; import org.jclouds.vcloud.director.v1_5.domain.TasksList; -import org.jclouds.vcloud.director.v1_5.domain.URISupplier; import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest; import org.jclouds.vcloud.director.v1_5.functions.OrgReferenceToTaskListEndpoint; import org.jclouds.vcloud.director.v1_5.functions.ThrowVCloudErrorOn4xx; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/OrgReferenceToTaskListEndpoint.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/OrgReferenceToTaskListEndpoint.java index a46f945082..5a40b35ae9 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/OrgReferenceToTaskListEndpoint.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/functions/OrgReferenceToTaskListEndpoint.java @@ -26,7 +26,6 @@ import javax.inject.Singleton; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.domain.Link; import org.jclouds.vcloud.director.v1_5.domain.Org; -import org.jclouds.vcloud.director.v1_5.domain.URISupplier; import org.jclouds.vcloud.director.v1_5.features.OrgClient; import com.google.common.base.Function; diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/predicates/TaskSuccess.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/predicates/TaskSuccess.java index 1cd2a9d804..ee0aa98810 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/predicates/TaskSuccess.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/predicates/TaskSuccess.java @@ -18,8 +18,6 @@ */ package org.jclouds.vcloud.director.v1_5.predicates; -import java.net.URI; - import javax.annotation.Resource; import javax.inject.Inject; import javax.inject.Singleton; @@ -27,7 +25,6 @@ import javax.inject.Singleton; import org.jclouds.logging.Logger; import org.jclouds.vcloud.director.v1_5.VCloudDirectorException; import org.jclouds.vcloud.director.v1_5.domain.Task; -import org.jclouds.vcloud.director.v1_5.domain.URISupplier; import org.jclouds.vcloud.director.v1_5.features.TaskClient; import com.google.common.base.Predicate; @@ -56,7 +53,7 @@ public class TaskSuccess implements Predicate { logger.trace("looking for status on task %s", task); // TODO shouldn't we see if it's already done before getting it from API server? - task = taskClient.getTask(task.getURI()); + task = taskClient.getTask(task.getHref()); // perhaps task isn't available, yet if (task == null) return false; diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogClientExpectTest.java index 44e33207a1..67daebfcdf 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogClientExpectTest.java @@ -60,7 +60,7 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx AdminCatalog expected = catalog(); - assertEquals(client.getAdminCatalogClient().getCatalog(catalogRef.getURI()), expected); + assertEquals(client.getAdminCatalogClient().getCatalog(catalogRef.getHref()), expected); } @Test @@ -77,7 +77,7 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx AdminCatalog expected = modifyCatalog(); - assertEquals(client.getAdminCatalogClient().updateCatalog(catalogRef.getURI(), expected), expected); + assertEquals(client.getAdminCatalogClient().updateCatalog(catalogRef.getHref(), expected), expected); } @Test @@ -93,7 +93,7 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx Owner expected = owner(); - assertEquals(client.getAdminCatalogClient().getOwner(catalogRef.getURI()), expected); + assertEquals(client.getAdminCatalogClient().getOwner(catalogRef.getHref()), expected); } @Test @@ -116,7 +116,7 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx .build()) .build(); - client.getAdminCatalogClient().setOwner(catalogRef.getURI(), newOwner); + client.getAdminCatalogClient().setOwner(catalogRef.getHref(), newOwner); } @Test @@ -134,7 +134,7 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx .isPublished(true) .build(); - client.getAdminCatalogClient().publishCatalog(catalogRef.getURI(), params); + client.getAdminCatalogClient().publishCatalog(catalogRef.getHref(), params); } @Test @@ -147,7 +147,7 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx new VcloudHttpResponsePrimer() .httpResponseBuilder().statusCode(204).build()); - client.getAdminCatalogClient().deleteCatalog(catalogRef.getURI()); + client.getAdminCatalogClient().deleteCatalog(catalogRef.getHref()); } public static final AdminCatalog catalog() { diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogClientLiveTest.java index 0f82fc5819..490895e53a 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/AdminCatalogClientLiveTest.java @@ -74,7 +74,7 @@ public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest @Test(testName = "GET /admin/catalog/{id}") public void testGetCatalog() { assertNotNull(catalogRef, String.format(REF_REQ_LIVE, "Catalog")); - catalog = catalogClient.getCatalog(catalogRef.getURI()); + catalog = catalogClient.getCatalog(catalogRef.getHref()); Checks.checkAdminCatalog(catalog); } @@ -82,7 +82,7 @@ public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest @Test(testName = "GET /admin/catalog/{id}/owner", dependsOnMethods = { "testGetCatalog" }) public void testGetCatalogOwner() { - owner = catalogClient.getOwner(catalog.getURI()); + owner = catalogClient.getOwner(catalog.getHref()); Checks.checkOwner(owner); } @@ -100,13 +100,13 @@ public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest .build(); try { - catalogClient.setOwner(catalog.getURI(), newOwner); - owner = catalogClient.getOwner(catalog.getURI()); + catalogClient.setOwner(catalog.getHref(), newOwner); + owner = catalogClient.getOwner(catalog.getHref()); Checks.checkOwner(owner); assertTrue(equal(owner, newOwner), String.format(OBJ_FIELD_UPDATABLE, CATALOG, "owner")); } finally { - catalogClient.setOwner(catalog.getURI(), oldOwner); - owner = catalogClient.getOwner(catalog.getURI()); + catalogClient.setOwner(catalog.getHref(), oldOwner); + owner = catalogClient.getOwner(catalog.getHref()); } } @@ -127,7 +127,7 @@ public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest // .catalogItems(newCatalogItems) .build(); - catalog = catalogClient.updateCatalog(catalog.getURI(), catalog); + catalog = catalogClient.updateCatalog(catalog.getHref(), catalog); assertTrue(equal(catalog.getName(), newName), String.format(OBJ_FIELD_UPDATABLE, CATALOG, "name")); assertTrue(equal(catalog.getDescription(), newDescription), @@ -144,7 +144,7 @@ public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest // .catalogItems(oldCatalogItems) .build(); - catalog = catalogClient.updateCatalog(catalog.getURI(), catalog); + catalog = catalogClient.updateCatalog(catalog.getHref(), catalog); } } @@ -158,8 +158,8 @@ public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest .isPublished(true) .build(); - catalogClient.publishCatalog(catalogRef.getURI(), params); - catalog = catalogClient.getCatalog(catalogRef.getURI()); + catalogClient.publishCatalog(catalogRef.getHref(), params); + catalog = catalogClient.getCatalog(catalogRef.getHref()); assertTrue(catalog.isPublished(), String.format(OBJ_FIELD_EQ, CATALOG, "isPublished", true, catalog.isPublished())); @@ -169,7 +169,7 @@ public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest @Test(testName = "DELETE /admin/catalog/{id}", dependsOnMethods = { "testPublishCatalog" }, enabled = false ) public void testDeleteCatalog() { - catalogClient.deleteCatalog(catalogRef.getURI()); + catalogClient.deleteCatalog(catalogRef.getHref()); Error expected = Error.builder() .message("???") @@ -178,7 +178,7 @@ public class AdminCatalogClientLiveTest extends BaseVCloudDirectorClientLiveTest .build(); try { - catalog = catalogClient.getCatalog(catalogRef.getURI()); + catalog = catalogClient.getCatalog(catalogRef.getHref()); fail("Should give HTTP 403 error"); } catch (VCloudDirectorException vde) { assertEquals(vde.getError(), expected); diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/GroupClientExpectTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/GroupClientExpectTest.java index c5e5e95464..b61708eace 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/GroupClientExpectTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/GroupClientExpectTest.java @@ -56,7 +56,7 @@ public class GroupClientExpectTest extends BaseVCloudDirectorRestClientExpectTes Group expected = group(); - assertEquals(client.getGroupClient().getGroup(groupRef.getURI()), expected); + assertEquals(client.getGroupClient().getGroup(groupRef.getHref()), expected); } public static final Group group() { @@ -79,7 +79,7 @@ public class GroupClientExpectTest extends BaseVCloudDirectorRestClientExpectTes Group expected = updateGroup(); - assertEquals(client.getGroupClient().updateGroup(groupRef.getURI(), expected), expected); + assertEquals(client.getGroupClient().updateGroup(groupRef.getHref(), expected), expected); } public static Group updateGroup() { @@ -96,6 +96,6 @@ public class GroupClientExpectTest extends BaseVCloudDirectorRestClientExpectTes new VcloudHttpResponsePrimer() .httpResponseBuilder().statusCode(204).build()); - client.getAdminCatalogClient().deleteCatalog(groupRef.getURI()); + client.getAdminCatalogClient().deleteCatalog(groupRef.getHref()); } } diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/GroupClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/GroupClientLiveTest.java index 6a618fc4d9..8b116b163e 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/GroupClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/GroupClientLiveTest.java @@ -76,7 +76,7 @@ public class GroupClientLiveTest extends BaseVCloudDirectorClientLiveTest { @Test(testName = "GET /admin/group/{id}", enabled = false) public void testGetGroup() { assertNotNull(groupRef, String.format(REF_REQ_LIVE, "Group")); - group = groupClient.getGroup(groupRef.getURI()); + group = groupClient.getGroup(groupRef.getHref()); Checks.checkGroup(group); } @@ -95,7 +95,7 @@ public class GroupClientLiveTest extends BaseVCloudDirectorClientLiveTest { .description(newDescription) .build(); - group = groupClient.updateGroup(group.getURI(), group); + group = groupClient.updateGroup(group.getHref(), group); assertTrue(equal(group.getName(), newName), String.format(OBJ_FIELD_UPDATABLE, GROUP, "name")); assertTrue(equal(group.getDescription(), newDescription), @@ -110,13 +110,13 @@ public class GroupClientLiveTest extends BaseVCloudDirectorClientLiveTest { .description(oldDescription) .build(); - group = groupClient.updateGroup(group.getURI(), group); + group = groupClient.updateGroup(group.getHref(), group); } } @Test(testName = "DELETE /admin/group/{id}", enabled = false ) public void testDeleteCatalog() { - groupClient.deleteGroup(groupRef.getURI()); + groupClient.deleteGroup(groupRef.getHref()); Error expected = Error.builder() .message("???") @@ -125,7 +125,7 @@ public class GroupClientLiveTest extends BaseVCloudDirectorClientLiveTest { .build(); try { - group = groupClient.getGroup(groupRef.getURI()); + group = groupClient.getGroup(groupRef.getHref()); fail("Should give HTTP 403 error"); } catch (VCloudDirectorException vde) { assertEquals(vde.getError(), expected); diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgClientLiveTest.java index 9b87ad8ed6..a1d910437d 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/OrgClientLiveTest.java @@ -92,7 +92,7 @@ public class OrgClientLiveTest extends BaseVCloudDirectorClientLiveTest { Reference orgRef = Iterables.getFirst(orgList.getOrgs(), null); assertNotNull(orgRef); - orgURI = orgRef.getURI(); + orgURI = orgRef.getHref(); // Call the method being tested org = orgClient.getOrg(orgURI); diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/TaskClientLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/TaskClientLiveTest.java index f57b01c187..bbe136481f 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/TaskClientLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/TaskClientLiveTest.java @@ -92,7 +92,7 @@ public class TaskClientLiveTest extends BaseVCloudDirectorClientLiveTest { //TODO: upload media or something so you can get a fresh cancellable task? Task taskRef = Iterables.getFirst(taskList.getTasks(), null); - taskURI = taskRef.getURI(); + taskURI = taskRef.getHref(); // Call the method being tested task = taskClient.getTask(taskURI);