Author: dims Date: Mon Nov 8 05:17:46 2004 New Revision: 56922 Removed: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/ReferenceCollectionImpl.java Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGbean.java geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/WSConfigBuilder.java geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/preconditions/GBeanConfigTest.java Log: Code cleanup
Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGbean.java ============================================================================== --- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGbean.java (original) +++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/AxisGbean.java Mon Nov 8 05:17:46 2004 @@ -43,24 +43,21 @@ // attributes infoFactory.addAttribute("Name", String.class, true); - infoFactory.addAttribute("kernel", Kernel.class, false); infoFactory.addAttribute("objectName", String.class, false); - infoFactory.addReference("resourceManagers", Object.class); // operations - infoFactory.setConstructor(new String[]{"kernel", "Name", - "objectName", "resourceManagers"}); + infoFactory.setConstructor(new String[]{"Name", + "objectName"}); GBEAN_INFO = infoFactory.getBeanInfo(); } /** * Constructor AxisGbean * - * @param kernel * @param name - * @param objectName + @param objectName */ - public AxisGbean(Kernel kernel, String name, String objectName, Collection resourceManagers) { + public AxisGbean(String name, String objectName) { this.name = name; this.objectName = JMXUtil.getObjectName(objectName); } Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/WSConfigBuilder.java ============================================================================== --- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/WSConfigBuilder.java (original) +++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/WSConfigBuilder.java Mon Nov 8 05:17:46 2004 @@ -16,6 +16,22 @@ package org.apache.geronimo.axis; +import org.apache.geronimo.deployment.ConfigurationBuilder; +import org.apache.geronimo.deployment.DeploymentException; +import org.apache.geronimo.gbean.GBeanData; +import org.apache.geronimo.gbean.GBeanInfo; +import org.apache.geronimo.gbean.GBeanInfoBuilder; +import org.apache.geronimo.gbean.WaitingException; +import org.apache.geronimo.gbean.jmx.GBeanMBean; +import org.apache.geronimo.j2ee.deployment.EARConfigBuilder; +import org.apache.geronimo.j2ee.deployment.ResourceReferenceBuilder; +import org.apache.geronimo.kernel.Kernel; +import org.apache.geronimo.kernel.config.Configuration; +import org.apache.geronimo.kernel.config.ConfigurationStore; +import org.apache.geronimo.kernel.repository.Repository; +import org.openejb.deployment.OpenEJBModuleBuilder; + +import javax.management.ObjectName; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; @@ -28,7 +44,6 @@ import java.net.URI; import java.net.URISyntaxException; import java.net.URL; -import java.net.URLClassLoader; import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; @@ -39,39 +54,16 @@ import java.util.jar.JarOutputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; -import javax.management.ObjectName; - -import org.apache.axis.utils.ClassUtils; -import org.apache.geronimo.deployment.ConfigurationBuilder; -import org.apache.geronimo.deployment.DeploymentException; -import org.apache.geronimo.gbean.GBeanData; -import org.apache.geronimo.gbean.GBeanInfo; -import org.apache.geronimo.gbean.GBeanInfoBuilder; -import org.apache.geronimo.gbean.WaitingException; -import org.apache.geronimo.gbean.jmx.GBeanMBean; -import org.apache.geronimo.j2ee.deployment.EARConfigBuilder; -import org.apache.geronimo.j2ee.deployment.ResourceReferenceBuilder; -import org.apache.geronimo.kernel.Kernel; -import org.apache.geronimo.kernel.config.Configuration; -import org.apache.geronimo.kernel.config.ConfigurationStore; -import org.apache.geronimo.kernel.repository.Repository; -import org.openejb.deployment.OpenEJBModuleBuilder; /** * @author Srinath Perera([EMAIL PROTECTED]) */ public class WSConfigBuilder implements ConfigurationBuilder { - private static final String PARENT_ID = "org/apache/geronimo/Server"; private boolean hasEJB = false; - private final Kernel kernel; - private final Repository repository; private final ConfigurationStore configurationStore; - private final String j2eeServerName; - private final String j2eeDomainName; private final ObjectName j2eeServer; private final ObjectName transactionContextManagerObjectName; - private final ObjectName connectionTrackerObjectName; private final ObjectName transactionalTimerObjectName; private final ObjectName nonTransactionalTimerObjectName; private final ObjectName trackedConnectionAssocator; @@ -85,13 +77,8 @@ Repository repository, Kernel kernel, ConfigurationStore configurationStore) { - this.kernel = kernel; - this.repository = repository; this.j2eeServer = j2eeServer; - j2eeServerName = j2eeServer.getKeyProperty("name"); - j2eeDomainName = j2eeServer.getDomain(); this.transactionContextManagerObjectName = transactionContextManagerObjectName; - this.connectionTrackerObjectName = connectionTrackerObjectName; this.transactionalTimerObjectName = transactionalTimerObjectName; this.nonTransactionalTimerObjectName = nonTransactionalTimerObjectName; this.trackedConnectionAssocator = trackedConnectionAssocator; @@ -121,20 +108,16 @@ break; } } - - // TODO DSS: it is a bad idea to use the thread context classloader. Most of geronimo does not set - // the thread context classloader (because of speed) and it is likely to be null. - ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); GBeanMBean[] confBeans = null; if (hasEJB) { - File file = installEJBWebService(earFile, outfile, classLoader); - confBeans = loadEJBWebService(file, earFile, classLoader); + File file = installEJBWebService(earFile, outfile); + confBeans = loadEJBWebService(file, earFile); } else { - File file = installPOJOWebService(earFile, outfile, classLoader); + File file = installPOJOWebService(earFile, outfile); confBeans = loadPOJOWebService(file); } - //TODO take tese from plan + //TODO: take these from plan ObjectName gbeanName1 = new ObjectName("geronimo.test:name=" + earFile.getName()); ObjectName gbeanName2 = new ObjectName("geronimo.test:name=" + earFile.getName() + "EJB"); Map gbeans = new HashMap(); @@ -171,7 +154,7 @@ public GBeanMBean[] loadtheWSConfigurations(File installedLocation, File module, ClassLoader classLoader) throws Exception { if (hasEJB) { - return loadEJBWebService(installedLocation, module, classLoader); + return loadEJBWebService(installedLocation, module); } else { return loadPOJOWebService(installedLocation); } @@ -191,31 +174,24 @@ } } if (hasEJB) { - return installEJBWebService(module, unpackedDir, classLoader); + return installEJBWebService(module, unpackedDir); } else { - return installPOJOWebService(module, unpackedDir, classLoader); + return installPOJOWebService(module, unpackedDir); } } /** * @param module Web Service module generated by EWS * @param unpackedDir for WS - * @param cl * @return the file to where Module is copied in to */ - private File installPOJOWebService(File module, File unpackedDir, ClassLoader cl) throws IOException, DeploymentException { - ClassLoader parentClassLoder = ClassUtils.getDefaultClassLoader(); - ClassLoader classloader - = new URLClassLoader(new URL[]{module.toURL()}, parentClassLoder); - //TODO registerClassLoader(new ZipFile(module),classloader); + private File installPOJOWebService(File module, File unpackedDir) throws IOException { File out = new File(unpackedDir, module.getName()); copyTheFile(module, out); - //The registration done from the POJOWS GBean - //addEntryToAxisDD(new ZipFile(module)); return out; } - private File installEJBWebService(File module, File unpackedDir, ClassLoader cl) throws IOException, URISyntaxException, DeploymentException { + private File installEJBWebService(File module, File unpackedDir) throws IOException, URISyntaxException, DeploymentException { /** * TODO following code deploy the EJB in the OpenEJB EJB continaer. * The code is borrows from the geronimo openEJB module @@ -257,8 +233,8 @@ return new GBeanMBean[]{gbean}; } - private GBeanMBean[] loadEJBWebService(File installLocation, File module, ClassLoader classLoader) throws Exception { - GBeanMBean config = loadConfig(installLocation, classLoader); + private GBeanMBean[] loadEJBWebService(File installLocation, File module) throws Exception { + GBeanMBean config = loadConfig(installLocation); config.setAttribute("baseURL", installLocation.toURL()); GBeanMBean gbean = new GBeanMBean(EJBWSGBean.getGBeanInfo()); ArrayList classList = AxisGeronimoUtils.getClassFileList(new ZipFile(module)); @@ -267,13 +243,13 @@ return new GBeanMBean[]{gbean, config}; } - private GBeanMBean loadConfig(File unpackedCar, ClassLoader classLoader) throws Exception { + private GBeanMBean loadConfig(File unpackedCar) throws Exception { InputStream in = new FileInputStream(new File(unpackedCar, "META-INF/config.ser")); try { ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(in)); GBeanData config = new GBeanData(); config.readExternal(ois); - return new GBeanMBean(config, classLoader); + return new GBeanMBean(config, null); } finally { in.close(); } Modified: geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/preconditions/GBeanConfigTest.java ============================================================================== --- geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/preconditions/GBeanConfigTest.java (original) +++ geronimo/trunk/modules/axis/src/test/org/apache/geronimo/axis/preconditions/GBeanConfigTest.java Mon Nov 8 05:17:46 2004 @@ -17,9 +17,6 @@ import org.apache.geronimo.axis.AbstractTestCase; import org.apache.geronimo.axis.AxisGbean; -import org.apache.geronimo.axis.AxisGeronimoUtils; -import org.apache.geronimo.axis.ReferenceCollectionImpl; -import org.apache.geronimo.gbean.ReferenceCollection; import org.apache.geronimo.gbean.jmx.GBeanMBean; import org.apache.geronimo.kernel.Kernel; @@ -46,7 +43,6 @@ public void testStartAxisService() throws Exception { ClassLoader cl = getClass().getClassLoader(); ClassLoader myCl = new URLClassLoader(new URL[0], cl); - ReferenceCollection rc = new ReferenceCollectionImpl(); GBeanMBean gbean2 = new GBeanMBean(AxisGbean.getGBeanInfo(), myCl); gbean2.setAttribute("Name", "Test"); kernel.loadGBean(name2, gbean2); @@ -61,7 +57,6 @@ public void testdependencies() throws Exception { ClassLoader cl = getClass().getClassLoader(); ClassLoader myCl = new URLClassLoader(new URL[0], cl); - ReferenceCollection rc = new ReferenceCollectionImpl(); GBeanMBean gbean2 = new GBeanMBean(AxisGbean.getGBeanInfo(), myCl); gbean2.setAttribute("Name", "Test"); kernel.loadGBean(name2, gbean2);