1 28 package de.nava.informa.utils.poller; 29 30 import de.nava.informa.core.ChannelIF; 31 import de.nava.informa.core.ItemIF; 32 import de.nava.informa.utils.manager.PersistenceManagerIF; 33 import de.nava.informa.utils.manager.PersistenceManagerException; 34 35 40 public class PersistenceObserver implements PollerObserverIF { 41 private PersistenceManagerIF manager; 42 43 50 public PersistenceObserver(PersistenceManagerIF manager) { 51 if (manager == null) { 52 throw new IllegalArgumentException ("Manager should be specified."); 53 } 54 55 this.manager = manager; 56 } 57 58 65 public final void itemFound(ItemIF item, ChannelIF channel) { 66 try { 67 manager.createItem(channel, item); 68 } catch (PersistenceManagerException e) { 69 } 71 } 72 73 79 public void channelErrored(ChannelIF channel, Exception e) { 80 } 81 82 87 public void channelChanged(ChannelIF channel) { 88 try { 89 manager.updateChannel(channel); 90 } catch (PersistenceManagerException e) { 91 } 93 } 94 95 100 public void pollStarted(ChannelIF channel) { 101 } 102 103 108 public void pollFinished(ChannelIF channel) { 109 } 110 } 111 | Popular Tags |