| | |
| | | import java.util.zip.DataFormatException; |
| | | |
| | | import org.opends.server.replication.common.ServerState; |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | |
| | | /** |
| | | * This message is used by LDAP server when they first connect. |
| | |
| | | { |
| | | private int serverId; // Id of the LDAP server that sent this message |
| | | private String serverURL; |
| | | private String baseDn; |
| | | private DN baseDN; |
| | | private int maxReceiveQueue; |
| | | private int maxSendQueue; |
| | | private int maxReceiveDelay; |
| | |
| | | * @param serverId2 The serverId of the server for which the ServerStartMsg |
| | | * is created. |
| | | * @param serverURL directory server URL |
| | | * @param baseDn The base DN. |
| | | * @param baseDN The base DN. |
| | | * @param windowSize The window size used by this server. |
| | | * @param heartbeatInterval The requested heartbeat interval. |
| | | * @param serverState The state of this server. |
| | |
| | | * after the start messages have been exchanged. |
| | | * @param groupId The group id of the DS for this DN |
| | | */ |
| | | public ServerStartMsg(int serverId2, String serverURL, String baseDn, |
| | | public ServerStartMsg(int serverId2, String serverURL, DN baseDN, |
| | | int windowSize, long heartbeatInterval, ServerState serverState, |
| | | long generationId, boolean sslEncryption, |
| | | byte groupId) |
| | |
| | | |
| | | this.serverId = serverId2; |
| | | this.serverURL = serverURL; |
| | | this.baseDn = baseDn; |
| | | this.baseDN = baseDN; |
| | | this.maxReceiveDelay = 0; |
| | | this.maxReceiveQueue = 0; |
| | | this.maxSendDelay = 0; |
| | |
| | | * first calculate the length then construct the string |
| | | */ |
| | | int length = getNextLength(in, pos); |
| | | baseDn = new String(in, pos, length, "UTF-8"); |
| | | baseDN = DN.decode(new String(in, pos, length, "UTF-8")); |
| | | pos += length +1; |
| | | |
| | | /* |
| | |
| | | // have more than one ServerState field. |
| | | serverState = new ServerState(in, pos, in.length - 1); |
| | | |
| | | } catch (UnsupportedEncodingException e) |
| | | } |
| | | catch (UnsupportedEncodingException e) |
| | | { |
| | | throw new DataFormatException("UTF-8 is not supported by this jvm."); |
| | | } |
| | | catch (DirectoryException e) |
| | | { |
| | | throw new DataFormatException(e.getLocalizedMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * Get the baseDn. |
| | | * @return Returns the baseDn. |
| | | * Get the baseDN. |
| | | * |
| | | * @return Returns the baseDN. |
| | | */ |
| | | public String getBaseDn() |
| | | public DN getBaseDN() |
| | | { |
| | | return baseDn; |
| | | return baseDN; |
| | | } |
| | | |
| | | /** |
| | |
| | | public byte[] getBytes(short sessionProtocolVersion) |
| | | { |
| | | try { |
| | | byte[] byteDn = baseDn.getBytes("UTF-8"); |
| | | byte[] byteDn = baseDN.toString().getBytes("UTF-8"); |
| | | byte[] byteServerId = String.valueOf(serverId).getBytes("UTF-8"); |
| | | byte[] byteServerUrl = serverURL.getBytes("UTF-8"); |
| | | byte[] byteMaxRecvDelay = |
| | |
| | | "\nprotocolVersion: " + protocolVersion + |
| | | "\ngenerationId: " + generationId + |
| | | "\ngroupId: " + groupId + |
| | | "\nbaseDn: " + baseDn + |
| | | "\nbaseDN: " + baseDN + |
| | | "\nheartbeatInterval: " + heartbeatInterval + |
| | | "\nmaxReceiveDelay: " + maxReceiveDelay + |
| | | "\nmaxReceiveQueue: " + maxReceiveQueue + |
| | |
| | | "\nsslEncryption: " + sslEncryption + |
| | | "\nwindowSize: " + windowSize; |
| | | } |
| | | } |
| | | } |