org.nhindirect.config.resources
Class CertificateResource

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

@Component
public class CertificateResource
extends ProtectedResource

JAX-RS resource for managing certificate 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
CertificateResource()
          Constructor
 
Method Summary
 javax.ws.rs.core.Response addCertificate(javax.ws.rs.core.UriInfo uriInfo, org.nhindirect.config.model.Certificate cert)
          Adds a certificate to the system.
 javax.ws.rs.core.Response getAllCertificates()
          Gets all certificates in the system.
 javax.ws.rs.core.Response getCertificatesByOwner(String owner)
          Gets all certificates for a specific owner.
 javax.ws.rs.core.Response getCertificatesByOwnerAndThumbprint(String owner, String thumbprint)
          Gets a certificate for a specific owner and thumbprint.
 javax.ws.rs.core.Response removeCertificatesByIds(String ids)
          Deletes certificates by system id.
 javax.ws.rs.core.Response removeCertificatesByOwner(String owner)
          Deletes all certificate for a specific owner.
 void setCertificateDao(org.nhindirect.config.store.dao.CertificateDao certDao)
          Sets the certificate Dao.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CertificateResource

public CertificateResource()
Constructor

Method Detail

setCertificateDao

@Autowired
public void setCertificateDao(org.nhindirect.config.store.dao.CertificateDao certDao)
Sets the certificate Dao. Auto populate by Spring

Parameters:
certDao - The certificate Dao

getAllCertificates

public javax.ws.rs.core.Response getAllCertificates()
Gets all certificates in the system.

Returns:
A JSON representation of a collection of all certificates in the system. Returns a status of 204 if no certificates exist.

getCertificatesByOwner

public javax.ws.rs.core.Response getCertificatesByOwner(String owner)
Gets all certificates for a specific owner.

Parameters:
owner - The owner to retrieive certificates for.
Returns:
A JSON representation of a collection of all certificates in the system. Returns a status of 204 if no certificates exist for the owner.

getCertificatesByOwnerAndThumbprint

public javax.ws.rs.core.Response getCertificatesByOwnerAndThumbprint(String owner,
                                                                     String thumbprint)
Gets a certificate for a specific owner and thumbprint.

Parameters:
owner - The owner or the certificate.
thumbprint - The thubmprint of the certificates.
Returns:
Returns a JSON representation of the certificate that matches the owner and thumbprint. Returns a status of 404 if no matching certificate is found.

addCertificate

public javax.ws.rs.core.Response addCertificate(@Context
                                                javax.ws.rs.core.UriInfo uriInfo,
                                                org.nhindirect.config.model.Certificate cert)
Adds a certificate to the system.

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

removeCertificatesByIds

public javax.ws.rs.core.Response removeCertificatesByIds(String ids)
Deletes certificates by system id.

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

removeCertificatesByOwner

public javax.ws.rs.core.Response removeCertificatesByOwner(String owner)
Deletes all certificate for a specific owner.

Parameters:
owner - The owner of the certificate.
Returns:
Status of 200 if the certificates were deleted.


Copyright © 2014. All Rights Reserved.