org.nhindirect.config.processor.impl
Class DefaultBundleRefreshProcessorImpl

java.lang.Object
  extended by org.nhindirect.config.processor.impl.DefaultBundleRefreshProcessorImpl
All Implemented Interfaces:
BundleRefreshProcessor

public class DefaultBundleRefreshProcessorImpl
extends Object
implements BundleRefreshProcessor

Camel based implementation of the BundleRefreshProcessor interface.

The implementation allows for bundles to be downloaded from SSL protected sites that may not chain back to a trust CA. This is useful in developement environments and is not recommended in a production invironment. By default, this feature is disable, but can be enabled using the BUNDLE_REFRESH_PROCESSOR_ALLOW_DOWNLOAD_FROM_UNTRUSTED options parameter.

Since:
1.3
Author:
Greg Meyer

Field Summary
static String BUNDLE_REFRESH_PROCESSOR_ALLOW_DOWNLOAD_FROM_UNTRUSTED
          Boolean value that specifies if bundles can be downloaded from non verified or untrusted SSL URLs.
protected  org.nhindirect.config.store.dao.TrustBundleDao dao
           
protected static int DEFAULT_URL_CONNECTION_TIMEOUT
           
protected static int DEFAULT_URL_READ_TIMEOUT
           
 
Constructor Summary
DefaultBundleRefreshProcessorImpl()
          Default constructor.
 
Method Summary
protected  Collection<X509Certificate> convertRawBundleToAnchorCollection(byte[] rawBundle, org.nhindirect.config.store.TrustBundle existingBundle, Calendar processAttempStart)
          Converts a trust raw trust bundle byte array into a collection of X509Certificate objects.
protected  byte[] downloadBundleToByteArray(org.nhindirect.config.store.TrustBundle bundle, Calendar processAttempStart)
          Downloads a bundle from the bundle's URL and returns the result as a byte array.
static void initJVMParams()
          Initializes system preferences using the Direct OptionsManager pattern.
 void refreshBundle(org.nhindirect.config.store.TrustBundle bundle)
          Refreshes the set of anchors within a bundle.
 void setDao(org.nhindirect.config.store.dao.TrustBundleDao dao)
          Sets the trust bundle DAO for updating the bundle storage medium.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BUNDLE_REFRESH_PROCESSOR_ALLOW_DOWNLOAD_FROM_UNTRUSTED

public static final String BUNDLE_REFRESH_PROCESSOR_ALLOW_DOWNLOAD_FROM_UNTRUSTED
Boolean value that specifies if bundles can be downloaded from non verified or untrusted SSL URLs. The default value is false.

JVM Parameter/Options Name: org.nhindirect.config.processor.impl.bundlerefresh.AllowNonVerifiedSSL

See Also:
Constant Field Values

DEFAULT_URL_CONNECTION_TIMEOUT

protected static final int DEFAULT_URL_CONNECTION_TIMEOUT
See Also:
Constant Field Values

DEFAULT_URL_READ_TIMEOUT

protected static final int DEFAULT_URL_READ_TIMEOUT
See Also:
Constant Field Values

dao

protected org.nhindirect.config.store.dao.TrustBundleDao dao
Constructor Detail

DefaultBundleRefreshProcessorImpl

public DefaultBundleRefreshProcessorImpl()
Default constructor.

Method Detail

initJVMParams

public static void initJVMParams()
Initializes system preferences using the Direct OptionsManager pattern.


setDao

public void setDao(org.nhindirect.config.store.dao.TrustBundleDao dao)
Sets the trust bundle DAO for updating the bundle storage medium.

Parameters:
dao - The trust bundle DAOP

refreshBundle

@Handler
public void refreshBundle(org.nhindirect.config.store.TrustBundle bundle)
Refreshes the set of anchors within a bundle. The bundle is downloaded from the bundle's URL, validated for authenticity if the bundle is signed and a signing certificate has been configured, and the anchors are updated in the store. If the bundle has not changed (which can be checked using the bundle checksum), then the anchors in the bundle may not be updated.

Specified by:
refreshBundle in interface BundleRefreshProcessor
Parameters:
bundle - The bundle that will be updated.

convertRawBundleToAnchorCollection

protected Collection<X509Certificate> convertRawBundleToAnchorCollection(byte[] rawBundle,
                                                                         org.nhindirect.config.store.TrustBundle existingBundle,
                                                                         Calendar processAttempStart)
Converts a trust raw trust bundle byte array into a collection of X509Certificate objects.

Parameters:
rawBundle - The raw representation of the bundle. This generally the raw byte string downloaded from the bundle's URL.
existingBundle - The configured bundle object in the DAO. This object may contain the signing certificate used for bundle authenticity checking.
processAttempStart - The time that the update process started.
Returns:

downloadBundleToByteArray

protected byte[] downloadBundleToByteArray(org.nhindirect.config.store.TrustBundle bundle,
                                           Calendar processAttempStart)
Downloads a bundle from the bundle's URL and returns the result as a byte array.

Parameters:
bundle - The bundle that will be downloaded.
processAttempStart - The time that the update process started.
Returns:
A byte array representing the raw data of the bundle.


Copyright © 2013. All Rights Reserved.