本文整理汇总了Java中com.novell.ldap.util.DN.countRDNs方法的典型用法代码示例。如果您正苦于以下问题:Java DN.countRDNs方法的具体用法?Java DN.countRDNs怎么用?Java DN.countRDNs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.novell.ldap.util.DN
的用法示例。
在下文中一共展示了DN.countRDNs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compare
import com.novell.ldap.util.DN; //导入方法依赖的package包/类
public int compare(Object o1, Object o2) {
DN dn1 = (DN) o1;
DN dn2 = (DN) o2;
int num1 = dn1.countRDNs();
int num2 = dn2.countRDNs();
if (num1 < num2) {
return -1;
}
if (num1 > num2) {
return 1;
}
try {
if (dn1.equals(dn2)) {
return 0;
}
} catch (IllegalArgumentException e) {
}
return dn1.toString().compareTo(dn2.toString());
}
示例2: add
import com.novell.ldap.util.DN; //导入方法依赖的package包/类
private void add(AccessControlItem aci) {
DN dn = aci.getDn();
if (aci.getNum() == 3) {
////System.out.println();
}
//work in reverse from the end of the dn to the front
Vector<RDN> rdns = dn.getRDNs();
for (int i=rdns.size() - 1;i>=0;i--) {
DN levelDN = new DN();
for (int l=rdns.size() - 1;l>=i;l--) {
levelDN.addRDNToFront(rdns.get(l));
AciLevel level = this.acl.get(levelDN);
if (level == null) {
level = new AciLevel();
level.acis = new ArrayList<AccessControlItem>();
//we need to add all parents
for (int m=1;m<levelDN.countRDNs();m++) {
DN parentDNs = new DN();
Vector<RDN> parentRDNs = levelDN.getRDNs();
for (int k=m;k<levelDN.countRDNs();k++) {
parentDNs.addRDNToBack(parentRDNs.get(k));
}
AciLevel parentLevel = this.acl.get(parentDNs);
if (parentLevel != null) {
Iterator<AccessControlItem> aciIt = parentLevel.acis.iterator();
while (aciIt.hasNext()) {
AccessControlItem aciItem = aciIt.next();
if (! level.acis.contains(aciItem)) {
level.acis.add(aciItem);
}
}
}
}
this.acl.put(levelDN,level);
}
if (! level.acis.contains(aci)) {
level.acis.add(aci);
}
}
}
//now make sure we get all children too
Iterator<DN> it = this.acl.keySet().iterator();
while (it.hasNext()) {
dn = it.next();
if (this.isDescendantOf(aci.getDn(),dn) && ! acl.get(dn).acis.contains(aci)) {
acl.get(dn).acis.add(aci);
}
}
}
示例3: 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();
}
}