org.nhindirect.config.resources
Class AddressResource

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

@Component
public class AddressResource
extends ProtectedResource

JAX-RS resource for managing address 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
AddressResource()
          Constructor
 
Method Summary
 javax.ws.rs.core.Response addAddress(javax.ws.rs.core.UriInfo uriInfo, org.nhindirect.config.model.Address address)
          Adds an address to the system and associates it with a domain.
 javax.ws.rs.core.Response getAddress(String address)
          Gets an address by name.
 javax.ws.rs.core.Response getAddressesByDomain(String domainName)
          Gets all addresses configured for a given domain.
 javax.ws.rs.core.Response removedAddress(String address)
          Removes an address from the system.
 void setAddressDao(org.nhindirect.config.store.dao.AddressDao dao)
          Sets the address Dao.
 void setDomainDao(org.nhindirect.config.store.dao.DomainDao domainDao)
          Sets the domain Dao.
 javax.ws.rs.core.Response updateAddress(org.nhindirect.config.model.Address address)
          Updates the attributes of an existing address.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AddressResource

public AddressResource()
Constructor

Method Detail

setAddressDao

@Autowired
public void setAddressDao(org.nhindirect.config.store.dao.AddressDao dao)
Sets the address Dao. Auto populated by Spring

Parameters:
dao - Address Dao

setDomainDao

@Autowired
public void setDomainDao(org.nhindirect.config.store.dao.DomainDao domainDao)
Sets the domain Dao. Auto populate by Spring

Parameters:
domainDao -

getAddress

public javax.ws.rs.core.Response getAddress(String address)
Gets an address by name.

Parameters:
address - The address to retrieve.
Returns:
A JSON representation of an Address. Returns 404 if the address doesn't exists.

getAddressesByDomain

public javax.ws.rs.core.Response getAddressesByDomain(String domainName)
Gets all addresses configured for a given domain.

Parameters:
domainName - The domain name to retrieve addresses for.
Returns:
A JSON representation of a list of addresses. Returns a 404 status if the domain does not exists or a 204 status if no addresses are configured for the domain.

addAddress

public javax.ws.rs.core.Response addAddress(@Context
                                            javax.ws.rs.core.UriInfo uriInfo,
                                            org.nhindirect.config.model.Address address)
Adds an address to the system and associates it with a domain.

Parameters:
uriInfo - Injected URI context used for building the location URI.
address - The address to add.
Returns:
Returns status 201 if added successfully, 404 if the domain does not exist, or 409 if the address already exists.

updateAddress

public javax.ws.rs.core.Response updateAddress(org.nhindirect.config.model.Address address)
Updates the attributes of an existing address.

Parameters:
address - The address to update along with new attributes.
Returns:
Returns 204 if the address is updated successfully, 400 if the domain name is empty, 404 if the domain or address does not exist.

removedAddress

public javax.ws.rs.core.Response removedAddress(String address)
Removes an address from the system.

Parameters:
address - The address to removed.
Returns:
Returns a status of 200 if the address was removed or 404 if the address does not exists.


Copyright © 2014. All Rights Reserved.