1 package org.ozoneDB.tools.OPP.message; 9 10 import org.ozoneDB.tools.OPP.message.MessageWriter; 11 12 import java.util.Set ; 13 import java.util.HashSet ; 14 import java.util.Iterator ; 15 16 public class CompositeOPPMessageListener implements MessageWriter { 17 Set listeners = new HashSet (); 18 19 public void startGeneration(String object) { 20 for (Iterator iter = listeners.iterator(); iter.hasNext();) { 21 ((MessageWriter) iter.next()).startGeneration(object); 22 } 23 } 24 25 public void error(String message) { 26 for (Iterator iter = listeners.iterator(); iter.hasNext();) { 27 ((MessageWriter) iter.next()).error(message); 28 } 29 } 30 31 public void warning(String message) { 32 for (Iterator iter = listeners.iterator(); iter.hasNext();) { 33 ((MessageWriter) iter.next()).warning(message); 34 } 35 } 36 37 public void warning(String filename, int row, String message) { 38 for (Iterator iter = listeners.iterator(); iter.hasNext();) { 39 ((MessageWriter) iter.next()).warning(filename, row, message); 40 } 41 } 42 43 public void info(String message) { 44 for (Iterator iter = listeners.iterator(); iter.hasNext();) { 45 ((MessageWriter) iter.next()).info(message); 46 } 47 } 48 49 public void debug(String message) { 50 for (Iterator iter = listeners.iterator(); iter.hasNext();) { 51 ((MessageWriter) iter.next()).debug(message); 52 } 53 } 54 55 public void endGeneration() { 56 for (Iterator iter = listeners.iterator(); iter.hasNext();) { 57 ((MessageWriter) iter.next()).endGeneration(); 58 } 59 } 60 61 public void addListener(MessageWriter listener) { 62 listeners.add(listener); 63 } 64 65 public void removeListener(MessageWriter listener) { 66 listeners.remove(listener); 67 } 68 } 69 | Popular Tags |