1 19 package org.apache.avalon.excalibur.monitor.test; 20 21 import java.beans.PropertyChangeEvent ; 22 import java.beans.PropertyChangeListener ; 23 import java.util.Collections ; 24 import java.util.Set ; 25 26 import org.apache.avalon.excalibur.monitor.DirectoryResource; 27 import org.apache.avalon.framework.logger.AbstractLogEnabled; 28 29 32 class DirectoryTCListener 33 extends AbstractLogEnabled 34 implements PropertyChangeListener 35 { 36 private int m_changeCount; 37 private Set m_added = Collections.EMPTY_SET; 38 private Set m_removed = Collections.EMPTY_SET; 39 private Set m_modified = Collections.EMPTY_SET; 40 41 void reset() 42 { 43 m_added = Collections.EMPTY_SET; 44 m_removed = Collections.EMPTY_SET; 45 m_modified = Collections.EMPTY_SET; 46 } 47 48 public Set getAdded() 49 { 50 return m_added; 51 } 52 53 public Set getRemoved() 54 { 55 return m_removed; 56 } 57 58 public Set getModified() 59 { 60 return m_modified; 61 } 62 63 public int getChangeCount() 64 { 65 return m_changeCount; 66 } 67 68 public void propertyChange( final PropertyChangeEvent event ) 69 { 70 m_changeCount++; 71 final String name = event.getPropertyName(); 72 final Set newValue = (Set )event.getNewValue(); 73 if( name.equals( DirectoryResource.ADDED ) ) 74 { 75 m_added = newValue; 76 } 77 else if( name.equals( DirectoryResource.REMOVED ) ) 78 { 79 m_removed = newValue; 80 } 81 else 82 { 83 m_modified = newValue; 84 } 85 } 86 } 87 | Popular Tags |