1 17 package org.apache.activemq.broker.view; 18 19 import org.apache.activemq.broker.Broker; 20 import org.apache.activemq.broker.BrokerFilter; 21 import org.apache.commons.logging.Log; 22 import org.apache.commons.logging.LogFactory; 23 24 import java.io.FileWriter ; 25 import java.io.PrintWriter ; 26 27 32 public abstract class DotFileInterceptorSupport extends BrokerFilter { 33 private final Log log = LogFactory.getLog(DotFileInterceptorSupport.class); 34 35 private String file; 36 37 public DotFileInterceptorSupport(Broker next, String file) { 38 super(next); 39 this.file = file; 40 } 41 42 protected void generateFile() throws Exception { 43 if (log.isDebugEnabled()) { 44 log.debug("Creating DOT file at: " + file); 45 } 46 PrintWriter writer = new PrintWriter (new FileWriter (file)); 47 try { 48 generateFile(writer); 49 } 50 finally { 51 writer.close(); 52 } 53 } 54 55 protected abstract void generateFile(PrintWriter writer) throws Exception ; 56 } 57 | Popular Tags |