rana_b      02/03/06 06:02:14

  Added:       ftpserver/src/java/org/apache/avalon/ftpserver/remote/interfaces
                        ConnectionServiceInterface.java
                        FtpConfigInterface.java FtpConnectionObserver.java
                        FtpFileListener.java FtpStatisticsInterface.java
                        FtpStatisticsListener.java
                        IpRestrictorInterface.java
                        RemoteHandlerInterface.java
                        SpyConnectionInterface.java
                        UserManagerInterface.java
  Log:
  second stage of refactoring
  
  Revision  Changes    Path
  1.1                  
jakarta-avalon-apps/ftpserver/src/java/org/apache/avalon/ftpserver/remote/interfaces/ConnectionServiceInterface.java
  
  Index: ConnectionServiceInterface.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  
  package org.apache.avalon.ftpserver.remote.interfaces;
  
  import java.util.List;
  import java.rmi.Remote;
  import java.rmi.RemoteException;
  import org.apache.avalon.ftpserver.FtpUser;
  
  /**
   * Ftp user service interface - used by remote admin GUI.
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">Rana Bhattacharyya</a>
   */
  public
  interface ConnectionServiceInterface extends Remote {
          
      /**
       * It returns a list of all the currently connected user objects.
       */
      List getAllUsers() throws RemoteException;
      
      /**
       * Set user manager observer.
       */
      void setObserver(final FtpConnectionObserver obsr) throws RemoteException;
  
      /**
       * Get the observer.
       */
      FtpConnectionObserver getObserver() throws RemoteException;
       
      /**
       * Close ftp connection for this session id.
       */
      void closeConnection(final String sessionId) throws RemoteException;
       
      /**
       * Close all - close all the connections.
       */
      void closeAllConnections() throws RemoteException;
      
      /**
       * Get connected user
       */ 
      FtpUser getUser(String sessId) throws RemoteException;
      
      /**
       * Set spy object
       */ 
      void setSpyObject(String sessId, SpyConnectionInterface spy) throws 
RemoteException; 
  }    
  
  
  
  1.1                  
jakarta-avalon-apps/ftpserver/src/java/org/apache/avalon/ftpserver/remote/interfaces/FtpConfigInterface.java
  
  Index: FtpConfigInterface.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.avalon.ftpserver.remote.interfaces;
  
  import java.rmi.Remote;
  import java.rmi.RemoteException;
  import java.net.InetAddress;
  
  /**
   * Ftp configuration remote interface. It is used by remote admin GUI.
   * 
   * @author <a href="mailto:[EMAIL PROTECTED]">Rana Bhattacharyya</a>
   */
  public
  interface FtpConfigInterface extends Remote {
  
      /**
       * Get user manager
       */
      UserManagerInterface getUserManager() throws RemoteException;
      
      /**
       * Get ip restrictor
       */
      IpRestrictorInterface getIpRestrictor() throws RemoteException;
  
      /**
       * Get server bind address.
       */
      InetAddress getServerAddress() throws RemoteException;
  
      /**
       * Get server port.
       */
      int getServerPort() throws RemoteException;
               
      /**
       * Check annonymous login support.
       */
      boolean isAnonymousLoginAllowed() throws RemoteException;
       
      /**
       * Get user properties.
       */
      ConnectionServiceInterface getConnectionService() throws RemoteException; 
    
              
      /**
       * Get maximum number of connections.
       */
      int getMaxConnections() throws RemoteException;
      
      /**
       * Get maximum number of anonymous connections.
       */
      int getMaxAnonymousLogins() throws RemoteException;
      
      /**
       * Get poll interval in seconds.
       */
      int getSchedulerInterval() throws RemoteException;
       
      /**
       * Get default idle time in seconds.
       */ 
      int getDefaultIdleTime() throws RemoteException;
       
      /**
       * Get default root directory
       */ 
      String getDefaultRoot() throws RemoteException;
  
      /**
       * Get global statistics object.
       */
      FtpStatisticsInterface getStatistics() throws RemoteException;
  
      /**
       * Get rmi port
       */
      int getRemoteAdminPort() throws RemoteException;
      
      /**
       * Is remote admin allowed
       */
      boolean isRemoteAdminAllowed() throws RemoteException;
          
      /**
       * Get base directory.
       */
      String getBaseDirectory() throws RemoteException;
  
  }
  
  
  
  
  1.1                  
jakarta-avalon-apps/ftpserver/src/java/org/apache/avalon/ftpserver/remote/interfaces/FtpConnectionObserver.java
  
  Index: FtpConnectionObserver.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  
  package org.apache.avalon.ftpserver.remote.interfaces;
  
  import java.rmi.Remote;
  import java.rmi.RemoteException;
  import org.apache.avalon.ftpserver.FtpUser;
  
  /**
   * This observer interface monitors all the ftp connections.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Rana Bhattacharyya</a>
   */
  public 
  interface FtpConnectionObserver extends Remote {
      
      /**
       * New connection notification.
       * @param user new connected user.
       */
      void newConnection(final FtpUser user) throws RemoteException;
          
      /**
       * Close connection notification
       * @param user closed user object
       */
      void removeConnection(final FtpUser user) throws RemoteException;
       
      /**
       * Update connection notification
       * @param user updated user
       */
      void updateConnection(final FtpUser user) throws RemoteException;
  }    
  
  
  
  1.1                  
jakarta-avalon-apps/ftpserver/src/java/org/apache/avalon/ftpserver/remote/interfaces/FtpFileListener.java
  
  Index: FtpFileListener.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  
  package org.apache.avalon.ftpserver.remote.interfaces;
  
  import java.rmi.Remote;
  import java.rmi.RemoteException;
  
  /**
   * Ftp file upload/download/delete listener remote interface.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Rana Bhattacharyya</a>
   */
  public 
  interface FtpFileListener extends Remote {
      
      /**
       * User file upload notification.
       */
      void notifyUpload(final String file, final String sessionId) throws 
RemoteException;
      
      /**
       * User file download notification.
       */
      void notifyDownload(final String file, final String sessionId) throws 
RemoteException;
      
      /**
       * User file delete notification.
       */
      void notifyDelete(final String file, final  String sessionId) throws 
RemoteException;
       
  }
      
  
  
  
  1.1                  
jakarta-avalon-apps/ftpserver/src/java/org/apache/avalon/ftpserver/remote/interfaces/FtpStatisticsInterface.java
  
  Index: FtpStatisticsInterface.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  
  package org.apache.avalon.ftpserver.remote.interfaces;
  
  import java.rmi.Remote;
  import java.rmi.RemoteException;
  import java.util.Date; 
  
  
  /**
   * Ftp statistis remote interface.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Rana Bhattacharyya</a>
   */
  public
  interface FtpStatisticsInterface extends Remote {
      
      /**
       * Get server start time.
       */
      Date getStartTime() throws RemoteException;
      
      /**
       * Get number of files uploaded.
       */
      int getFileUploadNbr() throws RemoteException;
      
      /**
       * Get number of files downloaded.
       */
      int getFileDownloadNbr() throws RemoteException;
      
      /**
       * Get number of files deleted.
       */
      int getFileDeleteNbr() throws RemoteException;
      
      /**
       * Get total number of bytes uploaded.
       */
      long getFileUploadSize() throws RemoteException;
      
      /**
       * Get total number of bytes downloaded.
       */
      long getFileDownloadSize() throws RemoteException;
      
      /**
       * Get current number of connections.
       */
      int getConnectionNbr() throws RemoteException;
      
      /**
       * Get total number of connections
       */
      int getTotalConnectionNbr() throws RemoteException;
          
      /** 
       * Get current number of logins
       */
      int getLoginNbr() throws RemoteException;
      
      /**
       * Get total number of logins
       */
      int getTotalLoginNbr() throws RemoteException;
      
      /**
       * Get current number of anonymous logins.
       */
      int getAnonLoginNbr() throws RemoteException;
      
      /**
       * Get total number of anonymous logins
       */
      int getTotalAnonLoginNbr() throws RemoteException;
          
      /**
       * Set a listener object.
       */
      void setListener(FtpStatisticsListener listener) throws RemoteException;
      
      /**
       * Get listener object.
       */
      FtpStatisticsListener getListener() throws RemoteException;
      
      /**
       * Get file listener
       */ 
      void setFileListener(FtpFileListener listener) throws RemoteException;
       
      /**
       * Set file listener
       */ 
      FtpFileListener getFileListener() throws RemoteException;
      
  }    
  
  
  
  1.1                  
jakarta-avalon-apps/ftpserver/src/java/org/apache/avalon/ftpserver/remote/interfaces/FtpStatisticsListener.java
  
  Index: FtpStatisticsListener.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  
  package org.apache.avalon.ftpserver.remote.interfaces;
  
  import java.rmi.Remote;
  import java.rmi.RemoteException;
  
  /**
   * Ftp statistics listener remote interface.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Rana Bhattacharyya</a>
   */
  public 
  interface FtpStatisticsListener extends Remote {
       
      /**
       * User file upload notification.
       */
      void notifyUpload() throws RemoteException;
      
      /**
       * User file download notification.
       */
      void notifyDownload() throws RemoteException;
      
      /**
       * User file delete notification.
       */
      void notifyDelete() throws RemoteException;
       
      /**
       * New user login notification.
       */
      void notifyLogin() throws RemoteException;
      
      /**
       * User logout notification.
       */
      void notifyLogout() throws RemoteException;
      
      /**
       * Connection open/close notification
       */
      void notifyConnection() throws RemoteException; 
  
  }    
  
  
  
  1.1                  
jakarta-avalon-apps/ftpserver/src/java/org/apache/avalon/ftpserver/remote/interfaces/IpRestrictorInterface.java
  
  Index: IpRestrictorInterface.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  
  package org.apache.avalon.ftpserver.remote.interfaces;
  
  import java.io.IOException;
  import java.net.InetAddress;
  import java.util.Collection;
  import java.rmi.Remote;
  import java.rmi.RemoteException;
  
  /**
   * IP Restrictor remotr interface. Used by admin GUI.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Rana Bhattacharyya</a>
   */
  
  public 
  interface IpRestrictorInterface extends Remote {
      
      /**
       * Reload data from store.
       */
      void reload() throws IOException;
      
      /**
       * Save data into store.
       */
      void save() throws IOException;
          
      /**
       * Check IP permission.
       */
      boolean hasPermission(final InetAddress addr) throws RemoteException; 
      
      /**
       * Clear all entries.
       */
      void clear() throws RemoteException;
      
      /**
       * Add new entry
       */
      void addEntry(final String str) throws RemoteException;
      
      /**
       * Remove entry
       */
      void removeEntry(final String str) throws RemoteException; 
      
      /**
       * Get all entries
       */
      Collection getAllEntries() throws RemoteException; 
  } 
  
  
  
  1.1                  
jakarta-avalon-apps/ftpserver/src/java/org/apache/avalon/ftpserver/remote/interfaces/RemoteHandlerInterface.java
  
  Index: RemoteHandlerInterface.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  
  package org.apache.avalon.ftpserver.remote.interfaces;
  
  import java.rmi.Remote;
  import java.rmi.RemoteException;
  
  /**
   * Ftp server remote admin interface. This is the starting point of remote 
admin.
   * Call stack:
   * <pre>
   *    RemoteHandlerInterface
   *    |
   *    +---- FtpConfigInterface
   *          |
   *          +---- FtpStatisticsInterface &lt;- FtpStatisticsListener, 
FtpFileListener 
   *          |
   *          +---- ConnectionServiceInterface &lt;- FtpConnectionObserver
   *          |
   *          +---- IpRestrictorInterface      
   *          |
   *          +---- UserManagerInterface 
   * </pre>
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Rana Bhattacharyya</a>
   */
  public 
  interface RemoteHandlerInterface extends Remote {
      
      /**
       * Remote interface ID
       */
      public final static String BIND_NAME = "ftp_admin";     
      
      /**
       * Display server name
       */
      public final static String DISPLAY_NAME = "Ftp";
      
      /**
       * Remote admin login
       */
      String login(final String id, final String password) throws Exception; 
       
      /**
       * Remote admin logout
       */
      boolean logout(final String sessId) throws RemoteException;
       
      /**
       * Get configuration interface
       */
      FtpConfigInterface getConfigInterface(final String sessId) throws 
RemoteException; 
  
  }
  
  
  
  1.1                  
jakarta-avalon-apps/ftpserver/src/java/org/apache/avalon/ftpserver/remote/interfaces/SpyConnectionInterface.java
  
  Index: SpyConnectionInterface.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  
  package org.apache.avalon.ftpserver.remote.interfaces;
  
  import java.io.IOException;
  import java.rmi.Remote;
  
  
  /**
   * This interface is used to monitor user activities - remote admin.
   */
  public
  interface SpyConnectionInterface extends Remote {
      
      /**
       * Write user spy message.
       */
      void write(final String msg) throws IOException;
  }    
  
  
  
  1.1                  
jakarta-avalon-apps/ftpserver/src/java/org/apache/avalon/ftpserver/remote/interfaces/UserManagerInterface.java
  
  Index: UserManagerInterface.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.avalon.ftpserver.remote.interfaces;
  
  import java.util.List;
  import java.rmi.Remote;
  import java.rmi.RemoteException;
  import org.apache.avalon.ftpserver.usermanager.User;
  
  /**
   * This is user manager remote interface. This is used by remote admin GUI.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">Rana Bhattacharyya</a>
   */
  public
  interface UserManagerInterface extends Remote {
      
      /**
       * Save the user. If a new user, create it else update the
       * existing user.
       */
      void save(final User user) throws Exception;
      
      /**
       * Delete the user from the system.
       *
       * @param name name of the user to be deleted. 
       */
      void delete(final String userName) throws Exception;
      
      /**
       * Get user by name.
       */
      User getUserByName(final String name) throws RemoteException;
      
      /**
       * Get all user names in the system.
       */
      List getAllUserNames() throws RemoteException;
       
      /**
       * User existance check.
       *
       * @param name user name
       */
      boolean doesExist(final String name) throws RemoteException;
      
      /**
       * Authenticate user
       */
      boolean authenticate(final String login, final String password) throws 
RemoteException;
      
      /**
       * Load the user data again
       */ 
      void reload() throws Exception;
      
      /**
       * Close the user manager
       */    
      void close() throws RemoteException;      
  
  } 
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to