org.nhindirect.config.resources
Class AnchorResource

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

@Component
public class AnchorResource
extends ProtectedResource

JAX-RS resource for managing anchor 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
AnchorResource()
          Constructor
 
Method Summary
 javax.ws.rs.core.Response addAnchor(javax.ws.rs.core.UriInfo uriInfo, org.nhindirect.config.model.Anchor anchor)
          Adds an anchor to the system.
 javax.ws.rs.core.Response getAnchorForOwner(boolean incoming, boolean outgoing, String thumbprint, String owner)
          Gets a set of list of anchor for a given owner of the anchor.
 javax.ws.rs.core.Response getAnchors()
          Gets all anchors in the system.
 javax.ws.rs.core.Response removeAnchorsByIds(String ids)
          Deletes anchor from the system by system id.
 javax.ws.rs.core.Response removeAnchorsByOwner(String owner)
          Delete all anchors for a specific owner.
 void setAnchorDao(org.nhindirect.config.store.dao.AnchorDao anchorDao)
          Sets the anchor Dao.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnchorResource

public AnchorResource()
Constructor

Method Detail

setAnchorDao

@Autowired
public void setAnchorDao(org.nhindirect.config.store.dao.AnchorDao anchorDao)
Sets the anchor Dao. Auto populated by Spring

Parameters:
dao - Anchor Dao

getAnchorForOwner

public javax.ws.rs.core.Response getAnchorForOwner(boolean incoming,
                                                   boolean outgoing,
                                                   String thumbprint,
                                                   String owner)
Gets a set of list of anchor for a given owner of the anchor. Additional query parameters can further filter the return list.

Parameters:
incoming - Returned anchors must be marked for use of incoming messages. Defaults to false meaning that no filter is applied.
outgoing - Returned anchors must be marked for use of outgoing messages. Defaults to false meaning that no filter is applied.
thumbprint - Returned anchors that match a specific thumbprint effectively limiting the number of returned anchors to 1. Defaults to an empty string meaning that no filter is applied.
owner - The owner to retrieve anchors for.
Returns:
A JSON representation of a collection of anchors that match the filters. Returns a status of 204 if no anchors match the filters or no anchors exist for the owner.

getAnchors

public javax.ws.rs.core.Response getAnchors()
Gets all anchors in the system.

Returns:
A JSON representation of a collection of all anchors in the system.

addAnchor

public javax.ws.rs.core.Response addAnchor(@Context
                                           javax.ws.rs.core.UriInfo uriInfo,
                                           org.nhindirect.config.model.Anchor anchor)
Adds an anchor to the system.

Parameters:
uriInfo - Injected URI context used for building the location URI.
anchor - The anchor to add to the system.
Returns:
Returns a status of 201 if the anchor was added, or a status of 409 if the anchor already exists for a specific owner.

removeAnchorsByIds

public javax.ws.rs.core.Response removeAnchorsByIds(String ids)
Deletes anchor from the system by system id.

Parameters:
ids - List of ids to delete from the system.
Returns:
Status of 200 if the anchors were deleted successfully.

removeAnchorsByOwner

public javax.ws.rs.core.Response removeAnchorsByOwner(String owner)
Delete all anchors for a specific owner.

Parameters:
owner - The owner to delete anchor from.
Returns:
Status of 200 if the anchors were deleted successfully.


Copyright © 2014. All Rights Reserved.