Switch to new meta model,fixed small bugs and made demo work pretty oke.
This commit is contained in:
parent
afd821c360
commit
b3635cf64d
46 changed files with 1055 additions and 688 deletions
|
|
@ -61,6 +61,8 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
private String keyAttribute = null;
|
||||
private String ldapFilter = null;
|
||||
private String createObjectClass = null;
|
||||
private int timeLimit = 10000;
|
||||
private boolean referralFollowing = true;
|
||||
|
||||
/**
|
||||
* @return the ldapConnectionProvider
|
||||
|
|
@ -75,9 +77,6 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
public void setLdapConnectionProvider(LdapConnectionProvider ldapConnectionProvider) {
|
||||
this.ldapConnectionProvider = ldapConnectionProvider;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see net.forwardfire.vasc.backend.VascBackend#execute()
|
||||
|
|
@ -88,23 +87,21 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
List<Object> result = new ArrayList<Object>(50);
|
||||
try {
|
||||
|
||||
|
||||
LDAPSearchConstraints cons = new LDAPSearchConstraints();
|
||||
cons.setBatchSize( 0 );
|
||||
cons.setTimeLimit( 10000 ) ;
|
||||
cons.setReferralFollowing(true);
|
||||
cons.setTimeLimit(getTimeLimit() ) ;
|
||||
cons.setReferralFollowing(isReferralFollowing());
|
||||
connection.setConstraints(cons);
|
||||
|
||||
int searchScope = LDAPConnection.SCOPE_ONE;
|
||||
String searchBase = baseDN;
|
||||
|
||||
//System.out.println("Reading object :" + searchBase + " with filter: " + ldapFilter);
|
||||
LDAPSearchResults searchResults = connection.search(
|
||||
searchBase, // object to read
|
||||
searchScope, // scope - read single object
|
||||
ldapFilter, // search filter
|
||||
null, // return all attributes
|
||||
false); // return attrs and values
|
||||
searchBase, // object to read
|
||||
searchScope, // scope - read single object
|
||||
getLdapFilter(), // search filter
|
||||
null, // return all attributes
|
||||
false); // return attrs and values
|
||||
|
||||
while (searchResults.hasMore()) {
|
||||
LDAPEntry entry = searchResults.next();
|
||||
|
|
@ -114,7 +111,6 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
Iterator<LDAPAttribute> i = attributeSet.iterator();
|
||||
while (i.hasNext()) {
|
||||
LDAPAttribute attr = i.next();
|
||||
//System.out.println("ATTR: "+attr.getName()+" value: "+attr.getStringValue());
|
||||
String[] s = attr.getStringValueArray();
|
||||
if (s.length==1) {
|
||||
map.put(attr.getName(), attr.getStringValue());
|
||||
|
|
@ -149,14 +145,12 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
String keyValue = (String)map.get(keyAttribute);
|
||||
LDAPSearchConstraints cons = new LDAPSearchConstraints();
|
||||
cons.setBatchSize( 0 );
|
||||
cons.setTimeLimit( 10000 ) ;
|
||||
cons.setReferralFollowing(true);
|
||||
cons.setTimeLimit(getTimeLimit() ) ;
|
||||
cons.setReferralFollowing(isReferralFollowing());
|
||||
connection.setConstraints(cons);
|
||||
|
||||
int searchScope = LDAPConnection.SCOPE_ONE;
|
||||
String searchBase = baseDN;
|
||||
String filter = "(&("+keyAttribute+"="+keyValue+"))";
|
||||
System.out.println("ldap filter: "+filter);
|
||||
String filter = "(&"+ldapFilter+"("+keyAttribute+"="+keyValue+"))";
|
||||
LDAPSearchResults searchResults = connection.search(
|
||||
searchBase, // object to read
|
||||
searchScope, // scope - read single object
|
||||
|
|
@ -210,8 +204,9 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
}
|
||||
|
||||
LDAPModification[] m = new LDAPModification[mods.size()];
|
||||
mods.toArray(m);
|
||||
m = mods.toArray(m);
|
||||
connection.modify(entry.getDN(), m);
|
||||
|
||||
return object;
|
||||
} catch (Exception e) {
|
||||
throw new VascException(e);
|
||||
|
|
@ -270,7 +265,7 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
String keyValue = (String)map.get(keyAttribute);
|
||||
int searchScope = LDAPConnection.SCOPE_ONE;
|
||||
String searchBase = baseDN;
|
||||
String filter = "(&("+ldapFilter+")("+keyAttribute+"="+keyValue+"))";
|
||||
String filter = "(&"+ldapFilter+"("+keyAttribute+"="+keyValue+"))";
|
||||
LDAPSearchResults searchResults = connection.search(
|
||||
searchBase, // object to read
|
||||
searchScope, // scope - read single object
|
||||
|
|
@ -362,4 +357,32 @@ public class LdapVascBackend extends AbstractVascBackend {
|
|||
public void setCreateObjectClass(String createObjectClass) {
|
||||
this.createObjectClass = createObjectClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the timeLimit
|
||||
*/
|
||||
public int getTimeLimit() {
|
||||
return timeLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param timeLimit the timeLimit to set
|
||||
*/
|
||||
public void setTimeLimit(int timeLimit) {
|
||||
this.timeLimit = timeLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the referralFollowing
|
||||
*/
|
||||
public boolean isReferralFollowing() {
|
||||
return referralFollowing;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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