You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by da...@apache.org on 2006/04/05 00:18:33 UTC

svn commit: r391427 [1/2] - in /geronimo/branches/1.1: assemblies/j2ee-jetty-server/ assemblies/j2ee-tomcat-server/ configs/client-system/ configs/geronimo-gbean-deployer/ configs/j2ee-system/ configs/online-deployer/ configs/shutdown/ etc/ modules/axi...

Author: dain
Date: Tue Apr  4 15:18:27 2006
New Revision: 391427

URL: http://svn.apache.org/viewcvs?rev=391427&view=rev
Log:
Added optional support for using xstream to save configurations.
Use -Dorg.apache.geronimo.kernel.config.Marshaler=org.apache.geronimo.kernel.config.xstream.XStreamConfigurationMarshaler to enable xstream.

Added:
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationMarshaler.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/SerializedConfigurationMarshaler.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/
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/AbstractNameConverter.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/AbstractNameQueryConverter.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/ConfigurationModuleTypeConverter.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/DomConverter.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/GBeanDataConverter.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/ImportTypeConverter.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/URIConverter.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/UriConverter.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/VersionConverter.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/XStreamConfigurationMarshaler.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/XStreamGBeanStateConverter.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
Modified:
    geronimo/branches/1.1/assemblies/j2ee-jetty-server/project.xml
    geronimo/branches/1.1/assemblies/j2ee-tomcat-server/project.xml
    geronimo/branches/1.1/configs/client-system/project.properties
    geronimo/branches/1.1/configs/geronimo-gbean-deployer/project.properties
    geronimo/branches/1.1/configs/geronimo-gbean-deployer/project.xml
    geronimo/branches/1.1/configs/j2ee-system/project.properties
    geronimo/branches/1.1/configs/j2ee-system/project.xml
    geronimo/branches/1.1/configs/online-deployer/project.properties
    geronimo/branches/1.1/configs/shutdown/project.properties
    geronimo/branches/1.1/etc/project.properties
    geronimo/branches/1.1/modules/axis-builder/project.xml
    geronimo/branches/1.1/modules/connector-builder/project.xml
    geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/JCAResourceImpl.java
    geronimo/branches/1.1/modules/deployment/project.xml
    geronimo/branches/1.1/modules/j2ee-builder/project.xml
    geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
    geronimo/branches/1.1/modules/jetty-builder/project.xml
    geronimo/branches/1.1/modules/kernel/project.xml
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/Jsr77Naming.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationData.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
    geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ImportType.java
    geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/MockGBean.java
    geronimo/branches/1.1/modules/naming-builder/project.xml
    geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/jacc/ApplicationPolicyConfigurationManager.java
    geronimo/branches/1.1/modules/service-builder/project.xml
    geronimo/branches/1.1/modules/tomcat-builder/project.xml
    geronimo/branches/1.1/modules/transaction/src/java/org/apache/geronimo/transaction/manager/XidFactoryImplGBean.java
    geronimo/branches/1.1/plugins/geronimo-assembly-plugin/project.xml
    geronimo/branches/1.1/plugins/geronimo-packaging-plugin/project.xml

Modified: geronimo/branches/1.1/assemblies/j2ee-jetty-server/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/assemblies/j2ee-jetty-server/project.xml?rev=391427&r1=391426&r2=391427&view=diff
==============================================================================
--- geronimo/branches/1.1/assemblies/j2ee-jetty-server/project.xml (original)
+++ geronimo/branches/1.1/assemblies/j2ee-jetty-server/project.xml Tue Apr  4 15:18:27 2006
@@ -434,6 +434,24 @@
             </properties>
         </dependency>
 
+        <dependency>
+            <groupId>xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>${xstream_version}</version>
+            <properties>
+                 <geronimo.assemble>library</geronimo.assemble>
+             </properties>
+        </dependency>
+
+        <dependency>
+            <groupId>xpp3</groupId>
+            <artifactId>xpp3</artifactId>
+            <version>${xpp3_version}</version>
+            <properties>
+                 <geronimo.assemble>library</geronimo.assemble>
+             </properties>
+        </dependency>
+
         <!-- endorsed -->
         <dependency>
             <groupId>xerces</groupId>
@@ -1081,19 +1099,6 @@
             <artifactId>xbean</artifactId>
             <version>${xmlbeans_version}</version>
         </dependency>
-
-        <dependency>
-            <groupId>xpp3</groupId>
-            <artifactId>xpp3</artifactId>
-            <version>${xpp3_version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>xstream</groupId>
-            <artifactId>xstream</artifactId>
-            <version>${xstream_version}</version>
-        </dependency>
-
 
 <!-- stuff that has no clear purpose -->
         <dependency>

Modified: geronimo/branches/1.1/assemblies/j2ee-tomcat-server/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/assemblies/j2ee-tomcat-server/project.xml?rev=391427&r1=391426&r2=391427&view=diff
==============================================================================
--- geronimo/branches/1.1/assemblies/j2ee-tomcat-server/project.xml (original)
+++ geronimo/branches/1.1/assemblies/j2ee-tomcat-server/project.xml Tue Apr  4 15:18:27 2006
@@ -434,6 +434,24 @@
             </properties>
         </dependency>
 
+        <dependency>
+            <groupId>xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>${xstream_version}</version>
+            <properties>
+                 <geronimo.assemble>library</geronimo.assemble>
+             </properties>
+        </dependency>
+
+        <dependency>
+            <groupId>xpp3</groupId>
+            <artifactId>xpp3</artifactId>
+            <version>${xpp3_version}</version>
+            <properties>
+                 <geronimo.assemble>library</geronimo.assemble>
+             </properties>
+        </dependency>
+
         <!-- endorsed -->
         <dependency>
             <groupId>xerces</groupId>
@@ -1090,12 +1108,6 @@
             <groupId>xmlbeans</groupId>
             <artifactId>xbean</artifactId>
             <version>${xmlbeans_version}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>xpp3</groupId>
-            <artifactId>xpp3</artifactId>
-            <version>${xpp3_version}</version>
         </dependency>
 
         <dependency>

Modified: geronimo/branches/1.1/configs/client-system/project.properties
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/configs/client-system/project.properties?rev=391427&r1=391426&r2=391427&view=diff
==============================================================================
--- geronimo/branches/1.1/configs/client-system/project.properties (original)
+++ geronimo/branches/1.1/configs/client-system/project.properties Tue Apr  4 15:18:27 2006
@@ -39,7 +39,9 @@
     ../lib/mx4j-${mx4j_version}.jar \
     ../lib/mx4j-remote-${mx4j_version}.jar \
     ../lib/endorsed/xercesImpl-${xerces_version}.jar \
-    ../lib/endorsed/xmlParserAPIs-${xml_parser_apis_version}.jar
+    ../lib/endorsed/xmlParserAPIs-${xml_parser_apis_version}.jar \
+    ../lib/xpp3-${xpp3_version}.jar \
+    ../lib/xstream-${xstream_version}.jar \
 
 geronimo.packaging.mainClass=org.apache.geronimo.system.main.ClientCommandLine
 geronimo.packaging.endorsedDirs=lib/endorsed

Modified: geronimo/branches/1.1/configs/geronimo-gbean-deployer/project.properties
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/configs/geronimo-gbean-deployer/project.properties?rev=391427&r1=391426&r2=391427&view=diff
==============================================================================
--- geronimo/branches/1.1/configs/geronimo-gbean-deployer/project.properties (original)
+++ geronimo/branches/1.1/configs/geronimo-gbean-deployer/project.properties Tue Apr  4 15:18:27 2006
@@ -40,7 +40,9 @@
     ../lib/mx4j-${mx4j_version}.jar \
     ../lib/mx4j-remote-${mx4j_version}.jar \
     ../lib/endorsed/xercesImpl-${xerces_version}.jar \
-    ../lib/endorsed/xmlParserAPIs-${xml_parser_apis_version}.jar
+    ../lib/endorsed/xmlParserAPIs-${xml_parser_apis_version}.jar \
+    ../lib/xpp3-${xpp3_version}.jar \
+    ../lib/xstream-${xstream_version}.jar \
 
 geronimo.packaging.mainClass=org.apache.geronimo.deployment.cli.DeployTool
 geronimo.packaging.endorsedDirs=lib/endorsed

Modified: geronimo/branches/1.1/configs/geronimo-gbean-deployer/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/configs/geronimo-gbean-deployer/project.xml?rev=391427&r1=391426&r2=391427&view=diff
==============================================================================
--- geronimo/branches/1.1/configs/geronimo-gbean-deployer/project.xml (original)
+++ geronimo/branches/1.1/configs/geronimo-gbean-deployer/project.xml Tue Apr  4 15:18:27 2006
@@ -91,6 +91,24 @@
              </properties>
         </dependency>
 
+        <dependency>
+            <groupId>xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>${xstream_version}</version>
+            <properties>
+                 <geronimo.dependency>true</geronimo.dependency>
+             </properties>
+        </dependency>
+
+        <dependency>
+            <groupId>xpp3</groupId>
+            <artifactId>xpp3</artifactId>
+            <version>${xpp3_version}</version>
+            <properties>
+                 <geronimo.dependency>true</geronimo.dependency>
+             </properties>
+        </dependency>
+      
         <!-- for bootstrap -->
         <dependency>
             <groupId>geronimo</groupId>

Modified: geronimo/branches/1.1/configs/j2ee-system/project.properties
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/configs/j2ee-system/project.properties?rev=391427&r1=391426&r2=391427&view=diff
==============================================================================
--- geronimo/branches/1.1/configs/j2ee-system/project.properties (original)
+++ geronimo/branches/1.1/configs/j2ee-system/project.properties Tue Apr  4 15:18:27 2006
@@ -37,7 +37,9 @@
     ../lib/mx4j-${mx4j_version}.jar \
     ../lib/mx4j-remote-${mx4j_version}.jar \
     ../lib/endorsed/xercesImpl-${xerces_version}.jar \
-    ../lib/endorsed/xmlParserAPIs-${xml_parser_apis_version}.jar
+    ../lib/endorsed/xmlParserAPIs-${xml_parser_apis_version}.jar \
+    ../lib/xpp3-${xpp3_version}.jar \
+    ../lib/xstream-${xstream_version}.jar \
 
 geronimo.packaging.mainClass=org.apache.geronimo.system.main.Daemon
 geronimo.packaging.endorsedDirs=lib/endorsed

Modified: geronimo/branches/1.1/configs/j2ee-system/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/configs/j2ee-system/project.xml?rev=391427&r1=391426&r2=391427&view=diff
==============================================================================
--- geronimo/branches/1.1/configs/j2ee-system/project.xml (original)
+++ geronimo/branches/1.1/configs/j2ee-system/project.xml Tue Apr  4 15:18:27 2006
@@ -134,6 +134,23 @@
              </properties>
         </dependency>
 
+        <dependency>
+            <groupId>xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>${xstream_version}</version>
+            <properties>
+                 <geronimo.dependency>true</geronimo.dependency>
+             </properties>
+        </dependency>
+
+        <dependency>
+            <groupId>xpp3</groupId>
+            <artifactId>xpp3</artifactId>
+            <version>${xpp3_version}</version>
+            <properties>
+                 <geronimo.dependency>true</geronimo.dependency>
+             </properties>
+        </dependency>
     </dependencies>
 </project>
 

Modified: geronimo/branches/1.1/configs/online-deployer/project.properties
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/configs/online-deployer/project.properties?rev=391427&r1=391426&r2=391427&view=diff
==============================================================================
--- geronimo/branches/1.1/configs/online-deployer/project.properties (original)
+++ geronimo/branches/1.1/configs/online-deployer/project.properties Tue Apr  4 15:18:27 2006
@@ -36,6 +36,8 @@
     ../lib/log4j-${log4j_version}.jar \
     ../lib/mx4j-${mx4j_version}.jar \
     ../lib/mx4j-remote-${mx4j_version}.jar \
+    ../lib/xpp3-${xpp3_version}.jar \
+    ../lib/xstream-${xstream_version}.jar \
 
 geronimo.packaging.mainClass=org.apache.geronimo.deployment.cli.DeployTool
 

Modified: geronimo/branches/1.1/configs/shutdown/project.properties
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/configs/shutdown/project.properties?rev=391427&r1=391426&r2=391427&view=diff
==============================================================================
--- geronimo/branches/1.1/configs/shutdown/project.properties (original)
+++ geronimo/branches/1.1/configs/shutdown/project.properties Tue Apr  4 15:18:27 2006
@@ -33,6 +33,8 @@
     ../lib/log4j-${log4j_version}.jar \
     ../lib/mx4j-${mx4j_version}.jar \
     ../lib/mx4j-remote-${mx4j_version}.jar \
+    ../lib/xpp3-${xpp3_version}.jar \
+    ../lib/xstream-${xstream_version}.jar \
 
 geronimo.packaging.mainClass=org.apache.geronimo.deployment.cli.StopServer
 

Modified: geronimo/branches/1.1/etc/project.properties
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/etc/project.properties?rev=391427&r1=391426&r2=391427&view=diff
==============================================================================
--- geronimo/branches/1.1/etc/project.properties (original)
+++ geronimo/branches/1.1/etc/project.properties Tue Apr  4 15:18:27 2006
@@ -86,8 +86,8 @@
 tranql_vendors_version=1.1
 release_notes_version=1.0
 
-geronimo_packaging_plugin_version=1.1.0-2
-geronimo_assembly_plugin_version=1.1.0-8
+geronimo_packaging_plugin_version=1.1.0-3
+geronimo_assembly_plugin_version=1.1.0-9
 geronimo_deployment_plugin_version=1.1.0-1
 geronimo_dependency_plugin_version=1.1.0-1
 
@@ -189,7 +189,7 @@
 xmlbeans_maven_plugin_version=2.0.0-beta1
 xmlpull_version=1.1.3.4d_b4_min
 xpp3_version=1.1.3.3
-xstream_version=1.0.2
+xstream_version=1.1.3
 
 #####################################################
 # Site Colors

Modified: geronimo/branches/1.1/modules/axis-builder/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/axis-builder/project.xml?rev=391427&r1=391426&r2=391427&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/axis-builder/project.xml (original)
+++ geronimo/branches/1.1/modules/axis-builder/project.xml Tue Apr  4 15:18:27 2006
@@ -241,7 +241,18 @@
             <artifactId>wsdl4j</artifactId>
             <version>${wsdl4j_version}</version>
         </dependency>
+  
+        <dependency>
+            <groupId>xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>${xstream_version}</version>
+        </dependency>
 
+        <dependency>
+            <groupId>xpp3</groupId>
+            <artifactId>xpp3</artifactId>
+            <version>${xpp3_version}</version>
+        </dependency>
     </dependencies>
     <build>
         <resources>

Modified: geronimo/branches/1.1/modules/connector-builder/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector-builder/project.xml?rev=391427&r1=391426&r2=391427&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector-builder/project.xml (original)
+++ geronimo/branches/1.1/modules/connector-builder/project.xml Tue Apr  4 15:18:27 2006
@@ -227,5 +227,17 @@
             <version>${regexp_version}</version>
             <url>http://jakarta.apache.org/regexp</url>
         </dependency>
+
+        <dependency>
+            <groupId>xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>${xstream_version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>xpp3</groupId>
+            <artifactId>xpp3</artifactId>
+            <version>${xpp3_version}</version>
+        </dependency>
     </dependencies>
 </project>

Modified: geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/JCAResourceImpl.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/JCAResourceImpl.java?rev=391427&r1=391426&r2=391427&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/JCAResourceImpl.java (original)
+++ geronimo/branches/1.1/modules/connector/src/java/org/apache/geronimo/connector/JCAResourceImpl.java Tue Apr  4 15:18:27 2006
@@ -25,7 +25,7 @@
 import java.util.Iterator;
 
 /**
- * @version $Rev$ $Date$
+ * @version $Rev: 386505 $ $Date$
  */
 public class JCAResourceImpl implements JCAResource  {
     private final String objectName;

Modified: geronimo/branches/1.1/modules/deployment/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/deployment/project.xml?rev=391427&r1=391426&r2=391427&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/deployment/project.xml (original)
+++ geronimo/branches/1.1/modules/deployment/project.xml Tue Apr  4 15:18:27 2006
@@ -104,6 +104,18 @@
             <version>${xml_resolver_version}</version>
             <url>http://xml.apache.org/commons</url>
         </dependency>
+
+        <dependency>
+            <groupId>xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>${xstream_version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>xpp3</groupId>
+            <artifactId>xpp3</artifactId>
+            <version>${xpp3_version}</version>
+        </dependency>
     </dependencies>
 
 

Modified: geronimo/branches/1.1/modules/j2ee-builder/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/project.xml?rev=391427&r1=391426&r2=391427&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee-builder/project.xml (original)
+++ geronimo/branches/1.1/modules/j2ee-builder/project.xml Tue Apr  4 15:18:27 2006
@@ -158,6 +158,18 @@
             <artifactId>mx4j</artifactId>
             <version>${mx4j_version}</version>
         </dependency>
+    
+        <dependency>
+            <groupId>xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>${xstream_version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>xpp3</groupId>
+            <artifactId>xpp3</artifactId>
+            <version>${xpp3_version}</version>
+        </dependency>
     </dependencies>
 
 

Modified: geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java?rev=391427&r1=391426&r2=391427&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java (original)
+++ geronimo/branches/1.1/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/EARConfigBuilder.java Tue Apr  4 15:18:27 2006
@@ -38,7 +38,6 @@
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
 import org.apache.geronimo.kernel.config.ConfigurationAlreadyExistsException;

Modified: geronimo/branches/1.1/modules/jetty-builder/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/jetty-builder/project.xml?rev=391427&r1=391426&r2=391427&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/jetty-builder/project.xml (original)
+++ geronimo/branches/1.1/modules/jetty-builder/project.xml Tue Apr  4 15:18:27 2006
@@ -323,6 +323,17 @@
             <version>${wsdl4j_version}</version>
         </dependency>
 
+        <dependency>
+            <groupId>xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>${xstream_version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>xpp3</groupId>
+            <artifactId>xpp3</artifactId>
+            <version>${xpp3_version}</version>
+        </dependency>
     </dependencies>
 
 </project>

Modified: geronimo/branches/1.1/modules/kernel/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/project.xml?rev=391427&r1=391426&r2=391427&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/project.xml (original)
+++ geronimo/branches/1.1/modules/kernel/project.xml Tue Apr  4 15:18:27 2006
@@ -82,6 +82,18 @@
             <artifactId>mx4j</artifactId>
             <version>${mx4j_version}</version>
         </dependency>
+
+        <dependency>
+            <groupId>xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>${xstream_version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>xpp3</groupId>
+            <artifactId>xpp3</artifactId>
+            <version>${xpp3_version}</version>
+        </dependency>
     </dependencies>
 
     <build>

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java?rev=391427&r1=391426&r2=391427&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/gbean/AbstractName.java Tue Apr  4 15:18:27 2006
@@ -22,15 +22,14 @@
 import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
-import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.Jsr77Naming;
 
 /**
  * @version $Rev:$ $Date:$
@@ -51,13 +50,7 @@
         this.artifact = artifact;
         this.name = name;
 
-        try {
-            objectName = new ObjectName("geronimo", new Hashtable(name));
-        } catch (MalformedObjectNameException e) {
-            IllegalArgumentException illegalArgumentException = new IllegalArgumentException();
-            illegalArgumentException.initCause(e);
-            throw illegalArgumentException;
-        }
+        this.objectName = Jsr77Naming.createObjectName(name);
 
         this.uri = createURI(artifact, name);
     }
@@ -135,13 +128,7 @@
         //
         // object name
         //
-        try {
-            objectName = new ObjectName("geronimo", new Hashtable(name));
-        } catch (MalformedObjectNameException e) {
-            IllegalArgumentException illegalArgumentException = new IllegalArgumentException();
-            illegalArgumentException.initCause(e);
-            throw illegalArgumentException;
-        }
+        this.objectName = Jsr77Naming.createObjectName(name);
     }
 
     private static URI createURI(Artifact artifact, Map name) {

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/Jsr77Naming.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/Jsr77Naming.java?rev=391427&r1=391426&r2=391427&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/Jsr77Naming.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/Jsr77Naming.java Tue Apr  4 15:18:27 2006
@@ -71,7 +71,7 @@
     /**
      * @deprecated objectnames are being removed
      */
-    private static ObjectName createObjectName(Map nameMap) {
+    public static ObjectName createObjectName(Map nameMap) {
         Hashtable objectNameMap = new Hashtable(nameMap);
         String type = (String) nameMap.get(J2EE_TYPE);
         if ("JVM".equals(type)) {

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationData.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationData.java?rev=391427&r1=391426&r2=391427&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationData.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationData.java Tue Apr  4 15:18:27 2006
@@ -19,25 +19,16 @@
 
 import java.io.File;
 import java.io.Serializable;
-import java.io.IOException;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.EOFException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.LinkedHashSet;
 import java.util.List;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.LinkedHashMap;
 
-import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.GBeanData;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.kernel.Naming;
-import org.apache.geronimo.kernel.ObjectInputStreamExt;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
 
@@ -63,14 +54,9 @@
     private final LinkedHashSet classPath = new LinkedHashSet();
 
     /**
-     * GBeans contained in this configuration.
+     * The gbeans contained in this configuration
      */
-    private final List gbeans = new ArrayList();
-
-    /**
-     * The serialized form of the gbeans.  Once this is set on more gbeans can be added.
-     */
-    private byte[] gbeanState;
+    private final GBeanState gbeanState;
 
     /**
      * Child configurations of this configuration
@@ -111,9 +97,7 @@
         if (classPath != null) {
             this.classPath.addAll(classPath);
         }
-        if (gbeans != null){
-            this.gbeans.addAll(gbeans);
-        }
+        gbeanState = ConfigurationUtil.newGBeanState(gbeans);
         if (childConfigurations != null) {
             this.childConfigurations.putAll(childConfigurations);
         }
@@ -137,32 +121,15 @@
     }
 
     public List getGBeans(ClassLoader classLoader) throws InvalidConfigException {
-        if (gbeanState == null) {
-            return Collections.unmodifiableList(gbeans);
-        }
-        gbeans.addAll(loadGBeans(gbeanState, classLoader));
-        return Collections.unmodifiableList(gbeans);
+        return gbeanState.getGBeans(classLoader);
     }
 
     public void addGBean(GBeanData gbeanData) {
-        if (gbeanState != null) {
-            throw new IllegalStateException("GBeans have been serialized, so no more GBeans can be added");
-        }
-
-        gbeans.add(gbeanData);
+        gbeanState.addGBean(gbeanData);
     }
 
     public GBeanData addGBean(String name, GBeanInfo gbeanInfo) {
-        if (gbeanState != null) {
-            throw new IllegalStateException("GBeans have been serialized, so no more GBeans can be added");
-        }
-
-        String j2eeType = gbeanInfo.getJ2eeType();
-        if (j2eeType == null) j2eeType = "GBean";
-        AbstractName abstractName = naming.createRootName(environment.getConfigId(), name, j2eeType);
-        GBeanData gBeanData = new GBeanData(abstractName, gbeanInfo);
-        addGBean(gBeanData);
-        return gBeanData;
+        return gbeanState.addGBean(name, gbeanInfo, naming, environment);
     }
 
     public Map getChildConfigurations() {
@@ -196,67 +163,4 @@
     public void setConfigurationStore(ConfigurationStore configurationStore) {
         this.configurationStore = configurationStore;
     }
-
-    private void writeObject(java.io.ObjectOutputStream stream) throws IOException {
-        if (gbeanState == null) {
-            gbeanState = storeGBeans(gbeans);
-            gbeans.clear();
-        }
-
-        stream.defaultWriteObject();
-    }
-
-    private static List loadGBeans(byte[] gbeanState, ClassLoader classLoader) throws InvalidConfigException {
-        List gbeans = new ArrayList();
-        if (gbeanState != null && gbeanState.length > 0) {
-            // Set the thread context classloader so deserializing classes can grab the cl from the thread
-            ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
-            try {
-                Thread.currentThread().setContextClassLoader(classLoader);
-
-                ObjectInputStream ois = new ObjectInputStreamExt(new ByteArrayInputStream(gbeanState), classLoader);
-                try {
-                    while (true) {
-                        GBeanData gbeanData = new GBeanData();
-                        gbeanData.readExternal(ois);
-                        gbeans.add(gbeanData);
-                    }
-                } catch (EOFException e) {
-                    // ok
-                } finally {
-                    ois.close();
-                }
-            } catch (Exception e) {
-                throw new InvalidConfigException("Unable to deserialize GBeanState", e);
-            } finally {
-                Thread.currentThread().setContextClassLoader(oldCl);
-            }
-        }
-        return gbeans;
-    }
-
-    private static byte[] storeGBeans(List gbeans) throws IOException {
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        ObjectOutputStream oos;
-        try {
-            oos = new ObjectOutputStream(baos);
-        } catch (IOException e) {
-            throw (AssertionError) new AssertionError("Unable to initialize ObjectOutputStream").initCause(e);
-        }
-        for (Iterator iterator = gbeans.iterator(); iterator.hasNext();) {
-            GBeanData gbeanData = (GBeanData) iterator.next();
-            try {
-                gbeanData.writeExternal(oos);
-            } catch (Exception e) {
-                throw (IOException) new IOException("Unable to serialize GBeanData for " + gbeanData.getAbstractName()).initCause(e);
-            }
-        }
-        try {
-            oos.flush();
-        } catch (IOException e) {
-            throw (AssertionError) new AssertionError("Unable to flush ObjectOutputStream").initCause(e);
-        }
-        return baos.toByteArray();
-    }
-
 }

Added: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationMarshaler.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationMarshaler.java?rev=391427&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationMarshaler.java (added)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationMarshaler.java Tue Apr  4 15:18:27 2006
@@ -0,0 +1,33 @@
+/**
+ *
+ * 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;
+
+import java.io.OutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collection;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface ConfigurationMarshaler {
+    void writeConfigurationData(ConfigurationData configurationData, OutputStream out) throws IOException;
+
+    ConfigurationData readConfigurationData(InputStream in) throws IOException, ClassNotFoundException;
+
+    GBeanState newGBeanState(Collection gbeans);
+}

Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java?rev=391427&r1=391426&r2=391427&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java Tue Apr  4 15:18:27 2006
@@ -18,8 +18,6 @@
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
 import java.io.OutputStream;
 import java.net.URI;
 import java.net.URL;
@@ -41,17 +39,69 @@
 import org.apache.geronimo.kernel.GBeanAlreadyExistsException;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.ClassLoading;
 import org.apache.geronimo.kernel.basic.BasicKernel;
 import org.apache.geronimo.kernel.management.State;
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * @version $Rev:386276 $ $Date$
  */
 public final class ConfigurationUtil {
+    private static final ConfigurationMarshaler configurationMarshaler;
+
+    static {
+        Log log = LogFactory.getLog(ConfigurationUtil.class);
+
+        ConfigurationMarshaler marshaler = null;
+        String marshalerClass = System.getProperty("org.apache.geronimo.kernel.config.Marshaler");
+        if (marshalerClass != null) {
+            ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+            Class clazz = null;
+            if (classLoader != null) {
+                try {
+                    clazz = ClassLoading.loadClass(marshalerClass, classLoader);
+                } catch (ClassNotFoundException ignored) {
+                    // doesn't matter
+                }
+            }
+            if (clazz == null) {
+                classLoader = ConfigurationUtil.class.getClassLoader();
+                try {
+                    clazz = ClassLoading.loadClass(marshalerClass, classLoader);
+                } catch (ClassNotFoundException ignored) {
+                    // doesn't matter
+                }
+            }
+            if (clazz != null) {
+                try {
+                    Object object = clazz.newInstance();
+                    if (object instanceof ConfigurationMarshaler) {
+                        marshaler = (ConfigurationMarshaler) object;
+                    } else {
+                        log.warn("Configuration marshaler class is not an istance of ConfigurationMarshaler " + marshalerClass + ": using default configuration ");
+                    }
+                } catch (Exception e) {
+                    log.error("Error creating configuration marshaler class " + marshalerClass , e);
+                }
+            }
+        }
+        if (marshaler != null) {
+            configurationMarshaler = marshaler;
+        } else {
+            configurationMarshaler = new SerializedConfigurationMarshaler();
+        }
+    }
+
     private ConfigurationUtil() {
     }
 
+    public static GBeanState newGBeanState(Collection gbeans) {
+        return configurationMarshaler.newGBeanState(gbeans);
+    }
+
     public static AbstractName loadBootstrapConfiguration(Kernel kernel, InputStream in, ClassLoader classLoader) throws Exception {
         ConfigurationData configurationData = readConfigurationData(in);
         return loadBootstrapConfiguration(kernel, configurationData, classLoader);
@@ -91,26 +141,11 @@
     }
 
     public static void writeConfigurationData(ConfigurationData configurationData, OutputStream out) throws IOException {
-        ObjectOutputStream oout = new ObjectOutputStream(out);
-        try {
-            oout.writeObject(configurationData);
-        } finally {
-            if (oout != null) {
-                try {
-                    oout.flush();
-                } catch (IOException ignored) {
-                }
-            }
-        }
+        configurationMarshaler.writeConfigurationData(configurationData, out);
     }
 
     public static ConfigurationData readConfigurationData(InputStream in) throws IOException, ClassNotFoundException {
-        ObjectInputStream oin = new ObjectInputStream(in);
-        try {
-            return (ConfigurationData) oin.readObject();
-        } finally {
-            oin.close();
-        }
+        return configurationMarshaler.readConfigurationData(in);
     }
 
     /**

Added: 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=391427&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/GBeanState.java (added)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/GBeanState.java Tue Apr  4 15:18:27 2006
@@ -0,0 +1,36 @@
+/**
+ *
+ * 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;
+
+import java.io.Serializable;
+import java.util.List;
+
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.repository.Environment;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface GBeanState extends Serializable {
+    List getGBeans(ClassLoader classLoader) throws InvalidConfigException;
+
+    void addGBean(GBeanData gbeanData);
+
+    GBeanData addGBean(String name, GBeanInfo gbeanInfo, Naming naming, Environment environment);
+}

Added: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SerializedConfigurationMarshaler.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SerializedConfigurationMarshaler.java?rev=391427&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SerializedConfigurationMarshaler.java (added)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SerializedConfigurationMarshaler.java Tue Apr  4 15:18:27 2006
@@ -0,0 +1,56 @@
+/**
+ *
+ * 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;
+
+import java.io.OutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.util.Collection;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SerializedConfigurationMarshaler implements ConfigurationMarshaler {
+    public ConfigurationData readConfigurationData(InputStream in) throws IOException, ClassNotFoundException {
+        ObjectInputStream oin = new ObjectInputStream(in);
+        try {
+            return (ConfigurationData) oin.readObject();
+        } finally {
+            oin.close();
+        }
+    }
+
+    public void writeConfigurationData(ConfigurationData configurationData, OutputStream out) throws IOException {
+        ObjectOutputStream oout = new ObjectOutputStream(out);
+        try {
+            oout.writeObject(configurationData);
+        } finally {
+            if (oout != null) {
+                try {
+                    oout.flush();
+                } catch (IOException ignored) {
+                }
+            }
+        }
+    }
+
+    public GBeanState newGBeanState(Collection gbeans) {
+        return new SerializedGBeanState(gbeans);
+    }
+}

Added: 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=391427&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SerializedGBeanState.java (added)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SerializedGBeanState.java Tue Apr  4 15:18:27 2006
@@ -0,0 +1,151 @@
+/**
+ *
+ * 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;
+
+import java.io.Serializable;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.EOFException;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.kernel.Naming;
+import org.apache.geronimo.kernel.ObjectInputStreamExt;
+import org.apache.geronimo.kernel.repository.Environment;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SerializedGBeanState implements GBeanState {
+    private static final long serialVersionUID = 6015138334529564307L;
+
+    /**
+     * GBeans contained in this configuration.
+     */
+    private final List gbeans = new ArrayList();
+
+    /**
+     * The serialized form of the gbeans.  Once this is set on more gbeans can be added.
+     */
+    private byte[] gbeanState;
+
+    public SerializedGBeanState(Collection gbeans) {
+        if (gbeans != null){
+            this.gbeans.addAll(gbeans);
+        }
+    }
+
+    public List getGBeans(ClassLoader classLoader) throws InvalidConfigException {
+        if (gbeanState == null) {
+            return Collections.unmodifiableList(gbeans);
+        }
+        gbeans.addAll(loadGBeans(gbeanState, classLoader));
+        return Collections.unmodifiableList(gbeans);
+    }
+
+    public void addGBean(GBeanData gbeanData) {
+        if (gbeanState != null) {
+            throw new IllegalStateException("GBeans have been serialized, so no more GBeans can be added");
+        }
+
+        gbeans.add(gbeanData);
+    }
+
+    public GBeanData addGBean(String name, GBeanInfo gbeanInfo, Naming naming, Environment environment) {
+        if (gbeanState != null) {
+            throw new IllegalStateException("GBeans have been serialized, so no more GBeans can be added");
+        }
+
+        String j2eeType = gbeanInfo.getJ2eeType();
+        if (j2eeType == null) j2eeType = "GBean";
+        AbstractName abstractName = naming.createRootName(environment.getConfigId(), name, j2eeType);
+        GBeanData gBeanData = new GBeanData(abstractName, gbeanInfo);
+        addGBean(gBeanData);
+        return gBeanData;
+    }
+
+    private void writeObject(java.io.ObjectOutputStream stream) throws IOException {
+        if (gbeanState == null) {
+            gbeanState = storeGBeans(gbeans);
+            gbeans.clear();
+        }
+
+        stream.defaultWriteObject();
+    }
+
+    private static List loadGBeans(byte[] gbeanState, ClassLoader classLoader) throws InvalidConfigException {
+        List gbeans = new ArrayList();
+        if (gbeanState != null && gbeanState.length > 0) {
+            // Set the thread context classloader so deserializing classes can grab the cl from the thread
+            ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+            try {
+                Thread.currentThread().setContextClassLoader(classLoader);
+
+                ObjectInputStream ois = new ObjectInputStreamExt(new ByteArrayInputStream(gbeanState), classLoader);
+                try {
+                    while (true) {
+                        GBeanData gbeanData = new GBeanData();
+                        gbeanData.readExternal(ois);
+                        gbeans.add(gbeanData);
+                    }
+                } catch (EOFException e) {
+                    // ok
+                } finally {
+                    ois.close();
+                }
+            } catch (Exception e) {
+                throw new InvalidConfigException("Unable to deserialize GBeanState", e);
+            } finally {
+                Thread.currentThread().setContextClassLoader(oldCl);
+            }
+        }
+        return gbeans;
+    }
+
+    private static byte[] storeGBeans(List gbeans) throws IOException {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        ObjectOutputStream oos;
+        try {
+            oos = new ObjectOutputStream(baos);
+        } catch (IOException e) {
+            throw (AssertionError) new AssertionError("Unable to initialize ObjectOutputStream").initCause(e);
+        }
+        for (Iterator iterator = gbeans.iterator(); iterator.hasNext();) {
+            GBeanData gbeanData = (GBeanData) iterator.next();
+            try {
+                gbeanData.writeExternal(oos);
+            } catch (Exception e) {
+                throw (IOException) new IOException("Unable to serialize GBeanData for " + gbeanData.getAbstractName()).initCause(e);
+            }
+        }
+        try {
+            oos.flush();
+        } catch (IOException e) {
+            throw (AssertionError) new AssertionError("Unable to flush ObjectOutputStream").initCause(e);
+        }
+        return baos.toByteArray();
+    }
+}

Added: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/AbstractNameConverter.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/AbstractNameConverter.java?rev=391427&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/AbstractNameConverter.java (added)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/AbstractNameConverter.java Tue Apr  4 15:18:27 2006
@@ -0,0 +1,35 @@
+/**
+ *
+ * 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.net.URI;
+
+import com.thoughtworks.xstream.converters.basic.AbstractBasicConverter;
+import org.apache.geronimo.gbean.AbstractName;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AbstractNameConverter extends AbstractBasicConverter {
+    public boolean canConvert(Class clazz) {
+        return AbstractName.class.isAssignableFrom(clazz);
+    }
+
+    protected Object fromString(String string) {
+        return new AbstractName(URI.create(string));
+    }
+}

Added: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/AbstractNameQueryConverter.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/AbstractNameQueryConverter.java?rev=391427&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/AbstractNameQueryConverter.java (added)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/AbstractNameQueryConverter.java Tue Apr  4 15:18:27 2006
@@ -0,0 +1,36 @@
+/**
+ *
+ * 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.net.URI;
+
+import com.thoughtworks.xstream.converters.basic.AbstractBasicConverter;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AbstractNameQueryConverter extends AbstractBasicConverter {
+    public boolean canConvert(Class clazz) {
+        return AbstractNameQuery.class.isAssignableFrom(clazz);
+    }
+
+    protected Object fromString(String string) {
+        return new AbstractNameQuery(URI.create(string));
+    }
+}

Added: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/ConfigurationModuleTypeConverter.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/ConfigurationModuleTypeConverter.java?rev=391427&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/ConfigurationModuleTypeConverter.java (added)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/ConfigurationModuleTypeConverter.java Tue Apr  4 15:18:27 2006
@@ -0,0 +1,38 @@
+/**
+ *
+ * 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 com.thoughtworks.xstream.converters.basic.AbstractBasicConverter;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConfigurationModuleTypeConverter extends AbstractBasicConverter {
+    public boolean canConvert(Class clazz) {
+        return ConfigurationModuleType.class.equals(clazz);
+    }
+
+    protected String toString(Object object) {
+        ConfigurationModuleType type = (ConfigurationModuleType) object;
+        return type.getName();
+    }
+
+    protected Object fromString(String string) {
+        return ConfigurationModuleType.getByName(string);
+    }
+}

Added: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/DomConverter.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/DomConverter.java?rev=391427&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/DomConverter.java (added)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/DomConverter.java Tue Apr  4 15:18:27 2006
@@ -0,0 +1,101 @@
+/**
+ *
+ * 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 javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.ParserConfigurationException;
+
+import com.thoughtworks.xstream.converters.Converter;
+import com.thoughtworks.xstream.converters.MarshallingContext;
+import com.thoughtworks.xstream.converters.UnmarshallingContext;
+import com.thoughtworks.xstream.converters.ConversionException;
+import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
+import com.thoughtworks.xstream.io.HierarchicalStreamReader;
+import com.thoughtworks.xstream.io.xml.DomReader;
+import com.thoughtworks.xstream.io.xml.DomWriter;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DomConverter implements Converter {
+    public boolean canConvert(Class clazz) {
+        return Document.class.isAssignableFrom(clazz) || Element.class.isAssignableFrom(clazz);
+    }
+
+    public void marshal(Object object, HierarchicalStreamWriter writer, MarshallingContext marshallingContext) {
+        DomReader reader;
+        if (object instanceof Document) {
+            Document doc = (Document) object;
+            reader = new DomReader(doc);
+        } else {
+            Element element = (Element) object;
+            reader = new DomReader(element);
+        }
+
+        copy(reader, writer);
+    }
+
+    public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext unmarshallingContext) {
+        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+        DocumentBuilder documentBuilder = null;
+        try {
+            documentBuilder = documentBuilderFactory.newDocumentBuilder();
+        } catch (ParserConfigurationException e) {
+            throw new ConversionException("Cannot instantiate " + Document.class.getName(), e);
+        }
+        Document document = documentBuilder.newDocument();
+        DomWriter writer = new DomWriter(document);
+
+        copy(reader, writer);
+
+        if (Document.class.isAssignableFrom(unmarshallingContext.getRequiredType())) {
+            return document;
+        } else {
+            return document.getDocumentElement();
+        }
+    }
+
+    public static void copy(HierarchicalStreamReader reader, HierarchicalStreamWriter writer) {
+        writer.startNode(reader.getNodeName());
+
+        // write the attributes
+        int attributeCount = reader.getAttributeCount();
+        for (int i = 0; i < attributeCount; i++) {
+            String attributeName = reader.getAttributeName(i);
+            String attributeValue = reader.getAttribute(i);
+            writer.addAttribute(attributeName, attributeValue);
+        }
+
+        // write the child nodes recursively
+        while (reader.hasMoreChildren()) {
+            reader.moveDown();
+            copy(reader, writer);
+            reader.moveUp();
+        }
+
+        // write the context if any
+        String value = reader.getValue();
+        if (value != null && value.trim().length() > 0) {
+            writer.setValue(value);
+        }
+
+        writer.endNode();
+    }
+}

Added: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/GBeanDataConverter.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/GBeanDataConverter.java?rev=391427&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/GBeanDataConverter.java (added)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/GBeanDataConverter.java Tue Apr  4 15:18:27 2006
@@ -0,0 +1,193 @@
+/**
+ *
+ * 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.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.LinkedHashSet;
+import java.util.LinkedHashMap;
+import java.net.URI;
+
+import com.thoughtworks.xstream.converters.Converter;
+import com.thoughtworks.xstream.converters.MarshallingContext;
+import com.thoughtworks.xstream.converters.UnmarshallingContext;
+import com.thoughtworks.xstream.converters.ConversionException;
+import com.thoughtworks.xstream.io.HierarchicalStreamReader;
+import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
+import com.thoughtworks.xstream.mapper.Mapper;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.ReferencePatterns;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class GBeanDataConverter implements Converter {
+    private final Mapper mapper;
+
+    public GBeanDataConverter(Mapper mapper) {
+        this.mapper = mapper;
+    }
+
+    public boolean canConvert(Class clazz) {
+        return GBeanData.class.isAssignableFrom(clazz);
+    }
+
+    public void marshal(Object object, HierarchicalStreamWriter writer, MarshallingContext marshallingContext) {
+        GBeanData gbeanData = (GBeanData) object;
+
+        // name
+        AbstractName abstractName = gbeanData.getAbstractName();
+        if (abstractName != null) {
+            writer.addAttribute("name", abstractName.toString());
+        }
+
+        // gbeanInfo
+        GBeanInfo gbeanInfo = gbeanData.getGBeanInfo();
+        String sourceClass = gbeanInfo.getSourceClass();
+        if (sourceClass != null) {
+            writer.addAttribute("sourceClass", sourceClass);
+        } else {
+            writer.startNode("gbean-info");
+            marshallingContext.convertAnother(gbeanInfo);
+            writer.endNode();
+        }
+
+        // dependencies Set<ReferencePatterns>
+        Set dependencies = gbeanData.getDependencies();
+        for (Iterator iterator = dependencies.iterator(); iterator.hasNext();) {
+            ReferencePatterns referencePatterns = (ReferencePatterns) iterator.next();
+            writer.startNode("dependency");
+            marshallingContext.convertAnother(referencePatterns);
+            writer.endNode();
+        }
+
+        // attributes Map<String, Object>
+        Map attributes = gbeanData.getAttributes();
+        for (Iterator iterator = attributes.entrySet().iterator(); iterator.hasNext();) {
+            Map.Entry entry = (Map.Entry) iterator.next();
+            String attributeName = (String) entry.getKey();
+            Object attributeValue = entry.getValue();
+            if (attributeValue != null) {
+                writer.startNode("attribute");
+                writer.addAttribute("name", attributeName);
+
+                writer.startNode(mapper.serializedClass(attributeValue.getClass()));
+                marshallingContext.convertAnother(attributeValue);
+                writer.endNode();
+
+                writer.endNode();
+            }
+        }
+        // references Map<String, ReferencePatterns>
+        Map references = gbeanData.getReferences();
+        for (Iterator iterator = references.entrySet().iterator(); iterator.hasNext();) {
+            Map.Entry entry = (Map.Entry) iterator.next();
+            String referenceName = (String) entry.getKey();
+            ReferencePatterns referencePatterns = (ReferencePatterns) entry.getValue();
+            writer.startNode("reference");
+            writer.addAttribute("name", referenceName);
+            marshallingContext.convertAnother(referencePatterns);
+            writer.endNode();
+        }
+    }
+
+    public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext unmarshallingContext) {
+        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+        if (classLoader == null) {
+            classLoader = this.getClass().getClassLoader();
+        }
+
+        // name
+        String gbeanName = reader.getAttribute("name");
+        AbstractName abstractName = null;
+        if (gbeanName != null) {
+            abstractName = new AbstractName(URI.create(gbeanName));
+        }
+
+        // gbeanInfo
+        GBeanInfo gbeanInfo = null;
+        String sourceClass = reader.getAttribute("sourceClass");
+        if (sourceClass != null) {
+            gbeanInfo = GBeanInfo.getGBeanInfo(sourceClass, classLoader);
+        }
+
+        Set dependencies = new LinkedHashSet();
+        Map attributes = new LinkedHashMap();
+        Map references = new LinkedHashMap();
+        while (reader.hasMoreChildren()) {
+            reader.moveDown();
+
+            String nodeName = reader.getNodeName();
+            if (nodeName.equals("gbean-info")) {
+                if (gbeanInfo != null) {
+                    throw new ConversionException("GBean info declared more than once in gbean " + abstractName);
+                }
+                gbeanInfo = (GBeanInfo) unmarshallingContext.convertAnother(reader, GBeanInfo.class);
+            } else if (nodeName.equals("dependency")) {
+                ReferencePatterns referencePatterns = (ReferencePatterns) unmarshallingContext.convertAnother(reader, ReferencePatterns.class);
+                dependencies.add(referencePatterns);
+            } else if (nodeName.equals("attribute")) {
+                String attributeName = reader.getAttribute("name");
+
+                reader.moveDown();
+                String classAttribute = reader.getAttribute(mapper.attributeForImplementationClass());
+                Class type;
+                if (classAttribute == null) {
+                    type = mapper.realClass(reader.getNodeName());
+                } else {
+                    type = mapper.realClass(classAttribute);
+                }
+                Object attributeValue = unmarshallingContext.convertAnother(reader, type);
+                reader.moveUp();
+
+                attributes.put(attributeName, attributeValue);
+            } else if (nodeName.equals("reference")) {
+                String referenceName = reader.getAttribute("name");
+                ReferencePatterns referencePatterns = (ReferencePatterns) unmarshallingContext.convertAnother(reader, ReferencePatterns.class);
+                references.put(referenceName, referencePatterns);
+            } else {
+                throw new ConversionException("Unknown nested node in GBean: " + nodeName);
+            }
+
+            reader.moveUp();
+        }
+
+        if (gbeanInfo == null) {
+            throw new ConversionException("GBean info not declared in gbean " + abstractName);
+        }
+
+        GBeanData gbeanData = new GBeanData(abstractName, gbeanInfo);
+        gbeanData.setDependencies(dependencies);
+        for (Iterator iterator = attributes.entrySet().iterator(); iterator.hasNext();) {
+            Map.Entry entry = (Map.Entry) iterator.next();
+            String attributeName = (String) entry.getKey();
+            Object attributeValue = entry.getValue();
+            gbeanData.setAttribute(attributeName, attributeValue);
+        }
+        for (Iterator iterator = references.entrySet().iterator(); iterator.hasNext();) {
+            Map.Entry entry = (Map.Entry) iterator.next();
+            String referenceName = (String) entry.getKey();
+            ReferencePatterns referencePatterns = (ReferencePatterns) entry.getValue();
+            gbeanData.setReferencePatterns(referenceName, referencePatterns);
+        }
+
+        return gbeanData;
+    }
+}

Added: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/ImportTypeConverter.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/ImportTypeConverter.java?rev=391427&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/ImportTypeConverter.java (added)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/ImportTypeConverter.java Tue Apr  4 15:18:27 2006
@@ -0,0 +1,33 @@
+/**
+ *
+ * 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 com.thoughtworks.xstream.converters.basic.AbstractBasicConverter;
+import org.apache.geronimo.kernel.repository.ImportType;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ImportTypeConverter extends AbstractBasicConverter {
+    public boolean canConvert(Class clazz) {
+        return ImportType.class.isAssignableFrom(clazz);
+    }
+
+    protected Object fromString(String string) {
+        return ImportType.getByName(string);
+    }
+}

Added: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/URIConverter.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/URIConverter.java?rev=391427&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/URIConverter.java (added)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/URIConverter.java Tue Apr  4 15:18:27 2006
@@ -0,0 +1,34 @@
+/**
+ *
+ * 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.net.URI;
+
+import com.thoughtworks.xstream.converters.basic.AbstractBasicConverter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class URIConverter extends AbstractBasicConverter {
+    public boolean canConvert(Class clazz) {
+        return URI.class.isAssignableFrom(clazz);
+    }
+
+    protected Object fromString(String string) {
+        return URI.create(string);
+    }
+}

Added: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/UriConverter.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/UriConverter.java?rev=391427&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/UriConverter.java (added)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/UriConverter.java Tue Apr  4 15:18:27 2006
@@ -0,0 +1,34 @@
+/**
+ *
+ * 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.net.URI;
+
+import com.thoughtworks.xstream.converters.basic.AbstractBasicConverter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class URIConverter extends AbstractBasicConverter {
+    public boolean canConvert(Class clazz) {
+        return URI.class.isAssignableFrom(clazz);
+    }
+
+    protected Object fromString(String string) {
+        return URI.create(string);
+    }
+}

Added: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/VersionConverter.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/VersionConverter.java?rev=391427&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/VersionConverter.java (added)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/VersionConverter.java Tue Apr  4 15:18:27 2006
@@ -0,0 +1,33 @@
+/**
+ *
+ * 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 com.thoughtworks.xstream.converters.basic.AbstractBasicConverter;
+import org.apache.geronimo.kernel.repository.Version;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class VersionConverter extends AbstractBasicConverter {
+    public boolean canConvert(Class clazz) {
+        return Version.class.isAssignableFrom(clazz);
+    }
+
+    protected Object fromString(String string) {
+        return new Version(string);
+    }
+}

Added: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/XStreamConfigurationMarshaler.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/XStreamConfigurationMarshaler.java?rev=391427&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/XStreamConfigurationMarshaler.java (added)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/XStreamConfigurationMarshaler.java Tue Apr  4 15:18:27 2006
@@ -0,0 +1,80 @@
+/**
+ *
+ * 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.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.PushbackInputStream;
+import java.io.ObjectStreamConstants;
+import java.util.Collection;
+
+import com.thoughtworks.xstream.XStream;
+import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.config.ConfigurationMarshaler;
+import org.apache.geronimo.kernel.config.GBeanState;
+import org.apache.geronimo.kernel.config.SerializedConfigurationMarshaler;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class XStreamConfigurationMarshaler implements ConfigurationMarshaler {
+    private static byte[] SERIALIZED_MAGIC = new byte[] {
+            (byte) ((ObjectStreamConstants.STREAM_MAGIC >>> 8) & 0xFF),
+            (byte) ((ObjectStreamConstants.STREAM_MAGIC >>> 0) & 0xFF)
+    };
+
+    public ConfigurationData readConfigurationData(InputStream in) throws IOException, ClassNotFoundException {
+        PushbackInputStream pushbackInputStream = new PushbackInputStream(in, 2);
+        byte[] streamHeader = new byte[2];
+        pushbackInputStream.read(streamHeader);
+        pushbackInputStream.unread(streamHeader);
+
+        // if this is a serialized config, fallback to the serialization marshaler
+        if (SERIALIZED_MAGIC[0] == streamHeader[0] && SERIALIZED_MAGIC[1] == streamHeader[1]) {
+            return new SerializedConfigurationMarshaler().readConfigurationData(pushbackInputStream);
+        }
+
+        XStream xstream = XStreamUtil.createXStream();
+        Reader reader = new InputStreamReader(pushbackInputStream);
+        ConfigurationData configurationData = (ConfigurationData)xstream.fromXML(reader);
+        return configurationData;
+    }
+
+    public void writeConfigurationData(ConfigurationData configurationData, OutputStream out) throws IOException {
+        XStream xstream = XStreamUtil.createXStream();
+        String xml = xstream.toXML(configurationData);
+
+        out.write(("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+                "\n" +
+                "<!-- ======================================================== -->\n" +
+                "<!-- Warning - Modification of this file may cause server     -->\n" +
+                "<!-- instability.  Also, the format of this XML file is       -->\n" +
+                "<!-- undocumented and subject to change without notice.       -->\n" +
+                "<!-- ======================================================== -->\n" +
+                "\n").getBytes());
+
+        out.write(xml.getBytes());
+        out.flush();
+    }
+
+    public GBeanState newGBeanState(Collection gbeans) {
+        return new XStreamGBeanState(gbeans);
+    }
+}

Added: 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=391427&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/XStreamGBeanState.java (added)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/XStreamGBeanState.java Tue Apr  4 15:18:27 2006
@@ -0,0 +1,159 @@
+/**
+ *
+ * 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.io.IOException;
+import java.io.FileWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.io.xml.DomReader;
+import com.thoughtworks.xstream.io.xml.DomWriter;
+import org.apache.geronimo.gbean.AbstractName;
+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.repository.Environment;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class XStreamGBeanState implements GBeanState {
+    private static final long serialVersionUID = 5093634035012004893L;
+
+    /**
+     * GBeans contained in this configuration.
+     */
+    private final List gbeans = new ArrayList();
+
+    /**
+     * The serialized form of the gbeans.  Once this is set on more gbeans can be added.
+     */
+    private Element gbeanState;
+
+    public XStreamGBeanState(Element gbeanState) {
+        this.gbeanState = gbeanState;
+    }
+
+    public XStreamGBeanState(Collection gbeans) {
+        if (gbeans != null){
+            this.gbeans.addAll(gbeans);
+        }
+    }
+
+    public Element getGBeanState() throws IOException {
+        if (gbeanState == null) {
+            gbeanState = XStreamGBeanState.storeGBeans(gbeans);
+            gbeans.clear();
+        }
+        return gbeanState;
+    }
+
+    public List getGBeans(ClassLoader classLoader) throws InvalidConfigException {
+        if (gbeanState == null) {
+            return Collections.unmodifiableList(gbeans);
+        }
+        gbeans.addAll(XStreamGBeanState.loadGBeans(gbeanState, classLoader));
+        return Collections.unmodifiableList(gbeans);
+    }
+
+    public void addGBean(GBeanData gbeanData) {
+        if (gbeanState != null) {
+            throw new IllegalStateException("GBeans have been serialized, so no more GBeans can be added");
+        }
+
+        gbeans.add(gbeanData);
+    }
+
+    public GBeanData addGBean(String name, GBeanInfo gbeanInfo, Naming naming, Environment environment) {
+        if (gbeanState != null) {
+            throw new IllegalStateException("GBeans have been serialized, so no more GBeans can be added");
+        }
+
+        String j2eeType = gbeanInfo.getJ2eeType();
+        if (j2eeType == null) j2eeType = "GBean";
+        AbstractName abstractName = naming.createRootName(environment.getConfigId(), name, j2eeType);
+        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 {
+        if (element != null) {
+            // Set the thread context classloader so deserializing classes can grab the cl from the thread
+            ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+            try {
+                Thread.currentThread().setContextClassLoader(classLoader);
+
+                DomReader reader = new DomReader(element);
+                XStream xstream = XStreamUtil.createXStream();
+                xstream.setClassLoader(classLoader);
+                Object o = xstream.unmarshal(reader);
+                GBeanData[] gbeanDatas = (GBeanData[]) o;
+                return Arrays.asList(gbeanDatas);
+            } catch (Exception e) {
+                throw new InvalidConfigException("Unable to load gbeans", e);
+            } finally {
+                Thread.currentThread().setContextClassLoader(oldCl);
+            }
+        }
+        return Collections.EMPTY_LIST;
+    }
+
+    private static Element storeGBeans(List gbeans) throws IOException {
+        GBeanData[] gbeanDatas = (GBeanData[]) gbeans.toArray(new GBeanData[gbeans.size()]);
+
+        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+        DocumentBuilder documentBuilder = null;
+        try {
+            documentBuilder = documentBuilderFactory.newDocumentBuilder();
+        } catch (ParserConfigurationException e) {
+            throw (IOException)new IOException("Cannot instantiate " + Document.class.getName()).initCause(e);
+        }
+        Document document = documentBuilder.newDocument();
+        DomWriter writer = new DomWriter(document);
+
+        XStream xstream = XStreamUtil.createXStream();
+        xstream.marshal(gbeanDatas, writer);
+
+//        FileWriter w = new FileWriter("target/foo.xml");
+//        xstream.toXML(gbeanDatas, w);
+//        w.close();
+
+        return document.getDocumentElement();
+    }
+}