From scm-return-11095-apmail-geronimo-scm-archive=geronimo.apache.org@geronimo.apache.org Tue Apr 04 22:19:08 2006 Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 26625 invoked from network); 4 Apr 2006 22:19:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Apr 2006 22:19:07 -0000 Received: (qmail 78120 invoked by uid 500); 4 Apr 2006 22:19:07 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 77975 invoked by uid 500); 4 Apr 2006 22:19:06 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 77964 invoked by uid 99); 4 Apr 2006 22:19:06 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Apr 2006 15:19:06 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 04 Apr 2006 15:19:04 -0700 Received: (qmail 26488 invoked by uid 65534); 4 Apr 2006 22:18:44 -0000 Message-ID: <20060404221844.26485.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r391427 [2/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... Date: Tue, 04 Apr 2006 22:18:33 -0000 To: scm@geronimo.apache.org From: dain@apache.org X-Mailer: svnmailer-1.0.7 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Added: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/XStreamGBeanStateConverter.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/XStreamGBeanStateConverter.java?rev=391427&view=auto ============================================================================== --- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/XStreamGBeanStateConverter.java (added) +++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/XStreamGBeanStateConverter.java Tue Apr 4 15:18:27 2006 @@ -0,0 +1,62 @@ +/** + * + * 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 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 org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.w3c.dom.Node; + +/** + * @version $Rev$ $Date$ + */ +public class XStreamGBeanStateConverter implements Converter { + public boolean canConvert(Class clazz) { + return XStreamGBeanState.class.isAssignableFrom(clazz); + } + + public void marshal(Object object, HierarchicalStreamWriter writer, MarshallingContext marshallingContext) { + XStreamGBeanState gbeanState = (XStreamGBeanState) object; + Element element = null; + try { + element = gbeanState.getGBeanState(); + } catch (IOException e) { + throw new ConversionException("Cannot get xml version of gbeans", e); + } + marshallingContext.convertAnother(element); + } + + public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext unmarshallingContext) { + Element element = (Element) unmarshallingContext.convertAnother(reader, Element.class); + NodeList childNodes = element.getChildNodes(); + for (int i = 0; i < childNodes.getLength(); i ++) { + Node node = childNodes.item(i); + if (node instanceof Element) { + element = (Element) node; + return new XStreamGBeanState(element); + } + } + throw new ConversionException("No nested nodes found"); + } +} Added: 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=391427&view=auto ============================================================================== --- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/XStreamUtil.java (added) +++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/xstream/XStreamUtil.java Tue Apr 4 15:18:27 2006 @@ -0,0 +1,97 @@ +/** + * + * 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.XStream; +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.gbean.AbstractName; +import org.apache.geronimo.gbean.GBeanData; +import org.apache.geronimo.gbean.GBeanInfo; +import org.apache.geronimo.gbean.AbstractNameQuery; + +/** + * @version $Rev$ $Date$ + */ +public final class XStreamUtil { + private XStreamUtil() { + } + + public static XStream createXStream() { + XStream xstream = new XStream(); + xstream.alias("configurationData", ConfigurationData.class); + + // AbstractName + xstream.alias("abstractName", AbstractName.class); + xstream.addImmutableType(AbstractName.class); + xstream.registerConverter(new AbstractNameConverter()); + + // AbstractNameQuery + xstream.alias("abstractNameQuery", AbstractNameQuery.class); + xstream.addImmutableType(AbstractNameQuery.class); + xstream.registerConverter(new AbstractNameQueryConverter()); + + // Artifact + xstream.alias("artifact", Artifact.class); + xstream.addImmutableType(Artifact.class); + + // ConfigurationModuleTypeConverter + xstream.alias("moduleType", ConfigurationModuleType.class); + xstream.addImmutableType(ConfigurationModuleType.class); + xstream.registerConverter(new ConfigurationModuleTypeConverter()); + + // Dependency + xstream.alias("dependency", Dependency.class); + xstream.addImmutableType(Dependency.class); + + // GBeanData + xstream.alias("gbean", GBeanData.class); + xstream.registerConverter(new GBeanDataConverter(xstream.getClassMapper())); + + // GBeanInfo + xstream.alias("gbean-info", GBeanInfo.class); + + // w3c Dom + xstream.registerConverter(new DomConverter()); + + // ImportType + xstream.addImmutableType(ImportType.class); + xstream.registerConverter(new ImportTypeConverter()); + + // Version + xstream.alias("version", Version.class); + xstream.addImmutableType(Version.class); + xstream.registerConverter(new VersionConverter()); + + // URI + xstream.alias("uri", URI.class); + xstream.addImmutableType(URI.class); + xstream.registerConverter(new URIConverter()); + + // XStreamGBeanState + xstream.registerConverter(new XStreamGBeanStateConverter()); + + return xstream; + } + +} Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ImportType.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ImportType.java?rev=391427&r1=391426&r2=391427&view=diff ============================================================================== --- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ImportType.java (original) +++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/repository/ImportType.java Tue Apr 4 15:18:27 2006 @@ -33,6 +33,12 @@ public static final ImportType CLASSES = new ImportType("CLASSES"); public static final ImportType SERVICES = new ImportType("SERVICES"); + public static Object getByName(String name) { + ImportType type = (ImportType) typesByName.get(name); + if (type == null) throw new IllegalStateException("Unknown import type: " + name); + return type; + } + private final String name; private ImportType(String name) { @@ -49,8 +55,7 @@ } protected Object readResolve() { - ImportType type = (ImportType) typesByName.get(name); - if (type == null) throw new IllegalStateException("Unknown import type: " + name); - return type; + String name = this.name; + return getByName(name); } } Modified: geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/MockGBean.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/MockGBean.java?rev=391427&r1=391426&r2=391427&view=diff ============================================================================== --- geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/MockGBean.java (original) +++ geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/MockGBean.java Tue Apr 4 15:18:27 2006 @@ -48,6 +48,8 @@ private String value; + private Object someObject; + private MockEndpoint endpoint; private Collection endpointCollection = Collections.EMPTY_SET; @@ -70,6 +72,7 @@ infoFactory.addAttribute("mutableInt", Integer.TYPE, false); infoFactory.addAttribute("exceptionMutableInt", Integer.TYPE, true); infoFactory.addAttribute("endpointMutableInt", Integer.TYPE, false); + infoFactory.addAttribute("someObject", Object.class, true); infoFactory.addOperation("echo", new Class[]{String.class}); infoFactory.addOperation("checkEndpoint"); @@ -107,6 +110,14 @@ this.objectName = objectName; this.classLoader = classLoader; this.kernel = kernel; + } + + public Object getSomeObject() { + return someObject; + } + + public void setSomeObject(Object someObject) { + this.someObject = someObject; } public String getActualObjectName() { Added: 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=391427&view=auto ============================================================================== --- geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationUtilTest.java (added) +++ geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationUtilTest.java Tue Apr 4 15:18:27 2006 @@ -0,0 +1,116 @@ +/** + * + * 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.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.List; + +import junit.framework.TestCase; +import org.apache.geronimo.gbean.AbstractName; +import org.apache.geronimo.gbean.AbstractNameQuery; +import org.apache.geronimo.gbean.GBeanData; +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.repository.Artifact; +import org.apache.geronimo.kernel.repository.Environment; +import org.apache.geronimo.kernel.repository.ImportType; +import org.apache.geronimo.kernel.repository.Version; + +/** + * @version $Rev$ $Date$ + */ +public class ConfigurationUtilTest extends TestCase { + private XStreamConfigurationMarshaler xstreamConfigurationMarshaler = new XStreamConfigurationMarshaler(); + private SerializedConfigurationMarshaler serializedConfigurationMarshaler = new SerializedConfigurationMarshaler(); + private ConfigurationData configurationData1; + private ConfigurationData configurationData2; +// private ConfigurationData configurationData3; + + public void test() throws Exception { + copyTest(configurationData1); + copyTest(configurationData2); + } + + private void copyTest(ConfigurationData configurationData) throws Exception { + List gbeans = configurationData.getGBeans(getClass().getClassLoader()); + ConfigurationData data = copy(configurationData, serializedConfigurationMarshaler, serializedConfigurationMarshaler); + gbeans = data.getGBeans(getClass().getClassLoader()); + assertEquals(configurationData.getId(), data.getId()); + + gbeans = configurationData.getGBeans(getClass().getClassLoader()); + data = copy(configurationData, xstreamConfigurationMarshaler, xstreamConfigurationMarshaler); + 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()); + } + + 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(); + + Artifact artifact1 = new Artifact("test", "1", "1.1", "bar"); + Artifact artifact2 = new Artifact("test", "2", "2.2", "bar"); + + Environment e1 = new Environment(); + e1.setConfigId(artifact1); + configurationData1 = new ConfigurationData(e1, naming); + configurationData1 = new ConfigurationData(new Artifact("test", "test", "", "car"), naming); + + GBeanData mockBean1 = configurationData1.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()); +// AbstractName gbeanName2 = mockBean2.getAbstractName(); + mockBean2.setAttribute("value", "5678"); + mockBean2.setAttribute("name", "Parent"); + mockBean2.setAttribute("finalInt", new Integer(3)); + mockBean2.setAttribute("someObject", new GBeanData(gbeanName1, MockGBean.getGBeanInfo())); + mockBean2.setReferencePattern("MockEndpoint", gbeanName1); + mockBean2.setReferencePattern("EndpointCollection", new AbstractNameQuery(gbeanName1, MockGBean.getGBeanInfo().getInterfaces())); + + + Environment e2 = new Environment(); + e2.setConfigId(artifact2); + e2.addDependency(new Artifact("test", "1", (Version) null, "bar"), ImportType.ALL); + configurationData2 = new ConfigurationData(e2, naming); + +// Environment e3 = new Environment(); +// e3.setConfigId(artifact3); +// e3.addDependency(new Artifact("test", "2", (Version) null, "bar"), ImportType.ALL); +// configurationData3 = new ConfigurationData(e3, kernel.getNaming()); + } +} Modified: geronimo/branches/1.1/modules/naming-builder/project.xml URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/naming-builder/project.xml?rev=391427&r1=391426&r2=391427&view=diff ============================================================================== --- geronimo/branches/1.1/modules/naming-builder/project.xml (original) +++ geronimo/branches/1.1/modules/naming-builder/project.xml Tue Apr 4 15:18:27 2006 @@ -16,7 +16,7 @@ limitations under the License. --> - + 3 @@ -148,6 +148,18 @@ ${mx4j_version} + + + xstream + xstream + ${xstream_version} + + + + xpp3 + xpp3 + ${xpp3_version} + Modified: geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/jacc/ApplicationPolicyConfigurationManager.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/jacc/ApplicationPolicyConfigurationManager.java?rev=391427&r1=391426&r2=391427&view=diff ============================================================================== --- geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/jacc/ApplicationPolicyConfigurationManager.java (original) +++ geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/jacc/ApplicationPolicyConfigurationManager.java Tue Apr 4 15:18:27 2006 @@ -157,7 +157,7 @@ GBEAN_INFO = infoBuilder.getBeanInfo(); } - public GBeanInfo getGBeanInfo() { + public static GBeanInfo getGBeanInfo() { return GBEAN_INFO; } } Modified: geronimo/branches/1.1/modules/service-builder/project.xml URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/service-builder/project.xml?rev=391427&r1=391426&r2=391427&view=diff ============================================================================== --- geronimo/branches/1.1/modules/service-builder/project.xml (original) +++ geronimo/branches/1.1/modules/service-builder/project.xml Tue Apr 4 15:18:27 2006 @@ -142,6 +142,18 @@ ${xml_resolver_version} http://xml.apache.org/commons + + + xstream + xstream + ${xstream_version} + + + + xpp3 + xpp3 + ${xpp3_version} + Modified: geronimo/branches/1.1/modules/tomcat-builder/project.xml URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/tomcat-builder/project.xml?rev=391427&r1=391426&r2=391427&view=diff ============================================================================== --- geronimo/branches/1.1/modules/tomcat-builder/project.xml (original) +++ geronimo/branches/1.1/modules/tomcat-builder/project.xml Tue Apr 4 15:18:27 2006 @@ -450,6 +450,17 @@ ${xml_apis_version} + + xstream + xstream + ${xstream_version} + + + + xpp3 + xpp3 + ${xpp3_version} + Modified: geronimo/branches/1.1/modules/transaction/src/java/org/apache/geronimo/transaction/manager/XidFactoryImplGBean.java URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/transaction/src/java/org/apache/geronimo/transaction/manager/XidFactoryImplGBean.java?rev=391427&r1=391426&r2=391427&view=diff ============================================================================== --- geronimo/branches/1.1/modules/transaction/src/java/org/apache/geronimo/transaction/manager/XidFactoryImplGBean.java (original) +++ geronimo/branches/1.1/modules/transaction/src/java/org/apache/geronimo/transaction/manager/XidFactoryImplGBean.java Tue Apr 4 15:18:27 2006 @@ -29,7 +29,7 @@ public static final GBeanInfo GBEAN_INFO; static { - GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(XidFactoryImpl.class, NameFactory.XID_FACTORY); + GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(XidFactoryImplGBean.class, XidFactoryImpl.class, NameFactory.XID_FACTORY); infoFactory.addAttribute("tmId", byte[].class, true); infoFactory.addInterface(XidFactory.class); Modified: geronimo/branches/1.1/plugins/geronimo-assembly-plugin/project.xml URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-assembly-plugin/project.xml?rev=391427&r1=391426&r2=391427&view=diff ============================================================================== --- geronimo/branches/1.1/plugins/geronimo-assembly-plugin/project.xml (original) +++ geronimo/branches/1.1/plugins/geronimo-assembly-plugin/project.xml Tue Apr 4 15:18:27 2006 @@ -23,9 +23,25 @@ geronimo-assembly-plugin Geronimo :: Maven Assembly Plugin A plugin used to assemble a distribution of Geronimo - 1.1.0-8 + 1.1.0-9 + + xstream + xstream + 1.1.3 + + true + + + + xpp3 + xpp3 + 1.1.3.3 + + true + + geronimo geronimo-kernel Modified: geronimo/branches/1.1/plugins/geronimo-packaging-plugin/project.xml URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/plugins/geronimo-packaging-plugin/project.xml?rev=391427&r1=391426&r2=391427&view=diff ============================================================================== --- geronimo/branches/1.1/plugins/geronimo-packaging-plugin/project.xml (original) +++ geronimo/branches/1.1/plugins/geronimo-packaging-plugin/project.xml Tue Apr 4 15:18:27 2006 @@ -22,7 +22,7 @@ geronimo geronimo-packaging-plugin Geronimo :: Maven Packaging Plugin - 1.1.0-2 + 1.1.0-3 @@ -107,6 +107,24 @@ org.apache.geronimo.specs geronimo-qname_1.1_spec 1.0 + + true + + + + + xstream + xstream + 1.1.3 + + true + + + + + xpp3 + xpp3 + 1.1.3.3 true