You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by no...@apache.org on 2006/09/23 16:15:45 UTC
svn commit: r449249 - in /james/server/trunk/src/java/org/apache/james:
transport/ userrepository/
Author: norman
Date: Sat Sep 23 07:15:44 2006
New Revision: 449249
URL: http://svn.apache.org/viewvc?view=rev&rev=449249
Log:
Fix/Add javadocs. See JAMES-628
Remove some unused imports and code
Readd some javadocs i removed before.
Modified:
james/server/trunk/src/java/org/apache/james/transport/LinearProcessor.java
james/server/trunk/src/java/org/apache/james/transport/StateAwareProcessorList.java
james/server/trunk/src/java/org/apache/james/userrepository/AbstractJdbcUsersRepository.java
james/server/trunk/src/java/org/apache/james/userrepository/DefaultJamesUser.java
james/server/trunk/src/java/org/apache/james/userrepository/DefaultUser.java
james/server/trunk/src/java/org/apache/james/userrepository/DefaultUsersJdbcRepository.java
james/server/trunk/src/java/org/apache/james/userrepository/JamesUsersJdbcRepository.java
james/server/trunk/src/java/org/apache/james/userrepository/ListUsersJdbcRepository.java
james/server/trunk/src/java/org/apache/james/userrepository/UsersFileRepository.java
james/server/trunk/src/java/org/apache/james/userrepository/UsersLDAPRepository.java
Modified: james/server/trunk/src/java/org/apache/james/transport/LinearProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/transport/LinearProcessor.java?view=diff&rev=449249&r1=449248&r2=449249
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/LinearProcessor.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/LinearProcessor.java Sat Sep 23 07:15:44 2006
@@ -267,6 +267,23 @@
}
/**
+ * <p>Processes a single mail message through the chain of matchers and mailets.</p>
+ *
+ * <p>Calls to this method before setSpool has been called with a non-null argument
+ * will result in an <code>IllegalStateException</code>.</p>
+ *
+ * <p>If the matcher/mailet lists have not been closed by a call to the closeProcessorLists
+ * method then a call to this method will result in an <code>IllegalStateException</code>.
+ * The end of the matcher/mailet chain must be a matcher that matches all mails and
+ * a mailet that sets every mail to GHOST status. This is necessary to ensure that
+ * mails are removed from the spool in an orderly fashion. The closeProcessorLists method
+ * ensures this.</p>
+ *
+ * @param mail the new mail to be processed
+ *
+ * @throws IllegalStateException when this method is called before the processor lists have been closed
+ * or the spool has been initialized
+ *
* @see org.apache.james.services.MailProcessor#service(org.apache.mailet.Mail)
*/
public void service(Mail mail) throws MessagingException {
Modified: james/server/trunk/src/java/org/apache/james/transport/StateAwareProcessorList.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/transport/StateAwareProcessorList.java?view=diff&rev=449249&r1=449248&r2=449249
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/StateAwareProcessorList.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/StateAwareProcessorList.java Sat Sep 23 07:15:44 2006
@@ -125,6 +125,11 @@
}
/**
+ * Process this mail message by the appropriate processor as designated
+ * in the state of the Mail object.
+ *
+ * @param mail the mail message to be processed
+ *
* @see org.apache.james.services.MailProcessor#service(org.apache.mailet.Mail)
*/
public void service(Mail mail) {
Modified: james/server/trunk/src/java/org/apache/james/userrepository/AbstractJdbcUsersRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/userrepository/AbstractJdbcUsersRepository.java?view=diff&rev=449249&r1=449248&r2=449249
==============================================================================
--- james/server/trunk/src/java/org/apache/james/userrepository/AbstractJdbcUsersRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/userrepository/AbstractJdbcUsersRepository.java Sat Sep 23 07:15:44 2006
@@ -108,6 +108,10 @@
// The JDBCUtil helper class
private JDBCUtil theJDBCUtil;
+ /**
+ * Set the DataSourceSelector
+ * @param datasources the DataSourceSelector
+ */
public void setDatasources(DataSourceSelector datasources) {
m_datasources = datasources;
}
@@ -155,6 +159,8 @@
* <sqlParameters table="JamesUsers"/>
* </repository>
* </pre>
+ *
+ * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
*/
public void configure(Configuration configuration) throws ConfigurationException
{
@@ -238,6 +244,8 @@
* <p>3) Initialises the database with the required tables, if necessary.</p>
*
* @throws Exception if an error occurs
+ *
+ * @see org.apache.avalon.framework.activity.Initializable#initialize()
*/
public void initialize() throws Exception
{
@@ -374,9 +382,9 @@
//
// Superclass methods - overridden from AbstractUsersRepository
//
+
/**
- * Returns a list populated with all of the Users in the repository.
- * @return an <code>Iterator</code> of <code>JamesUser</code>s.
+ * @see org.apache.james.userrepository.AbstractUsersRepository#listAllUsers()
*/
protected Iterator listAllUsers() {
return getAllUsers().iterator();
@@ -418,10 +426,7 @@
}
/**
- * Adds a user to the underlying Repository.
- * The user name must not clash with an existing user.
- *
- * @param user the user to be added
+ * @see org.apache.james.userrepository.AbstractUsersRepository#doAddUser(org.apache.james.services.User)
*/
protected void doAddUser(User user) {
Connection conn = openConnection();
@@ -447,11 +452,7 @@
}
/**
- * Removes a user from the underlying repository.
- * If the user doesn't exist this method doesn't throw
- * an exception.
- *
- * @param user the user to be removed
+ * @see org.apache.james.userrepository.AbstractUsersRepository#doRemoveUser(org.apache.james.services.User)
*/
protected void doRemoveUser(User user) {
String username = user.getUserName();
@@ -475,9 +476,7 @@
}
/**
- * Updates a user record to match the supplied User.
- *
- * @param user the updated user record
+ * @see org.apache.james.userrepository.AbstractUsersRepository#doUpdateUser(org.apache.james.services.User)
*/
protected void doUpdateUser(User user)
{
Modified: james/server/trunk/src/java/org/apache/james/userrepository/DefaultJamesUser.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/userrepository/DefaultJamesUser.java?view=diff&rev=449249&r1=449248&r2=449249
==============================================================================
--- james/server/trunk/src/java/org/apache/james/userrepository/DefaultJamesUser.java (original)
+++ james/server/trunk/src/java/org/apache/james/userrepository/DefaultJamesUser.java Sat Sep 23 07:15:44 2006
@@ -78,31 +78,21 @@
}
/**
- * Set whether mail to this user is to be forwarded to another
- * email address
- *
- * @param forward whether mail is forwarded
+ * @see org.apache.james.services.JamesUser#setForwarding(boolean)
*/
public void setForwarding(boolean forward) {
forwarding = forward;
}
/**
- * Get whether mail to this user is to be forwarded to another
- * email address.
- *
- * @return forward whether mail is forwarded
+ * @see org.apache.james.services.JamesUser#getForwarding()
*/
public boolean getForwarding() {
return forwarding;
}
-
/**
- * Set the destination address to which mail to this user
- * will be forwarded.
- *
- * @param address the forward-to address
+ * @see org.apache.james.services.JamesUser#setForwardingDestination(org.apache.mailet.MailAddress)
*/
public boolean setForwardingDestination(MailAddress address) {
/* TODO: Some verification would be good */
@@ -111,37 +101,28 @@
}
/**
- * Get the destination address to which mail to this user
- * will be forwarded.
- *
- * @return the forward-to address
+ * @see org.apache.james.services.JamesUser#getForwardingDestination()
*/
public MailAddress getForwardingDestination() {
return forwardingDestination;
}
/**
- * Set whether this user id is an alias.
- *
- * @param alias whether this id is an alias
+ * @see org.apache.james.services.JamesUser#setAliasing(boolean)
*/
public void setAliasing(boolean alias) {
aliasing = alias;
}
/**
- * Get whether this user id is an alias.
- *
- * @return whether this id is an alias
+ * @see org.apache.james.services.JamesUser#getAliasing()
*/
public boolean getAliasing() {
return aliasing;
}
/**
- * Set the user id for which this id is an alias.
- *
- * @param address the user id for which this id is an alias
+ * @see org.apache.james.services.JamesUser#setAlias(java.lang.String)
*/
public boolean setAlias(String address) {
/* TODO: Some verification would be good */
@@ -150,9 +131,7 @@
}
/**
- * Get the user id for which this id is an alias.
- *
- * @return the user id for which this id is an alias
+ * @see org.apache.james.services.JamesUser#getAlias()
*/
public String getAlias() {
return alias;
Modified: james/server/trunk/src/java/org/apache/james/userrepository/DefaultUser.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/userrepository/DefaultUser.java?view=diff&rev=449249&r1=449248&r2=449249
==============================================================================
--- james/server/trunk/src/java/org/apache/james/userrepository/DefaultUser.java (original)
+++ james/server/trunk/src/java/org/apache/james/userrepository/DefaultUser.java Sat Sep 23 07:15:44 2006
@@ -68,36 +68,26 @@
}
/**
- * Accessor for immutable name
- *
- * @return the String of this users name
+ * @see org.apache.james.services.User#getUserName()
*/
public String getUserName() {
return userName;
}
/**
- * Method to verify passwords.
- *
- * @param pass the String that is claimed to be the password for this user
- * @return true if the hash of pass with the current algorithm matches
- * the stored hash.
+ * @see org.apache.james.services.User#verifyPassword(java.lang.String)
*/
public boolean verifyPassword(String pass) {
try {
String hashGuess = DigestUtil.digestString(pass, algorithm);
return hashedPassword.equals(hashGuess);
} catch (NoSuchAlgorithmException nsae) {
- throw new RuntimeException("Security error: " + nsae);
- }
+ throw new RuntimeException("Security error: " + nsae);
+ }
}
/**
- * Sets new password from String. No checks made on guessability of
- * password.
- *
- * @param newPass the String that is the new password.
- * @return true if newPass successfuly hashed
+ * @see org.apache.james.services.User#setPassword(java.lang.String)
*/
public boolean setPassword(String newPass) {
try {
@@ -125,6 +115,4 @@
protected String getHashAlgorithm() {
return algorithm;
}
-
-
}
Modified: james/server/trunk/src/java/org/apache/james/userrepository/DefaultUsersJdbcRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/userrepository/DefaultUsersJdbcRepository.java?view=diff&rev=449249&r1=449248&r2=449249
==============================================================================
--- james/server/trunk/src/java/org/apache/james/userrepository/DefaultUsersJdbcRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/userrepository/DefaultUsersJdbcRepository.java Sat Sep 23 07:15:44 2006
@@ -42,12 +42,7 @@
public class DefaultUsersJdbcRepository extends AbstractJdbcUsersRepository
{
/**
- * Reads properties for a User from an open ResultSet.
- *
- * @param rsUsers A ResultSet with a User record in the current row.
- * @return A User instance
- * @throws SQLException
- * if an exception occurs reading from the ResultSet
+ * @see org.apache.james.userrepository.AbstractJdbcUsersRepository#readUserFromResultSet(java.sql.ResultSet)
*/
protected User readUserFromResultSet(ResultSet rsUsers) throws SQLException
{
@@ -60,14 +55,7 @@
}
/**
- * Set parameters of a PreparedStatement object with
- * property values from a User instance.
- *
- * @param user a User instance, which should be an implementation class which
- * is handled by this Repostory implementation.
- * @param userInsert a PreparedStatement initialised with SQL taken from the "insert" SQL definition.
- * @throws SQLException
- * if an exception occurs while setting parameter values.
+ * @see org.apache.james.userrepository.AbstractJdbcUsersRepository#setUserForInsertStatement(org.apache.james.services.User, java.sql.PreparedStatement)
*/
protected void setUserForInsertStatement(User user,
PreparedStatement userInsert)
@@ -80,14 +68,7 @@
}
/**
- * Set parameters of a PreparedStatement object with
- * property values from a User instance.
- *
- * @param user a User instance, which should be an implementation class which
- * is handled by this Repostory implementation.
- * @param userUpdate a PreparedStatement initialised with SQL taken from the "update" SQL definition.
- * @throws SQLException
- * if an exception occurs while setting parameter values.
+ * @see org.apache.james.userrepository.AbstractJdbcUsersRepository#setUserForUpdateStatement(org.apache.james.services.User, java.sql.PreparedStatement)
*/
protected void setUserForUpdateStatement(User user,
PreparedStatement userUpdate)
Modified: james/server/trunk/src/java/org/apache/james/userrepository/JamesUsersJdbcRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/userrepository/JamesUsersJdbcRepository.java?view=diff&rev=449249&r1=449248&r2=449249
==============================================================================
--- james/server/trunk/src/java/org/apache/james/userrepository/JamesUsersJdbcRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/userrepository/JamesUsersJdbcRepository.java Sat Sep 23 07:15:44 2006
@@ -36,12 +36,7 @@
public class JamesUsersJdbcRepository extends AbstractJdbcUsersRepository
{
/**
- * Reads properties for a User from an open ResultSet.
- *
- * @param rsUsers A ResultSet with a User record in the current row.
- * @return A User instance
- * @throws SQLException
- * if an exception occurs reading from the ResultSet
+ * @see org.apache.james.userrepository.AbstractJdbcUsersRepository#readUserFromResultSet(java.sql.ResultSet)
*/
protected User readUserFromResultSet(ResultSet rsUsers) throws SQLException
{
@@ -81,15 +76,9 @@
return user;
}
+
/**
- * Set parameters of a PreparedStatement object with
- * property values from a User instance.
- *
- * @param user a User instance, which should be an implementation class which
- * is handled by this Repostory implementation.
- * @param userInsert a PreparedStatement initialised with SQL taken from the "insert" SQL definition.
- * @throws SQLException
- * if an exception occurs while setting parameter values.
+ * @see org.apache.james.userrepository.AbstractJdbcUsersRepository#setUserForInsertStatement(org.apache.james.services.User, java.sql.PreparedStatement)
*/
protected void setUserForInsertStatement(User user,
PreparedStatement userInsert)
@@ -98,14 +87,7 @@
}
/**
- * Set parameters of a PreparedStatement object with
- * property values from a User instance.
- *
- * @param user a User instance, which should be an implementation class which
- * is handled by this Repostory implementation.
- * @param userUpdate a PreparedStatement initialised with SQL taken from the "update" SQL definition.
- * @throws SQLException
- * if an exception occurs while setting parameter values.
+ * @see org.apache.james.userrepository.AbstractJdbcUsersRepository#setUserForUpdateStatement(org.apache.james.services.User, java.sql.PreparedStatement)
*/
protected void setUserForUpdateStatement(User user,
PreparedStatement userUpdate)
Modified: james/server/trunk/src/java/org/apache/james/userrepository/ListUsersJdbcRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/userrepository/ListUsersJdbcRepository.java?view=diff&rev=449249&r1=449248&r2=449249
==============================================================================
--- james/server/trunk/src/java/org/apache/james/userrepository/ListUsersJdbcRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/userrepository/ListUsersJdbcRepository.java Sat Sep 23 07:15:44 2006
@@ -35,13 +35,9 @@
*/
public class ListUsersJdbcRepository extends AbstractJdbcUsersRepository
{
+
/**
- * Reads properties for a User from an open ResultSet.
- *
- * @param rsUsers A ResultSet with a User record in the current row.
- * @return A User instance
- * @throws SQLException
- * if an exception occurs reading from the ResultSet
+ * @see org.apache.james.userrepository.AbstractJdbcUsersRepository#readUserFromResultSet(java.sql.ResultSet)
*/
protected User readUserFromResultSet(ResultSet rsUsers) throws SQLException {
// Get the username, and build a DefaultUser with it.
@@ -51,13 +47,7 @@
}
/**
- * Set parameters of a PreparedStatement object with
- * property values from a User instance.
- * @param user a User instance, which should be an implementation class which
- * is handled by this Repostory implementation.
- * @param userInsert a PreparedStatement initialised with SQL taken from the "insert" SQL definition.
- * @throws SQLException
- * if an exception occurs while setting parameter values.
+ * @see org.apache.james.userrepository.AbstractJdbcUsersRepository#setUserForInsertStatement(org.apache.james.services.User, java.sql.PreparedStatement)
*/
protected void setUserForInsertStatement(User user,
PreparedStatement userInsert)
Modified: james/server/trunk/src/java/org/apache/james/userrepository/UsersFileRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/userrepository/UsersFileRepository.java?view=diff&rev=449249&r1=449248&r2=449249
==============================================================================
--- james/server/trunk/src/java/org/apache/james/userrepository/UsersFileRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/userrepository/UsersFileRepository.java Sat Sep 23 07:15:44 2006
@@ -68,6 +68,11 @@
*/
private String destination;
+ /**
+ * Set the Store
+ *
+ * @param store the Store
+ */
public void setStore(Store store) {
this.store = store;
}
@@ -134,21 +139,14 @@
}
/**
- * List users in repository.
- *
- * @return Iterator over a collection of Strings, each being one user in the repository.
+ * @see org.apache.james.services.UsersRepository#list()
*/
public Iterator list() {
return objectRepository.list();
}
/**
- * Update the repository with the specified user object. A user object
- * with this username must already exist.
- *
- * @param user the user to be added.
- *
- * @return true if successful.
+ * @see org.apache.james.services.UsersRepository#addUser(org.apache.james.services.User)
*/
public synchronized boolean addUser(User user) {
String username = user.getUserName();
@@ -163,6 +161,9 @@
return true;
}
+ /**
+ * @see org.apache.james.services.UsersRepository#addUser(java.lang.String, java.lang.Object)
+ */
public void addUser(String name, Object attributes) {
if (attributes instanceof String) {
User newbie = new DefaultUser(name, "SHA");
@@ -175,12 +176,18 @@
}
}
+ /**
+ * @see org.apache.james.services.UsersRepository#addUser(java.lang.String, java.lang.String)
+ */
public boolean addUser(String username, String password) {
User newbie = new DefaultJamesUser(username, "SHA");
newbie.setPassword(password);
return addUser(newbie);
}
+ /**
+ * @see org.apache.james.services.UsersRepository#getUserByName(java.lang.String)
+ */
public synchronized User getUserByName(String name) {
if (contains(name)) {
try {
@@ -194,6 +201,9 @@
}
}
+ /**
+ * @see org.apache.james.services.UsersRepository#getUserByNameCaseInsensitive(java.lang.String)
+ */
public User getUserByNameCaseInsensitive(String name) {
String realName = getRealName(name);
if (realName == null ) {
@@ -202,6 +212,9 @@
return getUserByName(realName);
}
+ /**
+ * @see org.apache.james.services.UsersRepository#getRealName(java.lang.String)
+ */
public String getRealName(String name) {
Iterator it = list();
while (it.hasNext()) {
@@ -213,6 +226,9 @@
return null;
}
+ /**
+ * @see org.apache.james.services.UsersRepository#updateUser(org.apache.james.services.User)
+ */
public boolean updateUser(User user) {
String username = user.getUserName();
if (!contains(username)) {
@@ -226,14 +242,23 @@
return true;
}
+ /**
+ * @see org.apache.james.services.UsersRepository#removeUser(java.lang.String)
+ */
public synchronized void removeUser(String name) {
objectRepository.remove(name);
}
+ /**
+ * @see org.apache.james.services.UsersRepository#contains(java.lang.String)
+ */
public boolean contains(String name) {
return objectRepository.containsKey(name);
}
+ /**
+ * @see org.apache.james.services.UsersRepository#containsCaseInsensitive(java.lang.String)
+ */
public boolean containsCaseInsensitive(String name) {
Iterator it = list();
while (it.hasNext()) {
@@ -244,6 +269,9 @@
return false;
}
+ /**
+ * @see org.apache.james.services.UsersRepository#test(java.lang.String, java.lang.String)
+ */
public boolean test(String name, String password) {
User user;
try {
@@ -258,6 +286,9 @@
return user.verifyPassword(password);
}
+ /**
+ * @see org.apache.james.services.UsersRepository#countUsers()
+ */
public int countUsers() {
int count = 0;
for (Iterator it = list(); it.hasNext(); it.next()) {
Modified: james/server/trunk/src/java/org/apache/james/userrepository/UsersLDAPRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/userrepository/UsersLDAPRepository.java?view=diff&rev=449249&r1=449248&r2=449249
==============================================================================
--- james/server/trunk/src/java/org/apache/james/userrepository/UsersLDAPRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/userrepository/UsersLDAPRepository.java Sat Sep 23 07:15:44 2006
@@ -261,14 +261,23 @@
return false;
}
+ /**
+ * @see org.apache.james.services.UsersRepository#getUserByName(java.lang.String)
+ */
public User getUserByName(String name) {
return new DefaultUser("dummy", "dummy");
}
+ /**
+ * @see org.apache.james.services.UsersRepository#getUserByNameCaseInsensitive(java.lang.String)
+ */
public User getUserByNameCaseInsensitive(String name) {
return getUserByName(name);
}
+ /**
+ * @see org.apache.james.services.UsersRepository#containsCaseInsensitive(java.lang.String)
+ */
public boolean containsCaseInsensitive(String name) {
return contains(name);
}
@@ -280,6 +289,9 @@
return null;
}
+ /**
+ * @see org.apache.james.services.UsersRepository#updateUser(org.apache.james.services.User)
+ */
public boolean updateUser(User user) {
return false;
}
@@ -431,6 +443,9 @@
}
}
+ /**
+ * @see org.apache.james.services.UsersRepository#removeUser(java.lang.String)
+ */
public synchronized void removeUser(String userName) {
String[] attrIDs = {membersAttr};
@@ -570,6 +585,9 @@
}
+ /**
+ * @see org.apache.james.services.UsersRepository#contains(java.lang.String)
+ */
public boolean contains(String name) {
boolean found = false;
String[] attrIDs = {membersAttr};
@@ -600,6 +618,9 @@
}
+ /**
+ * @see org.apache.james.services.UsersRepository#test(java.lang.String, java.lang.String)
+ */
public boolean test(String name, String testPassword) {
boolean result = false;
boolean foundFlag = false;
@@ -700,6 +721,9 @@
}
+ /**
+ * @see org.apache.james.services.UsersRepository#countUsers()
+ */
public int countUsers() {
String[] attrIDs = {membersAttr};
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org