/** * Indicates whether the specified entry exists in the server. * * @param conn The connection to use to communicate with the directory * server. * @param dn The DN of the entry for which to make the determination. * * @return {@code true} if the entry exists, or {@code false} if not. * * @throws LDAPException If a problem is encountered while trying to * communicate with the directory server. */ public static boolean entryExists(final LDAPInterface conn, final String dn) throws LDAPException { return (conn.getEntry(dn, "1.1") != null); }
/** * Retrieves a list containing the DNs of the entries which are missing from * the directory server. * * @param conn The connection to use to communicate with the directory * server. * @param dns The DNs of the entries to try to find in the server. * * @return A list containing all of the provided DNs that were not found in * the server, or an empty list if all entries were found. * * @throws LDAPException If a problem is encountered while trying to * communicate with the directory server. */ public static List<String> getMissingEntryDNs(final LDAPInterface conn, final Collection<String> dns) throws LDAPException { final List<String> missingDNs = new ArrayList<String>(dns.size()); for (final String dn : dns) { if (conn.getEntry(dn, "1.1") == null) { missingDNs.add(dn); } } return missingDNs; }
/** * Ensures that the specified entry does not exist in the directory. * * @param conn The connection to use to communicate with the directory * server. * @param dn The DN of the entry expected to be missing. * * @throws LDAPException If a problem is encountered while trying to * communicate with the directory server. * * @throws AssertionError If the target entry is found in the server. */ public static void assertEntryMissing(final LDAPInterface conn, final String dn) throws LDAPException, AssertionError { if (conn.getEntry(dn, "1.1") != null) { throw new AssertionError(ERR_TEST_ENTRY_EXISTS.get(dn)); } }
/** * Retrieves the directory server root DSE using the provided connection. * * @param connection The connection to use to retrieve the server root DSE. * * @return The directory server root DSE, or {@code null} if it is not * available (e.g., the client does not have permission to read the * entry). * * @throws LDAPException If a problem occurs while attempting to retrieve * the server root DSE. */ public static RootDSE getRootDSE(final LDAPInterface connection) throws LDAPException { final Entry rootDSEEntry = connection.getEntry("", REQUEST_ATTRS); if (rootDSEEntry == null) { return null; } return new RootDSE(rootDSEEntry); }
/** * Retrieves the directory server root DSE using the provided connection. * * @param connection The connection to use to retrieve the server root DSE. * * @return The directory server root DSE, or {@code null} if it is not * available (e.g., the client does not have permission to read the * entry). * * @throws LDAPException If a problem occurs while attempting to retrieve * the server root DSE. */ public static RootDSE getRootDSE(final LDAPInterface connection) throws LDAPException { final Entry rootDSEEntry = connection.getEntry("", REQUEST_ATTRS); if (rootDSEEntry == null) { return null; } return new RootDSE(rootDSEEntry); }
/** * Retrieves the root DSE from an UnboundID server using the provided * connection. * * @param connection The connection to use to retrieve the server root DSE. * * @return The UnboundID server root DSE, or {@code null} if it is not * available (e.g., the client does not have permission to read the * entry). * * @throws LDAPException If a problem occurs while attempting to retrieve * the server root DSE. */ public static UnboundIDRootDSE getRootDSE(final LDAPInterface connection) throws LDAPException { final Entry rootDSEEntry = connection.getEntry("", REQUEST_ATTRS); if (rootDSEEntry == null) { return null; } return new UnboundIDRootDSE(rootDSEEntry); }
/** * Ensures that an entry with the provided DN exists in the directory. * * @param conn The connection to use to communicate with the directory * server. * @param dn The DN of the entry for which to make the determination. * * @throws LDAPException If a problem is encountered while trying to * communicate with the directory server. * * @throws AssertionError If the target entry does not exist. */ public static void assertEntryExists(final LDAPInterface conn, final String dn) throws LDAPException, AssertionError { if (conn.getEntry(dn, "1.1") == null) { throw new AssertionError(ERR_TEST_ENTRY_MISSING.get(dn)); } }
entry = ldap.getEntry(testEntry.toString());
try final Entry e = connection.getEntry(dn, attributes); if (e == null)
try entry = i.getEntry(dn, handler.getAttributesToRequest()); if (entry == null)
final Entry entry = conn.getEntry(dn, attributeName); if ((entry != null) && entry.hasAttribute(attributeName))
try entry = i.getEntry(dn, handler.getAttributesToRequest()); if (entry == null)
final Entry e = conn.getEntry(dn.toString(), p.getObjectHandler().getAttributesToRequest()); if (e == null)
try entry = i.getEntry(handler.getEntryDN(o), attrs);