1 26 27 package org.objectweb.petals.classloader.locator; 28 29 import java.io.IOException ; 30 import java.net.URL ; 31 import java.util.List ; 32 33 39 public abstract class LocatorAbstract { 40 41 49 public abstract boolean hasFile(String path); 50 51 59 public abstract boolean hasDirectory(String path); 60 61 69 public abstract List listContent(String path); 70 71 84 public static LocatorAbstract getLocator(URL url) throws IOException { 85 String path = url.getPath(); 86 if (path.matches(".*\\..ar")) { 87 return new JarFileLocator(url); 89 } else if (path.endsWith("/")) { 90 return new DirLocator(url); 92 } else { 93 String err = "Unsupported URL '" + url + "' support " 94 + "only jar archive and directory"; 95 throw new IOException (err); 96 } 97 } 98 } 99 | Popular Tags |