diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSApi.java
index c302348f49..bb571a0400 100644
--- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSApi.java
+++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/UltraDNSWSApi.java
@@ -19,7 +19,6 @@
package org.jclouds.ultradns.ws;
import java.io.Closeable;
-import java.util.Map;
import javax.inject.Named;
import javax.ws.rs.POST;
@@ -30,8 +29,7 @@ import org.jclouds.rest.annotations.PayloadParam;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.rest.annotations.VirtualHost;
import org.jclouds.rest.annotations.XMLResponseParser;
-import org.jclouds.ultradns.ws.domain.Account;
-import org.jclouds.ultradns.ws.domain.Region;
+import org.jclouds.ultradns.ws.domain.IdAndName;
import org.jclouds.ultradns.ws.features.DirectionalGroupApi;
import org.jclouds.ultradns.ws.features.DirectionalPoolApi;
import org.jclouds.ultradns.ws.features.ResourceRecordApi;
@@ -43,6 +41,8 @@ import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth;
import org.jclouds.ultradns.ws.xml.AccountHandler;
import org.jclouds.ultradns.ws.xml.RegionListHandler;
+import com.google.common.collect.Multimap;
+
/**
* Provides access to Neustar UltraDNS via the SOAP API
*
@@ -60,7 +60,7 @@ public interface UltraDNSWSApi extends Closeable {
@POST
@XMLResponseParser(AccountHandler.class)
@Payload("")
- Account getCurrentAccount();
+ IdAndName getCurrentAccount();
/**
* Lists the directional regions available in the account.
@@ -69,7 +69,7 @@ public interface UltraDNSWSApi extends Closeable {
@POST
@XMLResponseParser(RegionListHandler.class)
@Payload("")
- Map getRegionsById();
+ Multimap getRegionsById();
/**
* Provides access to Zone features.
diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalGroup.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalGroup.java
index 7caaf52d0c..d43236e2c8 100644
--- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalGroup.java
+++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalGroup.java
@@ -23,30 +23,49 @@ import static com.google.common.base.Objects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.Objects;
+import com.google.common.base.Optional;
+import com.google.common.collect.ForwardingMultimap;
+import com.google.common.collect.ImmutableMultimap;
+import com.google.common.collect.Multimap;
/**
+ * A region is a set of territory names.
+ *
* @author Adrian Cole
*/
-public class DirectionalGroup {
- private final String id;
+public class DirectionalGroup extends ForwardingMultimap {
+
private final String name;
+ private final Optional description;
+ private final Multimap regionToTerritories;
- private DirectionalGroup(String id, String name) {
- this.id = checkNotNull(id, "id");
+ private DirectionalGroup(String name, Optional description,
+ Multimap regionToTerritories) {
this.name = checkNotNull(name, "name");
- }
-
- public String getId() {
- return id;
+ this.description = checkNotNull(description, "description of %s", name);
+ this.regionToTerritories = checkNotNull(regionToTerritories, "regionToTerritories of %s", name);
}
public String getName() {
return name;
}
+ public Optional getDescription() {
+ return description;
+ }
+
+ public Multimap getRegionToTerritories() {
+ return regionToTerritories;
+ }
+
+ @Override
+ protected Multimap delegate() {
+ return regionToTerritories;
+ }
+
@Override
public int hashCode() {
- return Objects.hashCode(id, name);
+ return Objects.hashCode(name, regionToTerritories);
}
@Override
@@ -56,12 +75,13 @@ public class DirectionalGroup {
if (obj == null || getClass() != obj.getClass())
return false;
DirectionalGroup that = DirectionalGroup.class.cast(obj);
- return equal(this.id, that.id) && equal(this.name, that.name);
+ return equal(this.name, that.name) && equal(this.regionToTerritories, that.regionToTerritories);
}
@Override
public String toString() {
- return toStringHelper(this).omitNullValues().add("id", id).add("name", name).toString();
+ return toStringHelper(this).omitNullValues().add("name", name).add("description", description.orNull())
+ .add("regionToTerritories", regionToTerritories).toString();
}
public static Builder builder() {
@@ -73,16 +93,10 @@ public class DirectionalGroup {
}
public final static class Builder {
- private String id;
private String name;
-
- /**
- * @see DirectionalGroup#getId()
- */
- public Builder id(String id) {
- this.id = id;
- return this;
- }
+ private Optional description = Optional.absent();
+ private ImmutableMultimap.Builder regionToTerritories = ImmutableMultimap
+ . builder();
/**
* @see DirectionalGroup#getName()
@@ -92,12 +106,50 @@ public class DirectionalGroup {
return this;
}
+ /**
+ * @see DirectionalGroup#getDescription()
+ */
+ public Builder description(String description) {
+ this.description = Optional.fromNullable(description);
+ return this;
+ }
+
+ /**
+ * adds to current regionToTerritories
+ *
+ * @see DirectionalGroup#getRegionToTerritories()
+ */
+ public Builder mapRegionToTerritories(String region, Iterable territories) {
+ this.regionToTerritories.putAll(region, territories);
+ return this;
+ }
+
+ /**
+ * adds to current regionToTerritories
+ *
+ * @see DirectionalGroup#getRegionToTerritories()
+ */
+ public Builder mapRegionToTerritory(String region, String territory) {
+ this.regionToTerritories.put(region, territory);
+ return this;
+ }
+
+ /**
+ * replaces current regionToTerritories
+ *
+ * @see DirectionalGroup#getRegionToTerritories()
+ */
+ public Builder regionToTerritories(Multimap regionToTerritories) {
+ this.regionToTerritories = ImmutableMultimap. builder().putAll(regionToTerritories);
+ return this;
+ }
+
public DirectionalGroup build() {
- return new DirectionalGroup(id, name);
+ return new DirectionalGroup(name, description, regionToTerritories.build());
}
public Builder from(DirectionalGroup in) {
- return id(in.id).name(in.name);
+ return name(in.getName()).regionToTerritories(in.getRegionToTerritories());
}
}
}
diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalGroupNameAndRegions.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalGroupNameAndRegions.java
deleted file mode 100644
index 9c7b55f8bb..0000000000
--- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalGroupNameAndRegions.java
+++ /dev/null
@@ -1,127 +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.ultradns.ws.domain;
-
-import static com.google.common.base.Objects.equal;
-import static com.google.common.base.Objects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Set;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.ForwardingSet;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * A region is a set of territory names.
- *
- * @author Adrian Cole
- */
-public class DirectionalGroupNameAndRegions extends ForwardingSet {
-
- private final String name;
- private final Set regions;
-
- private DirectionalGroupNameAndRegions(String name, Set regions) {
- this.name = checkNotNull(name, "name");
- this.regions = checkNotNull(regions, "regions of %s", name);
- }
-
- public String getName() {
- return name;
- }
-
- public Set getRegions() {
- return regions;
- }
-
- @Override
- protected Set delegate() {
- return regions;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(name, regions);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null || getClass() != obj.getClass())
- return false;
- DirectionalGroupNameAndRegions that = DirectionalGroupNameAndRegions.class.cast(obj);
- return equal(this.name, that.name) && equal(this.regions, that.regions);
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("name", name).add("regions", regions).toString();
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- public Builder toBuilder() {
- return builder().from(this);
- }
-
- public final static class Builder {
- private String name;
- private ImmutableSet.Builder regions = ImmutableSet. builder();
-
- /**
- * @see DirectionalGroupNameAndRegions#getName()
- */
- public Builder name(String name) {
- this.name = name;
- return this;
- }
-
- /**
- * adds to current regions
- *
- * @see DirectionalGroupNameAndRegions#getRegions()
- */
- public Builder addRegion(Region region) {
- this.regions.add(region);
- return this;
- }
-
- /**
- * replaces current regions
- *
- * @see DirectionalGroupNameAndRegions#getRegions()
- */
- public Builder regions(Iterable regions) {
- this.regions = ImmutableSet. builder().addAll(regions);
- return this;
- }
-
- public DirectionalGroupNameAndRegions build() {
- return new DirectionalGroupNameAndRegions(name, regions.build());
- }
-
- public Builder from(DirectionalGroupNameAndRegions in) {
- return name(in.getName()).regions(in.getRegions());
- }
- }
-}
diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalRecordDetail.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalRecordDetail.java
index 0a5a27f194..c19977d07b 100644
--- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalRecordDetail.java
+++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/DirectionalRecordDetail.java
@@ -33,14 +33,14 @@ public class DirectionalRecordDetail {
private final String zoneName;
private final String name;
private final String id;
- private final Optional group;
- private final Optional geolocationGroup;
- private final Optional sourceIpGroup;
+ private final Optional group;
+ private final Optional geolocationGroup;
+ private final Optional sourceIpGroup;
private final DirectionalRecord record;
private DirectionalRecordDetail(String zoneName, String name, String id,
- Optional group, Optional geolocationGroup,
- Optional sourceIpGroup, DirectionalRecord record) {
+ Optional group, Optional geolocationGroup,
+ Optional sourceIpGroup, DirectionalRecord record) {
this.zoneName = checkNotNull(zoneName, "zoneName");
this.name = checkNotNull(name, "name");
this.id = checkNotNull(id, "id");
@@ -65,21 +65,21 @@ public class DirectionalRecordDetail {
/**
* group containing all regions that you have not specifically configured in {@link #getGeolocationGroup()}
*/
- public Optional getGroup() {
+ public Optional getGroup() {
return group;
}
/**
* group containing territories.
*/
- public Optional getGeolocationGroup() {
+ public Optional getGeolocationGroup() {
return geolocationGroup;
}
/**
* group containing IPV4 or IPV6 ranges.
*/
- public Optional getSourceIpGroup() {
+ public Optional getSourceIpGroup() {
return sourceIpGroup;
}
@@ -121,9 +121,9 @@ public class DirectionalRecordDetail {
private String zoneName;
private String name;
private String id;
- private Optional group = Optional.absent();
- private Optional geolocationGroup = Optional.absent();
- private Optional sourceIpGroup = Optional.absent();
+ private Optional group = Optional.absent();
+ private Optional geolocationGroup = Optional.absent();
+ private Optional sourceIpGroup = Optional.absent();
private DirectionalRecord record;
/**
@@ -153,7 +153,7 @@ public class DirectionalRecordDetail {
/**
* @see DirectionalRecordDetail#getGroup()
*/
- public Builder group(DirectionalGroup group) {
+ public Builder group(IdAndName group) {
this.group = Optional.fromNullable(group);
return this;
}
@@ -161,7 +161,7 @@ public class DirectionalRecordDetail {
/**
* @see DirectionalRecordDetail#getGeolocationGroup()
*/
- public Builder geolocationGroup(DirectionalGroup geolocationGroup) {
+ public Builder geolocationGroup(IdAndName geolocationGroup) {
this.geolocationGroup = Optional.fromNullable(geolocationGroup);
return this;
}
@@ -169,7 +169,7 @@ public class DirectionalRecordDetail {
/**
* @see DirectionalRecordDetail#getSourceIpGroup()
*/
- public Builder sourceIpGroup(DirectionalGroup sourceIpGroup) {
+ public Builder sourceIpGroup(IdAndName sourceIpGroup) {
this.sourceIpGroup = Optional.fromNullable(sourceIpGroup);
return this;
}
diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/Account.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/IdAndName.java
similarity index 83%
rename from providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/Account.java
rename to providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/IdAndName.java
index 202af85a72..764232d0c2 100644
--- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/Account.java
+++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/IdAndName.java
@@ -25,28 +25,28 @@ import com.google.common.base.Objects;
/**
* @author Adrian Cole
*/
-public final class Account {
- public static Account fromIdAndName(String id, String name) {
- return new Account(id, name);
+public final class IdAndName {
+ public static IdAndName fromIdAndName(String id, String name) {
+ return new IdAndName(id, name);
}
private final String id;
private final String name;
- private Account(String id, String name) {
+ private IdAndName(String id, String name) {
this.id = checkNotNull(id, "id");
this.name = checkNotNull(name, "name for %s", id);
}
/**
- * The id of the account. ex {@code AAAAAAAAAAAAAAAA}
+ * The id of the resource. ex {@code AAAAAAAAAAAAAAAA}
*/
public String getId() {
return id;
}
/**
- * The name of the account. ex {@code jclouds}
+ * The name of the resource. ex {@code jclouds}
*/
public String getName() {
return name;
@@ -65,7 +65,7 @@ public final class Account {
return false;
if (getClass() != obj.getClass())
return false;
- Account that = Account.class.cast(obj);
+ IdAndName that = IdAndName.class.cast(obj);
return Objects.equal(this.id, that.id) && Objects.equal(this.name, that.name);
}
diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/Region.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/Region.java
deleted file mode 100644
index 23ea0fd7cf..0000000000
--- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/domain/Region.java
+++ /dev/null
@@ -1,127 +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.ultradns.ws.domain;
-
-import static com.google.common.base.Objects.equal;
-import static com.google.common.base.Objects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Set;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.ForwardingSet;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * A region is a set of territory names.
- *
- * @author Adrian Cole
- */
-public class Region extends ForwardingSet {
-
- private final String name;
- private final Set territoryNames;
-
- private Region(String name, Set territoryNames) {
- this.name = checkNotNull(name, "name");
- this.territoryNames = checkNotNull(territoryNames, "territoryNames of %s", name);
- }
-
- public String getName() {
- return name;
- }
-
- public Set getTerritoryNames() {
- return territoryNames;
- }
-
- @Override
- protected Set delegate() {
- return territoryNames;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(name, territoryNames);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null || getClass() != obj.getClass())
- return false;
- Region that = Region.class.cast(obj);
- return equal(this.name, that.name) && equal(this.territoryNames, that.territoryNames);
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("name", name).add("territoryNames", territoryNames).toString();
- }
-
- public static Builder builder() {
- return new Builder();
- }
-
- public Builder toBuilder() {
- return builder().from(this);
- }
-
- public final static class Builder {
- private String name;
- private ImmutableSet.Builder territoryNames = ImmutableSet. builder();
-
- /**
- * @see Region#getName()
- */
- public Builder name(String name) {
- this.name = name;
- return this;
- }
-
- /**
- * adds to current territoryNames
- *
- * @see Region#getTerritoryNames()
- */
- public Builder addTerritoryName(String territoryName) {
- this.territoryNames.add(territoryName);
- return this;
- }
-
- /**
- * replaces current territoryNames
- *
- * @see Region#getTerritoryNames()
- */
- public Builder territoryNames(Iterable territoryNames) {
- this.territoryNames = ImmutableSet. builder().addAll(territoryNames);
- return this;
- }
-
- public Region build() {
- return new Region(name, territoryNames.build());
- }
-
- public Builder from(Region in) {
- return name(in.getName()).territoryNames(in.getTerritoryNames());
- }
- }
-}
diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/DirectionalGroupApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/DirectionalGroupApi.java
index 70e1436a94..4f5c0d255d 100644
--- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/DirectionalGroupApi.java
+++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/DirectionalGroupApi.java
@@ -36,7 +36,6 @@ import org.jclouds.ultradns.ws.binders.DirectionalGroupCoordinatesToXML;
import org.jclouds.ultradns.ws.domain.AccountLevelGroup;
import org.jclouds.ultradns.ws.domain.DirectionalGroup;
import org.jclouds.ultradns.ws.domain.DirectionalGroupCoordinates;
-import org.jclouds.ultradns.ws.domain.DirectionalGroupNameAndRegions;
import org.jclouds.ultradns.ws.domain.DirectionalRecordDetail;
import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth;
import org.jclouds.ultradns.ws.xml.AccountLevelGroupsHandler;
@@ -68,7 +67,7 @@ public interface DirectionalGroupApi {
@Fallback(NullOnNotFoundOr404.class)
@Payload("{GroupId}")
@Nullable
- DirectionalGroupNameAndRegions get(@PayloadParam("GroupId") String groupId);
+ DirectionalGroup get(@PayloadParam("GroupId") String groupId);
/**
* Returns all account-level groups.
diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApi.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApi.java
index 80c198499a..4e355b5e6f 100644
--- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApi.java
+++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/features/RoundRobinPoolApi.java
@@ -82,7 +82,7 @@ public interface RoundRobinPoolApi {
* @param hostname
* {@link RoundRobinPool#getDName() dname} of the RR pool {ex.
* www.jclouds.org.}
- * @return the {@code guid} of the new record
+ * @return the {@code guid} of the new pool
* @throws ResourceAlreadyExistsException
* if a pool already exists with the same attrs
*/
diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/AccountHandler.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/AccountHandler.java
index 7b2d1763e9..8a89823295 100644
--- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/AccountHandler.java
+++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/AccountHandler.java
@@ -24,19 +24,19 @@ import static org.jclouds.util.SaxUtils.equalsOrSuffix;
import java.util.Map;
import org.jclouds.http.functions.ParseSax;
-import org.jclouds.ultradns.ws.domain.Account;
+import org.jclouds.ultradns.ws.domain.IdAndName;
import org.xml.sax.Attributes;
/**
*
* @author Adrian Cole
*/
-public class AccountHandler extends ParseSax.HandlerForGeneratedRequestWithResult {
+public class AccountHandler extends ParseSax.HandlerForGeneratedRequestWithResult {
- private Account account;
+ private IdAndName account;
@Override
- public Account getResult() {
+ public IdAndName getResult() {
try {
return account;
} finally {
@@ -48,7 +48,7 @@ public class AccountHandler extends ParseSax.HandlerForGeneratedRequestWithResul
public void startElement(String uri, String localName, String qName, Attributes attrs) {
Map attributes = cleanseAttributes(attrs);
if (equalsOrSuffix(qName, "AccountDetailsData")) {
- account = Account.fromIdAndName(attributes.get("accountID"), attributes.get("accountName"));
+ account = IdAndName.fromIdAndName(attributes.get("accountID"), attributes.get("accountName"));
}
}
}
diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalGroupNameAndRegionsHandler.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalGroupNameAndRegionsHandler.java
index 800a9bd16f..17be49ae14 100644
--- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalGroupNameAndRegionsHandler.java
+++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalGroupNameAndRegionsHandler.java
@@ -21,9 +21,8 @@ package org.jclouds.ultradns.ws.xml;
import static org.jclouds.util.SaxUtils.equalsOrSuffix;
import org.jclouds.http.functions.ParseSax;
-import org.jclouds.ultradns.ws.domain.DirectionalGroupNameAndRegions;
-import org.jclouds.ultradns.ws.domain.DirectionalGroupNameAndRegions.Builder;
-import org.jclouds.ultradns.ws.domain.Region;
+import org.jclouds.ultradns.ws.domain.DirectionalGroup;
+import org.jclouds.ultradns.ws.domain.DirectionalGroup.Builder;
import org.xml.sax.Attributes;
import com.google.common.base.Splitter;
@@ -32,12 +31,12 @@ import com.google.common.base.Splitter;
*
* @author Adrian Cole
*/
-public class DirectionalGroupNameAndRegionsHandler extends ParseSax.HandlerForGeneratedRequestWithResult {
+public class DirectionalGroupNameAndRegionsHandler extends ParseSax.HandlerForGeneratedRequestWithResult {
- private final Builder group = DirectionalGroupNameAndRegions.builder();
+ private final Builder group = DirectionalGroup.builder();
@Override
- public DirectionalGroupNameAndRegions getResult() {
+ public DirectionalGroup getResult() {
return group.build();
}
@@ -46,11 +45,9 @@ public class DirectionalGroupNameAndRegionsHandler extends ParseSax.HandlerForGe
if (equalsOrSuffix(qName, "DirectionalDNSGroupDetail")) {
group.name(attrs.getValue("GroupName"));
} else if (equalsOrSuffix(qName, "RegionForNewGroups")) {
+ String regionName = attrs.getValue("RegionName");
Iterable territories = Splitter.on(';').split(attrs.getValue("TerritoryName"));
- Region region = Region.builder()
- .name(attrs.getValue("RegionName"))
- .territoryNames(territories).build();
- group.addRegion(region);
+ group.mapRegionToTerritories(regionName, territories);
}
}
}
diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalRecordDetailHandler.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalRecordDetailHandler.java
index 7c967aaa2f..3bf7914c87 100644
--- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalRecordDetailHandler.java
+++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/DirectionalRecordDetailHandler.java
@@ -24,7 +24,7 @@ import static org.jclouds.util.SaxUtils.equalsOrSuffix;
import java.util.Map;
import org.jclouds.http.functions.ParseSax;
-import org.jclouds.ultradns.ws.domain.DirectionalGroup;
+import static org.jclouds.ultradns.ws.domain.IdAndName.*;
import org.jclouds.ultradns.ws.domain.DirectionalRecord;
import org.jclouds.ultradns.ws.domain.DirectionalRecordDetail;
import org.xml.sax.Attributes;
@@ -64,19 +64,14 @@ public class DirectionalRecordDetailHandler extends
drd.id(attributes.get("DirPoolRecordId"));
}
if (attributes.containsKey("GroupId")) {
- drd.group(DirectionalGroup.builder()
- .id(attributes.get("GroupId"))
- .name(attributes.get("GroupName")).build());
+ drd.group(fromIdAndName(attributes.get("GroupId"), attributes.get("GroupName")));
}
if (attributes.containsKey("GeolocationGroupId")) {
- drd.geolocationGroup(DirectionalGroup.builder()
- .id(attributes.get("GeolocationGroupId"))
- .name(attributes.get("GeolocationGroupName")).build());
+ drd.geolocationGroup(fromIdAndName(attributes.get("GeolocationGroupId"),
+ attributes.get("GeolocationGroupName")));
}
if (attributes.containsKey("SourceIPGroupId")) {
- drd.sourceIpGroup(DirectionalGroup.builder()
- .id(attributes.get("SourceIPGroupId"))
- .name(attributes.get("SourceIPGroupName")).build());
+ drd.sourceIpGroup(fromIdAndName(attributes.get("SourceIPGroupId"), attributes.get("SourceIPGroupName")));
}
if (attributes.containsKey("recordType")) {
dr.type(attributes.get("recordType"));
diff --git a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/RegionListHandler.java b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/RegionListHandler.java
index 6c47f3bf3e..dc52ea1095 100644
--- a/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/RegionListHandler.java
+++ b/providers/ultradns-ws/src/main/java/org/jclouds/ultradns/ws/xml/RegionListHandler.java
@@ -24,23 +24,24 @@ import static org.jclouds.util.SaxUtils.equalsOrSuffix;
import java.util.Map;
import org.jclouds.http.functions.ParseSax;
-import org.jclouds.ultradns.ws.domain.Region;
+import org.jclouds.ultradns.ws.domain.IdAndName;
import org.xml.sax.Attributes;
import com.google.common.base.Splitter;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableMap.Builder;
+import com.google.common.collect.ImmutableMultimap;
+import com.google.common.collect.ImmutableMultimap.Builder;
+import com.google.common.collect.Multimap;
/**
*
* @author Adrian Cole
*/
-public class RegionListHandler extends ParseSax.HandlerForGeneratedRequestWithResult