| | |
| | | import java.io.File; |
| | | import java.io.UnsupportedEncodingException; |
| | | |
| | | import org.opends.server.types.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | |
| | | import com.sleepycat.je.Cursor; |
| | | import com.sleepycat.je.Database; |
| | | import com.sleepycat.je.DatabaseConfig; |
| | |
| | | { |
| | | long generationId=-1; |
| | | |
| | | DN baseDn; |
| | | String baseDn; |
| | | |
| | | try |
| | | { |
| | |
| | | + "<" + str[1] + ">")); |
| | | } |
| | | |
| | | // <baseDn> |
| | | baseDn = null; |
| | | try |
| | | { |
| | | baseDn = DN.decode(str[2]); |
| | | } catch (DirectoryException e) |
| | | { |
| | | Message message = |
| | | ERR_IGNORE_BAD_DN_IN_DATABASE_IDENTIFIER.get(str[1]); |
| | | logError(message); |
| | | |
| | | } |
| | | baseDn = str[2]; |
| | | |
| | | if (debugEnabled()) |
| | | TRACER.debugInfo( |
| | |
| | | + "<" + str[0] + ">")); |
| | | } |
| | | // <baseDn> |
| | | DN baseDn = null; |
| | | try |
| | | { |
| | | baseDn = DN.decode(str[1]); |
| | | } catch (DirectoryException e) |
| | | { |
| | | Message message = |
| | | ERR_IGNORE_BAD_DN_IN_DATABASE_IDENTIFIER.get(str[1]); |
| | | logError(message); |
| | | } |
| | | String baseDn = str[1]; |
| | | |
| | | if (debugEnabled()) |
| | | TRACER.debugInfo( |
| | |
| | | * @return the Database. |
| | | * @throws DatabaseException in case of underlying Exception. |
| | | */ |
| | | public Database getOrAddDb(Short serverId, DN baseDn, Long generationId) |
| | | public Database getOrAddDb(Short serverId, String baseDn, Long generationId) |
| | | throws DatabaseException |
| | | { |
| | | if (debugEnabled()) |
| | |
| | | serverId + " " + baseDn + " " + generationId); |
| | | try |
| | | { |
| | | String stringId = serverId.toString() + FIELD_SEPARATOR |
| | | + baseDn.toNormalizedString(); |
| | | String stringId = serverId.toString() + FIELD_SEPARATOR + baseDn; |
| | | |
| | | // Opens the database for the changes received from this server |
| | | // on this domain. Create it if it does not already exist. |
| | |
| | | |
| | | // Creates the record domain base Dn/ generationId in the stateDb |
| | | // if it does not already exist. |
| | | stringId = GENERATION_ID_TAG + FIELD_SEPARATOR + |
| | | baseDn.toNormalizedString(); |
| | | stringId = GENERATION_ID_TAG + FIELD_SEPARATOR + baseDn; |
| | | String dataStringId = GENERATION_ID_TAG + FIELD_SEPARATOR + |
| | | generationId.toString() + FIELD_SEPARATOR + |
| | | baseDn.toNormalizedString(); |
| | | generationId.toString() + FIELD_SEPARATOR + baseDn; |
| | | byteId = stringId.getBytes("UTF-8"); |
| | | byte[] dataByteId; |
| | | dataByteId = dataStringId.getBytes("UTF-8"); |
| | |
| | | * @param baseDn The baseDn for which the generationID must be cleared. |
| | | * |
| | | */ |
| | | public void clearGenerationId(DN baseDn) |
| | | public void clearGenerationId(String baseDn) |
| | | { |
| | | if (debugEnabled()) |
| | | TRACER.debugInfo( |
| | |
| | | try |
| | | { |
| | | // Deletes the record domain base Dn/ generationId in the stateDb |
| | | String stringId = GENERATION_ID_TAG + FIELD_SEPARATOR + |
| | | baseDn.toNormalizedString(); |
| | | String stringId = GENERATION_ID_TAG + FIELD_SEPARATOR + baseDn; |
| | | byte[] byteId = stringId.getBytes("UTF-8"); |
| | | DatabaseEntry key = new DatabaseEntry(); |
| | | key.setData(byteId); |
| | |
| | | if (debugEnabled()) |
| | | TRACER.debugInfo( |
| | | "In " + this.replicationServer.getMonitorInstanceName() + |
| | | " clearGenerationId (" + |
| | | baseDn +") succeeded."); |
| | | " clearGenerationId (" + baseDn +") succeeded."); |
| | | } |
| | | catch (DatabaseException dbe) |
| | | { |
| | |
| | | * @param serverId The serverId to remove from the Db. |
| | | * |
| | | */ |
| | | public void clearServerId(DN baseDn, Short serverId) |
| | | public void clearServerId(String baseDn, Short serverId) |
| | | { |
| | | if (debugEnabled()) |
| | | TRACER.debugInfo( |
| | |
| | | "clearServerId(baseDN=" + baseDn + ", serverId=" + serverId); |
| | | try |
| | | { |
| | | String stringId = serverId.toString() + FIELD_SEPARATOR |
| | | + baseDn.toNormalizedString(); |
| | | String stringId = serverId.toString() + FIELD_SEPARATOR + baseDn; |
| | | |
| | | // Deletes the record serverId/domain base Dn in the stateDb |
| | | byte[] byteId; |