Java Doc for AbstractJdbcUsersRepository.java in  » Net » james-2.3.1 » org » apache » james » userrepository » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » james 2.3.1 » org.apache.james.userrepository 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.james.userrepository.AbstractUsersRepository
   org.apache.james.userrepository.AbstractJdbcUsersRepository

All known Subclasses:   org.apache.james.userrepository.ListUsersJdbcRepository,  org.apache.james.userrepository.JamesUsersJdbcRepository,  org.apache.james.userrepository.DefaultUsersJdbcRepository,
AbstractJdbcUsersRepository
abstract public class AbstractJdbcUsersRepository extends AbstractUsersRepository implements Contextualizable,Serviceable,Configurable,Initializable(Code)
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
selectSelect all users.
insertInsert a user.
updateUpdate a user.
deleteDelete a user by name.
createTableCreate the users table.
Optional
selectByLowercaseNameSelect a user by name (case-insensitive lowercase).


Field Summary
protected  Contextcontext
    
protected  Mapm_sqlParameters
    


Method Summary
public  voidconfigure(Configuration configuration)
    
public  voidcontextualize(Context context)
    
protected  voiddoAddUser(User user)
     Adds a user to the underlying Repository.
protected  voiddoRemoveUser(User user)
     Removes a user from the underlying repository.
protected  voiddoUpdateUser(User user)
     Updates a user record to match the supplied User.
protected  UsergetUserByName(String name, boolean ignoreCase)
     Gets a user by name, ignoring case if specified.
public  voidinitialize()
    
protected  IteratorlistAllUsers()
     Returns a list populated with all of the Users in the repository.
protected  ListlistUserNames()
     Produces the complete list of User names, with correct case.
abstract protected  UserreadUserFromResultSet(ResultSet rsUsers)
     Reads properties for a User from an open ResultSet. Subclass implementations of this method must have knowledge of the fields presented by the "select" and "selectByLowercaseName" SQL statements. These implemenations may generate a subclass-specific User instance.
Parameters:
  rsUsers - A ResultSet with a User record in the current row.
public  voidservice(ServiceManager componentManager)
    
abstract protected  voidsetUserForInsertStatement(User user, PreparedStatement userInsert)
     Set parameters of a PreparedStatement object with property values from a User instance.
abstract protected  voidsetUserForUpdateStatement(User user, PreparedStatement userUpdate)
     Set parameters of a PreparedStatement object with property values from a User instance.

Field Detail
context
protected Context context(Code)
The Avalon context used by the instance



m_sqlParameters
protected Map m_sqlParameters(Code)





Method Detail
configure
public void configure(Configuration configuration) throws ConfigurationException(Code)
Configures the UserRepository for JDBC access.

Requires a configuration element in the .conf.xml file of the form:

 <repository name="LocalUsers"
 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>
 



contextualize
public void contextualize(Context context) throws ContextException(Code)

See Also:   org.apache.avalon.framework.context.Contextualizable.contextualize(Context)



doAddUser
protected void doAddUser(User user)(Code)
Adds a user to the underlying Repository. The user name must not clash with an existing user.
Parameters:
  user - the user to be added



doRemoveUser
protected void doRemoveUser(User user)(Code)
Removes a user from the underlying repository. If the user doesn't exist this method doesn't throw an exception.
Parameters:
  user - the user to be removed



doUpdateUser
protected void doUpdateUser(User user)(Code)
Updates a user record to match the supplied User.
Parameters:
  user - the updated user record



getUserByName
protected User getUserByName(String name, boolean ignoreCase)(Code)
Gets a user by name, ignoring case if specified. If the specified SQL statement has been defined, this method overrides the basic implementation in AbstractUsersRepository to increase performance.
Parameters:
  name - the name of the user being retrieved
Parameters:
  ignoreCase - whether the name is regarded as case-insensitive the user being retrieved, null if the user doesn't exist



initialize
public void initialize() throws Exception(Code)

Initialises the JDBC repository.

1) Tests the connection to the database.

2) Loads SQL strings from the SQL definition file, choosing the appropriate SQL for this connection, and performing parameter substitution,

3) Initialises the database with the required tables, if necessary.


throws:
  Exception - if an error occurs



listAllUsers
protected Iterator listAllUsers()(Code)
Returns a list populated with all of the Users in the repository. an Iterator of JamesUsers.



listUserNames
protected List listUserNames()(Code)
Produces the complete list of User names, with correct case. a List of Strings representinguser names.



readUserFromResultSet
abstract protected User readUserFromResultSet(ResultSet rsUsers) throws SQLException(Code)
Reads properties for a User from an open ResultSet. Subclass implementations of this method must have knowledge of the fields presented by the "select" and "selectByLowercaseName" SQL statements. These implemenations may generate a subclass-specific User instance.
Parameters:
  rsUsers - A ResultSet with a User record in the current row. A User instance
throws:
  SQLException - if an exception occurs reading from the ResultSet



service
public void service(ServiceManager componentManager) throws ServiceException(Code)

See Also:   org.apache.avalon.framework.service.Serviceable.compose(ServiceManager)



setUserForInsertStatement
abstract protected void setUserForInsertStatement(User user, PreparedStatement userInsert) throws SQLException(Code)
Set parameters of a PreparedStatement object with property values from a User instance. Implementations of this method have knowledge of the parameter ordering of the "insert" SQL statement definition.
Parameters:
  user - a User instance, which should be an implementation class whichis handled by this Repostory implementation.
Parameters:
  userInsert - a PreparedStatement initialised with SQL taken from the "insert" SQL definition.
throws:
  SQLException - if an exception occurs while setting parameter values.



setUserForUpdateStatement
abstract protected void setUserForUpdateStatement(User user, PreparedStatement userUpdate) throws SQLException(Code)
Set parameters of a PreparedStatement object with property values from a User instance. Implementations of this method have knowledge of the parameter ordering of the "update" SQL statement definition.
Parameters:
  user - a User instance, which should be an implementation class whichis handled by this Repostory implementation.
Parameters:
  userUpdate - a PreparedStatement initialised with SQL taken from the "update" SQL definition.
throws:
  SQLException - if an exception occurs while setting parameter values.



Methods inherited from org.apache.james.userrepository.AbstractUsersRepository
public boolean addUser(User user)(Code)(Java Doc)
public void addUser(String name, Object attributes)(Code)(Java Doc)
public boolean addUser(String username, String password)(Code)(Java Doc)
public boolean contains(String name)(Code)(Java Doc)
public boolean containsCaseInsensitive(String name)(Code)(Java Doc)
public int countUsers()(Code)(Java Doc)
abstract protected void doAddUser(User user)(Code)(Java Doc)
abstract protected void doRemoveUser(User user)(Code)(Java Doc)
abstract protected void doUpdateUser(User user)(Code)(Java Doc)
public String getRealName(String name)(Code)(Java Doc)
protected User getUserByName(String name, boolean ignoreCase)(Code)(Java Doc)
public User getUserByName(String name)(Code)(Java Doc)
public User getUserByNameCaseInsensitive(String name)(Code)(Java Doc)
public Iterator list()(Code)(Java Doc)
abstract protected Iterator listAllUsers()(Code)(Java Doc)
protected List listUserNames()(Code)(Java Doc)
public void removeUser(String name)(Code)(Java Doc)
public boolean test(String name, String password)(Code)(Java Doc)
public boolean updateUser(User user)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.