| | |
| | | } |
| | | |
| | | private void processZipEntry(ClassLoader urlCL, ZipEntry zipentry, String packageName, JarScannerListener l, Handler h, String contextName) { |
| | | log(Level.FINEST, zipentry.getName()); |
| | | finest(zipentry.getName()); |
| | | String zName = zipentry.getName(); |
| | | if (zName.toLowerCase().endsWith(".class")) { |
| | | int pos = zName.indexOf(".class"); |
| | | String fullClassName = zName.substring(0, pos); |
| | | log(Level.FINEST, "full class name: " + zName); |
| | | finest("full class name: " + zName); |
| | | String fullClassNameDots = fullClassName.replace('/', '.'); |
| | | log(Level.FINEST, "full class name dots: " + fullClassNameDots); |
| | | finest("full class name dots: " + fullClassNameDots); |
| | | String pkgName = getPackageName(fullClassNameDots); |
| | | log(Level.FINEST, " -- package name: " + pkgName); |
| | | finest(" -- package name: " + pkgName); |
| | | if (null != urlCL && pkgName.toLowerCase().startsWith(packageName)) { |
| | | Class c = null; |
| | | try { |
| | | c = urlCL.loadClass(fullClassNameDots); |
| | | if (c != null) { |
| | | if (c.isAnnotationPresent(Actor.class)) { |
| | | log(Level.FINER, " ---- ACTOR ---- " + fullClassNameDots); |
| | | finest(" ---- ACTOR ---- " + fullClassNameDots); |
| | | l.actorFound(c, h, contextName); |
| | | } else { |
| | | log(Level.FINER, "kein Actor " + fullClassNameDots); |
| | | finest("kein Actor " + fullClassNameDots); |
| | | } |
| | | } else { |
| | | log(Level.FINER, "class NOT loaded: " + zName); |
| | | finest("class NOT loaded: " + zName); |
| | | } |
| | | } catch (ClassNotFoundException ex) { |
| | | log(Level.FINER, " +++++ Class not found: " + ex.getMessage()); |
| | | finest(" +++++ Class not found: " + ex.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | ClassLoader urlCL = null; |
| | | try { |
| | | url = getPath(c).toURL(); |
| | | log(Level.FINER, "url: " + url.getPath()); |
| | | finer("url: " + url.getPath()); |
| | | urlCL = new URLClassLoader(new URL[]{url}); |
| | | } catch (URISyntaxException ex) { |
| | | log(Level.SEVERE, ex.getMessage()); |
| | |
| | | public URI getPath(Class c) throws URISyntaxException { |
| | | //Class c = this.getClass(); |
| | | String className = c.getName(); |
| | | finer("this name: " + className); |
| | | finest("this name: " + className); |
| | | |
| | | int pos = className.indexOf(".class"); |
| | | if(pos > -1) { |
| | | String classNameWoExt = className.substring(0, pos); |
| | | } |
| | | String classNameWoPkg = className.substring(className.lastIndexOf(".") + 1); |
| | | finer("Class name: " + classNameWoPkg); |
| | | finest("Class name: " + classNameWoPkg); |
| | | String classPath = c.getResource(classNameWoPkg + ".class").getPath(); |
| | | pos = classPath.indexOf("!"); |
| | | String jarPath; |
| | |
| | | } else { |
| | | jarPath = classPath; |
| | | } |
| | | finer("path: " + jarPath); |
| | | finest("path: " + jarPath); |
| | | return new URI(jarPath); |
| | | } |
| | | |
| | | private void finest(String msg) { |
| | | log(Level.FINEST, msg); |
| | | } |
| | | |
| | | private void finer(String msg) { |
| | | log(Level.FINER, msg); |
| | | } |