Example usage for com.amazonaws.services.route53.model GetHostedZoneResult toString

List of usage examples for com.amazonaws.services.route53.model GetHostedZoneResult toString

Introduction

In this page you can find the example usage for com.amazonaws.services.route53.model GetHostedZoneResult toString.

Prototype

@Override
public String toString() 

Source Link

Document

Returns a string representation of this object.

Usage

From source file:com.msi.dns53.server.query.GetHostedZone.java

License:Apache License

private GetHostedZoneResult getHostedZone(Session sess, GetHostedZoneRequest request) throws ErrorResponse {
    String zoneId = request.getId();
    logger.debug("GetHosteZone target: " + zoneId);
    GetHostedZoneResult result = new GetHostedZoneResult();
    AccessMySQL sqlaccess = AccessMySQL.getInstance();
    String[] responseCont = sqlaccess.getHostedZone(zoneId);
    if (responseCont[1] == null) {
        throw DNS53Faults.NoSuchHostedZone(zoneId);
    }//from   w  w w.  ja v  a  2 s .c om
    HostedZone hz = new HostedZone();
    hz.setId(responseCont[0]);
    hz.setName(responseCont[1]);
    hz.setCallerReference(responseCont[2]);
    HostedZoneConfig config = new HostedZoneConfig();
    config.setComment(responseCont[3]);
    hz.setConfig(config);
    result.setHostedZone(hz);

    DelegationSet delegationSet = new DelegationSet();
    Collection<String> nameServers = new LinkedList<String>();
    List<DNS53ResourceRecord> nsRecords = sqlaccess.listResourceRecords(sess, request.getId(), null, null, "NS",
            null, -1, -1);
    for (DNS53ResourceRecord ns : nsRecords) {
        String nameserver = ns.getRdata();
        nameserver = nameserver.substring(0, nameserver.length() - 1);
        nameServers.add(nameserver);
    }
    delegationSet.setNameServers(nameServers);
    result.setDelegationSet(delegationSet);
    logger.debug("Returning the result: " + result.toString());
    return result;
}