| | |
| | | import org.opends.server.api.MonitorProvider; |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.replication.protocol.SocketSession; |
| | | import org.opends.server.replication.protocol.ReplSessionSecurity; |
| | | import org.opends.server.replication.protocol.ProtocolSession; |
| | | import org.opends.server.types.Attribute; |
| | | import org.opends.server.types.AttributeType; |
| | | import org.opends.server.types.AttributeValue; |
| | |
| | | private int replicationPort; |
| | | // de deleted from the persistent storage. |
| | | private boolean stopListen = false; |
| | | private ReplSessionSecurity replSessionSecurity; |
| | | |
| | | /** |
| | | * Creates a new Replication server using the provided configuration entry. |
| | |
| | | { |
| | | dbDirname = "changelogDb"; |
| | | } |
| | | // Chech that this path exists or create it. |
| | | // Check that this path exists or create it. |
| | | File f = getFileForPath(dbDirname); |
| | | try |
| | | { |
| | |
| | | throw new ConfigException(msg, e); |
| | | } |
| | | |
| | | replSessionSecurity = new ReplSessionSecurity(configuration); |
| | | initialize(replicationServerId, replicationPort); |
| | | configuration.addChangeListener(this); |
| | | DirectoryServer.registerMonitorProvider(this); |
| | |
| | | |
| | | void runListen() |
| | | { |
| | | Socket newSocket = null; |
| | | Socket newSocket; |
| | | while ((shutdown == false) && (stopListen == false)) |
| | | { |
| | | // Wait on the replicationServer port. |
| | |
| | | newSocket.setReceiveBufferSize(1000000); |
| | | newSocket.setTcpNoDelay(true); |
| | | newSocket.setKeepAlive(true); |
| | | ServerHandler handler = new ServerHandler( |
| | | new SocketSession(newSocket), queueSize); |
| | | handler.start(null, serverId, serverURL, rcvWindow, this); |
| | | } catch (IOException e) |
| | | ProtocolSession session = |
| | | replSessionSecurity.createServerSession(newSocket); |
| | | ServerHandler handler = new ServerHandler(session, queueSize); |
| | | handler.start(null, serverId, serverURL, rcvWindow, |
| | | false, this); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | // The socket has probably been closed as part of the |
| | | // shutdown or changing the port number process. |
| | |
| | | int separator = serverURL.lastIndexOf(':'); |
| | | String port = serverURL.substring(separator + 1); |
| | | String hostname = serverURL.substring(0, separator); |
| | | boolean sslEncryption = replSessionSecurity.isSslEncryption(serverURL); |
| | | |
| | | try |
| | | { |
| | |
| | | socket.connect(ServerAddr, 500); |
| | | |
| | | ServerHandler handler = new ServerHandler( |
| | | new SocketSession(socket), queueSize); |
| | | handler.start(baseDn, serverId, this.serverURL, rcvWindow, this); |
| | | replSessionSecurity.createClientSession(serverURL, socket), |
| | | queueSize); |
| | | handler.start(baseDn, serverId, this.serverURL, rcvWindow, |
| | | sslEncryption, this); |
| | | } |
| | | catch (IOException e) |
| | | catch (Exception e) |
| | | { |
| | | // ignore |
| | | } |
| | |
| | | } |
| | | |
| | | if ((configuration.getReplicationDbDirectory() != null) && |
| | | (dbDirname != configuration.getReplicationDbDirectory())) |
| | | (!dbDirname.equals(configuration.getReplicationDbDirectory()))) |
| | | { |
| | | return new ConfigChangeResult(ResultCode.SUCCESS, true); |
| | | } |