diff options
author | Mark Spruiell <mes@zeroc.com> | 2006-04-26 03:22:49 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2006-04-26 03:22:49 +0000 |
commit | d24b35ce1f999f86c6f856821d51f4adf72c76e6 (patch) | |
tree | b1d1dbe50724a4d42ce1e46622aa49fde0a5492d /java/src/IceSSL/Instance.java | |
parent | use two stages for plugin initialization; refactoring to remove Context (diff) | |
download | ice-d24b35ce1f999f86c6f856821d51f4adf72c76e6.tar.bz2 ice-d24b35ce1f999f86c6f856821d51f4adf72c76e6.tar.xz ice-d24b35ce1f999f86c6f856821d51f4adf72c76e6.zip |
use two stages for plugin initialization
Diffstat (limited to 'java/src/IceSSL/Instance.java')
-rw-r--r-- | java/src/IceSSL/Instance.java | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/java/src/IceSSL/Instance.java b/java/src/IceSSL/Instance.java index 4b6fa6baf66..e14619334d7 100644 --- a/java/src/IceSSL/Instance.java +++ b/java/src/IceSSL/Instance.java @@ -18,34 +18,24 @@ class Instance _securityTraceCategory = "Security"; // - // Initialize the plugin, unless IceSSL.DelayInit=1. - // - if(communicator.getProperties().getPropertyAsInt("IceSSL.DelayInit") == 0) - { - initialize(null); - } - - // // Register the endpoint factory. // _facade.addEndpointFactory(new EndpointFactoryI(this)); } void - initialize(javax.net.ssl.SSLContext context) + initialize() { if(_context != null) { - Ice.PluginInitializationException e = new Ice.PluginInitializationException(); - e.reason = "plugin is already initialized"; - throw e; + return; } // // If we have to initialize an SSLContext, we'll need a SecureRandom object. // java.security.SecureRandom rand = null; - if(context == null) + if(_ctx == null) { try { @@ -71,7 +61,7 @@ class Instance // try { - _context = new Context(this, context, rand); + _context = new Context(this, _ctx, rand); } catch(java.security.GeneralSecurityException ex) { @@ -83,6 +73,25 @@ class Instance } void + setContext(javax.net.ssl.SSLContext context) + { + if(_context != null) + { + Ice.PluginInitializationException ex = new Ice.PluginInitializationException(); + ex.reason = "IceSSL: plugin is already initialized"; + throw ex; + } + + _ctx = context; + } + + javax.net.ssl.SSLContext + getContext() + { + return _ctx; + } + + void setCertificateVerifier(CertificateVerifier verifier) { _verifier = verifier; @@ -147,4 +156,5 @@ class Instance private String _securityTraceCategory; private Context _context; private CertificateVerifier _verifier; + private javax.net.ssl.SSLContext _ctx; } |