当前位置: 首页>>代码示例>>Java>>正文


Java LdapNetworkConnection.lookup方法代码示例

本文整理汇总了Java中org.apache.directory.ldap.client.api.LdapNetworkConnection.lookup方法的典型用法代码示例。如果您正苦于以下问题:Java LdapNetworkConnection.lookup方法的具体用法?Java LdapNetworkConnection.lookup怎么用?Java LdapNetworkConnection.lookup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.directory.ldap.client.api.LdapNetworkConnection的用法示例。


在下文中一共展示了LdapNetworkConnection.lookup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: rangeSearch

import org.apache.directory.ldap.client.api.LdapNetworkConnection; //导入方法依赖的package包/类
private Attribute rangeSearch(LdapNetworkConnection connection, Entry previousEntry, String attrName, int high) {
	Dn dn = previousEntry.getDn();
	String attributesToGet = attrName + ";range=" + (high + 1) + "-*";
	Entry entry = null;
	OperationLog.logOperationReq(connection, "Search REQ base={0}, filter={1}, scope={2}, attributes={3}", 
			dn, AbstractLdapConfiguration.SEARCH_FILTER_ALL, SearchScope.OBJECT, attributesToGet);
	try {
		entry = connection.lookup( dn, attributesToGet );
		
		if ( entry==null ) {
            OperationLog.logOperationErr(connection, "Entry not found for {0}", dn);
            throw LdapUtil.processLdapException( "Range search for "+dn+" with "+attributesToGet+" failed", 
                new LdapNoSuchObjectException("No entry found for " + dn));
		}
	} catch (LdapException e) {
		OperationLog.logOperationErr(connection, "Search ERR {0}: {1}", e.getClass().getName(), e.getMessage(), e);
		throw LdapUtil.processLdapException("Range search for "+dn+" with "+attributesToGet+" failed", e);
	}
	
	OperationLog.logOperationRes(connection, "Search RES {0}", entry);
	
	return entry.get(attrName);
}
 
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:24,代码来源:AdAttributeHandler.java

示例2: fetchEntry

import org.apache.directory.ldap.client.api.LdapNetworkConnection; //导入方法依赖的package包/类
/**
 * Fetch a single entry using its DN.
 * 
 * @param connection The LDAP connection to use
 * @param dn The entry's DN
 * @param ldapObjectClass The entry's ObjectClass
 * @param options The options to use 
 * @param schemaTranslator The Schema translator instance
 * @return The found entry, or null if none is found.
 */
public static Entry fetchEntry(LdapNetworkConnection connection, String dn, 
		org.apache.directory.api.ldap.model.schema.ObjectClass ldapObjectClass, 
		OperationOptions options, AbstractSchemaTranslator schemaTranslator) {
	String[] attributesToGet = getAttributesToGet(ldapObjectClass, options, schemaTranslator);
	Entry entry = null;
	LOG.ok("Search REQ base={0}, filter={1}, scope={2}, attributes={3}", 
			dn, AbstractLdapConfiguration.SEARCH_FILTER_ALL, SearchScope.OBJECT, attributesToGet);
	
	try {
	    entry = connection.lookup( dn, attributesToGet );
	} catch (LdapException e) {
		LOG.error("Search ERR {0}: {1}", e.getClass().getName(), e.getMessage(), e);
		throw processLdapException("Search for "+dn+" failed", e);
	}
	
	LOG.ok("Search RES {0}", entry);
	
	return entry;
}
 
开发者ID:Evolveum,项目名称:connector-ldap,代码行数:30,代码来源:LdapUtil.java


注:本文中的org.apache.directory.ldap.client.api.LdapNetworkConnection.lookup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。