org.nhindirect.config.resources
Class TrustBundleResource

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

@Component
public class TrustBundleResource
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
TrustBundleResource()
          Constructor
 
Method Summary
 javax.ws.rs.core.Response addTrustBundle(javax.ws.rs.core.UriInfo uriInfo, org.nhindirect.config.model.TrustBundle bundle)
          Adds a trust bundle to the system.
 javax.ws.rs.core.Response associateTrustBundleToDomain(String bundleName, String domainName, boolean incoming, boolean outgoing)
          Associates a trust bundle to a domain along with directional trust.
 javax.ws.rs.core.Response deleteBundle(String bundleName)
          Deletes a trust bundle.
 javax.ws.rs.core.Response disassociateTrustBundleFromDomain(String bundleName, String domainName)
          Removes the association of a trust bundle from a domain.
 javax.ws.rs.core.Response disassociateTrustBundleFromDomains(String bundleName)
          Removes a trust bundle from all domains.
 javax.ws.rs.core.Response disassociateTrustBundlesFromDomain(String domainName)
          Removes all trust bundle from a domain.
 javax.ws.rs.core.Response getTrustBundleByName(String bundleName)
          Gets a trust bundle by name.
 javax.ws.rs.core.Response getTrustBundles(boolean fetchAnchors)
          Gets all trust bundles in the system.
 javax.ws.rs.core.Response getTrustBundlesByDomain(String domainName, boolean fetchAnchors)
          Gets all trust bundles associated to a domain.
 javax.ws.rs.core.Response refreshTrustBundle(String bundleName)
          Forces the refresh of a trust bundle.
 void setDomainDao(org.nhindirect.config.store.dao.DomainDao domainDao)
          Sets the domain Dao.
 void setTemplate(org.apache.camel.ProducerTemplate template)
          Sets the producer template.
 void setTrustBundleDao(org.nhindirect.config.store.dao.TrustBundleDao bundleDao)
          Sets the trustBundle Dao.
 javax.ws.rs.core.Response updateBundleAttributes(String bundleName, org.nhindirect.config.model.TrustBundle bundleData)
          Updates multiple bundle attributes.
 javax.ws.rs.core.Response updateSigningCert(String bundleName, byte[] certData)
          Updates the signing certificate of a trust bundle.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrustBundleResource

public TrustBundleResource()
Constructor

Method Detail

setTrustBundleDao

@Autowired
public void setTrustBundleDao(org.nhindirect.config.store.dao.TrustBundleDao bundleDao)
Sets the trustBundle Dao. Auto populate by Spring

Parameters:
bundleDao - The trustBundle Dao.

setDomainDao

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

Parameters:
domainDao - The domain Dao.

setTemplate

@Autowired
@Qualifier(value="bundleRefresh")
public void setTemplate(org.apache.camel.ProducerTemplate template)
Sets the producer template. Auto populate by Spring

Parameters:
template - The producer template.

getTrustBundles

public javax.ws.rs.core.Response getTrustBundles(boolean fetchAnchors)
Gets all trust bundles in the system.

Parameters:
fetchAnchors - Indicates if the retrieval should also include the trust anchors in the bundle. When only needing bundle names, this parameter should be set to false for better performance.
Returns:
A JSON representation of a collection of all trust bundles in the system. Returns a status of 204 if no trust bundles exist.

getTrustBundlesByDomain

public javax.ws.rs.core.Response getTrustBundlesByDomain(String domainName,
                                                         boolean fetchAnchors)
Gets all trust bundles associated to a domain.

Parameters:
domainName - The name of the domain to fetch trust bundles for.
fetchAnchors - Indicates if the retrieval should also include the trust anchors in the bundle. When only needing bundle names, this parameter should be set to false for better performance.
Returns:
A JSON representation of a collection of trust bundle that are associated to the given domain. Returns a status of 404 if a domain with the given name does not exist or a status of 404 if no trust bundles are associated with the given name.

getTrustBundleByName

public javax.ws.rs.core.Response getTrustBundleByName(String bundleName)
Gets a trust bundle by name.

Parameters:
bundleName - The name of the trust bundle to retrieve.
Returns:
A JSON representation of a the trust bundle. Returns a status of 404 if a trust bundle with the given name does not exist.

addTrustBundle

public javax.ws.rs.core.Response addTrustBundle(@Context
                                                javax.ws.rs.core.UriInfo uriInfo,
                                                org.nhindirect.config.model.TrustBundle bundle)
Adds a trust bundle to the system.

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

refreshTrustBundle

public javax.ws.rs.core.Response refreshTrustBundle(String bundleName)
Forces the refresh of a trust bundle.

Parameters:
bundleName - The name of the trust bundle to refresh.
Returns:
Status of 204 if the bundle was refreshed or a status of 404 if a trust bundle with the given name does not exist.

deleteBundle

public javax.ws.rs.core.Response deleteBundle(String bundleName)
Deletes a trust bundle.

Parameters:
bundleName - The name of the bundle to delete.
Returns:
Status of 200 if the trust bundle was deleted or a status of 404 if a trust bundle with the given name does not exist.

updateSigningCert

public javax.ws.rs.core.Response updateSigningCert(String bundleName,
                                                   byte[] certData)
Updates the signing certificate of a trust bundle.

Parameters:
bundleName - The name of the trust bundle to update.
certData - A DER encoded representation of the new signing certificate.
Returns:
Status of 204 if the trust bundle's signing certificate was updated, status of 400 if the signing certificate is invalid, or a status 404 if a trust bundle with the given name does not exist.

updateBundleAttributes

public javax.ws.rs.core.Response updateBundleAttributes(String bundleName,
                                                        org.nhindirect.config.model.TrustBundle bundleData)
Updates multiple bundle attributes. If the URL of the bundle changes, then the bundle is automatically refreshed.

Parameters:
bundleName - The name of the bundle to update.
bundleData - The data of the trust bundle to update. Empty or null attributes indicate that the attribute should not be changed.
Returns:
Status of 204 if the bundle attributes were updated, status of 400 if the signing certificate is invalid, or a status 404 if a trust bundle with the given name does not exist.

associateTrustBundleToDomain

public javax.ws.rs.core.Response associateTrustBundleToDomain(String bundleName,
                                                              String domainName,
                                                              boolean incoming,
                                                              boolean outgoing)
Associates a trust bundle to a domain along with directional trust.

Parameters:
bundleName - The name of the bundle to associate to a domain.
domainName - The name of the domain to associate to a bundle.
incoming - Indicates if trust should be allowed for incoming messages.
outgoing - Indicates if trust should be allowed for outgoing messages.
Returns:
Status of 204 if the association was made or a status of 404 if either a domain or trust bundle with its given name does not exist.

disassociateTrustBundleFromDomain

public javax.ws.rs.core.Response disassociateTrustBundleFromDomain(String bundleName,
                                                                   String domainName)
Removes the association of a trust bundle from a domain.

Parameters:
bundleName - The name of the trust bundle to remove from the domain.
domainName - The name of the domain to remove from the trust bundle.
Returns:
Status of 200 if the association was removed or a status of 404 if either a domain or trust bundle with its given name does not exist.

disassociateTrustBundlesFromDomain

public javax.ws.rs.core.Response disassociateTrustBundlesFromDomain(String domainName)
Removes all trust bundle from a domain.

Parameters:
domainName - The name of the domain to remove trust bundle from.
Returns:
Status of 200 if trust bundles were removed from the domain or a status of 404 if a domain with the given name does not exist.

disassociateTrustBundleFromDomains

public javax.ws.rs.core.Response disassociateTrustBundleFromDomains(String bundleName)
Removes a trust bundle from all domains.

Parameters:
bundleName - The name of the trust bundle to remove from all domains.
Returns:
Status of 200 if the trust bundle was removed from all domains or a status of 404 if a trust bundle with the given name does not exist.


Copyright © 2014. All Rights Reserved.