1 29 30 package com.caucho.loader.enhancer; 31 32 import com.caucho.java.WorkDir; 33 import com.caucho.loader.EnvironmentClassLoader; 34 import com.caucho.util.L10N; 35 import com.caucho.vfs.Path; 36 37 45 public class EnhancingClassLoader extends EnvironmentClassLoader { 46 private static final L10N L = new L10N(EnhancingClassLoader.class); 47 48 private Path _workPath; 49 50 53 public EnhancingClassLoader() 54 { 55 this(Thread.currentThread().getContextClassLoader()); 56 } 57 58 61 public EnhancingClassLoader(ClassLoader parent) 62 { 63 super(parent); 64 } 65 66 69 public Path getWorkPath() 70 { 71 if (_workPath != null) 72 return _workPath; 73 else 74 return WorkDir.getLocalWorkDir(this); 75 } 76 77 80 public void setWorkPath(Path workPath) 81 { 82 _workPath = workPath; 83 } 84 85 88 public final Path getPreWorkPath() 89 { 90 return getWorkPath().lookup("pre-enhance"); 91 } 92 93 96 public final Path getPostWorkPath() 97 { 98 return getWorkPath().lookup("post-enhance"); 99 } 100 101 104 public void init() 105 { 106 super.init(); 107 108 if (getTransformerList() == null 109 && EnhancerManager.getLocalEnhancer(this) != null) { 110 EnhancerManager.create(this); 111 } 112 } 113 114 public String toString() 115 { 116 if (getId() != null) 117 return "EnhancingClassLoader[" + getId() + "]"; 118 else 119 return "EnhancingClassLoader" + getLoaders(); 120 } 121 } 122 | Popular Tags |