org.nhindirect.config.resources
Class DNSResource

java.lang.Object
  extended by org.nhindirect.config.resources.ProtectedResource
      extended by org.nhindirect.config.resources.DNSResource

@Component
public class DNSResource
extends ProtectedResource

JAX-RS resource for managing DNS resources in the configuration service.

Although not required, this class is instantiated using the Jersey SpringServlet and dependencies are defined in the Sprint context XML file.

Since:
2.0
Author:
Greg Meyer

Constructor Summary
DNSResource()
          Constructor
 
Method Summary
 javax.ws.rs.core.Response addDNSRecord(javax.ws.rs.core.UriInfo uriInfo, org.nhindirect.config.model.DNSRecord record)
          Adds a DNS record.
 javax.ws.rs.core.Response getDNSRecords(int type, String name)
          Gets DNS records that match a given name, type, or combination of both.
 javax.ws.rs.core.Response removeDNSRecordsByIds(String ids)
          Delete DNS records by system id.
 void setDNSDao(org.nhindirect.config.store.dao.DNSDao dnsDao)
          Sets the DNS Dao.
 javax.ws.rs.core.Response updateDNSRecord(org.nhindirect.config.model.DNSRecord updateRecord)
          Updates the attributes of an existing DNS record.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DNSResource

public DNSResource()
Constructor

Method Detail

setDNSDao

@Autowired
public void setDNSDao(org.nhindirect.config.store.dao.DNSDao dnsDao)
Sets the DNS Dao. Auto populated by Spring

Parameters:
dnsDao - DNS Dao

getDNSRecords

public javax.ws.rs.core.Response getDNSRecords(int type,
                                               String name)
Gets DNS records that match a given name, type, or combination of both.

Parameters:
type - DNS record type filter. Defaults to -1 which means no filter will be applied.
name - DNS record name filter. Defaults to an empty string which means no filter will be applied.
Returns:
A JSON representation of a collection of all DNS records that match the given search criteria. Returns a status of 204 if no records match the search criteria.

addDNSRecord

public javax.ws.rs.core.Response addDNSRecord(@Context
                                              javax.ws.rs.core.UriInfo uriInfo,
                                              org.nhindirect.config.model.DNSRecord record)
Adds a DNS record.

Parameters:
uriInfo - Injected URI context used for building the location URI.
record - The DNS record to add.
Returns:
Status fo 201 if the DNS record was added to the system or a status of 409 if the record already exists.

updateDNSRecord

public javax.ws.rs.core.Response updateDNSRecord(org.nhindirect.config.model.DNSRecord updateRecord)
Updates the attributes of an existing DNS record.

Parameters:
updateRecord - The DNS record to update.
Returns:
Status of 204 if the DNS record was updated or status of 404 if the record could not be found.

removeDNSRecordsByIds

public javax.ws.rs.core.Response removeDNSRecordsByIds(String ids)
Delete DNS records by system id.

Parameters:
ids - Comma delimited list of ids to delete.
Returns:
Status of 200 if the DNS records were deleted.


Copyright © 2014. All Rights Reserved.