1 26 27 package org.objectweb.jonas_lib.loader.factory; 28 29 import java.net.URL ; 30 import java.io.IOException ; 31 32 37 public abstract class URLFactory { 38 39 48 public abstract URL getURL(String path) throws IOException ; 49 50 61 public static URLFactory getFactory(URL url) throws IOException { 62 63 String path = url.getPath(); 64 if (path.matches(".*\\..ar")) { 65 return new JarURLFactory(url); 67 } else if (path.endsWith("/")) { 68 return new DirURLFactory(url); 70 } else { 71 String err = "Unsupported URL '" + url + "' support " 72 + "only jar archive and directory"; 73 throw new IOException (err); 74 } 75 } 76 77 } 78 | Popular Tags |