1 23 package com.sun.enterprise.util; 24 25 30 import java.io.IOException ; 31 import java.io.File ; 32 import java.util.Set ; 33 import java.util.HashSet ; 34 35 import java.net.URL ; 36 import com.sun.enterprise.util.FileUtil; 37 38 import java.util.logging.*; 40 import com.sun.logging.*; 41 43 import com.sun.enterprise.loader.EJBClassLoader; 45 46 public class JarClassLoader extends EJBClassLoader { 47 48 static Logger _logger=LogDomains.getLogger(LogDomains.UTIL_LOGGER); 50 52 private static final boolean debug = com.sun.enterprise.util.logging.Debug.enabled; 55 57 public JarClassLoader() { 58 super(ConnectorClassLoader.getInstance()); 59 } 60 61 public JarClassLoader(String jarName) throws IOException { 62 super(ConnectorClassLoader.getInstance()); 63 addJar(jarName); 64 } 65 66 69 70 public synchronized void addJar(String jarName) throws IOException { 71 File file = new File (FileUtil.getAbsolutePath(jarName)); 75 79 if(debug && _logger.isLoggable(Level.FINE)) { 81 _logger.log(Level.FINE,"JarClassLoader.addJar: url=" + file.toURL()); 82 } 83 85 appendURL(file); 86 } 87 88 public void addDir(URL url) throws IOException { 89 93 if(debug && _logger.isLoggable(Level.FINE)) { 95 _logger.log(Level.INFO,"JarClassLoader.addDir: url=" + url); 96 } 97 appendURL(url); 99 } 100 101 public String getClassPath() { 102 String cpath = ""; 103 URL [] urls = getURLs(); 104 String sep = File.pathSeparator; 105 106 for(int i=0; i < urls.length; ++i) { 107 cpath = cpath + sep + urls[i].getFile(); 108 } 109 110 return cpath; 111 } 112 } 113 114 115 116 117 118 | Popular Tags |