org.nhindirect.config.resources
Class CertPolicyResource

java.lang.Object
  extended by org.nhindirect.config.resources.CertPolicyResource

@Component
public class CertPolicyResource
extends Object

JAX-RS resource for managing certificate policy 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
CertPolicyResource()
          Constructor
 
Method Summary
 javax.ws.rs.core.Response addPolicy(javax.ws.rs.core.UriInfo uriInfo, org.nhindirect.config.model.CertPolicy policy)
          Adds a certificate policy to the system.
 javax.ws.rs.core.Response addPolicyGroup(javax.ws.rs.core.UriInfo uriInfo, org.nhindirect.config.model.CertPolicyGroup group)
          Adds a policy group to the system.
 javax.ws.rs.core.Response addPolicyUseToGroup(String groupName, org.nhindirect.config.model.CertPolicyGroupUse use)
          Adds a certificate policy usage to a policy group.
 javax.ws.rs.core.Response associatePolicyGroupToDomain(String groupName, String domainName)
          Associates a policy group to a domain.
 javax.ws.rs.core.Response disassociatePolicyGroupFromDomain(String groupName, String domainName)
          Removed a policy group from a domain.
 javax.ws.rs.core.Response disassociatePolicyGroupFromDomains(String groupName)
          Removes a given policy group from all domains.
 javax.ws.rs.core.Response disassociatePolicyGroupsFromDomain(String domainName)
          Removes all policy groups for a given domain.
 javax.ws.rs.core.Response getPolicies()
          Gets all certificate policies in the system.
 javax.ws.rs.core.Response getPolicyByName(String policyName)
          Gets a certificate policy by name.
 javax.ws.rs.core.Response getPolicyGroupByName(String groupName)
          Gets a policy group name.
 javax.ws.rs.core.Response getPolicyGroupDomainReltns()
          Gets all policy group to domain relationships.
 javax.ws.rs.core.Response getPolicyGroups()
          Gets all policy groups in the system.
 javax.ws.rs.core.Response getPolicyGroupsByDomain(String domainName)
          Gets all policy groups associated with a domain.
 javax.ws.rs.core.Response removedPolicyUseFromGroup(String groupName, org.nhindirect.config.model.CertPolicyGroupUse use)
          Removes a certificate policy usage from a policy group.
 javax.ws.rs.core.Response removePolicyByName(String policyName)
          Deletes a certificate policy by name.
 javax.ws.rs.core.Response removePolicyGroupByName(String groupName)
          Deletes a policy group from the system.
 void setCertPolicyDao(org.nhindirect.config.store.dao.CertPolicyDao policyDao)
          Sets the policy Dao.
 void setDomainDao(org.nhindirect.config.store.dao.DomainDao domainDao)
          Sets the domain Dao.
 javax.ws.rs.core.Response updateGroupAttributes(String groupName, String newGroupName)
          Updates the attributes of a policy group.
 javax.ws.rs.core.Response updatePolicyAttributes(String policyName, org.nhindirect.config.model.CertPolicy policyData)
          Updates the information of a certificate policy.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CertPolicyResource

public CertPolicyResource()
Constructor

Method Detail

setCertPolicyDao

@Autowired
public void setCertPolicyDao(org.nhindirect.config.store.dao.CertPolicyDao policyDao)
Sets the policy Dao. Auto populated by Spring

Parameters:
policyDao - CertPolicyDao Dao

setDomainDao

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

Parameters:
domainDao - DomainDao Dao

getPolicies

public javax.ws.rs.core.Response getPolicies()
Gets all certificate policies in the system.

Returns:
A JSON representation of a collection of all certificate policies in the system. Returns a status of 204 if no certificate policies exists.

getPolicyByName

public javax.ws.rs.core.Response getPolicyByName(String policyName)
Gets a certificate policy by name.

Parameters:
policyName - The name of the certificate policy to retrieve.
Returns:
A JSON representation of the certificate policy. Returns a status of 404 if a certificate policy with the given name does not exist.

addPolicy

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

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

removePolicyByName

public javax.ws.rs.core.Response removePolicyByName(String policyName)
Deletes a certificate policy by name.

Parameters:
policyName - The name of the certificate policy.
Returns:
Status of 200 if the policy was delete or 404 if a certificate policy with the given name does not exist.

updatePolicyAttributes

public javax.ws.rs.core.Response updatePolicyAttributes(String policyName,
                                                        org.nhindirect.config.model.CertPolicy policyData)
Updates the information of a certificate policy.

Parameters:
policyName - The name of the certificate policy to update.
policyData - Data that should be update. Any null or empty attributes will result in that attribute not being updated.
Returns:
Status of 204 if the certificate policy was updated or 404 if a certificate policy with the given name does not exist.

getPolicyGroups

public javax.ws.rs.core.Response getPolicyGroups()
Gets all policy groups in the system.

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

getPolicyGroupByName

public javax.ws.rs.core.Response getPolicyGroupByName(String groupName)
Gets a policy group name.

Parameters:
groupName - The name of the policy group to retrieve.
Returns:
A JSON representation of the policy group. Returns a status of 404 if a policy group with the given name does not exist.

addPolicyGroup

public javax.ws.rs.core.Response addPolicyGroup(@Context
                                                javax.ws.rs.core.UriInfo uriInfo,
                                                org.nhindirect.config.model.CertPolicyGroup group)
Adds a policy group to the system.

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

removePolicyGroupByName

public javax.ws.rs.core.Response removePolicyGroupByName(String groupName)
Deletes a policy group from the system.

Parameters:
groupName - The name of the policy group to delete.
Returns:
A status of 200 if the policy group was deleted or a status of 404 if a policy group with the given name does not exist.

updateGroupAttributes

public javax.ws.rs.core.Response updateGroupAttributes(String groupName,
                                                       String newGroupName)
Updates the attributes of a policy group. This method only updates the policy group name.

Parameters:
groupName - The name of the policy group to update.
newGroupName - The new name of the policy group.
Returns:
Status of 204 if the policy group was updated or a status of 404 if a policy group with the given name does not exist.

addPolicyUseToGroup

public javax.ws.rs.core.Response addPolicyUseToGroup(String groupName,
                                                     org.nhindirect.config.model.CertPolicyGroupUse use)
Adds a certificate policy usage to a policy group.

Parameters:
groupName - The name of the policy group to add the usage to.
use - The certificate policy usage to add to the policy group.
Returns:
Status of 204 if the usage was added to the policy group or a status of 404 if either the certificate policy or policy group does not exist.

removedPolicyUseFromGroup

public javax.ws.rs.core.Response removedPolicyUseFromGroup(String groupName,
                                                           org.nhindirect.config.model.CertPolicyGroupUse use)
Removes a certificate policy usage from a policy group.

Parameters:
groupName - The name of the policy group to remove the usage from.
use - The certificate policy usage to removed from the policy group.
Returns:
A status of 200 if the usage is removed from the policy group or a status of 404 if the certificate policy, policy group, or existing relationship is not found.

getPolicyGroupDomainReltns

public javax.ws.rs.core.Response getPolicyGroupDomainReltns()
Gets all policy group to domain relationships.

Returns:
A JSON representation of a collection of domain to policy group relationships. Returns a status of 204 if no relationships exist.

getPolicyGroupsByDomain

public javax.ws.rs.core.Response getPolicyGroupsByDomain(String domainName)
Gets all policy groups associated with a domain.

Parameters:
domainName - The domain name to retrieve associate policy groups from.
Returns:
A JSON representation of a collection of policy groups that are associated to the given domain. Returns a status of 404 if the a domain with the given name does not exist or a status of 204 or no policy groups are associated to the given domain.

associatePolicyGroupToDomain

public javax.ws.rs.core.Response associatePolicyGroupToDomain(String groupName,
                                                              String domainName)
Associates a policy group to a domain.

Parameters:
groupName - The policy group name to associate to the domain.
domainName - The domain name to associate to the policy group.
Returns:
Status of 204 if the policy group and domain are associated or a status of 404 if either the policy group or domain with the given respective names do not exist.

disassociatePolicyGroupFromDomain

public javax.ws.rs.core.Response disassociatePolicyGroupFromDomain(String groupName,
                                                                   String domainName)
Removed a policy group from a domain.

Parameters:
groupName - The policy group name to remove from the domain.
domainName - The domain name to remove from the policy group.
Returns:
A status of 200 if the policy group is removed from the domain or a status of 404 if either the policy group or domain with the given respective names do not exist.

disassociatePolicyGroupsFromDomain

public javax.ws.rs.core.Response disassociatePolicyGroupsFromDomain(String domainName)
Removes all policy groups for a given domain.

Parameters:
domainName - The domain to remove all policy groups from.
Returns:
Status of 204 if all policy groups are removed from the domain or a status or 404 if a domain with the given name does not exist.

disassociatePolicyGroupFromDomains

public javax.ws.rs.core.Response disassociatePolicyGroupFromDomains(String groupName)
Removes a given policy group from all domains.

Parameters:
groupName - The policy group to remove from all domains.
Returns:
Status of 200 if the policy group is removed from all domains or a status of 404 if the a policy group with the given name does not exist.


Copyright © 2014. All Rights Reserved.