1 26 27 package net.sourceforge.groboutils.codecoverage.v2.datastore; 28 29 import java.io.File ; 30 import java.io.IOException ; 31 32 import net.sourceforge.groboutils.codecoverage.v2.IAnalysisModule; 33 34 35 42 public class DirMetaDataReader implements IMetaDataReader 43 { 44 private DirMetaDataIO store; 45 46 47 51 public DirMetaDataReader( File basedir ) 52 throws IOException 53 { 54 if (basedir == null) 55 { 56 throw new IllegalArgumentException ( "No null args." ); 57 } 58 this.store = new DirMetaDataIO( basedir ); 59 } 60 61 62 65 public IClassMetaDataReader getClassReader( IAnalysisModule module ) 66 throws IOException 67 { 68 if (module == null) 69 { 70 throw new IllegalArgumentException ("no null args"); 71 } 72 checkClose(); 73 74 76 return new DirClassMetaDataReader( module, this.store ); 77 } 78 79 80 83 public AnalysisModuleSet getAnalysisModuleSet() 84 throws IOException 85 { 86 checkClose(); 87 88 return this.store.getAnalysisModuleSet(); 89 } 90 91 92 95 public void close() 96 throws IOException 97 { 98 checkClose(); 99 this.store.close(); 100 this.store = null; 101 } 102 103 104 private void checkClose() 105 throws IOException 106 { 107 if (this.store == null) 108 { 109 throw new IOException ( "Writer has already been closed." ); 110 } 111 } 112 113 114 protected void finalize() throws Throwable 115 { 116 Exception ex = null; 117 if (this.store != null) 118 { 119 ex = new IllegalStateException ("Did not close writer."); 120 } 121 122 super.finalize(); 123 124 if (ex != null) 126 { 127 throw ex; 128 } 129 } 130 } 131 132 | Popular Tags |