@Deprecated public abstract class AbstractJdbcUsersRepository extends AbstractJamesUsersRepository
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). |
RecipientRewriteTable.ErrorMappingException
Modifier and Type | Field and Description |
---|---|
protected Map<String,String> |
m_sqlParameters
Deprecated.
|
enableAliases, enableForwarding, ignoreCase
ALIASDOMAIN_PREFIX, ERROR_PREFIX, REGEX_PREFIX, WILDCARD
Constructor and Description |
---|
AbstractJdbcUsersRepository()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
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'.
|
addAddressMapping, addAliasDomainMapping, addErrorMapping, addMapping, addRegexMapping, configure, doAddUser, getAllMappings, getMappings, getUserDomainMappings, removeAddressMapping, removeAliasDomainMapping, removeErrorMapping, removeMapping, removeRegexMapping, setEnableAliases, setEnableForwarding, setIgnoreCase, updateUser
addUser, getLogger, isValidUsername, setDomainList, setEnableVirtualHosting, setLog, supportVirtualHosting
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addUser, supportVirtualHosting
public void removeUser(String userName) throws UsersRepositoryException
userName
- the user to be removedUsersRepositoryException
public User getUserByName(String name) throws UsersRepositoryException
name
- the name of the user to retrieveUsersRepositoryException
- if errorpublic boolean contains(String name) throws UsersRepositoryException
name
- the name to check in the repositoryUsersRepositoryException
- if errorpublic 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 testedUsersRepositoryException
- if errorpublic int countUsers() throws UsersRepositoryException
UsersRepositoryException
- if errorpublic Iterator<String> list() throws UsersRepositoryException
UsersRepositoryException
- if errorpublic 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 occursprotected 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 AbstractUsersRepository
org.apache.commons.configuration.ConfigurationException
AbstractUsersRepository.doConfigure(org.apache.commons.configuration.HierarchicalConfiguration)
protected List<String> listUserNames() throws UsersRepositoryException
List
of String
s representing user
names.UsersRepositoryException
protected Iterator<User> listAllUsers() throws UsersRepositoryException
Iterator
of User
s.UsersRepositoryException
protected void doAddUser(User user) throws UsersRepositoryException
doAddUser
in class AbstractJamesUsersRepository
user
- the user to addUsersRepositoryException
protected void doRemoveUser(User user) throws UsersRepositoryException
user
- the user to removeUsersRepositoryException
protected void doUpdateUser(User user) throws UsersRepositoryException
doUpdateUser
in class AbstractJamesUsersRepository
user
- the user to updateUsersRepositoryException
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-insensitiveUsersRepositoryException
protected User getUserByName(String name, boolean ignoreCase) throws UsersRepositoryException
name
- the name of the user being retrievedignoreCase
- whether the name is regarded as case-insensitiveUsersRepositoryException
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 ResultSetprotected 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.Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.