• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java LimitExceededException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: appendSubStringValues

import javax.naming.LimitExceededException; //导入依赖的package包/类
/**
 * Appends a collection of sub-string attribute values to a list.
 * <br/>The sub-attributes are determined by attribute.getAll().
 * <br/>Only sub-attributes of type String will be appended.
 * @param attribute the attribute containing values to append (from)
 * @param values the list of values to populate (to)
 * @throws NamingException if an exception occurs
 */
protected void appendSubStringValues(Attribute attribute, StringSet values)
  throws NamingException {
  NamingEnumeration<?> enAttr = null;
  try {
    if (attribute != null) {
      enAttr = attribute.getAll();
      while (enAttr.hasMore()) {
        Object oAttr = enAttr.next();
        if (oAttr instanceof String) {
          values.add((String)oAttr);
        }
      }
    }
  } catch (PartialResultException pre) {
	 LogUtil.getLogger().finer(pre.toString());
  } catch (LimitExceededException lee) {
	 LogUtil.getLogger().finer(lee.toString());
  } finally {
    closeEnumeration(enAttr);
  }
}
 
开发者ID:GeoinformationSystems,项目名称:GeoprocessingAppstore,代码行数:30,代码来源:LdapQueryFunctions.java


示例2: readAttribute

import javax.naming.LimitExceededException; //导入依赖的package包/类
/**
 * Reads the attribute values associated with an attribute name.
 * @param dirContext the directory context
 * @param attrubuteName attribute name.
 * @param objectDN the distinguished name of the object
 * @return the list attribute values (strings only are returned)
 * @throws NamingException if an exception occurs
 */
protected StringSet readAttribute(DirContext dirContext,
                                  String objectDN, 
                                  String attrubuteName)
  throws NamingException {
	StringSet values = new StringSet();
	try{	  
	  if ((objectDN.length() > 0) && (attrubuteName.length() > 0)) {
	    String[] aReturn = new String[1];
	    aReturn[0] = attrubuteName;
	    try{
	    Attributes attributes = dirContext.getAttributes(objectDN,aReturn);
	    if (attributes != null) {
	      appendSubStringValues(attributes.get(attrubuteName),values);
	    }
	    }catch(NameNotFoundException nnfe){
	    	LogUtil.getLogger().finer(nnfe.toString());
	    }
	  }	  
    } catch (PartialResultException pre) {
      LogUtil.getLogger().finer(pre.toString());
    } catch (LimitExceededException lee) {
        LogUtil.getLogger().finer(lee.toString());
    }
	return values;
}
 
开发者ID:GeoinformationSystems,项目名称:GeoprocessingAppstore,代码行数:34,代码来源:LdapQueryFunctions.java


示例3: appendAttributeValues

import javax.naming.LimitExceededException; //导入依赖的package包/类
/**
 * Appends attribute values to a map (keyed on attribute id).
 * @param attributes the attributes to append (from)
 * @param values the map of values to populate (to)
 * @param stringsOnly if true, only attributes values of type
 *        String will be appended
 * @throws NamingException if an exception occurs
 */
protected void appendAttributeValues(Attributes attributes,
                                     Map<String,Object> values,
                                     boolean stringsOnly)
  throws NamingException {
  NamingEnumeration<?> enAttr = null;
  try {
    if (attributes != null) {
      enAttr = attributes.getAll();
      while (enAttr.hasMore()) {
        Object oAttr = enAttr.next();
        if (oAttr instanceof Attribute) {
          Attribute attr = (Attribute)oAttr;
          String sId = attr.getID();
          Object oVal = attr.get();
          if (!stringsOnly || (oVal instanceof String)) {
            values.put(sId,oVal);
          } else if (stringsOnly && (oVal == null)) {
            //values.put(sId,"");
          }
          //System.err.println(sId+"="+oVal+" cl="+oVal.getClass().getName());
        }
      }
      enAttr.close();
    }
  }catch (PartialResultException pre) {
	 LogUtil.getLogger().finer(pre.toString());
  } catch (LimitExceededException lee) {
	 LogUtil.getLogger().finer(lee.toString());
  } finally {
    closeEnumeration(enAttr);
  }
}
 
开发者ID:GeoinformationSystems,项目名称:GeoprocessingAppstore,代码行数:41,代码来源:LdapQueryFunctions.java


示例4: searchDNs

import javax.naming.LimitExceededException; //导入依赖的package包/类
/**
 * Returns a list of distinguished names resulting from a search.
 * <br/>The search is executed with SearchControls.SUBTREE_SCOPE.
 * @param dirContext the directory context
 * @param baseDN the baseBN for the search
 * @param filter the filter for the search
 * @return a collection of distinguished names
 * @throws NamingException if an exception occurs
 */
protected StringSet searchDNs(DirContext dirContext,
                              String baseDN, 
                              String filter) 
  throws NamingException {
  StringSet names = new StringSet(false,false,true);
  NamingEnumeration<SearchResult> enSearch = null;
  try {
    baseDN = Val.chkStr(baseDN);
    filter = Val.chkStr(filter);
    if (filter.length() > 0) {
      SearchControls controls = new SearchControls();
      controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
      enSearch = dirContext.search(baseDN,filter,controls);
      try {
        while (enSearch.hasMore()) {
          SearchResult result = (SearchResult)enSearch.next();
          names.add(buildFullDN(result.getName(),baseDN));
        }
      } catch (PartialResultException pre) {
        LogUtil.getLogger().finer(pre.toString());
      } catch (LimitExceededException lee) {
          LogUtil.getLogger().finer(lee.toString());
      }
    }
  } finally {
    closeEnumeration(enSearch);
  }
  return names;
}
 
开发者ID:GeoinformationSystems,项目名称:GeoprocessingAppstore,代码行数:39,代码来源:LdapQueryFunctions.java


示例5: getReferralContext

import javax.naming.LimitExceededException; //导入依赖的package包/类
private DirContext getReferralContext(ReferralException e)
        throws LimitExceededException, NamingException {
    int limit = 0;
    if (env.get("java.naming.ldap.referral.limit") != null) {
        limit = Integer.valueOf(
                (String) env.get("java.naming.ldap.referral.limit"))
                .intValue();
    }

    if (limit == -1) {
        throw new LimitExceededException(Messages.getString("ldap.25")); //$NON-NLS-1$
    }

    if (limit == 1) {
        limit = -1;
    } else if (limit != 0) {
        limit -= 1;
    }

    Hashtable<Object, Object> newEnv = (Hashtable<Object, Object>) env
            .clone();
    newEnv.put("java.naming.ldap.referral.limit", String.valueOf(limit));
    DirContext referralContext = null;

    while (true) {
        try {
            referralContext = (DirContext) e.getReferralContext(newEnv);
            break;
        } catch (NamingException ex) {
            if (e.skipReferral()) {
                continue;
            }
            throw ex;
        }
    }

    return referralContext;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:39,代码来源:LdapContextImpl.java


示例6: readUsers

import javax.naming.LimitExceededException; //导入依赖的package包/类
/**
 * Builds list of ldap users matching filter.
 * @param dirContext the directory context
 * @param filter the user search filter for ldap
 * @return the list of users matching filter
 * @throws NamingException if an LDAP naming exception occurs
 */
protected Users readUsers(DirContext dirContext,String filter, String attributeName) throws NamingException{	
	Users users = new Users();
	NamingEnumeration<SearchResult> enSearch = null;
	try{
		LdapUserProperties userProps = getConfiguration().getUserProperties();
		String sNameAttribute = userProps.getUserDisplayNameAttribute();
	    String sBaseDN = userProps.getUserSearchDIT();
	    String sFilter = userProps.returnUserLoginSearchFilter(filter);
	    if(attributeName != null){	    
	    	sFilter = userProps.returnUserNewRequestSearchFilter(filter, attributeName);
	    }
	    SearchControls controls = new SearchControls();
	    controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
	    if (sNameAttribute.length() > 0) {
	      String[] aReturn = new String[1];
	      aReturn[0] = sNameAttribute;
	      controls.setReturningAttributes(aReturn);
	    }
	    
	    enSearch = dirContext.search(sBaseDN,sFilter,controls);
	    try { 
	      while (enSearch.hasMore()) {
	        SearchResult result = (SearchResult)enSearch.next();
	        String sDN = buildFullDN(result.getName(),sBaseDN);
	        if (sDN.length() > 0) {
	          String sName = "";
	          if (sNameAttribute.length() > 0) {
	            Attribute attrName = result.getAttributes().get(sNameAttribute);
	            if ((attrName != null) && (attrName.size() > 0)) {
	              sName = Val.chkStr(attrName.get(0).toString());
	            }
	          }

		          User user = new User();
		          user.setDistinguishedName(sDN);
		          user.setKey(user.getDistinguishedName());
		          user.setName(sName);
		          users.add(user);
	        }
	      }
	    } catch (PartialResultException pre) {
	      LogUtil.getLogger().finer(pre.toString());
	    } catch (LimitExceededException lee) {
	        LogUtil.getLogger().finer(lee.toString());
	    }
	}finally {
	    closeEnumeration(enSearch);
	}
    return users;
}
 
开发者ID:GeoinformationSystems,项目名称:GeoprocessingAppstore,代码行数:58,代码来源:LdapQueryFunctions.java


示例7: readGroups

import javax.naming.LimitExceededException; //导入依赖的package包/类
/**
 * Builds list of ldap groups matching filter.
 * @param dirContext the directory context
 * @param filter the group search filter for ldap
 * @return the list of groups matching filter
 * @throws NamingException if an LDAP naming exception occurs
 */
protected Groups readGroups(DirContext dirContext,String filter) throws NamingException{	
	Groups groups = new Groups();
	NamingEnumeration<SearchResult> enSearch = null;
	try{
		LdapGroupProperties groupProps = getConfiguration().getGroupProperties();
		String sNameAttribute = groupProps.getGroupDisplayNameAttribute();
	    String sBaseDN = groupProps.getGroupSearchDIT();
	    String sFilter = groupProps.returnGroupNameSearchFilter(filter);
	    SearchControls controls = new SearchControls();
	    controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
	    if (sNameAttribute.length() > 0) {
	      String[] aReturn = new String[1];
	      aReturn[0] = sNameAttribute;
	      controls.setReturningAttributes(aReturn);
	    }
	    
	    enSearch = dirContext.search(sBaseDN,sFilter,controls);
	    try { 
	      while (enSearch.hasMore()) {
	        SearchResult result = (SearchResult)enSearch.next();
	        String sDN = buildFullDN(result.getName(),sBaseDN);
	        if (sDN.length() > 0) {
	          String sName = "";
	          if (sNameAttribute.length() > 0) {
	            Attribute attrName = result.getAttributes().get(sNameAttribute);
	            if ((attrName != null) && (attrName.size() > 0)) {
	              sName = Val.chkStr(attrName.get(0).toString());
	            }
	          }

		          Group group = new Group();
		          group.setDistinguishedName(sDN);
		          group.setKey(group.getDistinguishedName());
		          group.setName(sName);
		          groups.add(group);
	        }
	      }
	    } catch (PartialResultException pre) {
	      LogUtil.getLogger().finer(pre.toString());
	    } catch (LimitExceededException lee) {
	        LogUtil.getLogger().finer(lee.toString());
	    }
	}finally {
	    closeEnumeration(enSearch);
	}
    return groups;
}
 
开发者ID:GeoinformationSystems,项目名称:GeoprocessingAppstore,代码行数:55,代码来源:LdapQueryFunctions.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Summariser类代码示例发布时间:2022-05-22
下一篇:
Java ExtendSelector类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap