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


Java CursorException类代码示例

本文整理汇总了Java中org.apache.directory.api.ldap.model.cursor.CursorException的典型用法代码示例。如果您正苦于以下问题:Java CursorException类的具体用法?Java CursorException怎么用?Java CursorException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CursorException类属于org.apache.directory.api.ldap.model.cursor包,在下文中一共展示了CursorException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isMemberOfAllowedGroups

import org.apache.directory.api.ldap.model.cursor.CursorException; //导入依赖的package包/类
private boolean isMemberOfAllowedGroups(LdapConnection connection,
		String username) throws CursorException, LdapException {
	if (ldapAllowedGroups.size() == 0) {
		return true;
	}
	for (String group : ldapAllowedGroups) {
		Entry result = connection.lookup("cn=" + group + ","
				+ ldapGroupSearchBase);

		if (result == null) {
			return false;
		}

		Attribute members = result.get("memberuid");

		if (members == null) {
			return false;
		}

		return members.contains(username);
	}

	return false;
}
 
开发者ID:Codefor,项目名称:azkaban-ldap-usermanager,代码行数:25,代码来源:LdapUserManager.java

示例2: addLdapGroup

import org.apache.directory.api.ldap.model.cursor.CursorException; //导入依赖的package包/类
protected Entry addLdapGroup(String cn, String description, String... memberDns) throws LdapException, IOException, CursorException {
	LdapNetworkConnection connection = ldapConnect();
	Entry entry = createGroupEntry(cn, description, memberDns);
	LOGGER.trace("Adding LDAP entry:\n{}", entry);
	connection.add(entry);
	display("Added LDAP group:"+entry);
	ldapDisconnect(connection);
	return entry;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:10,代码来源:AbstractLdapTest.java

示例3: searchNode

import org.apache.directory.api.ldap.model.cursor.CursorException; //导入依赖的package包/类
/**
 * This method will search the directory and return at most one record.  If more than one record is found
 * an ldap exception will be thrown.
 *
 * @param connection is LdapConnection object used for all communication with host.
 * @param baseDn     contains address of distinguished name to begin ldap search
 * @param scope      indicates depth of search starting at basedn.  0 (base dn),
 *                   1 (one level down) or 2 (infinite) are valid values.
 * @param filter     contains the search criteria
 * @param attrs      is the requested list of attritubutes to return from directory search.
 * @param attrsOnly  if true pull back attribute names only.
 * @return entry   containing target ldap node.
 * @throws LdapException   thrown in the event of error in ldap client or server code.
 * @throws CursorException If we weren't able to fetch an element from the search result
 */
protected Entry searchNode( LdapConnection connection, String baseDn, SearchScope scope, String filter,
    String[] attrs, boolean attrsOnly ) throws LdapException, CursorException
{
    SearchRequest searchRequest = new SearchRequestImpl();

    searchRequest.setBase( new Dn( baseDn ) );
    searchRequest.setFilter( filter );
    searchRequest.setScope( scope );
    searchRequest.setTypesOnly( attrsOnly );
    searchRequest.addAttributes( attrs );

    SearchCursor result = connection.search( searchRequest );

    Entry entry = result.getEntry();

    if ( result.next() )
    {
        throw new LdapException( "searchNode failed to return unique record for LDAP search of base DN [" +
            baseDn + "] filter [" + filter + "]" );
    }

    return entry;
}
 
开发者ID:apache,项目名称:directory-fortress-core,代码行数:39,代码来源:LdapDataProvider.java

示例4: getUserRoles

import org.apache.directory.api.ldap.model.cursor.CursorException; //导入依赖的package包/类
@Override
public Set<String> getUserRoles(String userId) throws UserException {
    Set<String> roles = new HashSet<String>();
    try {
        String filter = "(" + config.getGroupFilter().replace("{0}", userDn(userId)) + ")";
        EntryCursor cursor = connection.search(config.getGroupSearchBase(), filter, 
                SearchScope.SUBTREE);

        while(cursor.next()) {
            Entry entry = cursor.get();
            roles.add(entry.get("cn").getString());
        }
    } catch (LdapException | CursorException e) {
        throw new UserException(e);
    }
    return roles;
}
 
开发者ID:Comcast,项目名称:dawg,代码行数:18,代码来源:LdapUserService.java

示例5: getChildList

import org.apache.directory.api.ldap.model.cursor.CursorException; //导入依赖的package包/类
/**
 * Get child list
 *
 * @param entryDN The distinguished name of an Entry in the LDAP
 * @param connection An initialized LDAP-Context
 * @return All child's of an Entry
 * @throws IOException
 * @throws CursorException
 * @throws LdapException
 */
private List<String> getChildList(String entryDN, LdapConnection connection) throws CursorException, IOException, LdapException {
    List<String> childs = new ArrayList<String>();

    EntryCursor cursor = connection.search("ou=system", "(objectclass=*)", SearchScope.ONELEVEL);
    while (cursor.next()) {
        Entry entry = cursor.get();
        childs.add(entry.get("distinguishedName").getString());
    }

    //SearchResultDone done = cursor.getSearchResultDone();
    //ResultCodeEnum resultCode = done.getLdapResult().getResultCode();
    cursor.close();
    // ResultCodeEnum.SUCCESS == resultCode
    return childs;
}
 
开发者ID:apache,项目名称:marmotta,代码行数:26,代码来源:LdapFoafProvider.java

示例6: getAccountData

import org.apache.directory.api.ldap.model.cursor.CursorException; //导入依赖的package包/类
/**
 * Get account data
 *
 * @param accountDN The distinguished Name of the Account (e.g
 *            "cn=Daniel  Trabe,ou=USERS,ou=SRFG,dc=salzburgresearch,dc=at")
 * @param connection An initialized LDAP-Context
 * @return a Map of Attributes and Values of an Account
 * @throws DataRetrievalException
 * @throws IOException
 * @throws CursorException
 * @throws LdapException
 */
private Map<String, List<String>> getAccountData(String accountDN, LdapConnection connection) throws DataRetrievalException, LdapException, CursorException, IOException {
    Map<String, List<String>> account = new HashMap<String, List<String>>();
    Dn dn = new Dn(accountDN);
    EntryCursor cursor = connection.search(dn, accountDN, SearchScope.ONELEVEL, (String[])null);
    if (cursor.next()) {
        //FIXME: only the first entry?
        Entry entry = cursor.get();
        for (Attribute attr : entry.getAttributes()) {
            String id = attr.getId();
            List<String> values;
            if (account.containsKey(id)) {
                values = account.get(id);
            } else {
                values = new ArrayList<String>();
            }
            values.add(attr.get().getValue().toString());
            account.put(id, values);
        }
    }
    return account;
}
 
开发者ID:apache,项目名称:marmotta,代码行数:34,代码来源:LdapFoafProvider.java

示例7: get

import org.apache.directory.api.ldap.model.cursor.CursorException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Entry get() throws CursorException
{
    if ( !searchCursor.available() )
    {
        throw new InvalidCursorPositionException();
    }

    try
    {
        do
        {
            if ( response instanceof SearchResultEntry )
            {
                return ( ( SearchResultEntry ) response ).getEntry();
            }

            if ( response instanceof SearchResultReference )
            {
                throw new LdapReferralException( ( ( SearchResultReference ) response ).getReferral().getLdapUrls() );
            }
        }
        while ( next() && !( response instanceof SearchResultDone ) );
    }
    catch ( LdapReferralException lre )
    {
        throw new CursorLdapReferralException( lre );
    }
    catch ( Exception e )
    {
        throw new CursorException( e );
    }

    return null;
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:39,代码来源:EntryCursorImpl.java

示例8: after

import org.apache.directory.api.ldap.model.cursor.CursorException; //导入依赖的package包/类
/**
 * This operation is not supported in SearchCursor.
 * {@inheritDoc}
 */
@Override
public void after( Entry element ) throws LdapException, CursorException
{
    throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
        .concat( "." ).concat( "after( Response element )" ) ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:11,代码来源:EntryCursorImpl.java

示例9: afterLast

import org.apache.directory.api.ldap.model.cursor.CursorException; //导入依赖的package包/类
/**
 * This operation is not supported in SearchCursor.
 * {@inheritDoc}
 */
@Override
public void afterLast() throws LdapException, CursorException
{
    throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
        .concat( "." ).concat( "afterLast()" ) ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:11,代码来源:EntryCursorImpl.java

示例10: before

import org.apache.directory.api.ldap.model.cursor.CursorException; //导入依赖的package包/类
/**
 * This operation is not supported in SearchCursor.
 * {@inheritDoc}
 */
@Override
public void before( Entry element ) throws LdapException, CursorException
{
    throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
        .concat( "." ).concat( "before( Response element )" ) ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:11,代码来源:EntryCursorImpl.java

示例11: beforeFirst

import org.apache.directory.api.ldap.model.cursor.CursorException; //导入依赖的package包/类
/**
 * This operation is not supported in SearchCursor.
 * {@inheritDoc}
 */
@Override
public void beforeFirst() throws LdapException, CursorException
{
    throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
        .concat( "." ).concat( "beforeFirst()" ) ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:11,代码来源:EntryCursorImpl.java

示例12: first

import org.apache.directory.api.ldap.model.cursor.CursorException; //导入依赖的package包/类
/**
 * This operation is not supported in SearchCursor.
 * {@inheritDoc}
 */
@Override
public boolean first() throws LdapException, CursorException
{
    throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
        .concat( "." ).concat( "first()" ) ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:11,代码来源:EntryCursorImpl.java

示例13: last

import org.apache.directory.api.ldap.model.cursor.CursorException; //导入依赖的package包/类
/**
 * This operation is not supported in SearchCursor.
 * {@inheritDoc}
 */
@Override
public boolean last() throws LdapException, CursorException
{
    throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
        .concat( "." ).concat( "last()" ) ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:11,代码来源:EntryCursorImpl.java

示例14: previous

import org.apache.directory.api.ldap.model.cursor.CursorException; //导入依赖的package包/类
/**
 * This operation is not supported in SearchCursor.
 * {@inheritDoc}
 */
@Override
public boolean previous() throws LdapException, CursorException
{
    throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
        .concat( "." ).concat( "previous()" ) ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:11,代码来源:EntryCursorImpl.java

示例15: after

import org.apache.directory.api.ldap.model.cursor.CursorException; //导入依赖的package包/类
/**
 * This operation is not supported in SearchCursor.
 * {@inheritDoc}
 */
@Override
public void after( Response element ) throws LdapException, CursorException
{
    throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
        .concat( "." ).concat( "after( Response element )" ) ) );
}
 
开发者ID:apache,项目名称:directory-ldap-api,代码行数:11,代码来源:SearchCursorImpl.java


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