1   /*
2    * $Id: FileManager.java 7963 2007-08-21 08:53:15Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.providers.ftp.server;
12  
13  import org.apache.ftpserver.ftplet.FileSystemManager;
14  import org.apache.ftpserver.ftplet.FileSystemView;
15  import org.apache.ftpserver.ftplet.FtpException;
16  import org.apache.ftpserver.ftplet.User;
17  
18  public class FileManager implements FileSystemManager
19  {
20  
21      private ServerState state;
22  
23      public void setStateFromSystemProperties(String key)
24      {
25          state = (InOutState) System.getProperties().get(key);
26          if (null == state)
27          {
28              throw new IllegalStateException("Missing state for key " + key);
29          }
30          state.started();
31      }
32  
33      public FileSystemView createFileSystemView(User user) throws FtpException
34      {
35          return new FileView(state);
36      }
37  
38  }