From 254ee6f47eebfc00462c10756a92066e82cc1a96 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Tue, 21 Jun 2011 15:46:02 +0200 Subject: Initial commit --- .../c2kernel/lookup/LegacyLDAPPropertyManager.java | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100755 source/com/c2kernel/lookup/LegacyLDAPPropertyManager.java (limited to 'source/com/c2kernel/lookup/LegacyLDAPPropertyManager.java') diff --git a/source/com/c2kernel/lookup/LegacyLDAPPropertyManager.java b/source/com/c2kernel/lookup/LegacyLDAPPropertyManager.java new file mode 100755 index 0000000..62653fb --- /dev/null +++ b/source/com/c2kernel/lookup/LegacyLDAPPropertyManager.java @@ -0,0 +1,70 @@ +package com.c2kernel.lookup; + +import com.c2kernel.common.ObjectCannotBeUpdated; +import com.c2kernel.common.ObjectNotFoundException; +import com.c2kernel.property.Property; +import com.c2kernel.utils.Logger; +import com.novell.ldap.LDAPAttribute; +import com.novell.ldap.LDAPAttributeSet; +import com.novell.ldap.LDAPDN; +import com.novell.ldap.LDAPEntry; +import com.novell.ldap.LDAPException; + +public class LegacyLDAPPropertyManager extends LDAPPropertyManager { + + public LegacyLDAPPropertyManager(LDAPLookup ldap) { + super(ldap); + } + + public void deleteProperty(EntityPath thisEntity, String name) throws ObjectNotFoundException, ObjectCannotBeUpdated { + try { + LDAPLookupUtils.delete(ldap.getConnection(), "cn="+name+","+thisEntity.getFullDN()); + } catch (LDAPException ex) { + Logger.error("Error deleting prop "+name+" from "+thisEntity.getSysKey()); + Logger.error(ex); + } + } + + public String[] getPropertyNames(EntityPath thisEntity) throws ObjectNotFoundException { + String props[]= LDAPLookupUtils.getChildrenDNs(ldap.getConnection(), thisEntity.getFullDN(), "objectclass=cristalproperty"); + String names[] = new String[props.length]; + for (int i=0; i