Author: davsclaus Date: Mon Apr 25 06:26:52 2011 New Revision: 1096416 URL: http://svn.apache.org/viewvc?rev=1096416&view=rev Log: Polished
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/BaseSSLContextParameters.java camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/KeyManagersParameters.java camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/KeyStoreParameters.java camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextClientParameters.java camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextParameters.java camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SecureRandomParameters.java camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/TrustManagersParameters.java Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java?rev=1096416&r1=1096415&r2=1096416&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java Mon Apr 25 06:26:52 2011 @@ -38,7 +38,6 @@ import java.util.Map; import java.util.Properties; import java.util.Scanner; -import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/BaseSSLContextParameters.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/BaseSSLContextParameters.java?rev=1096416&r1=1096415&r2=1096416&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/BaseSSLContextParameters.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/BaseSSLContextParameters.java Mon Apr 25 06:26:52 2011 @@ -87,7 +87,7 @@ public abstract class BaseSSLContextPara private FilterParameters secureSocketProtocolsFilter; /** - * The optional {@link SSLSessionContext} timeout time for {@link SSLSession}s. + * The optional {@link SSLSessionContext} timeout time for {@link javax.net.ssl.SSLSession}s. * TODO provide a time unit here and on the getter/setter. */ private Integer sessionTimeout; @@ -199,14 +199,14 @@ public abstract class BaseSSLContextPara } /** - * Returns the optional {@link SSLSessionContext} timeout time for {@link SSLSession}s. + * Returns the optional {@link SSLSessionContext} timeout time for {@link javax.net.ssl.SSLSession}s. */ public Integer getSessionTimeout() { return sessionTimeout; } /** - * Sets the optional {@link SSLSessionContext} timeout time for {@link SSLSession}s. + * Sets the optional {@link SSLSessionContext} timeout time for {@link javax.net.ssl.SSLSession}s. * * @param sessionTimeout the timeout value or {@code null} to use the default */ @@ -224,15 +224,15 @@ public abstract class BaseSSLContextPara * @throws GeneralSecurityException if there is an error configuring the context */ protected void configureSSLContext(SSLContext context) throws GeneralSecurityException { - LOG.debug("Configuring client and server side SSLContext parameters..."); - + LOG.trace("Configuring client and server side SSLContext parameters..."); + if (this.getSessionTimeout() != null) { - LOG.debug("Configuring client and server side SSLContext session timeout: " + this.getSessionTimeout()); + LOG.debug("Configuring client and server side SSLContext session timeout: {}", this.getSessionTimeout()); this.configureSessionContext(context.getClientSessionContext(), this.getSessionTimeout()); this.configureSessionContext(context.getServerSessionContext(), this.getSessionTimeout()); } - LOG.debug("Configured client and server side SSLContext parameters."); + LOG.trace("Configured client and server side SSLContext parameters."); } protected FilterParameters getDefaultCipherSuitesFilter() { @@ -536,7 +536,7 @@ public abstract class BaseSSLContextPara } /** - * Configures a {@link SessionContext}, client or server, with the supplied session timeout. + * Configures a {@link SSLSessionContext}, client or server, with the supplied session timeout. * * @param sessionContext the context to configure * @param sessionTimeout the timeout time period @@ -550,7 +550,7 @@ public abstract class BaseSSLContextPara } else { throw new GeneralSecurityException( "The SSLContext does not support SSLSessionContext, " - + "but a session timeout is configured. Set sessionTimeout to null " + + "but a session timeout is configured. Set sessionTimeout to null " + "to avoid this error."); } } @@ -610,8 +610,6 @@ public abstract class BaseSSLContextPara * @param excludePatterns the patterns to use for exclusion filtering, required if {@code explicitValues} is {@code null} * * @return the filtered values - * - * @see #filter(Collection, FilterParameters, FilterParameters, Collection) */ protected Collection<String> filter(Collection<String> explicitValues, Collection<String> availableValues, List<Pattern> includePatterns, List<Pattern> excludePatterns) { @@ -656,15 +654,19 @@ public abstract class BaseSSLContextPara } /** - * Configures a {@code T} based on the related configuration - * options. The return value from this method may be {@code object} or it - * may be a decorated instance there of. Consequently, any subsequent - * actions on {@code object} must be performed using the returned value. - * - * @param object the object to configure - * @return {@code object} or a decorated instance there of + * Configures a {@code T} based on the related configuration options. */ interface Configurer<T> { + + /** + * Configures a {@code T} based on the related configuration options. + * The return value from this method may be {@code object} or it + * may be a decorated instance there of. Consequently, any subsequent + * actions on {@code object} must be performed using the returned value. + * + * @param object the object to configure + * @return {@code object} or a decorated instance there of + */ T configure(T object); } @@ -681,7 +683,7 @@ public abstract class BaseSSLContextPara /** * Class needed to provide decoration of an existing {@link SSLContext}. * Since {@code SSLContext} is an abstract class and requires an instance of - * {@Link SSLContextSpi}, this class effectively wraps an + * {@link SSLContextSpi}, this class effectively wraps an * {@code SSLContext} as if it were an {@code SSLContextSpi}, allowing us to * achieve decoration. */ @@ -741,8 +743,7 @@ public abstract class BaseSSLContextPara } @Override - protected void engineInit( - KeyManager[] km, + protected void engineInit(KeyManager[] km, TrustManager[] tm, SecureRandom random) throws KeyManagementException { this.context.init(km, tm, random); @@ -762,7 +763,6 @@ public abstract class BaseSSLContextPara * @return {@code engine} or a decorated instance there of */ protected SSLEngine configureSSLEngine(SSLEngine engine) { - SSLEngine workingEngine = engine; for (Configurer<SSLEngine> configurer : this.sslEngineConfigurers) { @@ -948,4 +948,5 @@ public abstract class BaseSSLContextPara return workingSocket; } } + } Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/KeyManagersParameters.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/KeyManagersParameters.java?rev=1096416&r1=1096415&r2=1096416&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/KeyManagersParameters.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/KeyManagersParameters.java Mon Apr 25 06:26:52 2011 @@ -43,14 +43,14 @@ public class KeyManagersParameters { /** * The optional password for recovering keys in the key store. Used by the - * {@link KeyManagerFactory} that creates the {@link KeyManagers}s + * {@link KeyManagerFactory} that creates the {@link KeyManager}s * represented by this object's configuration. */ protected String keyPassword; /** * The optional provider identifier for the {@link KeyManagerFactory} used to create - * the {@link KeyManagers}s represented by this object's configuration. + * the {@link KeyManager}s represented by this object's configuration. */ protected String provider; @@ -81,11 +81,9 @@ public class KeyManagersParameters { */ public KeyManager[] createKeyManagers() throws GeneralSecurityException, IOException { - if (LOG.isDebugEnabled()) { - LOG.debug("Creating KeyManager[] from KeyManagersParameters: " + this); - } + LOG.debug("Creating KeyManager[] from KeyManagersParameters: {}", this); - KeyManager[] keyManagers = null; + KeyManager[] keyManagers; String kmfAlgorithm = this.getAlgorithm(); if (kmfAlgorithm == null) { @@ -139,7 +137,7 @@ public class KeyManagersParameters { /** * Sets the optional password for recovering keys in the key store. Used by the - * {@link KeyManagerFactory} that creates the {@link KeyManagers}s + * {@link KeyManagerFactory} that creates the {@link KeyManager}s * represented by this object's configuration. * * @param value the value to use @@ -169,7 +167,7 @@ public class KeyManagersParameters { } /** - * @see KeyManagersParametersTest#setAlgorithm(String) + * @see KeyManagerFactory#getDefaultAlgorithm() */ public String getAlgorithm() { return algorithm; Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/KeyStoreParameters.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/KeyStoreParameters.java?rev=1096416&r1=1096415&r2=1096416&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/KeyStoreParameters.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/KeyStoreParameters.java Mon Apr 25 06:26:52 2011 @@ -28,7 +28,6 @@ import java.security.Security; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - /** * A representation of configuration options for creating and loading a * {@link KeyStore} instance. @@ -151,9 +150,7 @@ public class KeyStoreParameters { */ public KeyStore createKeyStore() throws GeneralSecurityException, IOException { - if (LOG.isDebugEnabled()) { - LOG.debug("Creating KeyStore instance from KeyStoreParameters: " + this); - } + LOG.debug("Creating KeyStore instance from KeyStoreParameters: {}", this); String ksType = this.type; if (ksType == null) { @@ -165,7 +162,7 @@ public class KeyStoreParameters { ksPassword = this.password.toCharArray(); } - KeyStore ks = null; + KeyStore ks; if (this.provider == null) { ks = KeyStore.getInstance(ksType); } else { Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextClientParameters.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextClientParameters.java?rev=1096416&r1=1096415&r2=1096416&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextClientParameters.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextClientParameters.java Mon Apr 25 06:26:52 2011 @@ -36,12 +36,12 @@ public class SSLContextClientParameters @Override protected void configureSSLContext(SSLContext context) throws GeneralSecurityException { - LOG.debug("Configuring client-side SSLContext parameters..."); + LOG.trace("Configuring client-side SSLContext parameters..."); if (this.getSessionTimeout() != null) { LOG.debug("Configuring client-side SSLContext session timeout: " + this.getSessionTimeout()); this.configureSessionContext(context.getClientSessionContext(), this.getSessionTimeout()); } - LOG.debug("Configured client-side SSLContext parameters."); + LOG.trace("Configured client-side SSLContext parameters."); } /** Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextParameters.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextParameters.java?rev=1096416&r1=1096415&r2=1096416&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextParameters.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SSLContextParameters.java Mon Apr 25 06:26:52 2011 @@ -93,9 +93,6 @@ public class SSLContextParameters extend */ private String secureSocketProtocol; - /** - * @see #setKeyManagers(KeyManager) - */ public KeyManagersParameters getKeyManagers() { return keyManagers; } @@ -111,9 +108,6 @@ public class SSLContextParameters extend this.keyManagers = keyManagers; } - /** - * @see #setTrustManagers(TrustManagersParameters) - */ public TrustManagersParameters getTrustManagers() { return trustManagers; } @@ -129,9 +123,6 @@ public class SSLContextParameters extend this.trustManagers = trustManagers; } - /** - * @see #setSecureRandom(SecureRandomParameters) - */ public SecureRandomParameters getSecureRandom() { return secureRandom; } @@ -146,9 +137,6 @@ public class SSLContextParameters extend this.secureRandom = secureRandom; } - /** - * @see #setClientParameters(SSLContextClientParameters) - */ public SSLContextClientParameters getClientParameters() { return clientParameters; } @@ -166,9 +154,6 @@ public class SSLContextParameters extend this.clientParameters = clientParameters; } - /** - * @see #setServerParameters(SSLContextServerParameters) - */ public SSLContextServerParameters getServerParameters() { return serverParameters; } @@ -186,9 +171,6 @@ public class SSLContextParameters extend this.serverParameters = serverParameters; } - /** - * @see #setProvider(String) - */ public String getProvider() { return provider; } @@ -197,7 +179,7 @@ public class SSLContextParameters extend * Sets the optional provider identifier to use when constructing an * {@link SSLContext}. * - * @param the provider identifier (from the list of available providers + * @param provider the identifier (from the list of available providers * returned by {@link Security#getProviders()}) or {@code null} * to use the highest priority provider implementing the secure * socket protocol @@ -209,9 +191,6 @@ public class SSLContextParameters extend this.provider = provider; } - /** - * @see #setSecureSocketProtocol(String) - */ public String getSecureSocketProtocol() { if (this.secureSocketProtocol == null) { return DEFAULT_SECURE_SOCKET_PROTOCOL; @@ -250,15 +229,13 @@ public class SSLContextParameters extend */ public SSLContext createSSLContext() throws GeneralSecurityException, IOException { - if (LOG.isDebugEnabled()) { - LOG.debug("Creating SSLContext from SSLContextParameters: " + this); - } + LOG.debug("Creating SSLContext from SSLContextParameters: {}", this); KeyManager[] keyManagers = this.keyManagers == null ? null : this.keyManagers.createKeyManagers(); TrustManager[] trustManagers = this.trustManagers == null ? null : this.trustManagers.createTrustManagers(); SecureRandom secureRandom = this.secureRandom == null ? null : this.secureRandom.createSecureRandom(); - SSLContext context = null; + SSLContext context; if (this.getProvider() == null) { context = SSLContext.getInstance(this.getSecureSocketProtocol()); } else { @@ -282,7 +259,7 @@ public class SSLContextParameters extend @Override protected void configureSSLContext(SSLContext context) throws GeneralSecurityException { - LOG.debug("Configuring client and server side SSLContext parameters..."); + LOG.trace("Configuring client and server side SSLContext parameters..."); super.configureSSLContext(context); if (this.getClientParameters() != null) { @@ -295,13 +272,12 @@ public class SSLContextParameters extend this.getServerParameters().configureSSLContext(context); } - LOG.debug("Configured client and server side SSLContext parameters."); + LOG.trace("Configured client and server side SSLContext parameters."); } @Override protected List<Configurer<SSLEngine>> getSSLEngineConfigurers(SSLContext context) { - - LOG.debug("Collecting client and server side SSLEngine configurers..."); + LOG.trace("Collecting client and server side SSLEngine configurers..."); List<Configurer<SSLEngine>> configurers = super.getSSLEngineConfigurers(context); if (this.getClientParameters() != null) { @@ -314,14 +290,14 @@ public class SSLContextParameters extend configurers.addAll(this.getServerParameters().getSSLEngineConfigurers(context)); } - LOG.debug("Collected client and server side SSLEngine configurers."); + LOG.trace("Collected client and server side SSLEngine configurers."); return configurers; } @Override protected List<Configurer<SSLSocketFactory>> getSSLSocketFactoryConfigurers(SSLContext context) { - LOG.debug("Collecting SSLSocketFactory configurers..."); + LOG.trace("Collecting SSLSocketFactory configurers..."); List<Configurer<SSLSocketFactory>> configurers = super.getSSLSocketFactoryConfigurers(context); if (this.getClientParameters() != null) { @@ -329,14 +305,14 @@ public class SSLContextParameters extend configurers.addAll(this.getClientParameters().getSSLSocketFactoryConfigurers(context)); } - LOG.debug("Collected SSLSocketFactory configurers."); + LOG.trace("Collected SSLSocketFactory configurers."); return configurers; } @Override protected List<Configurer<SSLServerSocketFactory>> getSSLServerSocketFactoryConfigurers(SSLContext context) { - LOG.debug("Collecting SSLServerSocketFactory configurers..."); + LOG.trace("Collecting SSLServerSocketFactory configurers..."); List<Configurer<SSLServerSocketFactory>> configurers = super.getSSLServerSocketFactoryConfigurers(context); if (this.getServerParameters() != null) { @@ -344,7 +320,7 @@ public class SSLContextParameters extend configurers.addAll(this.getServerParameters().getSSLServerSocketFactoryConfigurers(context)); } - LOG.debug("Collected client and server side SSLServerSocketFactory configurers."); + LOG.trace("Collected client and server side SSLServerSocketFactory configurers."); return configurers; } Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SecureRandomParameters.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SecureRandomParameters.java?rev=1096416&r1=1096415&r2=1096416&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SecureRandomParameters.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/SecureRandomParameters.java Mon Apr 25 06:26:52 2011 @@ -56,12 +56,9 @@ public class SecureRandomParameters { * not exist. */ public SecureRandom createSecureRandom() throws GeneralSecurityException { - if (LOG.isDebugEnabled()) { - LOG.debug("Creating SecureRandom from SecureRandomParameters: " + this); - } - - SecureRandom secureRandom = null; - + LOG.debug("Creating SecureRandom from SecureRandomParameters: {}", this); + + SecureRandom secureRandom; if (this.getProvider() != null) { secureRandom = SecureRandom.getInstance(this.getAlgorithm(), this.getProvider()); } else { Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/TrustManagersParameters.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/TrustManagersParameters.java?rev=1096416&r1=1096415&r2=1096416&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/TrustManagersParameters.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/jsse/TrustManagersParameters.java Mon Apr 25 06:26:52 2011 @@ -71,14 +71,11 @@ public class TrustManagersParameters { */ public TrustManager[] createTrustManagers() throws GeneralSecurityException, IOException { - if (LOG.isDebugEnabled()) { - LOG.debug("Creating TrustManager[] from TrustManagersParameters: " + this); - } - + LOG.trace("Creating TrustManager[] from TrustManagersParameters: {}", this); + TrustManager[] trustManagers = null; if (this.getKeyStore() != null) { - String tmfAlgorithm = this.getAlgorithm(); if (tmfAlgorithm == null) { tmfAlgorithm = TrustManagerFactory.getDefaultAlgorithm(); @@ -95,15 +92,11 @@ public class TrustManagersParameters { tmf.init(ks); trustManagers = tmf.getTrustManagers(); - } return trustManagers; } - /** - * @see #setKeyStore(KeyStoreParameters) - */ public KeyStoreParameters getKeyStore() { return keyStore; } @@ -118,9 +111,6 @@ public class TrustManagersParameters { this.keyStore = value; } - /** - * @see #setProvider(String) - */ public String getProvider() { return provider; } @@ -139,9 +129,6 @@ public class TrustManagersParameters { this.provider = value; } - /** - * @see KeyManagersParametersTest#setAlgorithm(String) - */ public String getAlgorithm() { return algorithm; }