1 23 24 package com.sun.enterprise.connectors.util; 25 26 import java.security.SecureClassLoader ; 27 28 38 public class ConnectorRARClassLoader extends SecureClassLoader { 39 private JarResourceExtractor jarResources; 40 41 public ConnectorRARClassLoader(String jarName, ClassLoader parent) { 42 super(parent); 43 jarResources = new JarResourceExtractor(jarName); 45 } 46 47 protected byte[] loadClassBytes(String className) { 48 className = formatClassName(className); 49 return (jarResources.getResource(className)); 50 } 51 52 public Class findClass(String name) throws ClassNotFoundException { 53 byte[] b = loadClassBytes(name); 54 if (b == null) { 55 throw new ClassNotFoundException (name); 56 } 57 return defineClass(name, b, 0, b.length); 58 } 59 60 private String formatClassName(String className) { 61 return className.replace('.', '/') + ".class"; 62 } 63 64 public String getResourceAsString(String raDeploymentDescPath) { 65 return new String (jarResources.getResource(raDeploymentDescPath)); 66 } 67 68 } 69 | Popular Tags |