djencks 2004/02/12 21:48:40
Modified: modules/naming/src/java/org/apache/geronimo/naming/java ComponentContextBuilder.java Log: marginal improvements Revision Changes Path 1.2 +18 -10 incubator-geronimo/modules/naming/src/java/org/apache/geronimo/naming/java/ComponentContextBuilder.java Index: ComponentContextBuilder.java =================================================================== RCS file: /home/cvs/incubator-geronimo/modules/naming/src/java/org/apache/geronimo/naming/java/ComponentContextBuilder.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ComponentContextBuilder.java 12 Feb 2004 20:38:18 -0000 1.1 +++ ComponentContextBuilder.java 13 Feb 2004 05:48:40 -0000 1.2 @@ -66,6 +66,7 @@ import org.apache.geronimo.xbeans.j2ee.EjbRefType; import org.apache.geronimo.xbeans.j2ee.EnvEntryType; import org.apache.geronimo.xbeans.j2ee.ResourceRefType; +import org.apache.geronimo.xbeans.j2ee.EjbLinkType; /** * @@ -74,13 +75,16 @@ */ public class ComponentContextBuilder { + private static final String ENV = "env/"; + private final ProxyFactory proxyFactory; private final UserTransaction userTransaction; - private static final String ENV = "env/"; + private final ClassLoader cl; - public ComponentContextBuilder(ProxyFactory proxyFactory, UserTransaction userTransaction) { + public ComponentContextBuilder(ProxyFactory proxyFactory, UserTransaction userTransaction, ClassLoader cl) { this.userTransaction = userTransaction; this.proxyFactory = proxyFactory; + this.cl = cl; } /** @@ -153,7 +157,7 @@ String name = ejbRef.getEjbRefName().getStringValue(); Object proxy = null; try { - proxy = proxyFactory.getProxy(loadClass(ejbRef.getHome().getStringValue()) ,loadClass(ejbRef.getRemote().getStringValue()), getLink(ejbRef.getEjbLink().getStringValue())); + proxy = proxyFactory.getProxy(loadClass(ejbRef.getHome().getStringValue()), loadClass(ejbRef.getRemote().getStringValue()), getLink(ejbRef.getEjbLink())); } catch (NamingException e) { throw new DeploymentException("Could not construct proxy for " + ejbRef + ", " + e.getMessage()); } @@ -165,12 +169,16 @@ } } - private Object getLink(String link) { + private Object getLink(EjbLinkType link) { return null; } - private Class loadClass(String stringValue) { - return null; + private Class loadClass(String stringValue) throws DeploymentException { + try { + return cl.loadClass(stringValue); + } catch (ClassNotFoundException e) { + throw new DeploymentException("Could not load interface class: " + stringValue, e); + } } private void buildEJBLocalRefs(ReadOnlyContext readOnlyContext, EjbLocalRefType[] ejbLocalRefs) throws DeploymentException { @@ -179,7 +187,7 @@ String name = ejbLocalRef.getEjbRefName().getStringValue(); Object proxy = null; try { - proxy = proxyFactory.getProxy(loadClass(ejbLocalRef.getLocalHome().getStringValue()), loadClass(ejbLocalRef.getLocal().getStringValue()), getLink(ejbLocalRef.toString())); + proxy = proxyFactory.getProxy(loadClass(ejbLocalRef.getLocalHome().getStringValue()), loadClass(ejbLocalRef.getLocal().getStringValue()), getLink(ejbLocalRef.getEjbLink())); } catch (NamingException e) { throw new DeploymentException("Could not construct reference to " + ejbLocalRef + ", " + e.getMessage()); } @@ -199,13 +207,13 @@ Object ref; if ("java.net.URL".equals(type)) { try { - ref = new URL(null /*resRef.geturl().getStringValue()*/); + ref = new URL("http://thisisnotaurlyousupplied" /*resRef.geturl().getStringValue()*/); } catch (MalformedURLException e) { throw new DeploymentException("Invalid URL for resource-ref "+name, e); } } else { try { - ref = proxyFactory.getProxy(loadClass(resRef.getResType().getStringValue()), getLink(resRef.toString())); + ref = proxyFactory.getProxy(loadClass(resRef.getResType().getStringValue()), null); } catch (NamingException e) { throw new DeploymentException("Could not construct reference to " + resRef); }