コード例 #1
0
 /** {@inheritDoc} */
 @Override
 public Response<Void> delete(final DeleteRequest request) throws LdapException {
   Response<Void> response = null;
   try {
     final LDAPResponseQueue queue =
         connection.delete(request.getDn(), (LDAPResponseQueue) null, getLDAPConstraints(request));
     final LDAPResponse lr = (LDAPResponse) queue.getResponse();
     response = createResponse(request, null, lr);
   } catch (LDAPException e) {
     processLDAPException(e);
   }
   return response;
 }
コード例 #2
0
 /** {@inheritDoc} */
 @Override
 public Response<Void> add(final AddRequest request) throws LdapException {
   Response<Void> response = null;
   try {
     final JLdapUtils bu = new JLdapUtils();
     final LDAPResponseQueue queue =
         connection.add(
             new LDAPEntry(request.getDn(), bu.fromLdapAttributes(request.getLdapAttributes())),
             (LDAPResponseQueue) null,
             getLDAPConstraints(request));
     final LDAPResponse lr = (LDAPResponse) queue.getResponse();
     response = createResponse(request, null, lr);
   } catch (LDAPException e) {
     processLDAPException(e);
   }
   return response;
 }
コード例 #3
0
 /**
  * Performs a simple bind.
  *
  * @param request to bind with
  * @return bind response
  * @throws LdapException if an error occurs
  */
 protected Response<Void> simpleBind(final BindRequest request) throws LdapException {
   Response<Void> response = null;
   try {
     final LDAPResponseQueue queue =
         connection.bind(
             LDAPConnection.LDAP_V3,
             request.getDn(),
             request.getCredential().getBytes(),
             (LDAPResponseQueue) null,
             getLDAPConstraints(request));
     final LDAPResponse lr = (LDAPResponse) queue.getResponse();
     response = createResponse(request, null, lr);
   } catch (LDAPException e) {
     processLDAPException(e);
   }
   return response;
 }
コード例 #4
0
 /**
  * Performs an anonymous bind.
  *
  * @param request to bind with
  * @return bind response
  * @throws LdapException if an error occurs
  */
 protected Response<Void> anonymousBind(final BindRequest request) throws LdapException {
   Response<Void> response = null;
   try {
     final LDAPResponseQueue queue =
         connection.bind(
             LDAPConnection.LDAP_V3,
             (String) null,
             (byte[]) null,
             (LDAPResponseQueue) null,
             getLDAPConstraints(request));
     final LDAPResponse lr = (LDAPResponse) queue.getResponse();
     response = createResponse(request, null, lr);
   } catch (LDAPException e) {
     processLDAPException(e);
   }
   return response;
 }
コード例 #5
0
 /** {@inheritDoc} */
 @Override
 public Response<Boolean> compare(final CompareRequest request) throws LdapException {
   Response<Boolean> response = null;
   try {
     final JLdapUtils bu = new JLdapUtils();
     final LDAPResponseQueue queue =
         connection.compare(
             request.getDn(),
             bu.fromLdapAttribute(request.getAttribute()),
             (LDAPResponseQueue) null,
             getLDAPConstraints(request));
     final LDAPResponse lr = (LDAPResponse) queue.getResponse();
     response = createResponse(request, lr.getResultCode() == ResultCode.COMPARE_TRUE.value(), lr);
   } catch (LDAPException e) {
     processLDAPException(e);
   }
   return response;
 }
コード例 #6
0
 /** {@inheritDoc} */
 @Override
 public Response<Void> modifyDn(final ModifyDnRequest request) throws LdapException {
   Response<Void> response = null;
   try {
     final String[] dn = request.getNewDn().split(",", 2);
     final LDAPResponseQueue queue =
         connection.rename(
             request.getDn(),
             dn[0],
             dn[1],
             request.getDeleteOldRDn(),
             (LDAPResponseQueue) null,
             getLDAPConstraints(request));
     final LDAPResponse lr = (LDAPResponse) queue.getResponse();
     response = createResponse(request, null, lr);
   } catch (LDAPException e) {
     processLDAPException(e);
   }
   return response;
 }
コード例 #7
0
  /**
   * Sends the LDAPExtendedRequest to the ldap server using the specified, connection and registers
   * the listener with the parent polling thread.
   *
   * @param conn LDAPConnection for sending LDAPOperation.
   * @param requestoperation LDAPExtendedOperation to be send as LDAPExtendedRequest.
   * @param alistener The LDAPListener to be registered.
   * @throws LDAPException When the underlying operations on connection fails.
   */
  private void sendExtendedRequest(
      final LDAPConnection conn,
      final LDAPExtendedOperation requestoperation,
      final LDAPEventListener alistener)
      throws LDAPException {
    LDAPResponseQueue queue = conn.extendedOperation(requestoperation, null, null);
    EdirEventsGenerator eventgenerator = null;
    int[] ids = queue.getMessageIDs();

    if (ids.length == 1) {
      eventgenerator = new EdirEventsGenerator(alistener);

      super.pollforevents(queue, conn, eventgenerator, ids[0], this);
    } else {
      /// CLOVER:OFF
      throw new LDAPException(null, LDAPException.LOCAL_ERROR, "Unable to Obtain Message Id");

      /// CLOVER:ON
    }
  }