use of com.unboundid.util.json.JSONBuffer in project ldapsdk by pingidentity.
the class JSONAccessLogRequestHandler method processModifyRequest.
/**
* {@inheritDoc}
*/
@Override()
@NotNull()
public LDAPMessage processModifyRequest(final int messageID, @NotNull final ModifyRequestProtocolOp request, @NotNull final List<Control> controls) {
final long opID = nextOperationID.getAndIncrement();
final JSONBuffer buffer = getRequestHeader("modify", opID, messageID);
buffer.appendString("dn", request.getDN());
buffer.endObject();
logHandler.publish(new LogRecord(Level.INFO, buffer.toString()));
logHandler.flush();
final long startTimeNanos = System.nanoTime();
final LDAPMessage responseMessage = requestHandler.processModifyRequest(messageID, request, controls);
final long eTimeNanos = System.nanoTime() - startTimeNanos;
final ModifyResponseProtocolOp protocolOp = responseMessage.getModifyResponseProtocolOp();
generateResponse(buffer, "modify", opID, messageID, protocolOp.getResultCode(), protocolOp.getDiagnosticMessage(), protocolOp.getMatchedDN(), protocolOp.getReferralURLs(), eTimeNanos);
buffer.endObject();
logHandler.publish(new LogRecord(Level.INFO, buffer.toString()));
logHandler.flush();
return responseMessage;
}
use of com.unboundid.util.json.JSONBuffer in project ldapsdk by pingidentity.
the class JSONAccessLogRequestHandler method processModifyDNRequest.
/**
* {@inheritDoc}
*/
@Override()
@NotNull()
public LDAPMessage processModifyDNRequest(final int messageID, @NotNull final ModifyDNRequestProtocolOp request, @NotNull final List<Control> controls) {
final long opID = nextOperationID.getAndIncrement();
final JSONBuffer buffer = getRequestHeader("modify-dn", opID, messageID);
buffer.appendString("dn", request.getDN());
buffer.appendString("new-rdn", request.getNewRDN());
buffer.appendBoolean("delete-old-rdn", request.deleteOldRDN());
final String newSuperior = request.getNewSuperiorDN();
if (newSuperior != null) {
buffer.appendString("new-superior", newSuperior);
}
buffer.endObject();
logHandler.publish(new LogRecord(Level.INFO, buffer.toString()));
logHandler.flush();
final long startTimeNanos = System.nanoTime();
final LDAPMessage responseMessage = requestHandler.processModifyDNRequest(messageID, request, controls);
final long eTimeNanos = System.nanoTime() - startTimeNanos;
final ModifyDNResponseProtocolOp protocolOp = responseMessage.getModifyDNResponseProtocolOp();
generateResponse(buffer, "modify-dn", opID, messageID, protocolOp.getResultCode(), protocolOp.getDiagnosticMessage(), protocolOp.getMatchedDN(), protocolOp.getReferralURLs(), eTimeNanos);
buffer.endObject();
logHandler.publish(new LogRecord(Level.INFO, buffer.toString()));
logHandler.flush();
return responseMessage;
}
use of com.unboundid.util.json.JSONBuffer in project ldapsdk by pingidentity.
the class JSONAccessLogRequestHandler method processUnbindRequest.
/**
* {@inheritDoc}
*/
@Override()
public void processUnbindRequest(final int messageID, @NotNull final UnbindRequestProtocolOp request, @NotNull final List<Control> controls) {
final JSONBuffer buffer = getRequestHeader("unbind", nextOperationID.getAndIncrement(), messageID);
buffer.endObject();
logHandler.publish(new LogRecord(Level.INFO, buffer.toString()));
logHandler.flush();
requestHandler.processUnbindRequest(messageID, request, controls);
}
use of com.unboundid.util.json.JSONBuffer in project ldapsdk by pingidentity.
the class JSONAccessLogRequestHandler method processCompareRequest.
/**
* {@inheritDoc}
*/
@Override()
@NotNull()
public LDAPMessage processCompareRequest(final int messageID, @NotNull final CompareRequestProtocolOp request, @NotNull final List<Control> controls) {
final long opID = nextOperationID.getAndIncrement();
final JSONBuffer buffer = getRequestHeader("compare", opID, messageID);
buffer.appendString("dn", request.getDN());
buffer.appendString("attribute-type", request.getAttributeName());
buffer.endObject();
logHandler.publish(new LogRecord(Level.INFO, buffer.toString()));
logHandler.flush();
final long startTimeNanos = System.nanoTime();
final LDAPMessage responseMessage = requestHandler.processCompareRequest(messageID, request, controls);
final long eTimeNanos = System.nanoTime() - startTimeNanos;
final CompareResponseProtocolOp protocolOp = responseMessage.getCompareResponseProtocolOp();
generateResponse(buffer, "compare", opID, messageID, protocolOp.getResultCode(), protocolOp.getDiagnosticMessage(), protocolOp.getMatchedDN(), protocolOp.getReferralURLs(), eTimeNanos);
buffer.endObject();
logHandler.publish(new LogRecord(Level.INFO, buffer.toString()));
logHandler.flush();
return responseMessage;
}
use of com.unboundid.util.json.JSONBuffer in project ldapsdk by pingidentity.
the class JSONAccessLogRequestHandler method closeInstance.
/**
* {@inheritDoc}
*/
@Override()
public void closeInstance() {
final JSONBuffer buffer = getConnectionHeader("disconnect");
buffer.endObject();
logHandler.publish(new LogRecord(Level.INFO, buffer.toString()));
logHandler.flush();
requestHandler.closeInstance();
}
Aggregations