mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nick Padgett (JIRA)" <j...@apache.org>
Subject [jira] Created: (FTPSERVER-335) Create a HomeDirectoryResolver interface to Resolve a User's Home Directory
Date Wed, 16 Sep 2009 22:19:57 GMT
Create a HomeDirectoryResolver interface to Resolve a User's Home Directory

                 Key: FTPSERVER-335
                 URL: https://issues.apache.org/jira/browse/FTPSERVER-335
             Project: FtpServer
          Issue Type: Improvement
            Reporter: Nick Padgett

It would be useful to have a HomeDirectoryResolver interface to resolve a user's home directory.
 I use such a class to do the following:
1) Prefix a base path to user home directories.  I have FtpServer deployed with two different
applications.  In one applicationI need their home directory to begin with "d:/mnt" and in
the other I need "/mnt".
2) Allow users to share a common home directory (i.e. "d:/mnt/users").
3) Allow users to have private home directories (i.e. "d:/mnt/users/npadgett").

The interface I use looks something like:
public interface HomeDirectoryResolver {
    String resolve(final User user);

The class I use looks something like:
public class HomeDirectoryResolverImpl implements HomeDirectoryResolver {
    public static enum Strategy {

    private final String basePath;
    private final Strategy strategy;

    public HomeDirectoryResolverImpl(final String basePath,
            final Strategy strategy) {
        this.basePath = basePath;
        this.strategy = strategy;

    public String resolve(final User user) {
        String homeDirectory = this.basePath
                + (this.basePath.endsWith("/") ? "" : "/");
        switch (this.strategy) {
            case SHARED:
                // do nothing
            case USERNAME:
                homeDirectory += user.getName();
            case HOME_DIRECTORY:
                homeDirectory += user.getHomeDirectory();
                throw new IllegalStateException();
        return homeDirectory;

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message