| | |
| | | { |
| | | try |
| | | { |
| | | // |
| | | // start the common registry |
| | | startCommonRegistry(); |
| | | |
| | | // |
| | | // start the RMI connector (SSL + server authentication) |
| | | startConnectorNoClientCertificate(); |
| | | |
| | | // |
| | | // start the RMI connector (SSL + server authentication + |
| | | // client authentication + identity given part SASL/PLAIN) |
| | | // TODO startConnectorClientCertificate(clientConnection); |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | final InetAddress listenAddress = jmxConnectionHandler.getListenAddress(); |
| | | int registryPort = jmxConnectionHandler.getListenPort(); |
| | | |
| | | // |
| | | // create our local RMI registry if it does not exist already |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | |
| | | } |
| | | try |
| | | { |
| | | // |
| | | // TODO Not yet implemented: If the host has several interfaces |
| | | if (registry == null) |
| | | { |
| | |
| | | } |
| | | catch (RemoteException re) |
| | | { |
| | | // |
| | | // is the registry already created ? |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | |
| | | } |
| | | try |
| | | { |
| | | // |
| | | // get a 'remote' reference on the registry |
| | | Registry reg = LocateRegistry.getRegistry(registryPort); |
| | | |
| | | // |
| | | // 'ping' the registry |
| | | reg.list(); |
| | | registry = reg; |
| | |
| | | { |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | | // |
| | | // no 'valid' registry found on the specified port |
| | | logger.trace("exception thrown while pinging the RMI registry"); |
| | | |
| | | // |
| | | // throw the original exception |
| | | logger.traceException(re); |
| | | } |
| | | throw re; |
| | | } |
| | | |
| | | // |
| | | // here the registry is ok even though |
| | | // it was not created by this call |
| | | if (logger.isTraceEnabled()) |
| | |
| | | { |
| | | try |
| | | { |
| | | // |
| | | // Environment map |
| | | HashMap<String, Object> env = new HashMap<String, Object>(); |
| | | |
| | |
| | | // --------------------- |
| | | // SERVER SIDE |
| | | // --------------------- |
| | | // |
| | | // Get a Server socket factory |
| | | KeyManager[] keyManagers; |
| | | KeyManagerProvider provider = DirectoryServer |
| | |
| | | null); |
| | | SSLSocketFactory ssf = ctx.getSocketFactory(); |
| | | |
| | | // |
| | | // set the Server socket factory in the JMX map |
| | | rmiServerSockeyFactory = new DirectoryRMIServerSocketFactory(ssf, |
| | | false); |
| | | rmiServerSockeyFactory = new DirectoryRMIServerSocketFactory(ssf, false); |
| | | env.put( |
| | | "jmx.remote.rmi.server.socket.factory", |
| | | rmiServerSockeyFactory); |
| | |
| | | } |
| | | } |
| | | |
| | | // |
| | | // specify the rmi JMX authenticator to be used |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | |
| | | |
| | | env.put(JMXConnectorServer.AUTHENTICATOR, rmiAuthenticator); |
| | | |
| | | // |
| | | // Create the JMX Service URL |
| | | String uri = "org.opends.server.protocols.jmx.client-unknown"; |
| | | String serviceUrl = "service:jmx:rmi:///jndi/rmi://" |
| | |
| | | + "/" + uri; |
| | | JMXServiceURL url = new JMXServiceURL(serviceUrl); |
| | | |
| | | // |
| | | // Create and start the connector |
| | | if (logger.isTraceEnabled()) |
| | | { |
| | |
| | | opendsRmiConnectorServer, mbs); |
| | | jmxRmiConnectorNoClientCertificate.start(); |
| | | |
| | | // |
| | | // Register the connector into the RMI registry |
| | | // TODO Should we do that? |
| | | ObjectName name = new ObjectName(jmxRmiConnectorNoClientCertificateName); |
| | |
| | | jmxRmiConnectorNoClientCertificate = null; |
| | | jmxRmiConnectorClientCertificate = null; |
| | | |
| | | // |
| | | // Unregister connectors and stop them. |
| | | try |
| | | { |
| | |
| | | |
| | | if (stopRegistry) |
| | | { |
| | | // |
| | | // Close the socket |
| | | try |
| | | { |
| | | if (rmiSsf != null) |
| | | { |
| | | rmiSsf.close(); |
| | | } |
| | | } |
| | | catch (IOException e) |
| | | { |
| | |
| | | } |
| | | registry = null; |
| | | } |
| | | |
| | | } |
| | | |
| | | |