renamed backend summary lines.
This commit is contained in:
parent
a13719f008
commit
9a6227be5b
9 changed files with 108 additions and 78 deletions
|
|
@ -27,6 +27,7 @@ import java.util.HashMap;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.forwardfire.vasc.backend.AbstractVascBackend;
|
||||
import net.forwardfire.vasc.backend.VascBackendException;
|
||||
|
|
@ -40,19 +41,20 @@ import com.novell.ldap.LDAPAttribute;
|
|||
import com.novell.ldap.LDAPAttributeSet;
|
||||
import com.novell.ldap.LDAPConnection;
|
||||
import com.novell.ldap.LDAPEntry;
|
||||
import com.novell.ldap.LDAPException;
|
||||
import com.novell.ldap.LDAPModification;
|
||||
import com.novell.ldap.LDAPSearchConstraints;
|
||||
import com.novell.ldap.LDAPSearchResults;
|
||||
|
||||
/**
|
||||
* Provides backend for ldap.
|
||||
* LdapVascBackend provides abstract data access for ldap.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Sep 4, 2008
|
||||
*/
|
||||
public class LdapVascBackend extends AbstractVascBackend {
|
||||
|
||||
|
||||
|
||||
private Logger logger = Logger.getLogger(LdapVascBackend.class.getName());
|
||||
private LdapConnectionProvider ldapConnectionProvider = null;
|
||||
private String baseDN = null;
|
||||
private String keyAttribute = null;
|
||||
|
|
@ -62,14 +64,14 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
private boolean referralFollowing = true;
|
||||
|
||||
/**
|
||||
* @return the ldapConnectionProvider
|
||||
* @return the ldapConnectionProvider.
|
||||
*/
|
||||
public LdapConnectionProvider getLdapConnectionProvider() {
|
||||
return ldapConnectionProvider;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ldapConnectionProvider the ldapConnectionProvider to set
|
||||
* @param ldapConnectionProvider the ldapConnectionProvider to set.
|
||||
*/
|
||||
public void setLdapConnectionProvider(LdapConnectionProvider ldapConnectionProvider) {
|
||||
this.ldapConnectionProvider = ldapConnectionProvider;
|
||||
|
|
@ -121,16 +123,14 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
}
|
||||
result.add(map);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (LDAPException e) {
|
||||
throw new VascBackendException(e);
|
||||
} finally {
|
||||
if (connection!=null) {
|
||||
connection.clone();
|
||||
}
|
||||
safeDisconnect(connection);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#merge(java.lang.Object)
|
||||
*/
|
||||
|
|
@ -205,15 +205,13 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
connection.modify(entry.getDN(), m);
|
||||
|
||||
return object;
|
||||
} catch (Exception e) {
|
||||
} catch (LDAPException e) {
|
||||
throw new VascBackendException(e);
|
||||
} finally {
|
||||
if (connection!=null) {
|
||||
connection.clone();
|
||||
}
|
||||
safeDisconnect(connection);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#persist(java.lang.Object)
|
||||
*/
|
||||
|
|
@ -242,12 +240,10 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
entry.getAttributeSet().add(attr);
|
||||
}
|
||||
connection.add(entry);
|
||||
} catch (Exception e) {
|
||||
} catch (LDAPException e) {
|
||||
throw new VascBackendException(e);
|
||||
} finally {
|
||||
if (connection!=null) {
|
||||
connection.clone();
|
||||
}
|
||||
safeDisconnect(connection);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -276,12 +272,21 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
}
|
||||
LDAPEntry entry = searchResults.next();
|
||||
connection.delete(entry.getDN());
|
||||
} catch (Exception e) {
|
||||
} catch (LDAPException e) {
|
||||
throw new VascBackendException(e);
|
||||
} finally {
|
||||
if (connection!=null) {
|
||||
connection.clone();
|
||||
}
|
||||
safeDisconnect(connection);
|
||||
}
|
||||
}
|
||||
|
||||
private void safeDisconnect(LDAPConnection connection) {
|
||||
if (connection==null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
connection.disconnect();
|
||||
} catch (LDAPException e) {
|
||||
logger.warning("Error while disconnecting: "+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -291,95 +296,95 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
public VascEntryRecordCreator provideVascEntryRecordCreator() {
|
||||
return new MapVascEntryRecordCreator();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#provideVascEntryFieldValue()
|
||||
*/
|
||||
public VascEntryFieldValue provideVascEntryFieldValue() {
|
||||
return new MapVascEntryFieldValue();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the baseDN
|
||||
* @return the baseDN.
|
||||
*/
|
||||
public String getBaseDN() {
|
||||
return baseDN;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param baseDN the baseDN to set
|
||||
* @param baseDN the baseDN to set.
|
||||
*/
|
||||
public void setBaseDN(String baseDN) {
|
||||
this.baseDN = baseDN;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the keyAttribute
|
||||
* @return the keyAttribute.
|
||||
*/
|
||||
public String getKeyAttribute() {
|
||||
return keyAttribute;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param keyAttribute the keyAttribute to set
|
||||
* @param keyAttribute the keyAttribute to set.
|
||||
*/
|
||||
public void setKeyAttribute(String keyAttribute) {
|
||||
this.keyAttribute = keyAttribute;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the ldapFilter
|
||||
* @return the ldapFilter.
|
||||
*/
|
||||
public String getLdapFilter() {
|
||||
return ldapFilter;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param ldapFilter the ldapFilter to set
|
||||
* @param ldapFilter the ldapFilter to set.
|
||||
*/
|
||||
public void setLdapFilter(String ldapFilter) {
|
||||
this.ldapFilter = ldapFilter;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the createObjectClass
|
||||
* @return the createObjectClass.
|
||||
*/
|
||||
public String getCreateObjectClass() {
|
||||
return createObjectClass;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param createObjectClass the createObjectClass to set
|
||||
* @param createObjectClass the createObjectClass to set.
|
||||
*/
|
||||
public void setCreateObjectClass(String createObjectClass) {
|
||||
this.createObjectClass = createObjectClass;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the timeLimit
|
||||
* @return the timeLimit.
|
||||
*/
|
||||
public int getTimeLimit() {
|
||||
return timeLimit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param timeLimit the timeLimit to set
|
||||
* @param timeLimit the timeLimit to set.
|
||||
*/
|
||||
public void setTimeLimit(int timeLimit) {
|
||||
this.timeLimit = timeLimit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the referralFollowing
|
||||
* @return the referralFollowing.
|
||||
*/
|
||||
public boolean isReferralFollowing() {
|
||||
return referralFollowing;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param referralFollowing the referralFollowing to set
|
||||
* @param referralFollowing the referralFollowing to set.
|
||||
*/
|
||||
public void setReferralFollowing(boolean referralFollowing) {
|
||||
this.referralFollowing = referralFollowing;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue