public NamingEnumeration<SearchResult> search(String dn, String filter, String... attrs) throws NamingException { SearchControls ctls = new SearchControls(); ctls.setSearchScope(SearchControls.ONELEVEL_SCOPE); ctls.setReturningObjFlag(false); ctls.setReturningAttributes(attrs); return ctx.search(dn, filter, ctls); }
public NamingEnumeration<SearchResult> search(String dn, String filter, String... attrs) throws NamingException { SearchControls ctls = new SearchControls(); ctls.setSearchScope(SearchControls.ONELEVEL_SCOPE); ctls.setReturningObjFlag(false); ctls.setReturningAttributes(attrs); return ctx.search(dn, filter, ctls); }
public NamingEnumeration<SearchResult> search(String deviceName, String[] attrsArray, String filter) throws NamingException { return deviceName != null ? search(deviceRef(deviceName), filter, attrsArray) : ctx.search(devicesDN, filter, searchControlSubtreeScope(0, attrsArray, true)); }
public NamingEnumeration<SearchResult> search(String deviceName, String[] attrsArray, String filter) throws NamingException { return deviceName != null ? search(deviceRef(deviceName), filter, attrsArray) : ctx.search(devicesDN, filter, searchControlSubtreeScope(0, attrsArray, true)); }
private boolean findConfiguration() throws ConfigurationException { NamingEnumeration<SearchResult> ne = null; try { SearchControls ctls = searchControlSubtreeScope(1, StringUtils.EMPTY_STRING, false); ne = ctx.search( baseDN, "(&(objectclass=" + configurationRoot + ")(cn=" + configurationCN + "))", ctls); if (!ne.hasMore()) return false; setConfigurationDN(ne.next().getName() + "," + baseDN); return true; } catch (NamingException e) { throw new ConfigurationException(e); } finally { LdapUtils.safeClose(ne); } }
private boolean findConfiguration() throws ConfigurationException { NamingEnumeration<SearchResult> ne = null; try { SearchControls ctls = searchControlSubtreeScope(1, StringUtils.EMPTY_STRING, false); ne = ctx.search( baseDN, "(&(objectclass=" + configurationRoot + ")(cn=" + configurationCN + "))", ctls); if (!ne.hasMore()) return false; setConfigurationDN(ne.next().getName() + "," + baseDN); return true; } catch (NamingException e) { throw new ConfigurationException(e); } finally { LdapUtils.safeClose(ne); } }
public synchronized Device findDevice(String filter, String childName) throws ConfigurationException { if (!configurationExists()) throw new ConfigurationNotFoundException(); SearchControls ctls = searchControlSubtreeScope(1, StringUtils.EMPTY_STRING, false); NamingEnumeration<SearchResult> ne = null; String childDN; try { ne = ctx.search(devicesDN, filter, ctls); if (!ne.hasMore()) throw new ConfigurationNotFoundException(childName); childDN = ne.next().getNameInNamespace(); } catch (NamingException e) { throw new ConfigurationException(e); } finally { LdapUtils.safeClose(ne); } String deviceDN = childDN.substring(childDN.indexOf(',') + 1); return loadDevice(deviceDN); }
public synchronized Device findDevice(String filter, String childName) throws ConfigurationException { if (!configurationExists()) throw new ConfigurationNotFoundException(); SearchControls ctls = searchControlSubtreeScope(1, StringUtils.EMPTY_STRING, false); NamingEnumeration<SearchResult> ne = null; String childDN; try { ne = ctx.search(devicesDN, filter, ctls); if (!ne.hasMore()) throw new ConfigurationNotFoundException(childName); childDN = ne.next().getNameInNamespace(); } catch (NamingException e) { throw new ConfigurationException(e); } finally { LdapUtils.safeClose(ne); } String deviceDN = childDN.substring(childDN.indexOf(',') + 1); return loadDevice(deviceDN); }