@Override public int hashCode() { return LdapUtils.computeHashCode(HASH_CODE_SEED, getOID(), getCriticality(), syncState, entryUuid, cookie); }
@Override public String toString() { return String.format( "[%s@%d::criticality=%s, syncState=%s, entryUuid=%s, cookie=%s]", getClass().getName(), hashCode(), getCriticality(), syncState, entryUuid, LdapUtils.base64Encode(cookie)); }
/** * Creates a new sync state control. * * @param state sync state * @param uuid sync entry uuid * @param value sync state cookie * @param critical whether this control is critical */ public SyncStateControl(final State state, final UUID uuid, final byte[] value, final boolean critical) { super(OID, critical); setSyncState(state); setEntryUuid(uuid); setCookie(value); }
/** * Creates a new sync state control. * * @param state sync state * @param uuid sync entry uuid * @param critical whether this control is critical */ public SyncStateControl(final State state, final UUID uuid, final boolean critical) { super(OID, critical); setSyncState(state); setEntryUuid(uuid); }
/** * @param berValue to encode. * @param expected sync state control to test. * * @throws Exception On test failure. */ @Test(groups = {"control"}, dataProvider = "response") public void decode(final byte[] berValue, final SyncStateControl expected) throws Exception { final SyncStateControl actual = new SyncStateControl(expected.getCriticality()); actual.decode(berValue); Assert.assertEquals(actual, expected); } }
new SyncStateControl( SyncStateControl.State.ADD, UUID.fromString("843177ec-5b0e-1031-827f-116ff56e4e59"), "MEsKAQIEEF1dpdBb4hAxgoQRb/VuTlkENHJpZD0wMDAsY3NuPTIwMTIwNzA2MTgx" + "NTUyLjMzNzcxOFojMDAwMDAwIzAwMCMwMDAwMDA="), new SyncStateControl( SyncStateControl.State.MODIFY, UUID.fromString("5d5da5d0-5be2-1031-8284-116ff56e4e59"), "MDsKAQEEAAQ0cmlkPTAwMCxjc249MjAxMzAyMTUyMTIzMjAuNDY0NDg1WiMwMDAw" + "MDAjMDAwIzAwMDAwMA=="), new SyncStateControl( SyncStateControl.State.ADD, null,
/** * Creates a new sync state control. * * @param state sync state */ public SyncStateControl(final State state) { super(OID); setSyncState(state); }
@Override public void handle(final DERParser parser, final ByteBuffer encoded) { if (encoded.hasRemaining()) { getObject().setEntryUuid(UuidType.decode(encoded)); } } }
@Override public void handle(final DERParser parser, final ByteBuffer encoded) { final byte[] cookie = OctetStringType.readBuffer(encoded); if (cookie != null && cookie.length > 0) { getObject().setCookie(cookie); } } }
@Override public HandlerResult<SearchEntry> handle( final Connection conn, final SearchRequest request, final SearchEntry entry) throws LdapException { try { logger.debug("received {}", entry); final SyncReplItem item = new SyncReplItem(new SyncReplItem.Entry(entry)); if (item.getEntry().getSyncStateControl() != null) { final byte[] cookie = item.getEntry().getSyncStateControl().getCookie(); if (cookie != null) { manager.writeCookie(cookie); } } queue.put(item); } catch (Exception e) { logger.warn("Unable to enqueue entry {}", entry); } return new HandlerResult<>(null); }
ctl = new SyncStateControl( SyncStateControl.State.valueOf(c.getSyncStateType().getValue()), UuidType.decode(ByteBuffer.wrap(c.getEntryUUID())),
/** * Creates a new sync state control. * * @param state sync state * @param uuid sync entry uuid * @param critical whether this control is critical */ public SyncStateControl(final State state, final UUID uuid, final boolean critical) { super(OID, critical); setSyncState(state); setEntryUuid(uuid); }
/** * Creates a new sync state control. * * @param state sync state */ public SyncStateControl(final State state) { super(OID); setSyncState(state); }
@Override public void handle(final DERParser parser, final ByteBuffer encoded) { if (encoded.hasRemaining()) { getObject().setEntryUuid(UuidType.decode(encoded)); } } }
@Override public void handle(final DERParser parser, final ByteBuffer encoded) { final byte[] cookie = OctetStringType.readBuffer(encoded); if (cookie != null && cookie.length > 0) { getObject().setCookie(cookie); } } }
@Override public HandlerResult<SearchEntry> handle( final Connection conn, final SearchRequest request, final SearchEntry entry) throws LdapException { try { logger.debug("received {}", entry); final SyncReplItem item = new SyncReplItem(new SyncReplItem.Entry(entry)); if (item.getEntry().getSyncStateControl() != null) { final byte[] cookie = item.getEntry().getSyncStateControl().getCookie(); if (cookie != null) { manager.writeCookie(cookie); } } queue.put(item); } catch (Exception e) { logger.warn("Unable to enqueue entry {}", entry); } return new HandlerResult<>(null); }
/** * Creates a new sync state control. * * @param state sync state * @param uuid sync entry uuid * @param value sync state cookie * @param critical whether this control is critical */ public SyncStateControl(final State state, final UUID uuid, final byte[] value, final boolean critical) { super(OID, critical); setSyncState(state); setEntryUuid(uuid); setCookie(value); }
ctl = new SyncStateControl(critical); ctl.decode(encoded); break;
@Override public int hashCode() { return LdapUtils.computeHashCode(HASH_CODE_SEED, getOID(), getCriticality(), syncState, entryUuid, cookie); }
@Override public String toString() { return String.format( "[%s@%d::criticality=%s, syncState=%s, entryUuid=%s, cookie=%s]", getClass().getName(), hashCode(), getCriticality(), syncState, entryUuid, LdapUtils.base64Encode(cookie)); }