Search in sources :

Example 1 with JSONBuffer

use of com.unboundid.util.json.JSONBuffer in project ldapsdk by pingidentity.

the class JSONLDAPConnectionLogger method logModifyDNRequest.

/**
 * {@inheritDoc}
 */
@Override()
public void logModifyDNRequest(@NotNull final LDAPConnectionInfo connectionInfo, final int messageID, @NotNull final ReadOnlyModifyDNRequest modifyDNRequest) {
    if (logRequests && operationTypes.contains(OperationType.MODIFY_DN)) {
        final JSONBuffer buffer = startLogMessage("request", OperationType.MODIFY_DN, connectionInfo, messageID);
        appendDN(buffer, "dn", modifyDNRequest.getDN());
        appendDN(buffer, "new-rdn", modifyDNRequest.getNewRDN());
        buffer.appendBoolean("delete-old-rdn", modifyDNRequest.deleteOldRDN());
        final String newSuperiorDN = modifyDNRequest.getNewSuperiorDN();
        if (newSuperiorDN != null) {
            appendDN(buffer, "new-superior-dn", newSuperiorDN);
        }
        appendControls(buffer, "control-oids", modifyDNRequest.getControls());
        logMessage(buffer, flushAfterRequestMessages);
    }
}
Also used : JSONBuffer(com.unboundid.util.json.JSONBuffer)

Example 2 with JSONBuffer

use of com.unboundid.util.json.JSONBuffer in project ldapsdk by pingidentity.

the class JSONLDAPConnectionLogger method logExtendedRequest.

/**
 * {@inheritDoc}
 */
@Override()
public void logExtendedRequest(@NotNull final LDAPConnectionInfo connectionInfo, final int messageID, @NotNull final ExtendedRequest extendedRequest) {
    if (logRequests && operationTypes.contains(OperationType.EXTENDED)) {
        final JSONBuffer buffer = startLogMessage("request", OperationType.EXTENDED, connectionInfo, messageID);
        buffer.appendString("oid", extendedRequest.getOID());
        buffer.appendBoolean("has-value", (extendedRequest.getValue() != null));
        appendControls(buffer, "control-oids", extendedRequest.getControls());
        logMessage(buffer, flushAfterRequestMessages);
    }
}
Also used : JSONBuffer(com.unboundid.util.json.JSONBuffer)

Example 3 with JSONBuffer

use of com.unboundid.util.json.JSONBuffer in project ldapsdk by pingidentity.

the class JSONLDAPConnectionLogger method logDeleteRequest.

/**
 * {@inheritDoc}
 */
@Override()
public void logDeleteRequest(@NotNull final LDAPConnectionInfo connectionInfo, final int messageID, @NotNull final ReadOnlyDeleteRequest deleteRequest) {
    if (logRequests && operationTypes.contains(OperationType.DELETE)) {
        final JSONBuffer buffer = startLogMessage("request", OperationType.DELETE, connectionInfo, messageID);
        appendDN(buffer, "dn", deleteRequest.getDN());
        appendControls(buffer, "control-oids", deleteRequest.getControls());
        logMessage(buffer, flushAfterRequestMessages);
    }
}
Also used : JSONBuffer(com.unboundid.util.json.JSONBuffer)

Example 4 with JSONBuffer

use of com.unboundid.util.json.JSONBuffer in project ldapsdk by pingidentity.

the class JSONLDAPConnectionLogger method logSearchRequest.

/**
 * {@inheritDoc}
 */
@Override()
public void logSearchRequest(@NotNull final LDAPConnectionInfo connectionInfo, final int messageID, @NotNull final ReadOnlySearchRequest searchRequest) {
    if (logRequests && operationTypes.contains(OperationType.SEARCH)) {
        final JSONBuffer buffer = startLogMessage("request", OperationType.SEARCH, connectionInfo, messageID);
        appendDN(buffer, "base-dn", searchRequest.getBaseDN());
        buffer.appendString("scope", searchRequest.getScope().getName());
        buffer.appendString("dereference-policy", searchRequest.getDereferencePolicy().getName());
        buffer.appendNumber("size-limit", searchRequest.getSizeLimit());
        buffer.appendNumber("time-limit-seconds", searchRequest.getTimeLimitSeconds());
        buffer.appendBoolean("types-only", searchRequest.typesOnly());
        buffer.appendString("filter", redactFilter(searchRequest.getFilter()).toString());
        buffer.beginArray("requested-attributes");
        for (final String attributeName : searchRequest.getAttributeList()) {
            buffer.appendString(attributeName);
        }
        buffer.endArray();
        appendControls(buffer, "control-oids", searchRequest.getControls());
        logMessage(buffer, flushAfterRequestMessages);
    }
}
Also used : JSONBuffer(com.unboundid.util.json.JSONBuffer)

Example 5 with JSONBuffer

use of com.unboundid.util.json.JSONBuffer in project ldapsdk by pingidentity.

the class JSONLDAPConnectionLogger method logUnbindRequest.

/**
 * {@inheritDoc}
 */
@Override()
public void logUnbindRequest(@NotNull final LDAPConnectionInfo connectionInfo, final int messageID, @NotNull final List<Control> requestControls) {
    if (logRequests && operationTypes.contains(OperationType.UNBIND)) {
        final JSONBuffer buffer = startLogMessage("request", OperationType.UNBIND, connectionInfo, messageID);
        appendControls(buffer, "control-oids", requestControls);
        logMessage(buffer, flushAfterRequestMessages);
    }
}
Also used : JSONBuffer(com.unboundid.util.json.JSONBuffer)

Aggregations

JSONBuffer (com.unboundid.util.json.JSONBuffer)73 Test (org.testng.annotations.Test)20 NotNull (com.unboundid.util.NotNull)16 LogRecord (java.util.logging.LogRecord)12 LDAPMessage (com.unboundid.ldap.protocol.LDAPMessage)8 Date (java.util.Date)5 LDAPException (com.unboundid.ldap.sdk.LDAPException)3 LDAPRuntimeException (com.unboundid.ldap.sdk.LDAPRuntimeException)3 JSONException (com.unboundid.util.json.JSONException)3 DN (com.unboundid.ldap.sdk.DN)2 RDN (com.unboundid.ldap.sdk.RDN)2 JSONField (com.unboundid.util.json.JSONField)2 JSONObject (com.unboundid.util.json.JSONObject)2 JSONString (com.unboundid.util.json.JSONString)2 AddResponseProtocolOp (com.unboundid.ldap.protocol.AddResponseProtocolOp)1 BindResponseProtocolOp (com.unboundid.ldap.protocol.BindResponseProtocolOp)1 CompareResponseProtocolOp (com.unboundid.ldap.protocol.CompareResponseProtocolOp)1 DeleteResponseProtocolOp (com.unboundid.ldap.protocol.DeleteResponseProtocolOp)1 ExtendedResponseProtocolOp (com.unboundid.ldap.protocol.ExtendedResponseProtocolOp)1 ModifyDNResponseProtocolOp (com.unboundid.ldap.protocol.ModifyDNResponseProtocolOp)1