1 26 27 package net.sourceforge.groboutils.codecoverage.v2.datastore; 28 29 import java.io.IOException ; 30 31 import net.sourceforge.groboutils.codecoverage.v2.IAnalysisModule; 32 33 34 41 public class DirClassMetaDataReader implements IClassMetaDataReader 42 { 43 private DirMetaDataIO store; 44 private IAnalysisModule am; 45 private AnalysisModuleSet ams; 46 47 DirClassMetaDataReader( IAnalysisModule module, DirMetaDataIO data ) 48 throws IOException 49 { 50 if (data == null || module == null) 51 { 52 throw new IllegalArgumentException ("no null args"); 53 } 54 this.store = data; 55 this.am = module; 56 this.ams = data.getAnalysisModuleSet(); 57 } 58 59 60 63 public ClassRecord readClass( String classSignature ) 64 throws IOException 65 { 66 if (classSignature == null) 67 { 68 throw new IllegalArgumentException ("no null args"); 69 } 70 checkClose(); 71 return this.store.getClassRecord( this.ams, this.am, classSignature ); 72 } 73 74 75 78 public String [] getClassSignatures() 79 throws IOException 80 { 81 checkClose(); 82 return this.store.getClassSigsForAnalysisModule( this.am ); 83 } 84 85 86 89 public void close() 90 throws IOException 91 { 92 checkClose(); 93 this.store = null; 95 } 96 97 98 private void checkClose() 99 throws IOException 100 { 101 if (this.store == null) 102 { 103 throw new IOException ( "Reader has already been closed." ); 104 } 105 } 106 107 108 109 protected void finalize() throws Throwable 110 { 111 super.finalize(); 112 113 if (this.store != null) 114 { 115 throw new IllegalStateException ("Did not close reader."); 116 } 117 } 118 } 119 120 | Popular Tags |