use of com.unboundid.util.Nullable in project ldapsdk by pingidentity.
the class PasswordPolicyStateExtendedResult method encodeValue.
/**
* Encodes the provided information into a suitable value for this control.
*
* @param userDN The user DN from the response.
* @param operations The set of operations from the response, mapped
* from operation type to the corresponding
* operation data.
*
* @return An ASN.1 octet string containing the appropriately-encoded value
* for this control, or {@code null} if there should not be a value.
*/
@Nullable()
private static ASN1OctetString encodeValue(@Nullable final String userDN, @Nullable final PasswordPolicyStateOperation[] operations) {
if ((userDN == null) && ((operations == null) || (operations.length == 0))) {
return null;
}
final ArrayList<ASN1Element> elements = new ArrayList<>(2);
elements.add(new ASN1OctetString(userDN));
if ((operations != null) && (operations.length > 0)) {
final ASN1Element[] opElements = new ASN1Element[operations.length];
for (int i = 0; i < operations.length; i++) {
opElements[i] = operations[i].encode();
}
elements.add(new ASN1Sequence(opElements));
}
return new ASN1OctetString(new ASN1Sequence(elements).encode());
}
use of com.unboundid.util.Nullable in project ldapsdk by pingidentity.
the class MonitorManager method getStackTraceMonitorEntry.
/**
* Retrieves the stack trace monitor entry from the Directory Server.
*
* @param connection The connection to use to communicate with the Directory
* Server.
*
* @return The stack trace monitor entry from the Directory Server, or
* {@code null} if it is not available.
*
* @throws LDAPSearchException If a problem occurs while communicating with
* the Directory Server.
*/
@Nullable()
public static StackTraceMonitorEntry getStackTraceMonitorEntry(@NotNull final LDAPInterface connection) throws LDAPSearchException {
final Filter filter = Filter.createEqualityFilter("objectClass", StackTraceMonitorEntry.STACK_TRACE_MONITOR_OC);
final SearchResult searchResult = connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, filter);
final int numEntries = searchResult.getEntryCount();
if (numEntries == 0) {
Debug.debug(Level.FINE, DebugType.MONITOR, "No entries returned in getStackTraceMonitorEntry");
return null;
} else if (numEntries != 1) {
Debug.debug(Level.FINE, DebugType.MONITOR, "Multiple entries returned in getStackTraceMonitorEntry");
}
return new StackTraceMonitorEntry(searchResult.getSearchEntries().get(0));
}
use of com.unboundid.util.Nullable in project ldapsdk by pingidentity.
the class MonitorManager method getResultCodeMonitorEntry.
/**
* Retrieves the result code monitor entry from the Directory Server.
*
* @param connection The connection to use to communicate with the Directory
* Server.
*
* @return The result code monitor entry from the Directory Server, or
* {@code null} if it is not available.
*
* @throws LDAPSearchException If a problem occurs while communicating with
* the Directory Server.
*/
@Nullable()
public static ResultCodeMonitorEntry getResultCodeMonitorEntry(@NotNull final LDAPInterface connection) throws LDAPSearchException {
final Filter filter = Filter.createEqualityFilter("objectClass", ResultCodeMonitorEntry.RESULT_CODE_MONITOR_OC);
final SearchResult searchResult = connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, filter);
final int numEntries = searchResult.getEntryCount();
if (numEntries == 0) {
Debug.debug(Level.FINE, DebugType.MONITOR, "No entries returned in getResultCodeMonitorEntry");
return null;
} else if (numEntries != 1) {
Debug.debug(Level.FINE, DebugType.MONITOR, "Multiple entries returned in getResultCodeMonitorEntry");
}
return new ResultCodeMonitorEntry(searchResult.getSearchEntries().get(0));
}
use of com.unboundid.util.Nullable in project ldapsdk by pingidentity.
the class MonitorManager method getVersionMonitorEntry.
/**
* Retrieves the version monitor entry from the Directory Server.
*
* @param connection The connection to use to communicate with the Directory
* Server.
*
* @return The version monitor entry from the Directory Server, or
* {@code null} if it is not available.
*
* @throws LDAPSearchException If a problem occurs while communicating with
* the Directory Server.
*/
@Nullable()
public static VersionMonitorEntry getVersionMonitorEntry(@NotNull final LDAPInterface connection) throws LDAPSearchException {
final Filter filter = Filter.createEqualityFilter("objectClass", VersionMonitorEntry.VERSION_MONITOR_OC);
final SearchResult searchResult = connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, filter);
final int numEntries = searchResult.getEntryCount();
if (numEntries == 0) {
Debug.debug(Level.FINE, DebugType.MONITOR, "No entries returned in getVersionMonitorEntry");
return null;
} else if (numEntries != 1) {
Debug.debug(Level.FINE, DebugType.MONITOR, "Multiple entries returned in getVersionMonitorEntry");
}
return new VersionMonitorEntry(searchResult.getSearchEntries().get(0));
}
use of com.unboundid.util.Nullable in project ldapsdk by pingidentity.
the class MonitorManager method getTraditionalWorkQueueMonitorEntry.
/**
* Retrieves the traditional work queue monitor entry from the Directory
* Server.
*
* @param connection The connection to use to communicate with the Directory
* Server.
*
* @return The traditional work queue monitor entry from the Directory
* Server, or {@code null} if it is not available.
*
* @throws LDAPSearchException If a problem occurs while communicating with
* the Directory Server.
*/
@Nullable()
public static TraditionalWorkQueueMonitorEntry getTraditionalWorkQueueMonitorEntry(@NotNull final LDAPInterface connection) throws LDAPSearchException {
final Filter filter = Filter.createEqualityFilter("objectClass", TraditionalWorkQueueMonitorEntry.TRADITIONAL_WORK_QUEUE_MONITOR_OC);
final SearchResult searchResult = connection.search(MonitorEntry.MONITOR_BASE_DN, SearchScope.SUB, filter);
final int numEntries = searchResult.getEntryCount();
if (numEntries == 0) {
Debug.debug(Level.FINE, DebugType.MONITOR, "No entries returned in getTraditionalWorkQueueMonitorEntry");
return null;
} else if (numEntries != 1) {
Debug.debug(Level.FINE, DebugType.MONITOR, "Multiple entries returned in getTraditionalWorkQueueMonitorEntry");
}
return new TraditionalWorkQueueMonitorEntry(searchResult.getSearchEntries().get(0));
}
Aggregations