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


Java DN.addRDN方法代码示例

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


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

示例1: delete

import com.novell.ldap.util.DN; //导入方法依赖的package包/类
public void delete(DeleteInterceptorChain chain, DistinguishedName dn,
		LDAPConstraints constraints) throws LDAPException {
	
		
		Vector<RDN> rdns = dn.getDN().getRDNs();
		ListIterator it = rdns.listIterator();
		DN newDN = new DN();
		while (it.hasNext()) {
			RDN rdn = (RDN) it.next();
			if (! this.attribsToRemove.contains(rdn.getType().toLowerCase())) {
				newDN.addRDN(rdn);
			}
		}
		
		chain.nextDelete(dn,constraints);
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:17,代码来源:FlattenNamespace.java

示例2: delete

import com.novell.ldap.util.DN; //导入方法依赖的package包/类
public void delete(DeleteInterceptorChain chain, DistinguishedName dn,
		LDAPConstraints constraints) throws LDAPException {
	Vector rdns = dn.getDN().getRDNs();
	RDN rdn = (RDN) rdns.get(0);
	RDN newRdn = new RDN();
	
	if (rdn.getType().equalsIgnoreCase(this.idAttrib)) {
		newRdn.add(this.idType,rdn.getValue(),null);
	} else {
		//TODO: add jdbc call here?
		//newRdn.add(this.idType,entry.getEntry().getAttribute(this.idAttrib).getStringValue(),null);
	}
	
	DN newDn = new DN();
	newDn.addRDN(newRdn);
	
	for (int i=1,m=rdns.size();i<m;i++) {
		newDn.addRDN((RDN)rdns.get(i));
	}
	
	dn.setDN(newDn);
	chain.nextDelete(dn,constraints);

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

示例3: modify

import com.novell.ldap.util.DN; //导入方法依赖的package包/类
public void modify(ModifyInterceptorChain chain, DistinguishedName dn,
		ArrayList<LDAPModification> mods, LDAPConstraints constraints)
		throws LDAPException {
	Vector rdns = dn.getDN().getRDNs();
	RDN rdn = (RDN) rdns.get(0);
	RDN newRdn = new RDN();
	
	if (rdn.getType().equalsIgnoreCase(this.idAttrib)) {
		newRdn.add(this.idType,rdn.getValue(),null);
	} else {
		//TODO add jdbc?
		//newRdn.add(this.idType,entry.getEntry().getAttribute(this.idAttrib).getStringValue(),null);
	}
	
	DN newDn = new DN();
	newDn.addRDN(newRdn);
	
	for (int i=1,m=rdns.size();i<m;i++) {
		newDn.addRDN((RDN)rdns.get(i));
	}
	
	dn.setDN(newDn);
	
	chain.nextModify(dn,mods,constraints);

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

示例4: setExternalDN

import com.novell.ldap.util.DN; //导入方法依赖的package包/类
private void setExternalDN(Entry entry) {
	DN dn = new DN(entry.getEntry().getDN());
	Vector<RDN> rdns = dn.getRDNs();
	if (rdns.size() == 0 || ! rdns.get(0).getType().equalsIgnoreCase(this.internalRDN)) {
		return;
	}
	
	String dnlower = entry.getEntry().getDN().toLowerCase();
	String strdn = this.in2out.get(dnlower);
	
	if (strdn != null) {
		entry.setEntry(new LDAPEntry(strdn,entry.getEntry().getAttributeSet()));
		return;
	}
	
	String val = entry.getEntry().getAttributeSet().getAttribute(this.externalRDN).getStringValue();
	DN newdn = new DN();
	RDN rdn = new RDN();
	rdn.add(this.externalRDN, val, val);
	newdn.addRDN(rdn);
	
	for (int i=1,m=rdns.size();i<m;i++) {
		newdn.addRDNToBack(rdns.elementAt(i));
	}
	
	this.in2out.put(dnlower, newdn.toString());
	
	entry.setEntry(new LDAPEntry(newdn.toString(),entry.getEntry().getAttributeSet()));
	
	
	
	
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:34,代码来源:SetRDN.java

示例5: add

import com.novell.ldap.util.DN; //导入方法依赖的package包/类
public void add(AddInterceptorChain chain, Entry entry,
		LDAPConstraints constraints) throws LDAPException {
	Vector rdns = (new DN(entry.getEntry().getDN())).getRDNs();
	RDN rdn = (RDN) rdns.get(0);
	RDN newRdn = new RDN();
	
	if (rdn.getType().equalsIgnoreCase(this.idAttrib)) {
		newRdn.add(this.idType,rdn.getValue(),null);
	} else {
		newRdn.add(this.idType,entry.getEntry().getAttribute(this.idAttrib).getStringValue(),null);
	}
	
	DN newDn = new DN();
	newDn.addRDN(newRdn);
	
	for (int i=1,m=rdns.size();i<m;i++) {
		newDn.addRDNToBack((RDN)rdns.get(i));
	}
	
	entry.setDN(newDn);
	
	if (! this.keepNameAsAttribute) {
		entry.getEntry().getAttributeSet().remove(this.idAttrib);
	}
	
	chain.nextAdd(entry,constraints);


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

示例6: getInternalDN

import com.novell.ldap.util.DN; //导入方法依赖的package包/类
private DN getInternalDN(DN externalDN,InterceptorChain chain,LDAPEntry toadd) throws LDAPException {
	Vector<RDN> externalRDNs =  externalDN.getRDNs();
	
	//check to make sure we need to do the mapping
	if (externalRDNs.size() == 0 || ! externalRDNs.get(0).getType().equalsIgnoreCase(this.externalRDN)) {
		return externalDN;
	}
	
	
	//check to see if we have it cached
	String dnstr = this.out2in.get(externalDN.toString().toLowerCase());
	
	if (dnstr != null) {
		return new DN(dnstr);
	}
	
	//we need to retrieve the attribute via a search
	Results results = new Results(null,chain.getPositionInChain(this));
	SearchInterceptorChain schain = chain.createSearchChain(chain.getPositionInChain(this));
	DN base = new DN();
	for (int i=1,m=externalRDNs.size();i<m;i++) {
		base.addRDNToBack(externalRDNs.get(i));
	}
	
	String val = "";
	
	if (toadd == null) {
		ArrayList<Attribute> attributes = new ArrayList<Attribute>();
		attributes.add(new Attribute(this.internalRDN));
		
		Filter filter = new Filter("(" + this.externalRDN + "=" + externalRDNs.get(0).getValue() +")");
		
		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();
			throw new LDAPException("No Such Object",LDAPException.NO_SUCH_OBJECT,"No Such Object");
		}
		
		val = entry.getEntry().getAttribute(this.internalRDN).getStringValue();
	} else {
		val = toadd.getAttribute(this.internalRDN).getStringValue();
	}
	
	DN internalDN = new DN();
	RDN rdn = new RDN();
	rdn.add(this.internalRDN, val, val);
	internalDN.addRDN(rdn);
	for (int i=1,m=externalRDNs.size();i<m;i++) {
		internalDN.addRDNToBack(externalRDNs.get(i));
	}
	
	this.out2in.put(externalDN.toString().toLowerCase(), internalDN.toString());
	return internalDN;
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:63,代码来源:SetRDN.java

示例7: setExternalDN

import com.novell.ldap.util.DN; //导入方法依赖的package包/类
private void setExternalDN(Entry entry) {
	
	/*if (this.toIgnore.contains(entry.getEntry().getDN())) {
		//we know to ignore
		return;
	}*/
	
	boolean ocFound = false;
	if (entry.getEntry().getAttribute("OBJECTCLASS") != null) {
		for (String oc : entry.getEntry().getAttribute("OBJECTCLASS").getStringValueArray()) {
			if (oc.equalsIgnoreCase(this.objectClass)) {
				ocFound = true;
				break;
			}
		}
	}
	
	if (! ocFound) {
		this.toIgnore.add(entry.getEntry().getDN());
		return;
	}
	
	
	DN dn = new DN(entry.getEntry().getDN());
	Vector<RDN> rdns = dn.getRDNs();
	if (rdns.size() == 0 || ! rdns.get(0).getType().equalsIgnoreCase(this.internalRDN)) {
		return;
	}
	
	String dnlower = entry.getEntry().getDN().toLowerCase();
	String strdn = null;//this.in2out.get(dnlower);
	
	if (strdn != null) {
		entry.setEntry(new LDAPEntry(strdn,entry.getEntry().getAttributeSet()));
		return;
	}
	
	if ( entry.getEntry().getAttributeSet().getAttribute(this.externalRDN) == null) {
		return;
	}
	
	String val = entry.getEntry().getAttributeSet().getAttribute(this.externalRDN).getStringValue();
	DN newdn = new DN();
	RDN rdn = new RDN();
	rdn.add(this.externalRDN, val, val);
	newdn.addRDN(rdn);
	
	for (int i=1,m=rdns.size();i<m;i++) {
		newdn.addRDNToBack(rdns.elementAt(i));
	}
	
	this.in2out.put(dnlower, newdn.toString());
	
	entry.setEntry(new LDAPEntry(newdn.toString(),entry.getEntry().getAttributeSet()));
	
	
	
	
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:60,代码来源:SetRDN.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

示例10: getInternalDN

import com.novell.ldap.util.DN; //导入方法依赖的package包/类
private DN getInternalDN(DN externalDN,InterceptorChain chain,LDAPEntry toadd) throws LDAPException {
	Vector<RDN> externalRDNs =  externalDN.getRDNs();
	
	//first see if we can ignore
	/*if (this.toIgnore.contains(externalDN.toString())) {
		return externalDN;
	}*/
	
	//check to make sure we need to do the mapping
	if (externalRDNs.size() == 0 || ! externalRDNs.get(0).getType().equalsIgnoreCase(this.externalRDN)) {
		return externalDN;
	}
	
	
	//check to see if we have it cached
	String dnstr = null;//this.out2in.get(externalDN.toString().toLowerCase());
	
	if (dnstr != null) {
		return new DN(dnstr);
	}
	
	//we need to retrieve the attribute via a search
	Results results = new Results(null,chain.getPositionInChain(this) + 1);
	SearchInterceptorChain schain = chain.createSearchChain(chain.getPositionInChain(this) + 1);
	DN base = new DN();
	for (int i=1,m=externalRDNs.size();i<m;i++) {
		base.addRDNToBack(externalRDNs.get(i));
	}
	
	String val = "";
	
	if (toadd == null) {
		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(this.externalRDN).append('=').append(externalRDNs.get(0).getValue()).append("))");
		//b.append('(').append(this.externalRDN).append('=').append(externalRDNs.get(0).getValue()).append(')');
		Filter filter = new Filter(b.toString());
		
		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;
		}
		
		val = entry.getEntry().getAttribute(this.internalRDN).getStringValue();

	} else {
		val = toadd.getAttribute(this.internalRDN).getStringValue();
	}
	
	DN internalDN = new DN();
	RDN rdn = new RDN();
	rdn.add(this.internalRDN, val, val);
	internalDN.addRDN(rdn);
	for (int i=1,m=externalRDNs.size();i<m;i++) {
		internalDN.addRDNToBack(externalRDNs.get(i));
	}
	
	this.out2in.put(externalDN.toString().toLowerCase(), internalDN.toString());
	return internalDN;
}
 
开发者ID:TremoloSecurity,项目名称:MyVirtualDirectory,代码行数:75,代码来源:SetRDN.java


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