コード例 #1
0
 /** {@inheritDoc} */
 @Override
 public Control handleRequest(final org.ldaptive.control.RequestControl requestControl) {
   Control ctl = null;
   if (ManageDsaITControl.OID.equals(requestControl.getOID())) {
     ctl = new ManageDsaITImpl(requestControl.getCriticality());
   } else if (PagedResultsControl.OID.equals(requestControl.getOID())) {
     final PagedResultsControl c = (PagedResultsControl) requestControl;
     ctl = new PagedResultsImpl();
     ((PagedResultsImpl) ctl).setSize(c.getSize());
     ((PagedResultsImpl) ctl).setCookie(c.getCookie());
     ctl.setCritical(c.getCriticality());
   } else if (PasswordPolicyControl.OID.equals(requestControl.getOID())) {
     final PasswordPolicyControl c = (PasswordPolicyControl) requestControl;
     ctl = new PasswordPolicyImpl();
     ctl.setCritical(c.getCriticality());
   } else if (SyncRequestControl.OID.equals(requestControl.getOID())) {
     final SyncRequestControl c = (SyncRequestControl) requestControl;
     ctl = new SyncRequestValueImpl();
     ((SyncRequestValueImpl) ctl).setCookie(c.getCookie());
     ((SyncRequestValueImpl) ctl).setReloadHint(c.getReloadHint());
     ((SyncRequestValueImpl) ctl)
         .setMode(SynchronizationModeEnum.getSyncMode(c.getRequestMode().value()));
     ctl.setCritical(c.getCriticality());
   }
   return ctl;
 }
コード例 #2
0
  /** {@inheritDoc} */
  @Override
  public org.ldaptive.control.ResponseControl handleResponse(final Control responseControl) {
    org.ldaptive.control.ResponseControl ctl = null;
    if (PagedResultsControl.OID.equals(responseControl.getOid())) {
      final PagedResults c = (PagedResults) responseControl;
      ctl = new PagedResultsControl(c.getSize(), c.getCookie(), c.isCritical());
    } else if (PasswordPolicyControl.OID.equals(responseControl.getOid())) {
      final PasswordPolicy c = (PasswordPolicy) responseControl;
      if (c.hasResponse()) {
        ctl = new PasswordPolicyControl(c.isCritical());

        final PasswordPolicyResponse ppr = c.getResponse();
        ((PasswordPolicyControl) ctl).setTimeBeforeExpiration(ppr.getTimeBeforeExpiration());
        ((PasswordPolicyControl) ctl).setGraceAuthNsRemaining(ppr.getGraceAuthNRemaining());

        final PasswordPolicyErrorEnum error = ppr.getPasswordPolicyError();
        if (error != null) {
          ((PasswordPolicyControl) ctl)
              .setError(PasswordPolicyControl.Error.valueOf(error.getValue()));
        }
      }
    } else if (SyncStateControl.OID.equals(responseControl.getOid())) {
      final SyncStateValue c = (SyncStateValue) responseControl;
      ctl =
          new SyncStateControl(
              SyncStateControl.State.valueOf(c.getSyncStateType().getValue()),
              UuidType.decode(ByteBuffer.wrap(c.getEntryUUID())),
              c.getCookie(),
              c.isCritical());
    } else if (SyncDoneControl.OID.equals(responseControl.getOid())) {
      final SyncDoneValue c = (SyncDoneValue) responseControl;
      ctl = new SyncDoneControl(c.getCookie(), c.isRefreshDeletes(), c.isCritical());
    }
    return ctl;
  }
コード例 #3
0
 /** {@inheritDoc} */
 @Override
 public String getOID(final Control control) {
   return control.getOid();
 }