avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ran...@apache.org
Subject cvs commit: jakarta-avalon-apps/ftpserver/src/java/org/apache/avalon/ftpserver/gui/remote FtpConnectionObserverAdapter.java FtpFileListenerAdapter.java FtpStatisticsListenerAdapter.java SpyConnectionAdapter.java
Date Wed, 06 Mar 2002 14:00:47 GMT
rana_b      02/03/06 06:00:47

  Added:       ftpserver/src/java/org/apache/avalon/ftpserver/gui/remote
                        FtpConnectionObserverAdapter.java
                        FtpFileListenerAdapter.java
                        FtpStatisticsListenerAdapter.java
                        SpyConnectionAdapter.java
  Log:
  second stage of refactoring
  
  Revision  Changes    Path
  1.1                  jakarta-avalon-apps/ftpserver/src/java/org/apache/avalon/ftpserver/gui/remote/FtpConnectionObserverAdapter.java
  
  Index: FtpConnectionObserverAdapter.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.gui.remote;
  
  import java.rmi.RemoteException;
  import java.rmi.server.UnicastRemoteObject;
  import org.apache.avalon.ftpserver.FtpUser;
  import org.apache.avalon.ftpserver.remote.interfaces.ConnectionServiceInterface;
  import org.apache.avalon.ftpserver.remote.interfaces.FtpConnectionObserver;
  
  /**
   * Monitor all ftp connections.
   *
   * @author <a href="mailto:rana_b@yahoo.com">Rana Bhattacharyya</a>
   */
  public 
  class FtpConnectionObserverAdapter implements FtpConnectionObserver {
      
      private FtpConnectionObserver mObserver;
      private ConnectionServiceInterface mConService;
      
      /**
       * Constructor - set the actual listener object
       */
      public FtpConnectionObserverAdapter(ConnectionServiceInterface conService,
                                          FtpConnectionObserver observer) throws RemoteException
{
          mObserver = observer;
          mConService = conService;
          
          UnicastRemoteObject.exportObject(this);
          mConService.setObserver(this);
      }
      
      /**
       * New connection notification.
       */
      public void newConnection(final FtpUser user) throws RemoteException {
          mObserver.newConnection(user);
      }
      
      /**
       * Close connection notification.
       */
      public void removeConnection(final FtpUser user) throws RemoteException {
          mObserver.removeConnection(user);
      }
      
      /**
       * User update notification.
       */
      public void updateConnection(final FtpUser user) throws RemoteException {
          mObserver.updateConnection(user);
      }
      
      /**
       * Close it
       */
      public void close() {
          try { mConService.setObserver(null); } catch(Exception ex) {}
          try { UnicastRemoteObject.unexportObject(this, true); }catch(Exception ex) {}
      } 
  }
      
  
  
  
  1.1                  jakarta-avalon-apps/ftpserver/src/java/org/apache/avalon/ftpserver/gui/remote/FtpFileListenerAdapter.java
  
  Index: FtpFileListenerAdapter.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.gui.remote;
  
  import java.rmi.RemoteException;
  import java.rmi.server.UnicastRemoteObject;
  import org.apache.avalon.ftpserver.remote.interfaces.FtpFileListener;
  import org.apache.avalon.ftpserver.remote.interfaces.FtpStatisticsInterface;
  
  /**
   * Ftp file upload/download/delete listener remote interface.
   *
   * @author <a href="mailto:rana_b@yahoo.com">Rana Bhattacharyya</a>
   */
  public 
  class FtpFileListenerAdapter implements FtpFileListener {
      
      private FtpFileListener mListener;
      private FtpStatisticsInterface mStatistics;
      
      /**
       * Constructor - set the actual listener object
       */
      public FtpFileListenerAdapter(FtpStatisticsInterface statistics,
                                    FtpFileListener listener) throws RemoteException {
          mListener = listener;
          mStatistics = statistics;
          
          UnicastRemoteObject.exportObject(this);
          mStatistics.setFileListener(this);
      }
      
      /**
       * User file upload notification.
       */
      public void notifyUpload(final String file, final String sessionId) throws RemoteException
{
          mListener.notifyUpload(file, sessionId);
      }
      
      /**
       * User file download notification.
       */
      public void notifyDownload(final String file, final String sessionId) throws RemoteException
{
          mListener.notifyDownload(file, sessionId);
      }
      
      /**
       * User file delete notification.
       */
      public void notifyDelete(final String file, final  String sessionId) throws RemoteException
{
          mListener.notifyDelete(file, sessionId);
      }
      
      /**
       * Close it
       */
      public void close() {
          try { mStatistics.setFileListener(null); } catch(Exception ex) {}
          try { UnicastRemoteObject.unexportObject(this, true); }catch(Exception ex) {}
      } 
  }
      
  
  
  
  1.1                  jakarta-avalon-apps/ftpserver/src/java/org/apache/avalon/ftpserver/gui/remote/FtpStatisticsListenerAdapter.java
  
  Index: FtpStatisticsListenerAdapter.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.gui.remote;
  
  import java.rmi.RemoteException;
  import java.rmi.server.UnicastRemoteObject;
  import org.apache.avalon.ftpserver.remote.interfaces.FtpStatisticsListener;
  import org.apache.avalon.ftpserver.remote.interfaces.FtpStatisticsInterface;
  
  /**
   * Ftp statistics listener remote interface.
   *
   * @author <a href="mailto:rana_b@yahoo.com">Rana Bhattacharyya</a>
   */
  public 
  class FtpStatisticsListenerAdapter implements FtpStatisticsListener {
       
      private FtpStatisticsInterface mStatistics; 
      private FtpStatisticsListener mListener;
       
      /**
       * Constructor - set the actual listener object
       */ 
      public FtpStatisticsListenerAdapter(FtpStatisticsInterface statistics, 
                                          FtpStatisticsListener listener) throws RemoteException
{
          mListener = listener;
          mStatistics = statistics;
          
          UnicastRemoteObject.exportObject(this);
          mStatistics.setListener(this);
      }
       
       
      /**
       * User file upload notification.
       */
      public void notifyUpload() throws RemoteException {
          mListener.notifyUpload();
      }
      
      /**
       * User file download notification.
       */
      public void notifyDownload() throws RemoteException {
          mListener.notifyDownload();
      }
      
      /**
       * User file delete notification.
       */
      public void notifyDelete() throws RemoteException {
          mListener.notifyDelete();
      }
       
      /**
       * New user login notification.
       */
      public void notifyLogin() throws RemoteException {
          mListener.notifyLogin();
      }
      
      /**
       * User logout notification.
       */
      public void notifyLogout() throws RemoteException {
          mListener.notifyLogout();
      }
      
      /**
       * Connection open/close notification
       */
      public void notifyConnection() throws RemoteException {
          mListener.notifyConnection();
      }
      
      /**
       * Close it
       */
      public void close() {
          try {mStatistics.setListener(null);} catch(Exception ex) {}
          try {UnicastRemoteObject.unexportObject(this, true);}catch(Exception ex) {}
      }
      
  }    
  
  
  
  1.1                  jakarta-avalon-apps/ftpserver/src/java/org/apache/avalon/ftpserver/gui/remote/SpyConnectionAdapter.java
  
  Index: SpyConnectionAdapter.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.gui.remote;
  
  import java.io.IOException;
  import java.rmi.RemoteException;
  import java.rmi.server.UnicastRemoteObject;
  import org.apache.avalon.ftpserver.remote.interfaces.ConnectionServiceInterface;
  import org.apache.avalon.ftpserver.remote.interfaces.SpyConnectionInterface;
  
  /**
   * This class is used to monitor user activities - remote adapter.
   *
   * @author <a href="mailto:rana_b@yahoo.com">Rana Bhattacharyya</a>
   */
  public
  class SpyConnectionAdapter implements SpyConnectionInterface {        
      
      private SpyConnectionInterface mSpy;
      private ConnectionServiceInterface mConService;
      private String mstSessionId;
      
      /**
       * Constructor - set the actual object.
       */
      public SpyConnectionAdapter(ConnectionServiceInterface conService,
                                  String sessionId,
                                  SpyConnectionInterface spy) throws RemoteException {
          mSpy = spy;
          mstSessionId = sessionId;
          mConService = conService;
          
          UnicastRemoteObject.exportObject(this);
          mConService.setSpyObject(sessionId, this);
      }
      
      /**
       * Write the message
       */
      public void write(final String msg) throws IOException {
          mSpy.write(msg);
      } 
      
      /**
       * Close - unexport the object
       */
      public void close() {
          try {mConService.setSpyObject(mstSessionId, null);}catch(Exception ex) {}
          try {UnicastRemoteObject.unexportObject(this, true);}catch(Exception ex) {}
      } 
  }    
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message