本文整理汇总了Java中com.novell.ldap.LDAPAttribute.addValue方法的典型用法代码示例。如果您正苦于以下问题:Java LDAPAttribute.addValue方法的具体用法?Java LDAPAttribute.addValue怎么用?Java LDAPAttribute.addValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.novell.ldap.LDAPAttribute
的用法示例。
在下文中一共展示了LDAPAttribute.addValue方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: revalueAttribute
import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
public void revalueAttribute(String attrib,HashMap<String,String> map) {
LDAPAttribute attribute = this.entry.getAttribute(attrib);
if (attribute == null) {
return;
}
String[] vals = attribute.getStringValueArray();
for (int i=0,m=vals.length;i<m;i++) {
String newVal = map.get(vals[i].toLowerCase());
if (newVal != null) {
attribute.removeValue(vals[i]);
attribute.addValue(newVal);
}
}
}
示例2: renameAttribute
import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
public void renameAttribute(String oldAttribName,String newAttribName) {
LDAPAttribute attrib = entry.getAttribute(oldAttribName);
if (attrib == null) {
return;
}
entry.getAttributeSet().remove(attrib);
LDAPAttribute newAttrib = new LDAPAttribute(newAttribName);
byte[][] vals = attrib.getByteValueArray();
for (int i=0,m=vals.length;i<m;i++) {
newAttrib.addValue(vals[i]);
}
entry.getAttributeSet().add(newAttrib);
}
示例3: checkObjectClass
import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
private boolean checkObjectClass(Entry entry, LDAPAttribute nocs) {
boolean isDynGroup = false;
LDAPAttribute ocs = entry.getEntry().getAttribute("objectClass");
if (ocs != null) {
String[] vals = ocs.getStringValueArray();
for (int i=0;i<vals.length;i++) {
if (vals[i].equalsIgnoreCase(dynOC)) {
isDynGroup = true;
nocs.addValue(staticOC);
} else {
nocs.addValue(vals[i]);
}
}
}
return isDynGroup;
}
示例4: postSearchEntry
import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
public void postSearchEntry(PostSearchEntryInterceptorChain chain,
Entry entry, DistinguishedName base, Int scope, Filter filter,
ArrayList<Attribute> attributes, Bool typesOnly,
LDAPSearchConstraints constraints) throws LDAPException {
chain.nextPostSearchEntry(entry,base,scope,filter,attributes,typesOnly,constraints);
LDAPAttribute member = entry.getEntry().getAttribute(this.attribName);
if (member != null) {
entry.getEntry().getAttributeSet().remove(member);
LDAPAttribute newMembers = new LDAPAttribute(this.attribName);
String[] vals = member.getStringValueArray();
for (int i=0,m=vals.length;i<m;i++) {
newMembers.addValue(this.rdnAttrib + "=" + vals[i] + "," + this.suffix);
}
entry.getEntry().getAttributeSet().add(newMembers);
}
}
示例5: modify
import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
public void modify(ModifyInterceptorChain chain, DistinguishedName dn, ArrayList<LDAPModification> mods, LDAPConstraints constraints) throws LDAPException {
ListIterator<LDAPModification> it = mods.listIterator();
while (it.hasNext()) {
LDAPModification mod = it.next();
String newName = this.localMap.get(mod.getAttribute().getBaseName().toLowerCase());
if (newName != null) {
LDAPAttribute newAttrib = new LDAPAttribute(newName);
byte[][] vals = mod.getAttribute().getByteValueArray();
for (int i=0,m=vals.length;i<m;i++) {
newAttrib.addValue(vals[i]);
}
LDAPModification newMod = new LDAPModification(mod.getOp(),newAttrib);
it.remove();
it.add(newMod);
}
}
chain.nextModify(dn,mods,constraints);
}
示例6: configure
import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
@Override
public void configure(String name, Properties props, NameSpace nameSpace) throws LDAPException {
this.name = name;
this.nameSpace = nameSpace;
this.oldFilterName = "myvd.vmemberof.orig.filter." + name;
this.skipPostSearchName = "myvd.vmemberof.skip." + name;
this.searchBase = props.getProperty("searchBase");
this.applyToObjectClass = props.getProperty("applyToObjectClass");
this.attributeName = props.getProperty("attributeName");
this.searchObjectClass = props.getProperty("searchObjectClass");
this.searchAttribute = props.getProperty("searchAttribute");
this.replace = props.getProperty("replace","false").equalsIgnoreCase("true");
LDAPAttribute oc = new LDAPAttribute("objectClass");
oc.addValue("top");
oc.addValue(this.applyToObjectClass);
}
示例7: postSearchEntry
import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
@Override
public void postSearchEntry(PostSearchEntryInterceptorChain chain, Entry entry, DistinguishedName base, Int scope,
Filter filter, ArrayList<Attribute> attributes, Bool typesOnly, LDAPSearchConstraints constraints)
throws LDAPException {
chain.nextPostSearchEntry(entry, base, scope, filter, attributes, typesOnly, constraints);
LDAPAttribute attr = entry.getEntry().getAttribute(this.sourceAttribute);
if (attr != null) {
LDAPAttribute nattr = new LDAPAttribute(this.sourceAttribute);
String[] dns = attr.getStringValueArray();
for (String dn : dns) {
nattr.addValue(this.dn2attr(dn, chain));
}
entry.getEntry().getAttributeSet().remove(this.sourceAttribute);
entry.getEntry().getAttributeSet().add(nattr);
}
}
示例8: rename
import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
public void rename(String newName) {
LDAPAttribute newAttrib = new LDAPAttribute(newName);
byte[][] vals = this.attribute.getByteValueArray();
for (int i=0,m=vals.length;i<m;i++) {
newAttrib.addValue(vals[i]);
}
this.attribute = newAttrib;
}
示例9: compare
import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
public void compare(CompareInterceptorChain chain, DistinguishedName dn,
Attribute attrib, LDAPConstraints constraints) throws LDAPException {
if (this.dnAttribs.contains(attrib.getAttribute().getBaseName())) {
LDAPAttribute nattrib = new LDAPAttribute(attrib.getAttribute().getName());
NamingUtils util = new NamingUtils();
nattrib.addValue(util.getRemoteMappedDN(new DN(attrib.getAttribute().getStringValue()), this.localBase, this.remoteBase).toString());
chain.nextCompare(dn, new Attribute(nattrib), constraints);
} else {
chain.nextCompare(dn, attrib, constraints);
}
}
示例10: search
import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
@Override
public void search(SearchInterceptorChain chain, DistinguishedName base,
Int scope, Filter filter, ArrayList<Attribute> attributes,
Bool typesOnly, Results results, LDAPSearchConstraints constraints)
throws LDAPException {
LDAPAttributeSet attribs = new LDAPAttributeSet();
LDAPAttributeSet ldifAttribs = this.schemaEntry.getAttributeSet();
boolean allAttribs = attributes.size() == 0 || attributes.contains(ALL_ATTRIBS);
Iterator<LDAPAttribute> it = ldifAttribs.iterator();
while (it.hasNext()) {
LDAPAttribute ldifAttrib = it.next();
Attribute attribName = new Attribute(ldifAttrib.getName());
if (allAttribs || attributes.contains(attribName)) {
LDAPAttribute newAttrib = new LDAPAttribute(ldifAttrib.getName());
Enumeration enumer = ldifAttrib.getByteValues();
while (enumer.hasMoreElements()) {
byte[] val = (byte[]) enumer.nextElement();
newAttrib.addValue(val);
}
attribs.add(newAttrib);
}
}
LDAPEntry toret = new LDAPEntry(this.schemaEntry.getDN(),attribs);
ArrayList<Entry> list = new ArrayList<Entry>();
list.add(new Entry(toret));
chain.addResult(results,new IteratorEntrySet(list.iterator()),base,scope,filter,attributes,typesOnly,constraints);
}
示例11: loadProps
import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
private void loadProps(Properties props,LDAPAttribute repos, String attribName, String delim) {
StringTokenizer toker;
toker = new StringTokenizer(props.getProperty(attribName,""),delim);
while (toker.hasMoreTokens()) {
repos.addValue(toker.nextToken());
}
}
示例12: postSearchEntry
import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
public void postSearchEntry(PostSearchEntryInterceptorChain chain,
Entry entry, DistinguishedName base, Int scope, Filter filter,
ArrayList<Attribute> attributes, Bool typesOnly,
LDAPSearchConstraints constraints) throws LDAPException {
chain.nextPostSearchEntry(entry, base, scope, filter, attributes, typesOnly, constraints);
LDAPAttribute attrib = entry.getEntry().getAttribute("objectguid");
if (attrib != null) {
byte[] bytes = attrib.getByteValue();
StringBuffer byteStr = new StringBuffer();
for (int i = 0; i < bytes.length; i++) {
byteStr.append("\\").append(byteToHex(bytes[i]));
}
StringBuffer buf = new StringBuffer();
buf.append(byteToHex(bytes[3]));
buf.append(byteToHex(bytes[2]));
buf.append(byteToHex(bytes[1]));
buf.append(byteToHex(bytes[0]));
buf.append('-');
buf.append(byteToHex(bytes[5]));
buf.append(byteToHex(bytes[4]));
buf.append('-');
buf.append(byteToHex(bytes[7]));
buf.append(byteToHex(bytes[6]));
buf.append('-');
buf.append(byteToHex(bytes[8]));
buf.append(byteToHex(bytes[9]));
buf.append('-');
buf.append(byteToHex(bytes[10]));
buf.append(byteToHex(bytes[11]));
buf.append(byteToHex(bytes[12]));
buf.append(byteToHex(bytes[13]));
buf.append(byteToHex(bytes[14]));
buf.append(byteToHex(bytes[15]));
attrib.removeValue(bytes);
attrib.addValue(buf.toString());
this.binaryToString.put(buf.toString(), byteStr.toString());
}
attrib = entry.getEntry().getAttribute("objectsid");
if (attrib != null) {
byte[] sidBytes = attrib.getByteValue();
attrib.removeValue(sidBytes);
String strSid = this.getSIDasStringOfBytes(sidBytes);
attrib.addValue(strSid);
}
}
示例13: testAdd
import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
public void testAdd() throws Exception {
LDAPAttributeSet attribs = new LDAPAttributeSet();
attribs.add(new LDAPAttribute("objectClass","inetOrgPerson"));
attribs.add(new LDAPAttribute("uid","testadd"));
attribs.add(new LDAPAttribute("givenName","test"));
attribs.add(new LDAPAttribute("sn","add"));
LDAPAttribute l = new LDAPAttribute("l");
l.addValue("LA");
l.addValue("NY");
attribs.add(l);
LDAPEntry entry = new LDAPEntry("uid=testadd,dc=nam,dc=compinternal,dc=com",attribs);
LDAPConnection con = new LDAPConnection();
con.connect("localhost",50983);
con.add(entry);
LDAPSearchResults res = con.search("uid=testadd,dc=nam,dc=compinternal,dc=com", 0, "(objectClass=*)", new String[0], false);
if (! res.hasMore()) {
fail("Entry not added");
return;
}
LDAPEntry fromdir = res.next();
if (res.hasMore()) {
fail("Entry added too many times?");
return;
}
Util util = new Util();
if (! util.compareEntry(fromdir, entry)) {
fail("Entries not the same : " + fromdir.toString());
}
con.delete("uid=testadd,dc=nam,dc=compinternal,dc=com");
con.disconnect();
}
示例14: testAdd
import com.novell.ldap.LDAPAttribute; //导入方法依赖的package包/类
@Test
public void testAdd() throws Exception {
LDAPAttributeSet attribs = new LDAPAttributeSet();
attribs.add(new LDAPAttribute("objectClass","inetOrgPerson"));
attribs.add(new LDAPAttribute("uid","testadd"));
attribs.add(new LDAPAttribute("givenName","test"));
attribs.add(new LDAPAttribute("sn","add"));
LDAPAttribute l = new LDAPAttribute("l");
l.addValue("LA");
l.addValue("NY");
attribs.add(l);
LDAPEntry entry = new LDAPEntry("uid=testadd,dc=nam,dc=compinternal,dc=com",attribs);
LDAPConnection con = new LDAPConnection();
con.connect("localhost",50983);
con.add(entry);
LDAPSearchResults res = con.search("uid=testadd,dc=nam,dc=compinternal,dc=com", 0, "(objectClass=*)", new String[0], false);
if (! res.hasMore()) {
fail("Entry not added");
return;
}
LDAPEntry fromdir = res.next();
if (res.hasMore()) {
fail("Entry added too many times?");
return;
}
Util util = new Util();
if (! util.compareEntry(fromdir, entry)) {
fail("Entries not the same : " + fromdir.toString());
}
con.delete("uid=testadd,dc=nam,dc=compinternal,dc=com");
con.disconnect();
}