james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simeon Kirov" <ski...@worldnn.com>
Subject [PROPOSAL] Accessing arbitrary User properties
Date Mon, 21 Jul 2003 17:12:07 GMT
I'm using James with JDBC UserRepository. In one of my mailets, I had to
extract some user properties, which are not accessible trough JamesUser
interface, but otherwise existed in the database.

To solve the problem I wrote an extension to
org.apache.james.userrepository.DefaultJamesUser and
org.apache.james.userrepository.JamesUsersJdbcRepository as well.

The attached file contains the sources and the modified james-config.xml and
sqlResources.xml files.

Here is a little more information, if you're interested:

Using some of com.nxtras.sbuild.mailext.server.SFUser
getPropertyAsXXX(String key) methods I can read any of the user properties
stored in the database. Here is some example mailet code:

    public void service(Mail mail) throws MessagingException {
        Collection recipients = mail.getRecipients();
        MailAddress recipient = (MailAddress)recipients.iterator().next();

        ComponentManager componentManager =

        try {
            UsersRepository users = (UsersRepository)componentManager

            SFUser user = (SFUser)users.getUserByName(recipient.getUser());
            System.out.println("User "+recipient+";
        } catch (Exception ex) {

In order to use the extensions you should compile sources into james.sar.
Configuration files also should be modified respectively - see attached
sqlResources.xml and james-config.xml, <users-store> section.

To James Project Leaders: if you thing such extension is useful, I'm ready
to move everything under james tree, implement similar behavior for File
UserRepository and make changes in Remote Manager to reflect new User


View raw message