View Javadoc

1   /**
2    * Copyright 2008 WebPhotos
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  /*
17   * SyncAdapter.java
18   *
19   * Created on 19 de Maio de 2006, 16:06
20   *
21   * To change this template, choose Tools | Template Manager
22   * and open the template in the editor.
23   */
24  
25  package net.sf.webphotos.sync.FTP;
26  
27  import net.sf.webphotos.sync.SyncEvent;
28  import net.sf.webphotos.sync.SyncListener;
29  import org.apache.commons.net.util.ListenerList;
30  
31  /**
32   * Adapta o listener para sincronização.
33   * Implementa a classe SyncListener.
34   * @author guilherme
35   */
36  public class SyncAdapter implements SyncListener {
37      
38      private ListenerList internalListeners;
39      
40      /**
41       * Construtor da classe.
42       * Cria uma nova instância de SyncAdapter.
43       */
44      public SyncAdapter() {
45          internalListeners = new ListenerList();
46      }
47  
48      /**
49       * Registra a FTPSyncListener para receber FTPSyncEvents.
50       * Embora este método não esteja declarado para ser sincronizado, é
51       * executado em uma maneira segura de thread.
52       * @param listener O FTPSyncListener para registrar.
53       */
54      public void addSyncListener(SyncListener listener) {
55          internalListeners.addListener(listener);
56      }
57  
58      /**
59       * Remove a FTPSyncListener.
60       * Embora este método não esteja sincronizado,
61       * é executado em uma maneira segura de thread.
62       * @param listener  O FTPSyncListener para remover.
63       */
64      public void removeSyncListener(SyncListener listener) {
65          internalListeners.removeListener(listener);
66      }
67      
68      /**
69       * Implementa o método disconnected da interface
70       * {@link net.sf.webphotos.sync.SyncListener SyncListener}.
71       * Esse método será manipulado e trabalhado na classe
72       * {@link net.sf.webphotos.gui.FtpClient FtpClient}.
73       * @param event Evento de SyncEvent.
74       */
75      @Override
76      public void disconnected(SyncEvent event) { }
77      
78      /**
79       * Implementa o método connected da interface
80       * {@link net.sf.webphotos.sync.SyncListener SyncListener}.
81       * Esse método será manipulado e trabalhado na classe
82       * {@link net.sf.webphotos.gui.FtpClient FtpClient}.
83       * @param event Evento de SyncEvent.
84       */
85      @Override
86      public void connected(SyncEvent event) { }
87  
88      /**
89       * Implementa o método logonStarted da interface
90       * {@link net.sf.webphotos.sync.SyncListener SyncListener}.
91       * Esse método será manipulado e trabalhado na classe
92       * {@link net.sf.webphotos.gui.FtpClient FtpClient}.
93       * @param event Evento de SyncEvent.
94       */
95      @Override
96      public void logonStarted(SyncEvent event) { }
97      
98  }