mirror of https://github.com/apache/jclouds.git
renamed IDHandler in ultradns to TextHandler as it isn't limited to ids
This commit is contained in:
parent
818a6f2c6f
commit
bc52b54945
|
@ -35,7 +35,7 @@ import org.jclouds.ultradns.ws.binders.ZoneAndResourceRecordToXML;
|
||||||
import org.jclouds.ultradns.ws.domain.ResourceRecord;
|
import org.jclouds.ultradns.ws.domain.ResourceRecord;
|
||||||
import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata;
|
import org.jclouds.ultradns.ws.domain.ResourceRecordMetadata;
|
||||||
import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth;
|
import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth;
|
||||||
import org.jclouds.ultradns.ws.xml.IDHandler;
|
import org.jclouds.ultradns.ws.xml.TextHandler;
|
||||||
import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler;
|
import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler;
|
||||||
|
|
||||||
import com.google.common.collect.FluentIterable;
|
import com.google.common.collect.FluentIterable;
|
||||||
|
@ -56,7 +56,7 @@ public interface ResourceRecordAsyncApi {
|
||||||
*/
|
*/
|
||||||
@Named("createResourceRecord")
|
@Named("createResourceRecord")
|
||||||
@POST
|
@POST
|
||||||
@XMLResponseParser(IDHandler.Guid.class)
|
@XMLResponseParser(TextHandler.Guid.class)
|
||||||
@MapBinder(ZoneAndResourceRecordToXML.class)
|
@MapBinder(ZoneAndResourceRecordToXML.class)
|
||||||
ListenableFuture<String> create(@PayloadParam("resourceRecord") ResourceRecord toCreate)
|
ListenableFuture<String> create(@PayloadParam("resourceRecord") ResourceRecord toCreate)
|
||||||
throws ResourceAlreadyExistsException;
|
throws ResourceAlreadyExistsException;
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.jclouds.ultradns.ws.UltraDNSWSExceptions.ResourceAlreadyExistsExcepti
|
||||||
import org.jclouds.ultradns.ws.domain.ResourceRecord;
|
import org.jclouds.ultradns.ws.domain.ResourceRecord;
|
||||||
import org.jclouds.ultradns.ws.domain.RoundRobinPool;
|
import org.jclouds.ultradns.ws.domain.RoundRobinPool;
|
||||||
import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth;
|
import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth;
|
||||||
import org.jclouds.ultradns.ws.xml.IDHandler;
|
import org.jclouds.ultradns.ws.xml.TextHandler;
|
||||||
import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler;
|
import org.jclouds.ultradns.ws.xml.ResourceRecordListHandler;
|
||||||
import org.jclouds.ultradns.ws.xml.RoundRobinPoolListHandler;
|
import org.jclouds.ultradns.ws.xml.RoundRobinPoolListHandler;
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ public interface RoundRobinPoolAsyncApi {
|
||||||
*/
|
*/
|
||||||
@Named("addRRLBPool")
|
@Named("addRRLBPool")
|
||||||
@POST
|
@POST
|
||||||
@XMLResponseParser(IDHandler.RRPool.class)
|
@XMLResponseParser(TextHandler.RRPoolID.class)
|
||||||
@Payload("<v01:addRRLBPool><transactionID /><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><description>{description}</description><poolRecordType>1</poolRecordType><rrGUID /></v01:addRRLBPool>")
|
@Payload("<v01:addRRLBPool><transactionID /><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><description>{description}</description><poolRecordType>1</poolRecordType><rrGUID /></v01:addRRLBPool>")
|
||||||
ListenableFuture<String> createAPoolForHostname(@PayloadParam("description") String name,
|
ListenableFuture<String> createAPoolForHostname(@PayloadParam("description") String name,
|
||||||
@PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException;
|
@PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException;
|
||||||
|
@ -84,7 +84,7 @@ public interface RoundRobinPoolAsyncApi {
|
||||||
*/
|
*/
|
||||||
@Named("addRecordToRRPool")
|
@Named("addRecordToRRPool")
|
||||||
@POST
|
@POST
|
||||||
@XMLResponseParser(IDHandler.Guid.class)
|
@XMLResponseParser(TextHandler.Guid.class)
|
||||||
@Payload("<v01:addRecordToRRPool><transactionID /><roundRobinRecord lbPoolID=\"{lbPoolID}\" info1Value=\"{address}\" ZoneName=\"{zoneName}\" Type=\"1\" TTL=\"{ttl}\"/></v01:addRecordToRRPool>")
|
@Payload("<v01:addRecordToRRPool><transactionID /><roundRobinRecord lbPoolID=\"{lbPoolID}\" info1Value=\"{address}\" ZoneName=\"{zoneName}\" Type=\"1\" TTL=\"{ttl}\"/></v01:addRecordToRRPool>")
|
||||||
ListenableFuture<String> addARecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID,
|
ListenableFuture<String> addARecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID,
|
||||||
@PayloadParam("address") String ipv4Address, @PayloadParam("ttl") int ttl)
|
@PayloadParam("address") String ipv4Address, @PayloadParam("ttl") int ttl)
|
||||||
|
@ -114,7 +114,7 @@ public interface RoundRobinPoolAsyncApi {
|
||||||
*/
|
*/
|
||||||
@Named("addRRLBPool")
|
@Named("addRRLBPool")
|
||||||
@POST
|
@POST
|
||||||
@XMLResponseParser(IDHandler.RRPool.class)
|
@XMLResponseParser(TextHandler.RRPoolID.class)
|
||||||
@Payload("<v01:addRRLBPool><transactionID /><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><description>{description}</description><poolRecordType>28</poolRecordType><rrGUID /></v01:addRRLBPool>")
|
@Payload("<v01:addRRLBPool><transactionID /><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><description>{description}</description><poolRecordType>28</poolRecordType><rrGUID /></v01:addRRLBPool>")
|
||||||
ListenableFuture<String> createAAAAPoolForHostname(@PayloadParam("description") String name,
|
ListenableFuture<String> createAAAAPoolForHostname(@PayloadParam("description") String name,
|
||||||
@PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException;
|
@PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException;
|
||||||
|
@ -124,7 +124,7 @@ public interface RoundRobinPoolAsyncApi {
|
||||||
*/
|
*/
|
||||||
@Named("addRecordToRRPool")
|
@Named("addRecordToRRPool")
|
||||||
@POST
|
@POST
|
||||||
@XMLResponseParser(IDHandler.Guid.class)
|
@XMLResponseParser(TextHandler.Guid.class)
|
||||||
@Payload("<v01:addRecordToRRPool><transactionID /><roundRobinRecord lbPoolID=\"{lbPoolID}\" info1Value=\"{address}\" ZoneName=\"{zoneName}\" Type=\"28\" TTL=\"{ttl}\"/></v01:addRecordToRRPool>")
|
@Payload("<v01:addRecordToRRPool><transactionID /><roundRobinRecord lbPoolID=\"{lbPoolID}\" info1Value=\"{address}\" ZoneName=\"{zoneName}\" Type=\"28\" TTL=\"{ttl}\"/></v01:addRecordToRRPool>")
|
||||||
ListenableFuture<String> addAAAARecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID,
|
ListenableFuture<String> addAAAARecordWithAddressAndTTL(@PayloadParam("lbPoolID") String lbPoolID,
|
||||||
@PayloadParam("address") String ipv6Address, @PayloadParam("ttl") int ttl)
|
@PayloadParam("address") String ipv6Address, @PayloadParam("ttl") int ttl)
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.jclouds.rest.annotations.VirtualHost;
|
||||||
import org.jclouds.rest.annotations.XMLResponseParser;
|
import org.jclouds.rest.annotations.XMLResponseParser;
|
||||||
import org.jclouds.ultradns.ws.domain.Task;
|
import org.jclouds.ultradns.ws.domain.Task;
|
||||||
import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth;
|
import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth;
|
||||||
import org.jclouds.ultradns.ws.xml.IDHandler;
|
import org.jclouds.ultradns.ws.xml.TextHandler;
|
||||||
import org.jclouds.ultradns.ws.xml.TaskHandler;
|
import org.jclouds.ultradns.ws.xml.TaskHandler;
|
||||||
import org.jclouds.ultradns.ws.xml.TaskListHandler;
|
import org.jclouds.ultradns.ws.xml.TaskListHandler;
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ public interface TaskAsyncApi {
|
||||||
*/
|
*/
|
||||||
@Named("runTest")
|
@Named("runTest")
|
||||||
@POST
|
@POST
|
||||||
@XMLResponseParser(IDHandler.Guid.class)
|
@XMLResponseParser(TextHandler.Guid.class)
|
||||||
@Payload("<v01:runTest><value>{value}</value></v01:runTest>")
|
@Payload("<v01:runTest><value>{value}</value></v01:runTest>")
|
||||||
ListenableFuture<String> runTest(@PayloadParam("value") String value);
|
ListenableFuture<String> runTest(@PayloadParam("value") String value);
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,8 @@ import org.jclouds.ultradns.ws.domain.PoolRecordSpec;
|
||||||
import org.jclouds.ultradns.ws.domain.TrafficControllerPool;
|
import org.jclouds.ultradns.ws.domain.TrafficControllerPool;
|
||||||
import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord;
|
import org.jclouds.ultradns.ws.domain.TrafficControllerPoolRecord;
|
||||||
import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth;
|
import org.jclouds.ultradns.ws.filters.SOAPWrapWithPasswordAuth;
|
||||||
import org.jclouds.ultradns.ws.xml.IDHandler;
|
|
||||||
import org.jclouds.ultradns.ws.xml.PoolRecordSpecHandler;
|
import org.jclouds.ultradns.ws.xml.PoolRecordSpecHandler;
|
||||||
|
import org.jclouds.ultradns.ws.xml.TextHandler;
|
||||||
import org.jclouds.ultradns.ws.xml.TrafficControllerPoolListHandler;
|
import org.jclouds.ultradns.ws.xml.TrafficControllerPoolListHandler;
|
||||||
import org.jclouds.ultradns.ws.xml.TrafficControllerPoolRecordListHandler;
|
import org.jclouds.ultradns.ws.xml.TrafficControllerPoolRecordListHandler;
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public interface TrafficControllerPoolAsyncApi {
|
||||||
*/
|
*/
|
||||||
@Named("addTCLBPool")
|
@Named("addTCLBPool")
|
||||||
@POST
|
@POST
|
||||||
@XMLResponseParser(IDHandler.TCPool.class)
|
@XMLResponseParser(TextHandler.TCPoolID.class)
|
||||||
@Payload("<v01:addTCLBPool><transactionID /><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><description>{description}</description><poolRecordType>1</poolRecordType><failOver>Enabled</failOver><probing>Enabled</probing><maxActive>0</maxActive><rrGUID /></v01:addTCLBPool>")
|
@Payload("<v01:addTCLBPool><transactionID /><zoneName>{zoneName}</zoneName><hostName>{hostName}</hostName><description>{description}</description><poolRecordType>1</poolRecordType><failOver>Enabled</failOver><probing>Enabled</probing><maxActive>0</maxActive><rrGUID /></v01:addTCLBPool>")
|
||||||
ListenableFuture<String> createPoolForHostname(@PayloadParam("description") String name,
|
ListenableFuture<String> createPoolForHostname(@PayloadParam("description") String name,
|
||||||
@PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException;
|
@PayloadParam("hostName") String hostname) throws ResourceAlreadyExistsException;
|
||||||
|
@ -96,7 +96,7 @@ public interface TrafficControllerPoolAsyncApi {
|
||||||
*/
|
*/
|
||||||
@Named("addPoolRecord")
|
@Named("addPoolRecord")
|
||||||
@POST
|
@POST
|
||||||
@XMLResponseParser(IDHandler.PoolRecord.class)
|
@XMLResponseParser(TextHandler.PoolRecordID.class)
|
||||||
@Payload("<v01:addPoolRecord><transactionID /><poolID>{poolID}</poolID><pointsTo>{pointsTo}</pointsTo><priority /><failOverDelay /><ttl>{ttl}</ttl><weight /><mode /><threshold /></v01:addPoolRecord>")
|
@Payload("<v01:addPoolRecord><transactionID /><poolID>{poolID}</poolID><pointsTo>{pointsTo}</pointsTo><priority /><failOverDelay /><ttl>{ttl}</ttl><weight /><mode /><threshold /></v01:addPoolRecord>")
|
||||||
ListenableFuture<String> addRecordToPoolWithTTL(@PayloadParam("pointsTo") String pointsTo,
|
ListenableFuture<String> addRecordToPoolWithTTL(@PayloadParam("pointsTo") String pointsTo,
|
||||||
@PayloadParam("poolID") String lbPoolID, @PayloadParam("ttl") int ttl) throws ResourceAlreadyExistsException;
|
@PayloadParam("poolID") String lbPoolID, @PayloadParam("ttl") int ttl) throws ResourceAlreadyExistsException;
|
||||||
|
|
|
@ -28,54 +28,54 @@ import org.jclouds.http.functions.ParseSax;
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
public abstract class IDHandler extends ParseSax.HandlerForGeneratedRequestWithResult<String> {
|
public abstract class TextHandler extends ParseSax.HandlerForGeneratedRequestWithResult<String> {
|
||||||
|
|
||||||
public static class Guid extends IDHandler {
|
public static class Guid extends TextHandler {
|
||||||
public Guid() {
|
public Guid() {
|
||||||
super("guid");
|
super("guid");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class RRPool extends IDHandler {
|
public static class RRPoolID extends TextHandler {
|
||||||
public RRPool() {
|
public RRPoolID() {
|
||||||
super("RRPoolID");
|
super("RRPoolID");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TCPool extends IDHandler {
|
public static class TCPoolID extends TextHandler {
|
||||||
public TCPool() {
|
public TCPoolID() {
|
||||||
super("TCPoolID");
|
super("TCPoolID");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class PoolRecord extends IDHandler {
|
public static class PoolRecordID extends TextHandler {
|
||||||
public PoolRecord() {
|
public PoolRecordID() {
|
||||||
super("poolRecordID");
|
super("poolRecordID");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String idElement;
|
private String textElement;
|
||||||
|
|
||||||
private StringBuilder currentText = new StringBuilder();
|
private StringBuilder currentText = new StringBuilder();
|
||||||
private String id = null;
|
private String text = null;
|
||||||
|
|
||||||
private IDHandler(String idElement) {
|
private TextHandler(String textElement) {
|
||||||
this.idElement = checkNotNull(idElement, "idElement");
|
this.textElement = checkNotNull(textElement, "textElement");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getResult() {
|
public String getResult() {
|
||||||
try {
|
try {
|
||||||
return checkNotNull(id, "%s not present in the response", idElement);
|
return checkNotNull(text, "%s not present in the response", textElement);
|
||||||
} finally {
|
} finally {
|
||||||
id = null;
|
text = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void endElement(String uri, String name, String qName) {
|
public void endElement(String uri, String name, String qName) {
|
||||||
if (equalsOrSuffix(qName, idElement)) {
|
if (equalsOrSuffix(qName, textElement)) {
|
||||||
id = currentOrNull(currentText);
|
text = currentOrNull(currentText);
|
||||||
}
|
}
|
||||||
currentText = new StringBuilder();
|
currentText = new StringBuilder();
|
||||||
}
|
}
|
|
@ -23,7 +23,7 @@ import static org.testng.Assert.assertEquals;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
import org.jclouds.http.functions.BaseHandlerTest;
|
import org.jclouds.http.functions.BaseHandlerTest;
|
||||||
import org.jclouds.ultradns.ws.xml.IDHandler;
|
import org.jclouds.ultradns.ws.xml.TextHandler;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,7 +35,7 @@ public class RunTestResponseTest extends BaseHandlerTest {
|
||||||
public void test() {
|
public void test() {
|
||||||
InputStream is = getClass().getResourceAsStream("/taskid.xml");
|
InputStream is = getClass().getResourceAsStream("/taskid.xml");
|
||||||
|
|
||||||
IDHandler.Guid handler = injector.getInstance(IDHandler.Guid.class);
|
TextHandler.Guid handler = injector.getInstance(TextHandler.Guid.class);
|
||||||
assertEquals(factory.create(handler).parse(is), "8d7a1725-4f4a-4b70-affa-f01dcce1526e");
|
assertEquals(factory.create(handler).parse(is), "8d7a1725-4f4a-4b70-affa-f01dcce1526e");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue