1 28 package de.nava.informa.utils.cleaner; 29 30 import de.nava.informa.core.ChannelIF; 31 import de.nava.informa.core.ItemIF; 32 33 import java.util.List ; 34 import java.util.Vector ; 35 36 42 class CompositeObserver implements CleanerObserverIF { 43 private List observers = new Vector (); 44 45 51 public void unwantedItem(ItemIF item, ChannelIF channel) { 52 final int size = observers.size(); 53 for (int i = 0; i < size; i++) { 54 final CleanerObserverIF observer = (CleanerObserverIF) observers.get(i); 55 try { 56 observer.unwantedItem(item, channel); 57 } catch (Exception e) { 58 } 60 } 61 } 62 63 68 public void cleaningStarted(ChannelIF channel) { 69 final int size = observers.size(); 70 for (int i = 0; i < size; i++) { 71 final CleanerObserverIF observer = (CleanerObserverIF) observers.get(i); 72 try { 73 observer.cleaningStarted(channel); 74 } catch (Exception e) { 75 } 77 } 78 } 79 80 85 public void cleaningFinished(ChannelIF channel) { 86 final int size = observers.size(); 87 for (int i = 0; i < size; i++) { 88 final CleanerObserverIF observer = (CleanerObserverIF) observers.get(i); 89 try { 90 observer.cleaningFinished(channel); 91 } catch (Exception e) { 92 } 94 } 95 } 96 97 102 public final void add(CleanerObserverIF observer) { 103 if (!observers.contains(observer)) { 104 observers.add(observer); 105 } 106 } 107 108 113 public final void remove(CleanerObserverIF observer) { 114 observers.remove(observer); 115 } 116 } 117 | Popular Tags |