org.nhindirect.config.service.impl
Class TrustBundleServiceImpl

java.lang.Object
  extended by org.nhindirect.config.service.impl.TrustBundleServiceImpl
All Implemented Interfaces:
TrustBundleService

public class TrustBundleServiceImpl
extends Object
implements TrustBundleService

Implementation of the TrustBundleService

Since:
1.3
Author:
Greg Meyer

Constructor Summary
TrustBundleServiceImpl()
           
 
Method Summary
 void addTrustBundle(org.nhindirect.config.store.TrustBundle bundle)
          Adds a trust bundle to the system.
 void associateTrustBundleToDomain(long domainId, long trustBundleId, boolean incoming, boolean outgoing)
          Associates a domain to a trust bundle.
 void deleteTrustBundles(long[] trustBundleIds)
          Deletes a set of trust bundle from the system.
 void disassociateTrustBundleFromDomain(long domainId, long trustBundleId)
          Dissociates a domain from a trust bundle.
 void disassociateTrustBundleFromDomains(long trustBundleId)
          Dissociates a trust bundle from all domains.
 void disassociateTrustBundlesFromDomain(long domainId)
          Dissociates a domain from all trust bundles.
 org.nhindirect.config.store.dao.TrustBundleDao getDao()
          Return the value of the TrustBundlDao object.
 org.nhindirect.config.store.TrustBundle getTrustBundleById(long id)
          Gets a specific trust bundle by its internal id.
 org.nhindirect.config.store.TrustBundle getTrustBundleByName(String bundleName)
          Gets a specific trust bundle by name.
 Collection<org.nhindirect.config.store.TrustBundle> getTrustBundles(boolean fetchAnchors)
          Gets a collection of all trust bundles in the system
 Collection<org.nhindirect.config.store.TrustBundleDomainReltn> getTrustBundlesByDomain(long domainId, boolean fetchAnchors)
          Gets all trust bundles associated with a domain
 void init()
          Initialization method.
 void refreshTrustBundle(long id)
          Forces an on demand refresh of a trust bundle regardless of its refresh internal.
 void setDao(org.nhindirect.config.store.dao.TrustBundleDao dao)
          Set the value of the TrustBundlDao object.
 void setTemplate(org.apache.camel.ProducerTemplate template)
          Sets the camel ProducerTemplate object for bundle refresh operations.
 void updateLastUpdateError(long trustBundleId, Calendar attemptTime, org.nhindirect.config.store.BundleRefreshError error)
          Updates the last error that occurred when trying to download or refresh the bundle from its URL.
 void updateTrustBundleAttributes(long trustBundleId, String bundleName, String bundleUrl, org.nhindirect.config.store.Certificate signingCert, int refreshInterval)
          Updates multiple attributes of a trust bundle.
 void updateTrustBundleSigningCertificate(long trustBundleId, org.nhindirect.config.store.Certificate signingCert)
          Updates the signing certificate used to validate the authenticity of a bundle.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrustBundleServiceImpl

public TrustBundleServiceImpl()
Method Detail

init

public void init()
Initialization method.


getTrustBundles

public Collection<org.nhindirect.config.store.TrustBundle> getTrustBundles(boolean fetchAnchors)
                                                                    throws ConfigurationServiceException
Gets a collection of all trust bundles in the system

Specified by:
getTrustBundles in interface TrustBundleService
Parameters:
fetchAnchors - Indicates if the anchors should be fetched. When only the trust bundle names are needed, it is desireable to suppress returning the list of anchors for efficiency.
Returns:
Collection of all trust bundles in the system. If no trust bundles have been configured, then an empty collection is returned.
Throws:
ConfigurationServiceException

getTrustBundleByName

public org.nhindirect.config.store.TrustBundle getTrustBundleByName(String bundleName)
                                                             throws ConfigurationServiceException
Gets a specific trust bundle by name. Each trust bundle name is unique and case insensitive.

Specified by:
getTrustBundleByName in interface TrustBundleService
Parameters:
bundleName - The bundle name.
Returns:
The trust bundle specified by the name. If a bundle with the given name is not found, then null is returned.
Throws:
ConfigurationServiceException

getTrustBundleById

public org.nhindirect.config.store.TrustBundle getTrustBundleById(long id)
                                                           throws ConfigurationServiceException
Gets a specific trust bundle by its internal id.

Specified by:
getTrustBundleById in interface TrustBundleService
Parameters:
id - The internal trust bundle id.
Returns:
The trust bundle specified by the id. If a bundle with the given id is not found, then null is returned.
Throws:
ConfigurationServiceException

addTrustBundle

public void addTrustBundle(org.nhindirect.config.store.TrustBundle bundle)
                    throws ConfigurationServiceException
Adds a trust bundle to the system. The anchors should not be provided in the object as they will be downloaded. from the provided trust bundle URL.

Specified by:
addTrustBundle in interface TrustBundleService
Parameters:
bundle - The bundle to add.
Throws:
ConfigurationServiceException - Throw if a bundle with the same name already exists of if required properties are empty or null.

refreshTrustBundle

public void refreshTrustBundle(long id)
                        throws ConfigurationServiceException
Forces an on demand refresh of a trust bundle regardless of its refresh internal.

Specified by:
refreshTrustBundle in interface TrustBundleService
Parameters:
id - The id of the trust bundle to refresh.
Throws:
ConfigurationServiceException

updateLastUpdateError

public void updateLastUpdateError(long trustBundleId,
                                  Calendar attemptTime,
                                  org.nhindirect.config.store.BundleRefreshError error)
                           throws ConfigurationServiceException
Updates the last error that occurred when trying to download or refresh the bundle from its URL.

Specified by:
updateLastUpdateError in interface TrustBundleService
Parameters:
trustBundleId - The id of the bundle.
attemptTime - The time the bundle update was attempted
error - The reason for the error.
Throws:
ConfigurationServiceException

deleteTrustBundles

public void deleteTrustBundles(long[] trustBundleIds)
                        throws ConfigurationServiceException
Deletes a set of trust bundle from the system. All associations to domains are deleted as well.

Specified by:
deleteTrustBundles in interface TrustBundleService
Parameters:
trustBundleIds - The ids of the bundles to delete.
Throws:
ConfigurationServiceException

updateTrustBundleSigningCertificate

public void updateTrustBundleSigningCertificate(long trustBundleId,
                                                org.nhindirect.config.store.Certificate signingCert)
                                         throws ConfigurationServiceException
Updates the signing certificate used to validate the authenticity of a bundle.

Specified by:
updateTrustBundleSigningCertificate in interface TrustBundleService
Parameters:
trustBundleId - The trust bundle id.
signingCert - The certificate used to sign the bundle
Throws:
ConfigurationServiceException

updateTrustBundleAttributes

public void updateTrustBundleAttributes(long trustBundleId,
                                        String bundleName,
                                        String bundleUrl,
                                        org.nhindirect.config.store.Certificate signingCert,
                                        int refreshInterval)
                                 throws ConfigurationServiceException
Updates multiple attributes of a trust bundle.

Specified by:
updateTrustBundleAttributes in interface TrustBundleService
Parameters:
trustBundleId - The id of the bundle to update.
bundleName - The new bundle name. If empty or null, then the name is not updated. If the URL changes, a bundle refresh is forced.
bundleUrl - The new bundle url. If empty or null, then the url is not updated.
signingCert - The new certificate used to sign the bundle. The attributes will be applied even if the signingCert is null.
refreshInterval - The new refresh interval.
Throws:
ConfigurationServiceException

associateTrustBundleToDomain

public void associateTrustBundleToDomain(long domainId,
                                         long trustBundleId,
                                         boolean incoming,
                                         boolean outgoing)
                                  throws ConfigurationServiceException
Associates a domain to a trust bundle. Bundle associates are directional and may be set as incoming only, outgoing only, or incoming and outgoing.

Specified by:
associateTrustBundleToDomain in interface TrustBundleService
Parameters:
domainId - The id of the domain.
trustBundleId - The id of the trust bundle.
incoming - Indicates if the trust should allow incoming messages.
outgoing - Indicates if the trust should allow outgoing messages.
Throws:
ConfigurationServiceException

disassociateTrustBundleFromDomain

public void disassociateTrustBundleFromDomain(long domainId,
                                              long trustBundleId)
                                       throws ConfigurationServiceException
Dissociates a domain from a trust bundle.

Specified by:
disassociateTrustBundleFromDomain in interface TrustBundleService
Parameters:
domainId - The id of the domain
trustBundleId - The id of the trust bundle
Throws:
ConfigurationServiceException

disassociateTrustBundlesFromDomain

public void disassociateTrustBundlesFromDomain(long domainId)
                                        throws ConfigurationServiceException
Dissociates a domain from all trust bundles.

Specified by:
disassociateTrustBundlesFromDomain in interface TrustBundleService
Parameters:
domainId - The id of the domain
Throws:
ConfigurationServiceException

disassociateTrustBundleFromDomains

public void disassociateTrustBundleFromDomains(long trustBundleId)
                                        throws ConfigurationServiceException
Dissociates a trust bundle from all domains.

Specified by:
disassociateTrustBundleFromDomains in interface TrustBundleService
Parameters:
trustBundleId - The trust bundle id.
Throws:
ConfigurationServiceException

getTrustBundlesByDomain

public Collection<org.nhindirect.config.store.TrustBundleDomainReltn> getTrustBundlesByDomain(long domainId,
                                                                                              boolean fetchAnchors)
                                                                                       throws ConfigurationServiceException
Gets all trust bundles associated with a domain

Specified by:
getTrustBundlesByDomain in interface TrustBundleService
Parameters:
domainId - The domain id
fetchAnchors - Indicates if the anchors should be returned with each bundle. When only the trust bundle names are needed, it is desirable to suppress returning the list of anchors for efficiency.
Returns:
Collection of all trust bundles associated with a specific domain.
Throws:
ConfigurationServiceException

setDao

@Autowired
public void setDao(org.nhindirect.config.store.dao.TrustBundleDao dao)
Set the value of the TrustBundlDao object.

Parameters:
dao - the value of the TrustBundlDao object.

getDao

public org.nhindirect.config.store.dao.TrustBundleDao getDao()
Return the value of the TrustBundlDao object.

Returns:
the value of the TrustBundlDao object.

setTemplate

@Autowired
@Qualifier(value="bundleRefresh")
public void setTemplate(org.apache.camel.ProducerTemplate template)
Sets the camel ProducerTemplate object for bundle refresh operations.

Parameters:
template -


Copyright © 2014. All Rights Reserved.