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


Java DN.toString方法代码示例

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


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

示例1: getConnection

import com.novell.ldap.util.DN; //导入方法依赖的package包/类
private ConnectionWrapper getConnection(DN bindDN,Password pass,boolean force,DN base,HashMap<Object,Object> session,boolean forceBind) throws LDAPException {
	ConnectionWrapper wrapper = null;
	
	if (logger.isDebugEnabled()) {
		logger.debug("Bound inserts : " + session.get(SessionVariables.BOUND_INTERCEPTORS));
	}
	
	if (this.passThroughBindOnly && ! force) {
		wrapper = pool.getConnection(new DN(this.proxyDN),new Password(this.proxyPass),force);
	} else if (forceBind || (! this.passThroughBindOnly && ((ArrayList<String>) session.get(SessionVariables.BOUND_INTERCEPTORS)).contains(this.name))) {
		wrapper = pool.getConnection(bindDN,pass,force);
	} else {
		wrapper = pool.getConnection(new DN(this.proxyDN),new Password(this.proxyPass),force);
	}
	
	if (wrapper == null) {
		
		throw new LDAPException("Could not get remote connection",LDAPException.SERVER_DOWN,base.toString());
	} else {
		return wrapper;
	}
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:23,代码来源:LDAPInterceptor.java

示例2: getInternalDN

import com.novell.ldap.util.DN; //导入方法依赖的package包/类
private DN getInternalDN(DN externalDN,InterceptorChain chain) throws LDAPException {
	DN dn = this.getInternalDN(externalDN, chain,null);
	if (dn != null) {
		return dn;
	} else {
		return new DN(externalDN.toString());
	}
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:9,代码来源:SetRDN.java

示例3: DistinguishedName

import com.novell.ldap.util.DN; //导入方法依赖的package包/类
public DistinguishedName(DN dn) {
	this.dn = new DN(dn.toString());
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:4,代码来源:DistinguishedName.java

示例4: setDN

import com.novell.ldap.util.DN; //导入方法依赖的package包/类
public void setDN(DN dn) {
	this.entry = new LDAPEntry(dn.toString(),entry.getAttributeSet());
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:4,代码来源:Entry.java

示例5: add

import com.novell.ldap.util.DN; //导入方法依赖的package包/类
public void add(AddInterceptorChain chain, Entry entry,
		LDAPConstraints constraints) throws LDAPException {
	Stack<JoinData> jd = (Stack<JoinData>) chain.getRequest().get(stackKey);
	
	HashSet<String> joinAttribs;
	
	if (jd != null) {
		joinAttribs = jd.peek().joinedAttribsSet;
	} else {
		joinAttribs = (HashSet) chain.getRequest().get(Joiner.MYVD_JOIN_JATTRIBS + this.joinerName);
	}
	LDAPAttributeSet primaryAttribs = new LDAPAttributeSet(),joinedAttribs = new LDAPAttributeSet();
	
	LDAPAttributeSet toadd = entry.getEntry().getAttributeSet();
	
	Iterator it = toadd.iterator();
	
	while (it.hasNext()) {
		LDAPAttribute attrib = (LDAPAttribute) it.next();
		if (! joinAttribs.contains(attrib.getName())) {
			primaryAttribs.add(attrib);
		} else {
			joinedAttribs.add(attrib);
		}
		
		if (attrib.getName().equalsIgnoreCase("objectclass")) {
			attrib.removeValue(joinedObjectClass);
		} else if (sharedAttributes.contains(attrib.getName().toLowerCase())) {
			primaryAttribs.add(attrib);
			joinedAttribs.add(attrib);
		}
		
		
	}
	
	LDAPAttribute oc = new LDAPAttribute("objectClass",joinedObjectClass);
	joinedAttribs.add(oc);
	
	NamingUtils nameutil = new NamingUtils();
	
	DN primaryDN = nameutil.getRemoteMappedDN(new DN(entry.getEntry().getDN()), joinerNamespaceDN, primaryNamespaceDN);
	
	DN joinedDN = nameutil.getRemoteMappedDN(new DN(entry.getEntry().getDN()), joinerNamespaceDN, joinedNamespaceDN);
	
	LDAPEntry primary = new LDAPEntry(primaryDN.toString(),primaryAttribs); 
	LDAPEntry joined  = new LDAPEntry(joinedDN.toString(),joinedAttribs);
	
	AddInterceptorChain nchain = null;
	
	//logger.info("Add to joined only? : " + this.addToJoinedOnly);
	
	if (! this.addToJoinedOnly){
		nchain = new AddInterceptorChain(chain.getBindDN(),chain.getBindPassword(),0,new InsertChain(new Insert[0]),chain.getSession(),chain.getRequest(),ns.getRouter());
		nchain.nextAdd(new Entry(primary), constraints);
	}
	
	nchain = new AddInterceptorChain(chain.getBindDN(),chain.getBindPassword(),0,new InsertChain(new Insert[0]),chain.getSession(),chain.getRequest(),ns.getRouter());
	nchain.nextAdd(new Entry(joined),constraints);

}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:61,代码来源:JoinAddFlatNS.java

示例6: search

import com.novell.ldap.util.DN; //导入方法依赖的package包/类
public void search(SearchInterceptorChain chain,DistinguishedName base,Int scope,Filter filter,ArrayList<Attribute> attributes,Bool typesOnly,Results results,LDAPSearchConstraints constraints) throws LDAPException {
	
	logger.debug("Entering router search");
	
	int notFounds = 0;
	HashSet<String> toExclude = (HashSet<String>) chain.getRequest().get(RequestVariables.ROUTE_NAMESPACE_EXCLUDE);
	
	
	logger.debug("Determining local levels");
	ArrayList<NameSpace> localBackends = this.getLocalLevels(chain,base);
	logger.debug("Determined local levels");
	Iterator<NameSpace> it = localBackends.iterator();
	
	logger.debug("Iterate over levels");
	while (it.hasNext()) {
	
		NameSpace holder = it.next(); 
		
		if (toExclude != null  && toExclude.contains(holder.getLabel())) {
			continue;
		}
		
		DN parentDN = holder.getBase().getDN().getParent();
		
		
		DN reqDN = new DN(base.toString());
		
		
		DistinguishedName searchBase = new DistinguishedName(reqDN.toString());
		
		logger.debug("Determine scope");
		Int localScope = new Int(scope.getValue());
		if (scope.getValue() != 0) {
			if (scope.getValue() == 1) {
				if (holder.getBase().getDN().countRDNs() - searchBase.getDN().countRDNs() == 1) {
					localScope.setValue(0);
					searchBase = new DistinguishedName(holder.getBase().getDN().toString());
				} else if (holder.getBase().getDN().countRDNs() - searchBase.getDN().countRDNs() > 0) {
					continue;
				}
			} else {
				searchBase = base;
			}
		}
		logger.debug("Base determined");
		
		
		try {
			logger.debug("create local chain");
			SearchInterceptorChain localChain = new SearchInterceptorChain(chain.getBindDN(),chain.getBindPassword(),0,holder.getChain(),chain.getSession(),chain.getRequest());
			logger.debug("Begin Local Chain");
			localChain.nextSearch(searchBase,localScope,filter,attributes,typesOnly,results,constraints);
			logger.debug("chain complete");
		} catch (LDAPException e) {
			logger.error("Error running search",e);
			if (e.getResultCode() == 32) {
				notFounds++;
			} else {
				throw e;
			}
		} 
		
		if (scope.getValue() == 0) {
			break;
		}
		
		
	}
	
	if (notFounds == localBackends.size()) {
		throw new LDAPException("Could not find base",LDAPException.NO_SUCH_OBJECT,"");
	}
	
	
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:76,代码来源:Router.java

示例7: addBackend

import com.novell.ldap.util.DN; //导入方法依赖的package包/类
public void addBackend(String label,DN name, NameSpace namespace) {
   	namespace.setRouter(this);
   	this.backends.put(label,namespace);
   	
   	if (name.countRDNs() == 0) {
   		this.rootNS = namespace;
   		return;
   	}
   	
	DN curr = new DN(name.toString());
	Level level;
	for (int i=0,m=name.countRDNs();i<m;i++) {
		level = this.subtree.get(curr);
		if (level == null) {
			level = new Level();
			this.subtree.put(curr,level);
		}
		
		if (! level.backends.contains(namespace)) {
			//level.backends.add(backend);
			
			if (level.backends.size() == 0) {
				level.backends.add(namespace);
			} else {
			
				//this needs to be sorted, most exact to least
				boolean found = false;
				for (int j=0;j<level.backends.size();j++) {
					NameSpace part =  level.backends.get(j);
					
					/*
					 * If the namespace added 
					 */
					if (newNamespaceProceedsCurrent(namespace, part)) {
						
						if (namespace.getBase().getDN().countRDNs() < part.getBase().getDN().countRDNs() || checkWeighting(namespace, part)) {
							level.backends.add(j,namespace);
							found = true;
							break;
						}
					} 
				}
				
				if (! found) {
					level.backends.add(namespace);
				}
			}
			
		}
		
		
		
		curr = curr.getParent();
		
	}
	
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:58,代码来源:Router.java

示例8: getExternalAttrDN

import com.novell.ldap.util.DN; //导入方法依赖的package包/类
private String getExternalAttrDN(String internalDN,InterceptorChain chain) throws LDAPException {
	/*if (this.toIgnore.contains(internalDN)) {
		return internalDN;
	}*/
	
	String externalDN = null;//this.in2out.get(internalDN.toLowerCase());
	if (externalDN != null) {
		return externalDN;
	}
	
	
	DN internalDNdn = new DN(internalDN);
	Vector rdns = internalDNdn.getRDNs();
	DN base = new DN();
	for (int i=1;i<rdns.size();i++) {
		base.addRDNToBack((RDN) rdns.get(i));
	}
	
	String internalRDNVal = ((RDN) rdns.get(0)).getValue();
	String internalRDNName = ((RDN) rdns.get(0)).getType();
	
	ArrayList<Attribute> attributes = new ArrayList<Attribute>();
	attributes.add(new Attribute(this.externalRDN));
	attributes.add(new Attribute(this.objectClass));
	
	StringBuffer b = new StringBuffer();
	b.append("(&(objectClass=").append(this.objectClass).append(")(").append(internalRDNName).append('=').append(internalRDNVal).append("))");
	//b.append('(').append(this.externalRDN).append('=').append(externalRDNs.get(0).getValue()).append(')');
	Filter filter = new Filter(b.toString());
	
	
	Results results = new Results(null,chain.getPositionInChain(this) + 1);
	SearchInterceptorChain schain = chain.createSearchChain(chain.getPositionInChain(this) + 1);
	
	
	logger.info("Base : '" + base + "'" );
	
	schain.nextSearch(new DistinguishedName(base), new Int(1), filter, attributes, new Bool(false), results, new LDAPSearchConstraints());
	
	results.start();
	
	
	Entry entry = null;
	
	if (results.hasMore()) {
		entry = results.next();
	} else {
		results.finish();
		//Assume this isn't the correct obectClass
		this.toIgnore.add(internalDN.toString());
		return internalDN;
	}
	
	String val = entry.getEntry().getAttribute(this.externalRDN).getStringValue();
	
	DN newExternal = new DN();
	b.setLength(0);
	b.append(this.externalRDN).append('=').append(val);
	RDN rdn = new RDN(b.toString());
	
	newExternal.addRDN(rdn);
	
	for (int i=1;i<rdns.size();i++) {
		newExternal.addRDNToBack((RDN) rdns.get(i));
	}
	
	this.in2out.put(internalDN.toLowerCase() , newExternal.toString().toLowerCase());
	return newExternal.toString();
	
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:71,代码来源:SetRDN.java

示例9: getInternalAttrDN

import com.novell.ldap.util.DN; //导入方法依赖的package包/类
private String getInternalAttrDN(String externalDN,InterceptorChain chain) throws LDAPException {
	/*if (this.toIgnore.contains(externalDN)) {
		return externalDN;
	}*/
	
	String internalDN = null;//this.out2in.get(externalDN.toLowerCase());
	if (internalDN != null) {
		return internalDN;
	}
	
	
	DN externalDNdn = new DN(externalDN);
	Vector rdns = externalDNdn.getRDNs();
	DN base = new DN();
	for (int i=1;i<rdns.size();i++) {
		base.addRDNToBack((RDN) rdns.get(i));
	}
	
	String externalRDNVal = ((RDN) rdns.get(0)).getValue();
	String externalRDNName = ((RDN) rdns.get(0)).getType();
	
	ArrayList<Attribute> attributes = new ArrayList<Attribute>();
	attributes.add(new Attribute(this.internalRDN));
	attributes.add(new Attribute(this.objectClass));
	
	StringBuffer b = new StringBuffer();
	b.append("(&(objectClass=").append(this.objectClass).append(")(").append(externalRDNName).append('=').append(externalRDNVal).append("))");
	//b.append('(').append(this.externalRDN).append('=').append(externalRDNs.get(0).getValue()).append(')');
	Filter filter = new Filter(b.toString());
	
	
	Results results = new Results(null,chain.getPositionInChain(this) + 1);
	SearchInterceptorChain schain = chain.createSearchChain(chain.getPositionInChain(this) + 1);
	
	schain.nextSearch(new DistinguishedName(base), new Int(1), filter, attributes, new Bool(false), results, new LDAPSearchConstraints());
	
	results.start();
	
	
	Entry entry = null;
	
	if (results.hasMore()) {
		entry = results.next();
	} else {
		results.finish();
		//Assume this isn't the correct obectClass
		this.toIgnore.add(externalDN.toString());
		return externalDN;
	}
	
	String val = entry.getEntry().getAttribute(this.internalRDN).getStringValue();
	
	DN newInternal = new DN();
	b.setLength(0);
	b.append(this.internalRDN).append('=').append(val);
	RDN rdn = new RDN(b.toString());
	
	newInternal.addRDN(rdn);
	
	for (int i=1;i<rdns.size();i++) {
		newInternal.addRDNToBack((RDN) rdns.get(i));
	}
	
	this.out2in.put(externalDN.toLowerCase() , newInternal.toString().toLowerCase());
	return newInternal.toString();
	
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:68,代码来源:SetRDN.java


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