1 18 19 package org.objectweb.speedo.generation.start; 20 21 import org.objectweb.speedo.generation.api.SpeedoCompilerParameter; 22 23 import java.io.File ; 24 import java.io.IOException ; 25 import java.io.InputStream ; 26 import java.io.PrintWriter ; 27 import java.net.URL ; 28 import java.util.ArrayList ; 29 import java.util.Collection ; 30 import java.util.Iterator ; 31 import java.util.List ; 32 33 34 37 public class ListResourceLocator 38 extends ResourceLocatorBase 39 implements ResourceLocator 40 { 41 44 final ArrayList files = new ArrayList (); 45 46 49 public ListResourceLocator(PrintWriter out, 50 boolean verbose, 51 List fileNames, 52 String dir, 53 SpeedoCompilerParameter scp) 54 throws IOException 55 { 56 super(out, verbose); 57 Assertion.assertion(fileNames != null); 58 59 for (Iterator i = fileNames.iterator(); i.hasNext();) { 61 final String s = (String )i.next(); 62 63 final File file = new File (dir+File.separator+s); 65 final URL url = file.toURL(); 66 final String canonicalName = url.toString(); 67 68 Assertion.assertion(canonicalName != null); 69 if (!file.canRead()) { 71 final String msg = getI18N("enhancer.cannot_read_resource", file.toString()); 72 throw new IOException (msg); 73 } 74 75 files.add(file.toString().substring(dir.length()+1)); 76 77 78 printMessage(getI18N("enhancer.using_resource", 79 canonicalName)); 80 } 81 } 82 83 public Collection getCollectionOfFiles() { 84 ArrayList res = new ArrayList (); 85 for (Iterator i = files.iterator();i.hasNext();){ 86 String f = (String ) i.next(); 87 res.add(f); 88 } 89 return res; 90 } 91 92 93 96 public InputStream getInputStreamForResource(String resourceName) 97 { 98 return null; } 100 } 101 | Popular Tags |