Coverage Report - org.mule.tools.visualizer.postrenderers.FileCleanerPostRenderer
 
Classes in this File Line Coverage Branch Coverage Complexity
FileCleanerPostRenderer
100%
6/6
75%
3/4
2
FileCleanerPostRenderer$1
100%
2/2
N/A
2
 
 1  
 /*
 2  
  * $Id: FileCleanerPostRenderer.java 7963 2007-08-21 08:53:15Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 package org.mule.tools.visualizer.postrenderers;
 11  
 
 12  
 import org.mule.tools.visualizer.components.PostRenderer;
 13  
 import org.mule.tools.visualizer.config.GraphEnvironment;
 14  
 
 15  
 import com.oy.shared.lm.graph.Graph;
 16  
 
 17  
 import java.io.File;
 18  
 import java.io.FilenameFilter;
 19  
 import java.util.Map;
 20  
 
 21  4
 public class FileCleanerPostRenderer implements PostRenderer
 22  
 {
 23  
 
 24  
     public void postRender(GraphEnvironment env, Map context, Graph graph)
 25  
     {
 26  4
         if (!env.getConfig().isKeepDotFiles())
 27  
         {
 28  4
             File[] dotFiles = env.getConfig().getOutputDirectory().listFiles(new FilenameFilter()
 29  
             {
 30  4
                 public boolean accept(File dir, String name)
 31  
                 {
 32  60
                     return name.endsWith(".dot") | name.endsWith(".cmapx");
 33  
                 }
 34  
             });
 35  12
             for (int x = 0; x < dotFiles.length; x++)
 36  
             {
 37  8
                 dotFiles[x].delete();
 38  
             }
 39  
         }
 40  4
     }
 41  
 
 42  
 }