geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r392392 - in /geronimo/branches/1.1/modules: axis-builder/src/java/org/apache/geronimo/axis/builder/ axis-builder/src/test/org/apache/geronimo/axis/builder/ axis/src/java/org/apache/geronimo/axis/client/ axis/src/java/org/apache/geronimo/ax...
Date Fri, 07 Apr 2006 20:53:59 GMT
Author: dain
Date: Fri Apr  7 13:53:55 2006
New Revision: 392392

URL: http://svn.apache.org/viewcvs?rev=392392&view=rev
Log:
Removed WebService class loader hack which delayed deserialization of WebServicContainers
until the web application class loader was available.  Starting with geronimo 1.1 the web
applicaiton class loader is the same class loader as the configuraiton class loader so there
is no need to delay.
Added special handling for QName in XStream to write a format that can be read in 1.4 and
1.5.
Server now boots on Java5 with the exception of the daytrader application, due to some CORBA
properties.

Added:
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/QNameConverter.java
Removed:
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/ClassLoaderReference.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/StoredObject.java
    geronimo/branches/1.1/modules/naming/src/java/org/apache/geronimo/naming/reference/DeserializingReference.java
Modified:
    geronimo/branches/1.1/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java
    geronimo/branches/1.1/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java
    geronimo/branches/1.1/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceImpl.java
    geronimo/branches/1.1/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java
    geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyPOJOWebServiceHolder.java
    geronimo/branches/1.1/modules/kernel/project.xml
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/ObjectInputStreamExt.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/GBeanState.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SerializedGBeanState.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/XStreamGBeanState.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/XStreamUtil.java
    geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationUtilTest.java
    geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
    geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java

Modified: geronimo/branches/1.1/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java?rev=392392&r1=392391&r2=392392&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java
(original)
+++ geronimo/branches/1.1/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisBuilder.java
Fri Apr  7 13:53:55 2006
@@ -16,9 +16,7 @@
  */
 package org.apache.geronimo.axis.builder;
 
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.io.ObjectOutputStream;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.net.MalformedURLException;
@@ -80,9 +78,6 @@
 import org.apache.geronimo.j2ee.deployment.ServiceReferenceBuilder;
 import org.apache.geronimo.j2ee.deployment.WebServiceBuilder;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.kernel.ClassLoaderReference;
-import org.apache.geronimo.kernel.StoredObject;
-import org.apache.geronimo.naming.reference.DeserializingReference;
 import org.apache.geronimo.xbeans.geronimo.naming.GerPortCompletionType;
 import org.apache.geronimo.xbeans.geronimo.naming.GerPortType;
 import org.apache.geronimo.xbeans.geronimo.naming.GerServiceCompletionType;
@@ -141,14 +136,8 @@
 
         }
 
-        classLoader = new ClassLoaderReference(classLoader);
         AxisWebServiceContainer axisWebServiceContainer = new AxisWebServiceContainer(location,
wsdlURI, service, serviceInfo.getWsdlMap(), classLoader);
-        //targetGBean.setAttribute("webServiceContainer", axisWebServiceContainer);
-        try {
-            targetGBean.setAttribute("webServiceContainer", new StoredObject(axisWebServiceContainer));
// Hack!
-        } catch (IOException e) {
-            throw new DeploymentException("Unable to serialize the AxisWebServiceContainer",
e);
-        }
+        targetGBean.setAttribute("webServiceContainer", axisWebServiceContainer);
     }
 
     public void configureEJB(GBeanData targetGBean, JarFile moduleFile, Object portInfoObject,
ClassLoader classLoader) throws DeploymentException {
@@ -182,18 +171,7 @@
         }
 
         Object service = createService(serviceInterface, schemaInfoBuilder, mapping, serviceQName,
SOAP_VERSION, handlerInfos, gerServiceRefType, deploymentContext, module, classLoader);
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        ObjectOutputStream oos = null;
-        try {
-            oos = new ObjectOutputStream(baos);
-            oos.writeObject(service);
-            oos.flush();
-        } catch (IOException e) {
-            throw new DeploymentException("Could not serialize service instance", e);
-        }
-        byte[] bytes = baos.toByteArray();
-        DeserializingReference reference = new DeserializingReference(bytes);
-        return reference;
+        return service;
     }
 
     public Object createService(Class serviceInterface, SchemaInfoBuilder schemaInfoBuilder,
JavaWsdlMappingType mapping, QName serviceQName, SOAPConstants soapVersion, List handlerInfos,
GerServiceRefType serviceRefType, DeploymentContext context, Module module, ClassLoader classloader)
throws DeploymentException {

Modified: geronimo/branches/1.1/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java?rev=392392&r1=392391&r2=392392&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java
(original)
+++ geronimo/branches/1.1/modules/axis-builder/src/test/org/apache/geronimo/axis/builder/ServiceReferenceTest.java
Fri Apr  7 13:53:55 2006
@@ -18,7 +18,6 @@
 
 import java.io.File;
 import java.lang.reflect.Method;
-import java.net.URI;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.rmi.Remote;
@@ -65,20 +64,19 @@
 import org.apache.geronimo.axis.client.ServiceImpl;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.DeploymentContext;
-import org.apache.geronimo.kernel.repository.Environment;
 import org.apache.geronimo.deployment.util.UnpackedJarFile;
+import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.j2ee.deployment.EJBModule;
 import org.apache.geronimo.j2ee.deployment.Module;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.Jsr77Naming;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.Jsr77Naming;
-import org.apache.geronimo.naming.reference.DeserializingReference;
+import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.xbeans.geronimo.naming.GerServiceRefType;
 import org.apache.geronimo.xbeans.j2ee.JavaWsdlMappingDocument;
 import org.apache.geronimo.xbeans.j2ee.JavaWsdlMappingType;
 import org.apache.geronimo.xbeans.j2ee.PackageMappingType;
-import org.apache.geronimo.xbeans.geronimo.naming.GerServiceRefType;
-import org.apache.geronimo.gbean.AbstractName;
 
 /**
  * @version $Rev:385232 $ $Date$
@@ -222,42 +220,6 @@
         } else {
             System.out.println("Skipping external ws test");
         }
-    }
-
-    public void xtestBuildInteropProxyFromURIs() throws Exception {
-        //ejb is from the EJBModule "ejb" targetPath.
-        context.addFile(new URI("ejb/META-INF/wsdl/interop.wsdl"), wsdlFile);
-        context.addFile(new URI("ejb/META-INF/wsdl/interop-jaxrpcmapping.xml"), new File(wsdlDir,
"interop-jaxrpcmapping.xml"));
-        ClassLoader cl = context.getClassLoader();
-        //new URLClassLoader(new URL[]{wsdldir.toURL()}, isolatedCl);
-        URI wsdlURI = new URI("META-INF/wsdl/interop.wsdl");
-        URI jaxrpcmappingURI = new URI("META-INF/wsdl/interop-jaxrpcmapping.xml");
-        QName serviceQName = new QName("http://tempuri.org/4s4c/1/3/wsdl/def/interopLab",
"interopLab");
-        AxisBuilder builder = new AxisBuilder();
-        Map portComponentRefMap = null;
-        List handlers = null;
-        DeserializingReference reference = (DeserializingReference) builder.createService(InteropLab.class,
wsdlURI, jaxrpcmappingURI, serviceQName, portComponentRefMap, handlers, gerServiceRefType,
context, module, cl);
-        ClassLoader contextCl = context.getClassLoader();
-        reference.setClassLoader(contextCl);
-        Object proxy = reference.getContent();
-        assertNotNull(proxy);
-        assertTrue(proxy instanceof InteropLab);
-
-        InteropLab interopLab = ((InteropLab) proxy);
-        InteropTestPortType interopTestPort = interopLab.getinteropTestPort();
-        assertNotNull(interopTestPort);
-        testInteropPort(interopTestPort);
-
-        //test more dynamically
-        Remote sei = interopLab.getPort(InteropTestPortType.class);
-        assertNotNull(sei);
-        assertTrue(sei instanceof InteropTestPortType);
-        testInteropPort((InteropTestPortType) sei);
-
-        Remote sei2 = interopLab.getPort(new QName("http://tempuri.org/4s4c/1/3/wsdl/def/interopLab",
"interopTestPort"), null);
-        assertNotNull(sei2);
-        assertTrue(sei2 instanceof InteropTestPortType);
-        testInteropPort((InteropTestPortType) sei2);
     }
 
     public void testBuildComplexTypeMap() throws Exception {

Modified: geronimo/branches/1.1/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceImpl.java?rev=392392&r1=392391&r2=392392&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceImpl.java
(original)
+++ geronimo/branches/1.1/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceImpl.java
Fri Apr  7 13:53:55 2006
@@ -23,29 +23,24 @@
 import java.rmi.Remote;
 import java.util.Iterator;
 import java.util.Map;
-
 import javax.xml.namespace.QName;
 import javax.xml.rpc.Call;
 import javax.xml.rpc.ServiceException;
 import javax.xml.rpc.encoding.TypeMappingRegistry;
 import javax.xml.rpc.handler.HandlerRegistry;
 
-import org.apache.axis.EngineConfiguration;
 import org.apache.axis.SimpleTargetedChain;
-import org.apache.axis.transport.http.HTTPSender;
-import org.apache.axis.constants.Use;
-import org.apache.axis.encoding.TypeMappingRegistryImpl;
-import org.apache.axis.encoding.TypeMapping;
-import org.apache.axis.client.AxisClient;
 import org.apache.axis.client.Service;
-import org.apache.axis.configuration.FileProvider;
 import org.apache.axis.configuration.SimpleProvider;
+import org.apache.axis.encoding.TypeMappingRegistryImpl;
+import org.apache.axis.transport.http.HTTPSender;
 
 
 /**
- * @version $Revision:$ $Date:$
+ * @version $Revision:$ $Date$
  */
 public class ServiceImpl implements javax.xml.rpc.Service, Serializable {
+    private static final long serialVersionUID = 8657993237680414470L;
 
     private transient Service delegate;
     private final Map seiClassNameToFactoryMap;

Modified: geronimo/branches/1.1/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java?rev=392392&r1=392391&r2=392392&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java
(original)
+++ geronimo/branches/1.1/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java
Fri Apr  7 13:53:55 2006
@@ -57,7 +57,7 @@
     private final URI wsdlLocation;
     private final SOAPService service;
 
-    private final ClassLoader classLoader;
+    private transient final ClassLoader classLoader;
     private final Map wsdlMap;
 
     public AxisWebServiceContainer(URI location, URI wsdlURL, SOAPService service, Map wsdlMap,
ClassLoader classLoader) {
@@ -65,7 +65,11 @@
         this.wsdlLocation = wsdlURL;
         this.service = service;
         this.wsdlMap = wsdlMap;
-        this.classLoader = classLoader;
+        if (classLoader == null) {
+            this.classLoader = Thread.currentThread().getContextClassLoader();
+        } else {
+            this.classLoader = classLoader;
+        }
     }
 
     public void invoke(Request req, Response res) throws Exception {
@@ -254,4 +258,11 @@
         return location;
     }
 
+    protected Object readResolve() {
+        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+        if (classLoader == null) {
+            classLoader = AxisWebServiceContainer.class.getClassLoader();
+        }
+        return new AxisWebServiceContainer(location, wsdlLocation, service, wsdlMap, classLoader);
+    }
 }

Modified: geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyPOJOWebServiceHolder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyPOJOWebServiceHolder.java?rev=392392&r1=392391&r2=392392&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyPOJOWebServiceHolder.java
(original)
+++ geronimo/branches/1.1/modules/jetty/src/java/org/apache/geronimo/jetty/JettyPOJOWebServiceHolder.java
Fri Apr  7 13:53:55 2006
@@ -32,7 +32,6 @@
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.kernel.StoredObject;
 import org.apache.geronimo.webservices.POJOWebServiceServlet;
 import org.apache.geronimo.webservices.WebServiceContainer;
 import org.apache.geronimo.webservices.WebServiceContainerInvoker;
@@ -44,10 +43,10 @@
  * This is intended to hold the web service stack for an axis POJO web service.
  * It is starting life as a copy of JettyServletHolder.
  *
- * @version $Rev$ $Date$
+ * @version $Rev: 385886 $ $Date$
  */
 public class JettyPOJOWebServiceHolder extends ServletHolder implements GBeanLifecycle {
-    private StoredObject storedWebServiceContainer;
+    private WebServiceContainer webServiceContainer;
     private Set servletMappings;
     private Map webRoleRefPermissions;
     private JettyServletRegistration context;
@@ -64,7 +63,7 @@
                                      Integer loadOnStartup,
                                      Set servletMappings,
                                      Map webRoleRefPermissions,
-                                     StoredObject storedWebServiceContainer,
+                                     WebServiceContainer webServiceContainer,
                                      ServletHolder previous,    //dependency for startup
ordering
                                      JettyServletRegistration context) throws Exception {
         super(context == null ? null : context.getServletHandler(), servletName, POJOWebServiceServlet.class.getName(),
null);
@@ -72,7 +71,7 @@
 
         this.pojoClassName = pojoClassName;
         this.context = context;
-        this.storedWebServiceContainer = storedWebServiceContainer;
+        this.webServiceContainer = webServiceContainer;
         if (context != null) {
             putAll(initParams);
             if (loadOnStartup != null) {
@@ -109,7 +108,6 @@
     public void doStart() throws Exception {
         if (context != null) {
             Class pojoClass = context.getWebClassLoader().loadClass(pojoClassName);
-            WebServiceContainer webServiceContainer = (WebServiceContainer) storedWebServiceContainer.getObject(context.getWebClassLoader());
 
             /* DMB: Hack! I really just want to override initServlet and give a reference
of the WebServiceContainer to the servlet before we call init on it.
              * But this will have to do instead....
@@ -154,7 +152,7 @@
         infoBuilder.addAttribute("loadOnStartup", Integer.class, true);
         infoBuilder.addAttribute("servletMappings", Set.class, true);
         infoBuilder.addAttribute("webRoleRefPermissions", Map.class, true);
-        infoBuilder.addAttribute("webServiceContainer", StoredObject.class, true);
+        infoBuilder.addAttribute("webServiceContainer", WebServiceContainer.class, true);
         infoBuilder.addReference("Previous", ServletHolder.class, NameFactory.SERVLET);
         infoBuilder.addReference("JettyServletRegistration", JettyServletRegistration.class);
 

Modified: geronimo/branches/1.1/modules/kernel/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/project.xml?rev=392392&r1=392391&r2=392392&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/project.xml (original)
+++ geronimo/branches/1.1/modules/kernel/project.xml Fri Apr  7 13:53:55 2006
@@ -54,6 +54,13 @@
             <version>${geronimo_spec_j2ee_deployment_version}</version>
         </dependency>
 
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-qname_1.1_spec</artifactId>
+            <version>${geronimo_spec_j2ee_deployment_version}</version>
+            <type>test</type>
+        </dependency>
+
         <!-- Thirdparty -->
 
         <dependency>

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/ObjectInputStreamExt.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/ObjectInputStreamExt.java?rev=392392&r1=392391&r2=392392&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/ObjectInputStreamExt.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/ObjectInputStreamExt.java
Fri Apr  7 13:53:55 2006
@@ -20,14 +20,7 @@
 import java.io.InputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectStreamClass;
-import java.io.Serializable;
-import java.io.ObjectStreamException;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectOutputStream;
-import java.io.ByteArrayInputStream;
 import java.lang.reflect.Proxy;
-
-import org.apache.geronimo.kernel.ClassLoading;
 
 /**
  * @version $Rev$ $Date$

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/GBeanState.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/GBeanState.java?rev=392392&r1=392391&r2=392392&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/GBeanState.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/GBeanState.java
Fri Apr  7 13:53:55 2006
@@ -16,7 +16,6 @@
  */
 package org.apache.geronimo.kernel.config;
 
-import java.io.Serializable;
 import java.util.List;
 
 import org.apache.geronimo.gbean.GBeanData;
@@ -27,7 +26,7 @@
 /**
  * @version $Rev$ $Date$
  */
-public interface GBeanState extends Serializable {
+public interface GBeanState {
     List getGBeans(ClassLoader classLoader) throws InvalidConfigException;
 
     void addGBean(GBeanData gbeanData);

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SerializedGBeanState.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SerializedGBeanState.java?rev=392392&r1=392391&r2=392392&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SerializedGBeanState.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SerializedGBeanState.java
Fri Apr  7 13:53:55 2006
@@ -39,7 +39,7 @@
 /**
  * @version $Rev$ $Date$
  */
-public class SerializedGBeanState implements GBeanState {
+public class SerializedGBeanState implements GBeanState, Serializable {
     private static final long serialVersionUID = 6015138334529564307L;
 
     /**

Added: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/QNameConverter.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/QNameConverter.java?rev=392392&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/QNameConverter.java
(added)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/QNameConverter.java
Fri Apr  7 13:53:55 2006
@@ -0,0 +1,57 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.kernel.config.xstream;
+
+import java.lang.reflect.Method;
+
+import com.thoughtworks.xstream.converters.ConversionException;
+import com.thoughtworks.xstream.converters.Converter;
+import com.thoughtworks.xstream.converters.MarshallingContext;
+import com.thoughtworks.xstream.converters.UnmarshallingContext;
+import com.thoughtworks.xstream.io.HierarchicalStreamReader;
+import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class QNameConverter implements Converter {
+    private static final String QNAME_CLASS = "javax.xml.namespace.QName";
+
+    public boolean canConvert(Class clazz) {
+        return QNAME_CLASS.equals(clazz.getName());
+    }
+
+    public void marshal(Object object, HierarchicalStreamWriter writer, MarshallingContext
marshallingContext) {
+        writer.setValue(object.toString());
+    }
+
+    public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext unmarshallingContext)
{
+        Class qnameClass = unmarshallingContext.getRequiredType();
+        if (!canConvert(qnameClass)) {
+            throw new ConversionException("Unexpected type in unmarshal: " + qnameClass.getName());
+        }
+
+        String qnameString = reader.getValue();
+        try {
+            Method method = qnameClass.getMethod("valueOf", new Class[]{String.class});
+            Object qname = method.invoke(null, new Object[] { qnameString });
+            return qname;
+        } catch (Exception e) {
+            throw new ConversionException("Unable to convert value to a qname: " + qnameString);
+        }
+    }
+}

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/XStreamGBeanState.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/XStreamGBeanState.java?rev=392392&r1=392391&r2=392392&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/XStreamGBeanState.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/XStreamGBeanState.java
Fri Apr  7 13:53:55 2006
@@ -17,7 +17,6 @@
 package org.apache.geronimo.kernel.config.xstream;
 
 import java.io.IOException;
-import java.io.FileWriter;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -34,8 +33,8 @@
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.kernel.Naming;
-import org.apache.geronimo.kernel.config.GBeanState;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.kernel.config.GBeanState;
 import org.apache.geronimo.kernel.repository.Environment;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -44,8 +43,6 @@
  * @version $Rev$ $Date$
  */
 public class XStreamGBeanState implements GBeanState {
-    private static final long serialVersionUID = 5093634035012004893L;
-
     /**
      * GBeans contained in this configuration.
      */
@@ -101,15 +98,6 @@
         GBeanData gBeanData = new GBeanData(abstractName, gbeanInfo);
         addGBean(gBeanData);
         return gBeanData;
-    }
-
-    private void writeObject(java.io.ObjectOutputStream stream) throws IOException {
-        if (gbeanState == null) {
-            gbeanState = XStreamGBeanState.storeGBeans(gbeans);
-            gbeans.clear();
-        }
-
-        stream.defaultWriteObject();
     }
 
     private static List loadGBeans(Element element, ClassLoader classLoader) throws InvalidConfigException
{

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/XStreamUtil.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/XStreamUtil.java?rev=392392&r1=392391&r2=392392&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/XStreamUtil.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/XStreamUtil.java
Fri Apr  7 13:53:55 2006
@@ -21,17 +21,16 @@
 import com.thoughtworks.xstream.XStream;
 import com.thoughtworks.xstream.converters.reflection.ReflectionProvider;
 import com.thoughtworks.xstream.core.JVM;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Dependency;
-import org.apache.geronimo.kernel.repository.Version;
 import org.apache.geronimo.kernel.repository.ImportType;
-import org.apache.geronimo.kernel.management.StateManageable;
-import org.apache.geronimo.gbean.AbstractName;
-import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.kernel.repository.Version;
 
 /**
  * @version $Rev$ $Date$
@@ -85,6 +84,13 @@
         // ImportType
         xstream.addImmutableType(ImportType.class);
         xstream.registerConverter(new ImportTypeConverter());
+
+        // QName
+        try {
+            xstream.registerConverter(new QNameConverter());
+        } catch (Exception e) {
+            // cl can't see QName class so we don't need to register a converter for it
+        }
 
         // Version
         xstream.alias("version", Version.class);

Modified: geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationUtilTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationUtilTest.java?rev=392392&r1=392391&r2=392392&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationUtilTest.java
(original)
+++ geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationUtilTest.java
Fri Apr  7 13:53:55 2006
@@ -22,6 +22,8 @@
 import java.util.Collections;
 import java.util.List;
 
+import javax.xml.namespace.QName;
+
 import junit.framework.TestCase;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.AbstractNameQuery;
@@ -29,10 +31,7 @@
 import org.apache.geronimo.kernel.Jsr77Naming;
 import org.apache.geronimo.kernel.MockGBean;
 import org.apache.geronimo.kernel.config.xstream.XStreamConfigurationMarshaler;
-import org.apache.geronimo.kernel.config.xstream.XStreamGBeanState;
 import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.Environment;
-import org.apache.geronimo.kernel.repository.ImportType;
 
 /**
  * @version $Rev$ $Date$
@@ -40,60 +39,56 @@
 public class ConfigurationUtilTest extends TestCase {
     private XStreamConfigurationMarshaler xstreamConfigurationMarshaler = new XStreamConfigurationMarshaler();
     private SerializedConfigurationMarshaler serializedConfigurationMarshaler = new SerializedConfigurationMarshaler();
-    private ConfigurationData configurationData1;
-    private ConfigurationData configurationData2;
-
-//    public void testPrint() throws Exception {
-//        xstreamConfigurationMarshaler.writeConfigurationData(configurationData1, System.out);
-//
-//    }
+    private static Artifact artifact3 = new Artifact("test", "3", "3.3", "bar");
+    private static final Jsr77Naming naming = new Jsr77Naming();
 
     public void test() throws Exception {
-        copyTest(configurationData1);
-        copyTest(configurationData2);
-    }
-
-    private void copyTest(ConfigurationData configurationData) throws Exception {
-        List gbeans = configurationData.getGBeans(getClass().getClassLoader());
+        ConfigurationData configurationData = createConfigurationData(serializedConfigurationMarshaler);
         ConfigurationData data = copy(configurationData, serializedConfigurationMarshaler,
serializedConfigurationMarshaler);
-        gbeans = data.getGBeans(getClass().getClassLoader());
-        assertEquals(configurationData.getId(), data.getId());
+        assertEquals(data, configurationData);
 
-        gbeans = configurationData.getGBeans(getClass().getClassLoader());
+        configurationData = createConfigurationData(xstreamConfigurationMarshaler);
+        xstreamConfigurationMarshaler.writeConfigurationData(configurationData, System.out);
         data = copy(configurationData, xstreamConfigurationMarshaler, xstreamConfigurationMarshaler);
+        assertEquals(data, configurationData);
+
+        configurationData = createConfigurationData(serializedConfigurationMarshaler);
+        data = copy(configurationData, serializedConfigurationMarshaler, xstreamConfigurationMarshaler);
+        assertEquals(data, configurationData);
+
+        configurationData = createConfigurationData(xstreamConfigurationMarshaler);
+        data = copy(configurationData, xstreamConfigurationMarshaler, serializedConfigurationMarshaler);
+        assertEquals(data, configurationData);
+    }
+
+    private void assertEquals(ConfigurationData data, ConfigurationData configurationData)
throws InvalidConfigException {
+        List gbeans;
         gbeans = data.getGBeans(getClass().getClassLoader());
         assertEquals(configurationData.getId(), data.getId());
-
-//        gbeans = configurationData.getGBeans(getClass().getClassLoader());
-//        data = copy(configurationData, serializedConfigurationMarshaler, xstreamConfigurationMarshaler);
-//        gbeans = data.getGBeans(getClass().getClassLoader());
-//        assertEquals(configurationData.getId(), data.getId());
+        ConfigurationData data3 = (ConfigurationData) data.getChildConfigurations().get(artifact3);
+        gbeans = data3.getGBeans(getClass().getClassLoader());
+        assertEquals(new QName("namespaceURI", "localPart"), ((GBeanData)gbeans.get(0)).getAttribute("someObject"));
     }
 
     private static ConfigurationData copy(ConfigurationData configurationData, ConfigurationMarshaler
writer, ConfigurationMarshaler reader) throws IOException, ClassNotFoundException {
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         writer.writeConfigurationData(configurationData, out);
-//        System.out.println(new String(out.toByteArray()));
         ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
         ConfigurationData data = reader.readConfigurationData(in);
         return data;
     }
 
-    protected void setUp() throws Exception {
-        super.setUp();
-
-        Jsr77Naming naming = new Jsr77Naming();
-
+    private static ConfigurationData createConfigurationData(ConfigurationMarshaler marshaler)
throws Exception {
         Artifact artifact1 = new Artifact("test", "1", "1.1", "bar");
-        configurationData1 = new ConfigurationData(artifact1, naming, new XStreamGBeanState(Collections.EMPTY_SET));
+        ConfigurationData configurationData = new ConfigurationData(artifact1, naming, marshaler.newGBeanState(Collections.EMPTY_SET));
 
-        GBeanData mockBean1 = configurationData1.addGBean("MyMockGMBean1", MockGBean.getGBeanInfo());
+        GBeanData mockBean1 = configurationData.addGBean("MyMockGMBean1", MockGBean.getGBeanInfo());
         AbstractName gbeanName1 = mockBean1.getAbstractName();
         mockBean1.setAttribute("value", "1234");
         mockBean1.setAttribute("name", "child");
         mockBean1.setAttribute("finalInt", new Integer(1));
 
-        GBeanData mockBean2 = configurationData1.addGBean("MyMockGMBean2", MockGBean.getGBeanInfo());
+        GBeanData mockBean2 = configurationData.addGBean("MyMockGMBean2", MockGBean.getGBeanInfo());
         mockBean2.setAttribute("value", "5678");
         mockBean2.setAttribute("name", "Parent");
         mockBean2.setAttribute("finalInt", new Integer(3));
@@ -102,16 +97,12 @@
         mockBean2.setReferencePattern("EndpointCollection", new AbstractNameQuery(gbeanName1,
MockGBean.getGBeanInfo().getInterfaces()));
 
 
-        Environment e2 = new Environment();
-        Artifact artifact2 = new Artifact("test", "2", "2.2", "bar");
-        e2.setConfigId(artifact2);
-        e2.addDependency(artifact1, ImportType.ALL);
-        configurationData2 = new ConfigurationData(e2, naming, new XStreamGBeanState(Collections.EMPTY_SET));
-
-        Artifact artifact3 = new Artifact("test", "3", "3.3", "bar");
-        ConfigurationData configurationData3 = new ConfigurationData(artifact3, naming, new
XStreamGBeanState(Collections.EMPTY_SET));
-        configurationData1.addChildConfiguration(configurationData3);
-        GBeanData childConfigurationGBean = configurationData3.addGBean("ChildConfigurationGBean",
MockGBean.getGBeanInfo());
+        ConfigurationData childConfigurationData = new ConfigurationData(artifact3, naming,
marshaler.newGBeanState(Collections.EMPTY_SET));
+        configurationData.addChildConfiguration(childConfigurationData);
+        GBeanData childConfigurationGBean = childConfigurationData.addGBean("ChildConfigurationGBean",
MockGBean.getGBeanInfo());
         childConfigurationGBean.setAttribute("name", "foo");
+        childConfigurationGBean.setAttribute("someObject", new QName("namespaceURI", "localPart"));
+
+        return configurationData;
     }
 }

Modified: geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java?rev=392392&r1=392391&r2=392392&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
(original)
+++ geronimo/branches/1.1/modules/tomcat-builder/src/java/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilder.java
Fri Apr  7 13:53:55 2006
@@ -58,7 +58,6 @@
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.Naming;
-import org.apache.geronimo.kernel.StoredObject;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
@@ -86,6 +85,7 @@
 import org.apache.geronimo.xbeans.j2ee.ServletType;
 import org.apache.geronimo.xbeans.j2ee.WebAppDocument;
 import org.apache.geronimo.xbeans.j2ee.WebAppType;
+import org.apache.geronimo.webservices.WebServiceContainer;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
 
@@ -372,7 +372,7 @@
                             throw new DeploymentException("No web service deployment info
for servlet name " + servletName);
                         }
 
-                        StoredObject wsContainer = configurePOJO(webModule.getModuleFile(),
portInfo, servletClassName, moduleClassLoader);
+                        WebServiceContainer wsContainer = configurePOJO(webModule.getModuleFile(),
portInfo, servletClassName, moduleClassLoader);
                         webServices.put(servletName, wsContainer);
                     }
                 }
@@ -436,14 +436,14 @@
         return TOMCAT_NAMESPACE;
     }
 
-    public StoredObject configurePOJO(JarFile moduleFile, Object portInfoObject, String seiClassName,
ClassLoader classLoader) throws DeploymentException, IOException {
+    public WebServiceContainer configurePOJO(JarFile moduleFile, Object portInfoObject, String
seiClassName, ClassLoader classLoader) throws DeploymentException, IOException {
         //the reason to configure a gbeandata rather than just fetch the WebServiceContainer
is that fetching the WSContainer ties us to that
         //ws implementation.  By configuring a servlet gbean, you can provide a different
servlet for each combination of
         //web container and ws implementation while assuming almost nothing about their relationship.
 
         GBeanData fakeData = new GBeanData();
         webServiceBuilder.configurePOJO(fakeData, moduleFile, portInfoObject, seiClassName,
classLoader);
-        return (StoredObject) fakeData.getAttribute("webServiceContainer");
+        return (WebServiceContainer) fakeData.getAttribute("webServiceContainer");
     }
 
 

Modified: geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java?rev=392392&r1=392391&r2=392392&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
(original)
+++ geronimo/branches/1.1/modules/tomcat/src/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
Fri Apr  7 13:53:55 2006
@@ -40,7 +40,6 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.kernel.StoredObject;
 import org.apache.geronimo.naming.enc.EnterpriseNamingContext;
 import org.apache.geronimo.naming.reference.ClassLoaderAwareReference;
 import org.apache.geronimo.naming.reference.KernelAwareReference;
@@ -229,15 +228,9 @@
             if (!baseServletClass.isAssignableFrom(servletClass)) {
                 //Nope - its probably a webservice, so lets see...
                 if (webServiceMap != null) {
-                    StoredObject storedObject = (StoredObject) webServiceMap.get(wrapper.getName());
+                    WebServiceContainer webServiceContainer = (WebServiceContainer) webServiceMap.get(wrapper.getName());
 
-                    if (storedObject != null) {
-                        WebServiceContainer webServiceContainer;
-                        try {
-                            webServiceContainer = (WebServiceContainer) storedObject.getObject(cl);
-                        } catch (IOException io) {
-                            throw new RuntimeException(io);
-                        }
+                    if (webServiceContainer != null) {
                         //Yep its a web service
                         //So swap it out with a POJOWebServiceServlet
                         wrapper.setServletClass("org.apache.geronimo.webservices.POJOWebServiceServlet");



Mime
View raw message