1 29 30 package com.caucho.amber.gen; 31 32 import java.util.logging.Logger; 33 34 import java.security.CodeSource; 35 36 import com.caucho.java.WorkDir; 37 38 import com.caucho.log.Log; 39 40 import com.caucho.loader.Loader; 41 import com.caucho.vfs.Path; 42 43 import com.caucho.amber.AmberManager; 44 45 49 public class AmberLoader extends Loader { 50 private static final Logger log = Log.open(AmberLoader.class); 51 52 private AmberManager _manager; 53 54 private Path _path; 56 private String _prefix; 57 private String _pathPrefix; 58 59 private CodeSource _codeSource; 60 61 64 public AmberLoader(AmberManager manager) 65 { 66 _manager = manager; 67 } 68 69 76 public Path getPath(String name) 77 { 78 if (! name.endsWith(".class")) 79 return null; 80 81 int p = name.lastIndexOf('$'); 82 if (p < 0) 83 p = name.lastIndexOf('-'); 84 if (p < 0) 85 p = name.lastIndexOf('.'); 86 87 String className = name.substring(0, p); 88 className = className.replace('/', '.'); 89 90 if (_manager.getEntityByInstanceClass(className) == null) 91 return null; 92 93 Path workPath = WorkDir.getLocalWorkDir(); 94 95 return workPath.lookup(name); 96 } 97 98 101 107 108 111 public String toString() 112 { 113 return "AmberLoader[]"; 114 } 115 } 116 | Popular Tags |