|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.james.user.lib.AbstractUsersRepository
org.apache.james.user.lib.AbstractJamesUsersRepository
org.apache.james.user.jdbc.AbstractJdbcUsersRepository
@Deprecated public abstract class AbstractJdbcUsersRepository
An abstract base class for creating UserRepository implementations which use a database for persistence. To implement a new UserRepository using by extending this class, you need to implement the 3 abstract methods defined below, and define the required SQL statements in an SQLResources file. The SQL statements used by this implementation are:
| Required | |
| select | Select all users. |
| insert | Insert a user. |
| update | Update a user. |
| delete | Delete a user by name. |
| createTable | Create the users table. |
| Optional | |
| selectByLowercaseName | Select a user by name (case-insensitive lowercase). |
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.apache.james.rrt.api.RecipientRewriteTable |
|---|
RecipientRewriteTable.ErrorMappingException |
| Field Summary | |
|---|---|
protected Map<String,String> |
m_sqlParameters
Deprecated. |
| Fields inherited from class org.apache.james.user.lib.AbstractJamesUsersRepository |
|---|
enableAliases, enableForwarding, ignoreCase |
| Fields inherited from interface org.apache.james.rrt.api.RecipientRewriteTable |
|---|
ALIASDOMAIN_PREFIX, ERROR_PREFIX, REGEX_PREFIX, WILDCARD |
| Constructor Summary | |
|---|---|
AbstractJdbcUsersRepository()
Deprecated. |
|
| Method Summary | |
|---|---|
boolean |
contains(String name)
Deprecated. Returns whether or not this user is in the repository |
boolean |
containsCaseInsensitive(String name)
Deprecated. Returns whether or not this user is in the repository. |
int |
countUsers()
Deprecated. Returns a count of the users in the repository. |
protected void |
doAddUser(User user)
Deprecated. Adds a user to the underlying Repository. |
protected void |
doConfigure(org.apache.commons.configuration.HierarchicalConfiguration configuration)
Deprecated. Configures the UserRepository for JDBC access. |
protected void |
doRemoveUser(User user)
Deprecated. Removes a user from the underlying repository. |
protected void |
doUpdateUser(User user)
Deprecated. Updates a user record to match the supplied User. |
User |
getUserByName(String name)
Deprecated. Get the user object with the specified user name. |
protected User |
getUserByName(String name,
boolean ignoreCase)
Deprecated. Gets a user by name, ignoring case if specified. |
protected User |
getUserByNameIterating(String name,
boolean ignoreCase)
Deprecated. Gets a user by name, ignoring case if specified. |
void |
init()
Deprecated. Initialises the JDBC repository. |
Iterator<String> |
list()
Deprecated. List users in repository. |
protected Iterator<User> |
listAllUsers()
Deprecated. Returns a list populated with all of the Users in the repository. |
protected List<String> |
listUserNames()
Deprecated. Produces the complete list of User names, with correct case. |
protected abstract User |
readUserFromResultSet(ResultSet rsUsers)
Deprecated. Reads properties for a User from an open ResultSet. |
void |
removeUser(String userName)
Deprecated. Removes a user from the repository |
void |
setDatasource(DataSource m_datasource)
Deprecated. Set the DataSourceSelector |
void |
setFileSystem(FileSystem system)
Deprecated. Sets the filesystem service |
protected abstract void |
setUserForInsertStatement(User user,
PreparedStatement userInsert)
Deprecated. Set parameters of a PreparedStatement object with property values from a User instance. |
protected abstract void |
setUserForUpdateStatement(User user,
PreparedStatement userUpdate)
Deprecated. Set parameters of a PreparedStatement object with property values from a User instance. |
boolean |
test(String name,
String password)
Deprecated. Test if user with name 'name' has password 'password'. |
| Methods inherited from class org.apache.james.user.lib.AbstractJamesUsersRepository |
|---|
addAddressMapping, addAliasDomainMapping, addErrorMapping, addMapping, addRegexMapping, configure, doAddUser, getAllMappings, getMappings, getUserDomainMappings, removeAddressMapping, removeAliasDomainMapping, removeErrorMapping, removeMapping, removeRegexMapping, setEnableAliases, setEnableForwarding, setIgnoreCase, updateUser |
| Methods inherited from class org.apache.james.user.lib.AbstractUsersRepository |
|---|
addUser, getLogger, isValidUsername, setDomainList, setEnableVirtualHosting, setLog, supportVirtualHosting |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.james.user.api.UsersRepository |
|---|
addUser, supportVirtualHosting |
| Field Detail |
|---|
protected Map<String,String> m_sqlParameters
| Constructor Detail |
|---|
public AbstractJdbcUsersRepository()
| Method Detail |
|---|
public void removeUser(String userName)
throws UsersRepositoryException
userName - the user to be removed
UsersRepositoryException
public User getUserByName(String name)
throws UsersRepositoryException
name - the name of the user to retrieve
UsersRepositoryException
public boolean contains(String name)
throws UsersRepositoryException
UsersRepositoryException
public boolean containsCaseInsensitive(String name)
throws UsersRepositoryException
UsersRepositoryException
public boolean test(String name,
String password)
throws UsersRepositoryException
name - the name of the user to be testedpassword - the password to be tested
UsersRepositoryException
public int countUsers()
throws UsersRepositoryException
UsersRepositoryException
public Iterator<String> list()
throws UsersRepositoryException
UsersRepositoryExceptionpublic void setDatasource(DataSource m_datasource)
m_datasource - the DataSourceSelectorpublic void setFileSystem(FileSystem system)
system - the new service
@PostConstruct
public void init()
throws Exception
Exception - if an error occurs
protected void doConfigure(org.apache.commons.configuration.HierarchicalConfiguration configuration)
throws org.apache.commons.configuration.ConfigurationException
Configures the UserRepository for JDBC access.
Requires a configuration element in the .conf.xml file of the form:
<repository name="so even "
class="org.apache.james.userrepository.JamesUsersJdbcRepository">
<!-- Name of the datasource to use -->
<data-source>MailDb</data-source>
<!-- File to load the SQL definitions from -->
<sqlFile>dist/conf/sqlResources.xml</sqlFile>
<!-- replacement parameters for the sql file -->
<sqlParameters table="JamesUsers"/>
</repository>
doConfigure in class AbstractUsersRepositoryorg.apache.commons.configuration.ConfigurationExceptionAbstractUsersRepository.doConfigure(org.apache.commons.configuration.HierarchicalConfiguration)
protected List<String> listUserNames()
throws UsersRepositoryException
List of Strings representing user
names.
UsersRepositoryException
protected Iterator<User> listAllUsers()
throws UsersRepositoryException
Iterator of Users.
UsersRepositoryException
protected void doAddUser(User user)
throws UsersRepositoryException
doAddUser in class AbstractJamesUsersRepositoryuser - the user to add
UsersRepositoryException
protected void doRemoveUser(User user)
throws UsersRepositoryException
user - the user to remove
UsersRepositoryException
protected void doUpdateUser(User user)
throws UsersRepositoryException
doUpdateUser in class AbstractJamesUsersRepositoryuser - the user to update
UsersRepositoryException
protected User getUserByNameIterating(String name,
boolean ignoreCase)
throws UsersRepositoryException
name.
name - the name of the user being retrievedignoreCase - whether the name is regarded as case-insensitive
UsersRepositoryException
protected User getUserByName(String name,
boolean ignoreCase)
throws UsersRepositoryException
name - the name of the user being retrievedignoreCase - whether the name is regarded as case-insensitive
UsersRepositoryException
protected abstract User readUserFromResultSet(ResultSet rsUsers)
throws SQLException
rsUsers - A ResultSet with a User record in the current row.
SQLException - if an exception occurs reading from the ResultSet
protected abstract void setUserForInsertStatement(User user,
PreparedStatement userInsert)
throws SQLException
user - a User instance, which should be an implementation class which
is handled by this Repostory implementation.userInsert - a PreparedStatement initialised with SQL taken from the
"insert" SQL definition.
SQLException - if an exception occurs while setting parameter values.
protected abstract void setUserForUpdateStatement(User user,
PreparedStatement userUpdate)
throws SQLException
user - a User instance, which should be an implementation class which
is handled by this Repostory implementation.userUpdate - a PreparedStatement initialised with SQL taken from the
"update" SQL definition.
SQLException - if an exception occurs while setting parameter values.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||