Added public getters for the most important context-related info.

This commit is contained in:
Ulrik Sandberg
2007-09-07 10:51:54 +00:00
parent 96bf1d3c89
commit 0ff2ad6c56
3 changed files with 87 additions and 8 deletions

View File

@@ -17,6 +17,16 @@ Consequently this is NOT a drop-in replacement for Spring LDAP 1.1.2,
though upgrading should not present all that much work. Please see
the supplied upgrade guide for details.
* Added getContextSource on LdapTemplate.
* The following getters on AbstractContextSource have been added:
getContextFactory
getDirObjectFactory
getAuthenticationSource
getUrls (was protected)
isPooled
isAnonymousReadOnly
* Upgraded to Spring 2.0.6 internally. Spring 1.2.x is still supported.
Changes in version 1.2-RC1 (5.12.2007)

View File

@@ -100,6 +100,15 @@ public class LdapTemplate implements LdapOperations, InitializingBean {
this.contextSource = contextSource;
}
/**
* Get the ContextSource.
*
* @return the ContextSource.
*/
public ContextSource getContextSource() {
return contextSource;
}
/**
* Specify whether <code>PartialResultException</code> should be ignored
* in searches. AD servers typically have a problem with referrals. Normally

View File

@@ -224,6 +224,15 @@ public abstract class AbstractContextSource implements ContextSource,
this.contextFactory = contextFactory;
}
/**
* Get the context factory.
*
* @return the context factory used when creating Contexts.
*/
public Class getContextFactory() {
return contextFactory;
}
/**
* Set the DirObjectFactory to use. Default is
* {@link DefaultDirObjectFactory}. The specified class needs to be an
@@ -239,6 +248,16 @@ public abstract class AbstractContextSource implements ContextSource,
this.dirObjectFactory = dirObjectFactory;
}
/**
* Get the DirObjectFactory to use.
*
* @return the DirObjectFactory to be used. <code>null</code> means that
* no DirObjectFactory will be used.
*/
public Class getDirObjectFactory() {
return dirObjectFactory;
}
/**
* Checks that all necessary data is set and that there is no compatibility
* issues, after which the instance is initialized. Note that you need to
@@ -347,6 +366,15 @@ public abstract class AbstractContextSource implements ContextSource,
this.urls = urls;
}
/**
* Get the urls of the LDAP servers.
*
* @return the urls of all servers.
*/
public String[] getUrls() {
return urls;
}
/**
* Set the url of the LDAP server. Utility method if only one server is
* used.
@@ -368,6 +396,15 @@ public abstract class AbstractContextSource implements ContextSource,
this.pooled = pooled;
}
/**
* Get whether the pooling flag should be set.
*
* @return whether Contexts should be pooled.
*/
public boolean isPooled() {
return pooled;
}
/**
* If any custom environment properties are needed, these can be set using
* this method.
@@ -397,9 +434,25 @@ public abstract class AbstractContextSource implements ContextSource,
return env;
}
/**
* Set the authentication source to use when retrieving user principal and
* credentials.
*
* @param authenticationSource
* the AuthenticationSource that will provide user info.
*/
public void setAuthenticationSource(
AuthenticationSource authenticationProvider) {
this.authenticationSource = authenticationProvider;
AuthenticationSource authenticationSource) {
this.authenticationSource = authenticationSource;
}
/**
* Get the authentication source.
*
* @return the AuthenticationSource that will provide user info.
*/
public AuthenticationSource getAuthenticationSource() {
return authenticationSource;
}
/**
@@ -423,13 +476,24 @@ public abstract class AbstractContextSource implements ContextSource,
* operations. Default is <code>false</code>.
*
* @param anonymousReadOnly
* <code>true</code> if and anonymous environment should be
* used for read-only operations, <code>false</code> otherwise.
* <code>true</code> if an anonymous environment should be used
* for read-only operations, <code>false</code> otherwise.
*/
public void setAnonymousReadOnly(boolean anonymousReadOnly) {
this.anonymousReadOnly = anonymousReadOnly;
}
/**
* Get whether an anonymous environment should be used for read-only
* operations.
*
* @return <code>true</code> if an anonymous environment should be used
* for read-only operations, <code>false</code> otherwise.
*/
public boolean isAnonymousReadOnly() {
return anonymousReadOnly;
}
/**
* Implement in subclass to create a DirContext of the desired type (e.g.
* InitialDirContext or InitialLdapContext).
@@ -454,8 +518,4 @@ public abstract class AbstractContextSource implements ContextSource,
}
}
protected String[] getUrls() {
return urls;
}
}