You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Aaron Mulder <am...@alumni.princeton.edu> on 2006/03/29 19:07:47 UTC

Re: svn commit: r389823 - in /geronimo/branches/1.1/modules/upgrade: ./ src/ src/java/ src/java/org/ src/java/org/apache/ src/java/org/apache/geronimo/ src/java/org/apache/geronimo/upgrade/ src/test-data/ src/test/ src/test/org/ src/test/org/apache/

Why is the BouncyCastle license used for this module?

Thanks,
    Aaron

On 3/29/06, djencks@apache.org <dj...@apache.org> wrote:
> Author: djencks
> Date: Wed Mar 29 08:38:17 2006
> New Revision: 389823
>
> URL: http://svn.apache.org/viewcvs?rev=389823&view=rev
> Log:
> Add the start of a converter utility, also has a loginmodulegbean change that should be ok but I'm not sure why I didn't commit it before.  revert if it causes problems.
>
> Added:
>     geronimo/branches/1.1/modules/upgrade/
>     geronimo/branches/1.1/modules/upgrade/LICENSE.txt
>     geronimo/branches/1.1/modules/upgrade/NOTICE.txt
>     geronimo/branches/1.1/modules/upgrade/project.xml
>     geronimo/branches/1.1/modules/upgrade/src/
>     geronimo/branches/1.1/modules/upgrade/src/java/
>     geronimo/branches/1.1/modules/upgrade/src/java/org/
>     geronimo/branches/1.1/modules/upgrade/src/java/org/apache/
>     geronimo/branches/1.1/modules/upgrade/src/java/org/apache/geronimo/
>     geronimo/branches/1.1/modules/upgrade/src/java/org/apache/geronimo/upgrade/
>     geronimo/branches/1.1/modules/upgrade/src/java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java
>     geronimo/branches/1.1/modules/upgrade/src/test/
>     geronimo/branches/1.1/modules/upgrade/src/test-data/
>     geronimo/branches/1.1/modules/upgrade/src/test-data/appclient_ejb_1.xml
>     geronimo/branches/1.1/modules/upgrade/src/test/org/
>     geronimo/branches/1.1/modules/upgrade/src/test/org/apache/
>     geronimo/branches/1.1/modules/upgrade/src/test/org/apache/geronimo/
>     geronimo/branches/1.1/modules/upgrade/src/test/org/apache/geronimo/upgrade/
>     geronimo/branches/1.1/modules/upgrade/src/test/org/apache/geronimo/upgrade/Upgrade1_0To1_1Test.java
>
> Added: geronimo/branches/1.1/modules/upgrade/LICENSE.txt
> URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/upgrade/LICENSE.txt?rev=389823&view=auto
> ==============================================================================
> --- geronimo/branches/1.1/modules/upgrade/LICENSE.txt (added)
> +++ geronimo/branches/1.1/modules/upgrade/LICENSE.txt Wed Mar 29 08:38:17 2006
> @@ -0,0 +1,20 @@
> +The Bouncy Castle License
> +
> +Copyright (c) 2000-2005 The Legion Of The Bouncy Castle (http://www.bouncycastle.org)
> +
> +Permission is hereby granted, free of charge, to any person obtaining a copy of this software
> +and associated documentation files (the "Software"), to deal in the Software without restriction,
> +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
> +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
> +subject to the following conditions:
> +
> +The above copyright notice and this permission notice shall be included in all copies or substantial
> +portions of the Software.
> +
> +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
> +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
> +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
> +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
> +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> +DEALINGS IN THE SOFTWARE.
> +
>
> Added: geronimo/branches/1.1/modules/upgrade/NOTICE.txt
> URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/upgrade/NOTICE.txt?rev=389823&view=auto
> ==============================================================================
> --- geronimo/branches/1.1/modules/upgrade/NOTICE.txt (added)
> +++ geronimo/branches/1.1/modules/upgrade/NOTICE.txt Wed Mar 29 08:38:17 2006
> @@ -0,0 +1,3 @@
> +This product includes software developed by
> +The Apache Software Foundation (http://www.apache.org/).
> +
>
> Added: geronimo/branches/1.1/modules/upgrade/project.xml
> URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/upgrade/project.xml?rev=389823&view=auto
> ==============================================================================
> --- geronimo/branches/1.1/modules/upgrade/project.xml (added)
> +++ geronimo/branches/1.1/modules/upgrade/project.xml Wed Mar 29 08:38:17 2006
> @@ -0,0 +1,158 @@
> +<?xml version="1.0" encoding="ISO-8859-1"?>
> +<!--
> +
> +    Copyright 2003-2004 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.
> +-->
> +
> +<!-- $Rev: 355877 $ $Date: 2005-12-10 18:48:27 -0800 (Sat, 10 Dec 2005) $ -->
> +
> +<project>
> +    <pomVersion>3</pomVersion>
> +    <extend>../../etc/project.xml</extend>
> +
> +    <!-- ===================== -->
> +    <!-- Module Identification -->
> +    <!-- ===================== -->
> +
> +    <name>Geronimo :: Upgrade</name>
> +    <id>geronimo-upgrade</id>
> +    <shortDescription>Geronimo Upgrade</shortDescription>
> +    <description>Geronimo Upgrade</description>
> +    <url>http://incubator.apache.org/projects/geronimo/kernel/</url>
> +    <siteDirectory>/www/incubator.apache.org/projects/geronimo/kernel</siteDirectory>
> +    <distributionDirectory>/www/incubator.apache.org/projects/geronimo/builds/kernel</distributionDirectory>
> +
> +    <package>org.apache.geronimo.ugrade</package>
> +
> +    <!-- ============ -->
> +    <!-- Dependencies -->
> +    <!-- ============ -->
> +
> +    <dependencies>
> +        <!-- Module Dependencies -->
> +        <dependency>
> +            <groupId>geronimo</groupId>
> +            <artifactId>geronimo-client-builder</artifactId>
> +            <version>${geronimo_version}</version>
> +        </dependency>
> +
> +        <dependency>
> +            <groupId>geronimo</groupId>
> +            <artifactId>geronimo-connector-builder</artifactId>
> +            <version>${geronimo_version}</version>
> +        </dependency>
> +
> +        <dependency>
> +            <groupId>geronimo</groupId>
> +            <artifactId>geronimo-j2ee-builder</artifactId>
> +            <version>${geronimo_version}</version>
> +        </dependency>
> +
> +        <dependency>
> +            <groupId>geronimo</groupId>
> +            <artifactId>geronimo-jetty-builder</artifactId>
> +            <version>${geronimo_version}</version>
> +        </dependency>
> +
> +        <dependency>
> +            <groupId>geronimo</groupId>
> +            <artifactId>geronimo-naming-builder</artifactId>
> +            <version>${geronimo_version}</version>
> +        </dependency>
> +
> +        <dependency>
> +            <groupId>geronimo</groupId>
> +            <artifactId>geronimo-security-builder</artifactId>
> +            <version>${geronimo_version}</version>
> +        </dependency>
> +
> +        <dependency>
> +            <groupId>geronimo</groupId>
> +            <artifactId>geronimo-service-builder</artifactId>
> +            <version>${geronimo_version}</version>
> +        </dependency>
> +
> +        <dependency>
> +            <groupId>geronimo</groupId>
> +            <artifactId>geronimo-tomcat-builder</artifactId>
> +            <version>${geronimo_version}</version>
> +        </dependency>
> +
> +        <dependency>
> +            <groupId>geronimo</groupId>
> +            <artifactId>geronimo-web-builder</artifactId>
> +            <version>${geronimo_version}</version>
> +        </dependency>
> +
> +        <dependency>
> +            <groupId>openejb</groupId>
> +            <artifactId>openejb-builder</artifactId>
> +            <version>${openejb_version}</version>
> +        </dependency>
> +
> +        <dependency>
> +            <groupId>xmlbeans</groupId>
> +            <artifactId>xbean</artifactId>
> +            <version>${xmlbeans_version}</version>
> +        </dependency>
> +
> +        <dependency>
> +            <groupId>stax</groupId>
> +            <artifactId>stax-api</artifactId>
> +            <version>${stax_api_version}</version>
> +        </dependency>
> +
> +        <dependency>
> +            <groupId>geronimo</groupId>
> +            <artifactId>geronimo-j2ee-schema</artifactId>
> +            <version>${pom.currentVersion}</version>
> +            <properties>
> +                <xmlbeans>true</xmlbeans>
> +            </properties>
> +        </dependency>
> +        <dependency>
> +            <groupId>geronimo</groupId>
> +            <artifactId>geronimo-kernel</artifactId>
> +            <version>${pom.currentVersion}</version>
> +        </dependency>
> +
> +    </dependencies>
> +
> +    <build>
> +        <resources>
> +            <resource>
> +                <directory>${basedir}/src/java</directory>
> +                <includes>
> +                    <include>**/*.xml</include>
> +                    <include>**/*.properties</include>
> +                </includes>
> +            </resource>
> +        </resources>
> +        <unitTest>
> +            <includes>
> +                <include>**/*Test.java</include>
> +            </includes>
> +            <excludes>
> +                <exclude>**/Abstract*.java</exclude>
> +            </excludes>
> +            <resources>
> +                <resource>
> +                    <directory>${basedir}/src/test-data</directory>
> +                </resource>
> +            </resources>
> +        </unitTest>
> +    </build>
> +
> +</project>
>
> Added: geronimo/branches/1.1/modules/upgrade/src/java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java
> URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/upgrade/src/java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java?rev=389823&view=auto
> ==============================================================================
> --- geronimo/branches/1.1/modules/upgrade/src/java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java (added)
> +++ geronimo/branches/1.1/modules/upgrade/src/java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java Wed Mar 29 08:38:17 2006
> @@ -0,0 +1,167 @@
> +/**
> + *
> + * Copyright 2006 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.upgrade;
> +
> +import java.io.InputStream;
> +import java.io.IOException;
> +import java.io.Writer;
> +import java.util.Map;
> +import java.util.HashMap;
> +import java.util.ArrayList;
> +import java.util.Collection;
> +
> +import javax.xml.namespace.QName;
> +
> +import org.apache.xmlbeans.XmlObject;
> +import org.apache.xmlbeans.XmlException;
> +import org.apache.xmlbeans.XmlOptions;
> +import org.apache.xmlbeans.XmlCursor;
> +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.deployment.xbeans.EnvironmentType;
> +import org.apache.geronimo.deployment.service.EnvironmentBuilder;
> +
> +/**
> + * @version $Rev:$ $Date:$
> + */
> +public class Upgrade1_0To1_1 {
> +
> +    private static final Map NAMESPACE_UPDATES = new HashMap();
> +
> +    static {
> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/j2ee/application-client", "http://geronimo.apache.org/xml/ns/j2ee/application-client-1.1");
> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/j2ee/application-client-1.0", "http://geronimo.apache.org/xml/ns/j2ee/application-client-1.1");
> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/j2ee/application", "http://geronimo.apache.org/xml/ns/j2ee/application-1.1");
> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/j2ee/application-1.0", "http://geronimo.apache.org/xml/ns/j2ee/application-1.1");
> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/deployment", "http://geronimo.apache.org/xml/ns/deployment-1.1");
> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/deployment-1.0", "http://geronimo.apache.org/xml/ns/deployment-1.1");
> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/j2ee/connector", "http://geronimo.apache.org/xml/ns/j2ee/connector-1.1");
> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/deployment/javabean", "http://geronimo.apache.org/xml/ns/deployment/javabean-1.0");
> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/loginconfig", "http://geronimo.apache.org/xml/ns/loginconfig-1.0");
> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/loginconfig-1.0", "http://geronimo.apache.org/xml/ns/loginconfig-1.0");
> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/naming", "http://geronimo.apache.org/xml/ns/naming-1.1");
> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/naming-1.0", "http://geronimo.apache.org/xml/ns/naming-1.1");
> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/security", "http://geronimo.apache.org/xml/ns/security-1.1");
> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/security-1.0", "http://geronimo.apache.org/xml/ns/security-1.1");
> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/web", "http://geronimo.apache.org/xml/ns/j2ee/web-1.1");
> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/web-1.0", "http://geronimo.apache.org/xml/ns/j2ee/web-1.1");
> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/web/jetty", "http://geronimo.apache.org/xml/ns/j2ee/web/jetty-1.1");
> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/web/jetty-1.0", "http://geronimo.apache.org/xml/ns/j2ee/web/jetty-1.1");
> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/web/jetty/config", "http://geronimo.apache.org/xml/ns/j2ee/web/jetty/config-1.0");
> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/web/tomcat", "http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.1");
> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/web/tomcat-1.0", "http://geronimo.apache.org/xml/ns/j2ee/web/tomcat-1.1");
> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/web/tomcat/config", "http://geronimo.apache.org/xml/ns/j2ee/web/tomcat/config-1.0");
> +        NAMESPACE_UPDATES.put("http://www.openejb.org/xml/ns/openejb-jar", "http://www.openejb.org/xml/ns/openejb-jar-2.1");
> +        NAMESPACE_UPDATES.put("http://www.openejb.org/xml/ns/openejb-jar-2.0", "http://www.openejb.org/xml/ns/openejb-jar-2.1");
> +        NAMESPACE_UPDATES.put("http://www.openejb.org/xml/ns/pkgen", "http://www.openejb.org/xml/ns/pkgen-2.0");
> +        NAMESPACE_UPDATES.put("http://www.openejb.org/xml/ns/corba-css-config_1_0", "http://www.openejb.org/xml/ns/corba-css-config-2.0");
> +        NAMESPACE_UPDATES.put("http://www.openejb.org/xml/ns/corba-tss-config_1_0", "http://www.openejb.org/xml/ns/corba-tss-config-2.0");
> +    }
> +
> +    private static final QName ENVIRONMENT_QNAME = new QName("http://geronimo.apache.org/xml/ns/deployment-1.1", "environment");
> +    private static final String DEFAULT_GROUPID = "default";
> +    private static final String DEFAULT_VERSION = "1-default";
> +    private static final QName CLIENT_ENVIRONMENT_QNAME = new QName("http://geronimo.apache.org/xml/ns/deployment-1.1", "client-environment");
> +    private static final QName PARENT_ENVIRONMENT_QNAME = new QName("http://geronimo.apache.org/xml/ns/deployment-1.1", "parent-environment");
> +
> +    public static void upgrade(InputStream source, Writer target) throws IOException, XmlException {
> +        XmlObject xmlObject = parse(source);
> +        XmlCursor cursor = xmlObject.newCursor();
> +        XmlCursor.TokenType token;
> +        while ((token = cursor.toNextToken()) != XmlCursor.TokenType.ENDDOC) {
> +            if (token == XmlCursor.TokenType.START) {
> +                Artifact configId = extractArtifact("configId", cursor);
> +                Artifact parentId = extractArtifact("parentId", cursor);
> +                Artifact clientConfigId = extractArtifact("clientConfigId", cursor);
> +                Artifact clientParentId = extractArtifact("clientParentId", cursor);
> +                if (clientConfigId != null) {
> +
> +                    insertEnvironment(clientConfigId, clientParentId, cursor, CLIENT_ENVIRONMENT_QNAME);
> +
> +                    insertEnvironment(configId, parentId, cursor, PARENT_ENVIRONMENT_QNAME);
> +
> +                } else if (configId != null) {
> +
> +                    insertEnvironment(configId, parentId, cursor, ENVIRONMENT_QNAME);
> +                }
> +            }
> +        }
> +
> +        XmlOptions xmlOptions = new XmlOptions();
> +        xmlOptions.setSavePrettyPrint();
> +        xmlObject.save(target, xmlOptions);
> +
> +    }
> +
> +    private static void insertEnvironment(Artifact configId, Artifact parentId, XmlCursor cursor, QName environmentQname) {
> +        positionEnvironment(cursor);
> +        Environment environment = new Environment();
> +        environment.setConfigId(configId);
> +        if (parentId != null ) {
> +            environment.addDependency(parentId, ImportType.ALL);
> +        }
> +        EnvironmentType environmentType = EnvironmentBuilder.buildEnvironmentType(environment);
> +        cursor.beginElement(environmentQname);
> +        XmlCursor element = environmentType.newCursor();
> +        try {
> +            element.copyXmlContents(cursor);
> +        } finally {
> +            element.dispose();
> +        }
> +    }
> +
> +    private static void positionEnvironment(XmlCursor cursor) {
> +        XmlCursor.TokenType token;
> +        while ((token = cursor.toNextToken()) != XmlCursor.TokenType.START && token != XmlCursor.TokenType.END) {
> +            //keep going
> +        }
> +    }
> +
> +    private static Artifact extractArtifact(String attrName, XmlCursor cursor) {
> +        String attrValue;
> +        QName attrQName = new QName(null, attrName);
> +        if ((attrValue = cursor.getAttributeText(attrQName)) != null) {
> +            cursor.removeAttribute(attrQName);
> +            try {
> +                return Artifact.create(attrValue);
> +            } catch (Exception e) {
> +                return new Artifact(DEFAULT_GROUPID, attrValue.replace('/', '_'), DEFAULT_VERSION, "car");
> +            }
> +        }
> +        return null;
> +    }
> +
> +    public static XmlObject parse(InputStream is) throws IOException, XmlException {
> +        ArrayList errors = new ArrayList();
> +        XmlObject parsed = XmlObject.Factory.parse(is, createXmlOptions(errors));
> +        if (errors.size() != 0) {
> +            throw new XmlException(errors.toArray().toString());
> +        }
> +        return parsed;
> +    }
> +
> +    public static XmlOptions createXmlOptions(Collection errors) {
> +        XmlOptions options = new XmlOptions();
> +        options.setLoadLineNumbers();
> +        options.setErrorListener(errors);
> +        options.setLoadSubstituteNamespaces(NAMESPACE_UPDATES);
> +        return options;
> +    }
> +
> +}
>
> Added: geronimo/branches/1.1/modules/upgrade/src/test-data/appclient_ejb_1.xml
> URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/upgrade/src/test-data/appclient_ejb_1.xml?rev=389823&view=auto
> ==============================================================================
> --- geronimo/branches/1.1/modules/upgrade/src/test-data/appclient_ejb_1.xml (added)
> +++ geronimo/branches/1.1/modules/upgrade/src/test-data/appclient_ejb_1.xml Wed Mar 29 08:38:17 2006
> @@ -0,0 +1,41 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<application
> +    xmlns="http://geronimo.apache.org/xml/ns/j2ee/application"
> +    configId="appclient_ejb_1"
> +    parentId="${pom.groupId}/server-security/${pom.currentVersion}/car">
> +    <module>
> +        <ejb>appclient_ejb_1_ejb.jar</ejb>
> +        <openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar" configId="ejb">
> +            <cmp-connection-factory>
> +                <resource-link>jdbc/DB1</resource-link>
> +            </cmp-connection-factory>
> +            <enterprise-beans>
> +                <entity>
> +                    <ejb-name>CMP20</ejb-name>
> +                    <table-name>CMP20_APPCLIENT_TABLE1</table-name>
> +                    <cmp-field-mapping>
> +                        <cmp-field-name>id</cmp-field-name>
> +                        <table-column>ID</table-column>
> +                    </cmp-field-mapping>
> +                </entity>
> +                <entity>
> +                    <ejb-name>CMP11</ejb-name>
> +                    <table-name>CMP20_APPCLIENT_TABLE2</table-name>
> +                    <cmp-field-mapping>
> +                        <cmp-field-name>KEY_ID</cmp-field-name>
> +                        <table-column>ID</table-column>
> +                    </cmp-field-mapping>
> +                </entity>
> +            </enterprise-beans>
> +        </openejb-jar>
> +    </module>
> +    <module>
> +        <java>appclient_ejb_1_client.jar</java>
> +        <application-client xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-client"
> +            configId="bar"
> +            clientConfigId="appclient_ejb_1/appclient_ejb_1_client"
> +            clientParentId="${pom.groupId}/client-database/${pom.currentVersion}/car">
> +
> +        </application-client>
> +    </module>
> +</application>
>
> Added: geronimo/branches/1.1/modules/upgrade/src/test/org/apache/geronimo/upgrade/Upgrade1_0To1_1Test.java
> URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/upgrade/src/test/org/apache/geronimo/upgrade/Upgrade1_0To1_1Test.java?rev=389823&view=auto
> ==============================================================================
> --- geronimo/branches/1.1/modules/upgrade/src/test/org/apache/geronimo/upgrade/Upgrade1_0To1_1Test.java (added)
> +++ geronimo/branches/1.1/modules/upgrade/src/test/org/apache/geronimo/upgrade/Upgrade1_0To1_1Test.java Wed Mar 29 08:38:17 2006
> @@ -0,0 +1,103 @@
> +/**
> + *
> + * Copyright 2006 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.upgrade;
> +
> +
> +import java.net.URL;
> +import java.util.List;
> +import java.util.ArrayList;
> +import java.io.InputStream;
> +import java.io.OutputStream;
> +import java.io.StringWriter;
> +import java.io.Writer;
> +
> +import javax.xml.namespace.QName;
> +
> +import junit.framework.TestCase;
> +import org.apache.xmlbeans.XmlObject;
> +import org.apache.xmlbeans.XmlCursor;
> +import org.apache.geronimo.schema.SchemaConversionUtils;
> +
> +/**
> + * @version $Rev:$ $Date:$
> + */
> +public class Upgrade1_0To1_1Test extends TestCase {
> +
> +    private final ClassLoader classLoader = this.getClass().getClassLoader();
> +
> +    public void test1() throws Exception {
> +//        InputStream srcXml = classLoader.getResourceAsStream("jms-plan.xml");
> +        InputStream srcXml = classLoader.getResourceAsStream("appclient_ejb_1.xml");
> +        Writer targetXml = new StringWriter();
> +        Upgrade1_0To1_1.upgrade(srcXml, targetXml);
> +
> +        String targetString = targetXml.toString();
> +        System.out.println(targetString);
> +        XmlObject targetXmlObject = XmlObject.Factory.parse(targetString);
> +        //uncomment fail to see output
> +//        fail();
> +//        URL expectedOutputXml = classLoader.getResource("appclient_dep_ejblink_single.ear.xml");
> +//        XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
> +//        XmlObject expected = XmlObject.Factory.parse(expectedOutputXml);
> +//        SchemaConversionUtils.validateDD(expected);
> +//        xmlObject = SchemaConversionUtils.convertToApplicationClientSchema(xmlObject);
> +//        System.out.println(xmlObject.toString());
> +//        System.out.println(expected.toString());
> +//        List problems = new ArrayList();
> +//        boolean ok = compareXmlObjects(xmlObject, expected, problems);
> +//        assertTrue("Differences: " + problems, ok);
> +    }
> +
> +    private boolean compareXmlObjects(XmlObject xmlObject, XmlObject expectedObject, List problems) {
> +        XmlCursor test = xmlObject.newCursor();
> +        XmlCursor expected = expectedObject.newCursor();
> +        boolean similar = true;
> +        int elementCount = 0;
> +        while (toNextStartToken(test)) {
> +            elementCount++;
> +            if (!toNextStartToken(expected)) {
> +                problems.add("test longer than expected at element: " + elementCount);
> +                return false;
> +            }
> +            QName actualQName = test.getName();
> +            QName expectedQName = expected.getName();
> +            if (!actualQName.equals(expectedQName)) {
> +                problems.add("Different elements at elementCount: " + elementCount + ", test: " + actualQName + ", expected: " + expectedQName);
> +                similar = false;
> +            }
> +            test.toNextToken();
> +            expected.toNextToken();
> +        }
> +        if (toNextStartToken(expected)) {
> +            problems.add("test shorter that expected at element: " + elementCount);
> +            similar = false;
> +        }
> +        return similar;
> +    }
> +
> +    private boolean toNextStartToken(XmlCursor cursor) {
> +        while (!cursor.isStart()) {
> +            if (!cursor.hasNextToken()) {
> +                return false;
> +            }
> +            cursor.toNextToken();
> +        }
> +        return true;
> +    }
> +
> +}
>
>
>

Re: svn commit: r389823 - in /geronimo/branches/1.1/modules/upgrade: ./ src/ src/java/ src/java/org/ src/java/org/apache/ src/java/org/apache/geronimo/ src/java/org/apache/geronimo/upgrade/ src/test-data/ src/test/ src/test/org/ src/test/org/apache/

Posted by Aaron Mulder <am...@alumni.princeton.edu>.
Well, I've put Geronimo code in the util module -- does that mean that
LICENSE.txt should contain two full licenses?

Thanks,
    Aaron

On 3/29/06, Kevan Miller <ke...@gmail.com> wrote:
> Hmmm. Good question. I would guess that David copied the LICENSE.txt
> from the util directory and didn't realize it wasn't the Apache
> license. Is it proper that util <only> contains the BouncyCastle
> license?
> --kevan
> On Mar 29, 2006, at 12:07 PM, Aaron Mulder wrote:
>
> > Why is the BouncyCastle license used for this module?
> >
> > Thanks,
> >     Aaron
> >
> > On 3/29/06, djencks@apache.org <dj...@apache.org> wrote:
> >> Author: djencks
> >> Date: Wed Mar 29 08:38:17 2006
> >> New Revision: 389823
> >>
> >> URL: http://svn.apache.org/viewcvs?rev=389823&view=rev
> >> Log:
> >> Add the start of a converter utility, also has a loginmodulegbean
> >> change that should be ok but I'm not sure why I didn't commit it
> >> before.  revert if it causes problems.
> >>
> >> Added:
> >>     geronimo/branches/1.1/modules/upgrade/
> >>     geronimo/branches/1.1/modules/upgrade/LICENSE.txt
> >>     geronimo/branches/1.1/modules/upgrade/NOTICE.txt
> >>     geronimo/branches/1.1/modules/upgrade/project.xml
> >>     geronimo/branches/1.1/modules/upgrade/src/
> >>     geronimo/branches/1.1/modules/upgrade/src/java/
> >>     geronimo/branches/1.1/modules/upgrade/src/java/org/
> >>     geronimo/branches/1.1/modules/upgrade/src/java/org/apache/
> >>     geronimo/branches/1.1/modules/upgrade/src/java/org/apache/
> >> geronimo/
> >>     geronimo/branches/1.1/modules/upgrade/src/java/org/apache/
> >> geronimo/upgrade/
> >>     geronimo/branches/1.1/modules/upgrade/src/java/org/apache/
> >> geronimo/upgrade/Upgrade1_0To1_1.java
> >>     geronimo/branches/1.1/modules/upgrade/src/test/
> >>     geronimo/branches/1.1/modules/upgrade/src/test-data/
> >>     geronimo/branches/1.1/modules/upgrade/src/test-data/
> >> appclient_ejb_1.xml
> >>     geronimo/branches/1.1/modules/upgrade/src/test/org/
> >>     geronimo/branches/1.1/modules/upgrade/src/test/org/apache/
> >>     geronimo/branches/1.1/modules/upgrade/src/test/org/apache/
> >> geronimo/
> >>     geronimo/branches/1.1/modules/upgrade/src/test/org/apache/
> >> geronimo/upgrade/
> >>     geronimo/branches/1.1/modules/upgrade/src/test/org/apache/
> >> geronimo/upgrade/Upgrade1_0To1_1Test.java
> >>
> >> Added: geronimo/branches/1.1/modules/upgrade/LICENSE.txt
> >> URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/
> >> upgrade/LICENSE.txt?rev=389823&view=auto
> >> =====================================================================
> >> =========
> >> --- geronimo/branches/1.1/modules/upgrade/LICENSE.txt (added)
> >> +++ geronimo/branches/1.1/modules/upgrade/LICENSE.txt Wed Mar 29
> >> 08:38:17 2006
> >> @@ -0,0 +1,20 @@
> >> +The Bouncy Castle License
> >> +
> >> +Copyright (c) 2000-2005 The Legion Of The Bouncy Castle (http://
> >> www.bouncycastle.org)
> >> +
> >> +Permission is hereby granted, free of charge, to any person
> >> obtaining a copy of this software
> >> +and associated documentation files (the "Software"), to deal in
> >> the Software without restriction,
> >> +including without limitation the rights to use, copy, modify,
> >> merge, publish, distribute, sublicense,
> >> +and/or sell copies of the Software, and to permit persons to whom
> >> the Software is furnished to do so,
> >> +subject to the following conditions:
> >> +
> >> +The above copyright notice and this permission notice shall be
> >> included in all copies or substantial
> >> +portions of the Software.
> >> +
> >> +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> >> EXPRESS OR IMPLIED,
> >> +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> >> FITNESS FOR A PARTICULAR
> >> +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
> >> COPYRIGHT HOLDERS BE
> >> +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
> >> ACTION OF CONTRACT, TORT OR
> >> +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
> >> SOFTWARE OR THE USE OR OTHER
> >> +DEALINGS IN THE SOFTWARE.
> >> +
> >>
> >> Added: geronimo/branches/1.1/modules/upgrade/NOTICE.txt
> >> URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/
> >> upgrade/NOTICE.txt?rev=389823&view=auto
> >> =====================================================================
> >> =========
> >> --- geronimo/branches/1.1/modules/upgrade/NOTICE.txt (added)
> >> +++ geronimo/branches/1.1/modules/upgrade/NOTICE.txt Wed Mar 29
> >> 08:38:17 2006
> >> @@ -0,0 +1,3 @@
> >> +This product includes software developed by
> >> +The Apache Software Foundation (http://www.apache.org/).
> >> +
> >>
> >> Added: geronimo/branches/1.1/modules/upgrade/project.xml
> >> URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/
> >> upgrade/project.xml?rev=389823&view=auto
> >> =====================================================================
> >> =========
> >> --- geronimo/branches/1.1/modules/upgrade/project.xml (added)
> >> +++ geronimo/branches/1.1/modules/upgrade/project.xml Wed Mar 29
> >> 08:38:17 2006
> >> @@ -0,0 +1,158 @@
> >> +<?xml version="1.0" encoding="ISO-8859-1"?>
> >> +<!--
> >> +
> >> +    Copyright 2003-2004 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.
> >> +-->
> >> +
> >> +<!-- $Rev: 355877 $ $Date: 2005-12-10 18:48:27 -0800 (Sat, 10 Dec
> >> 2005) $ -->
> >> +
> >> +<project>
> >> +    <pomVersion>3</pomVersion>
> >> +    <extend>../../etc/project.xml</extend>
> >> +
> >> +    <!-- ===================== -->
> >> +    <!-- Module Identification -->
> >> +    <!-- ===================== -->
> >> +
> >> +    <name>Geronimo :: Upgrade</name>
> >> +    <id>geronimo-upgrade</id>
> >> +    <shortDescription>Geronimo Upgrade</shortDescription>
> >> +    <description>Geronimo Upgrade</description>
> >> +    <url>http://incubator.apache.org/projects/geronimo/kernel/</url>
> >> +    <siteDirectory>/www/incubator.apache.org/projects/geronimo/
> >> kernel</siteDirectory>
> >> +    <distributionDirectory>/www/incubator.apache.org/projects/
> >> geronimo/builds/kernel</distributionDirectory>
> >> +
> >> +    <package>org.apache.geronimo.ugrade</package>
> >> +
> >> +    <!-- ============ -->
> >> +    <!-- Dependencies -->
> >> +    <!-- ============ -->
> >> +
> >> +    <dependencies>
> >> +        <!-- Module Dependencies -->
> >> +        <dependency>
> >> +            <groupId>geronimo</groupId>
> >> +            <artifactId>geronimo-client-builder</artifactId>
> >> +            <version>${geronimo_version}</version>
> >> +        </dependency>
> >> +
> >> +        <dependency>
> >> +            <groupId>geronimo</groupId>
> >> +            <artifactId>geronimo-connector-builder</artifactId>
> >> +            <version>${geronimo_version}</version>
> >> +        </dependency>
> >> +
> >> +        <dependency>
> >> +            <groupId>geronimo</groupId>
> >> +            <artifactId>geronimo-j2ee-builder</artifactId>
> >> +            <version>${geronimo_version}</version>
> >> +        </dependency>
> >> +
> >> +        <dependency>
> >> +            <groupId>geronimo</groupId>
> >> +            <artifactId>geronimo-jetty-builder</artifactId>
> >> +            <version>${geronimo_version}</version>
> >> +        </dependency>
> >> +
> >> +        <dependency>
> >> +            <groupId>geronimo</groupId>
> >> +            <artifactId>geronimo-naming-builder</artifactId>
> >> +            <version>${geronimo_version}</version>
> >> +        </dependency>
> >> +
> >> +        <dependency>
> >> +            <groupId>geronimo</groupId>
> >> +            <artifactId>geronimo-security-builder</artifactId>
> >> +            <version>${geronimo_version}</version>
> >> +        </dependency>
> >> +
> >> +        <dependency>
> >> +            <groupId>geronimo</groupId>
> >> +            <artifactId>geronimo-service-builder</artifactId>
> >> +            <version>${geronimo_version}</version>
> >> +        </dependency>
> >> +
> >> +        <dependency>
> >> +            <groupId>geronimo</groupId>
> >> +            <artifactId>geronimo-tomcat-builder</artifactId>
> >> +            <version>${geronimo_version}</version>
> >> +        </dependency>
> >> +
> >> +        <dependency>
> >> +            <groupId>geronimo</groupId>
> >> +            <artifactId>geronimo-web-builder</artifactId>
> >> +            <version>${geronimo_version}</version>
> >> +        </dependency>
> >> +
> >> +        <dependency>
> >> +            <groupId>openejb</groupId>
> >> +            <artifactId>openejb-builder</artifactId>
> >> +            <version>${openejb_version}</version>
> >> +        </dependency>
> >> +
> >> +        <dependency>
> >> +            <groupId>xmlbeans</groupId>
> >> +            <artifactId>xbean</artifactId>
> >> +            <version>${xmlbeans_version}</version>
> >> +        </dependency>
> >> +
> >> +        <dependency>
> >> +            <groupId>stax</groupId>
> >> +            <artifactId>stax-api</artifactId>
> >> +            <version>${stax_api_version}</version>
> >> +        </dependency>
> >> +
> >> +        <dependency>
> >> +            <groupId>geronimo</groupId>
> >> +            <artifactId>geronimo-j2ee-schema</artifactId>
> >> +            <version>${pom.currentVersion}</version>
> >> +            <properties>
> >> +                <xmlbeans>true</xmlbeans>
> >> +            </properties>
> >> +        </dependency>
> >> +        <dependency>
> >> +            <groupId>geronimo</groupId>
> >> +            <artifactId>geronimo-kernel</artifactId>
> >> +            <version>${pom.currentVersion}</version>
> >> +        </dependency>
> >> +
> >> +    </dependencies>
> >> +
> >> +    <build>
> >> +        <resources>
> >> +            <resource>
> >> +                <directory>${basedir}/src/java</directory>
> >> +                <includes>
> >> +                    <include>**/*.xml</include>
> >> +                    <include>**/*.properties</include>
> >> +                </includes>
> >> +            </resource>
> >> +        </resources>
> >> +        <unitTest>
> >> +            <includes>
> >> +                <include>**/*Test.java</include>
> >> +            </includes>
> >> +            <excludes>
> >> +                <exclude>**/Abstract*.java</exclude>
> >> +            </excludes>
> >> +            <resources>
> >> +                <resource>
> >> +                    <directory>${basedir}/src/test-data</directory>
> >> +                </resource>
> >> +            </resources>
> >> +        </unitTest>
> >> +    </build>
> >> +
> >> +</project>
> >>
> >> Added: geronimo/branches/1.1/modules/upgrade/src/java/org/apache/
> >> geronimo/upgrade/Upgrade1_0To1_1.java
> >> URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/
> >> upgrade/src/java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java?
> >> rev=389823&view=auto
> >> =====================================================================
> >> =========
> >> --- geronimo/branches/1.1/modules/upgrade/src/java/org/apache/
> >> geronimo/upgrade/Upgrade1_0To1_1.java (added)
> >> +++ geronimo/branches/1.1/modules/upgrade/src/java/org/apache/
> >> geronimo/upgrade/Upgrade1_0To1_1.java Wed Mar 29 08:38:17 2006
> >> @@ -0,0 +1,167 @@
> >> +/**
> >> + *
> >> + * Copyright 2006 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.upgrade;
> >> +
> >> +import java.io.InputStream;
> >> +import java.io.IOException;
> >> +import java.io.Writer;
> >> +import java.util.Map;
> >> +import java.util.HashMap;
> >> +import java.util.ArrayList;
> >> +import java.util.Collection;
> >> +
> >> +import javax.xml.namespace.QName;
> >> +
> >> +import org.apache.xmlbeans.XmlObject;
> >> +import org.apache.xmlbeans.XmlException;
> >> +import org.apache.xmlbeans.XmlOptions;
> >> +import org.apache.xmlbeans.XmlCursor;
> >> +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.deployment.xbeans.EnvironmentType;
> >> +import org.apache.geronimo.deployment.service.EnvironmentBuilder;
> >> +
> >> +/**
> >> + * @version $Rev:$ $Date:$
> >> + */
> >> +public class Upgrade1_0To1_1 {
> >> +
> >> +    private static final Map NAMESPACE_UPDATES = new HashMap();
> >> +
> >> +    static {
> >> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/
> >> j2ee/application-client", "http://geronimo.apache.org/xml/ns/j2ee/
> >> application-client-1.1");
> >> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/
> >> j2ee/application-client-1.0", "http://geronimo.apache.org/xml/ns/
> >> j2ee/application-client-1.1");
> >> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/
> >> j2ee/application", "http://geronimo.apache.org/xml/ns/j2ee/
> >> application-1.1");
> >> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/
> >> j2ee/application-1.0", "http://geronimo.apache.org/xml/ns/j2ee/
> >> application-1.1");
> >> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/
> >> deployment", "http://geronimo.apache.org/xml/ns/deployment-1.1");
> >> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/
> >> deployment-1.0", "http://geronimo.apache.org/xml/ns/deployment-1.1");
> >> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/
> >> j2ee/connector", "http://geronimo.apache.org/xml/ns/j2ee/
> >> connector-1.1");
> >> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/
> >> deployment/javabean", "http://geronimo.apache.org/xml/ns/
> >> deployment/javabean-1.0");
> >> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/
> >> loginconfig", "http://geronimo.apache.org/xml/ns/loginconfig-1.0");
> >> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/
> >> loginconfig-1.0", "http://geronimo.apache.org/xml/ns/
> >> loginconfig-1.0");
> >> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/
> >> naming", "http://geronimo.apache.org/xml/ns/naming-1.1");
> >> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/
> >> naming-1.0", "http://geronimo.apache.org/xml/ns/naming-1.1");
> >> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/
> >> security", "http://geronimo.apache.org/xml/ns/security-1.1");
> >> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/
> >> security-1.0", "http://geronimo.apache.org/xml/ns/security-1.1");
> >> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/
> >> web", "http://geronimo.apache.org/xml/ns/j2ee/web-1.1");
> >> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/
> >> web-1.0", "http://geronimo.apache.org/xml/ns/j2ee/web-1.1");
> >> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/
> >> web/jetty", "http://geronimo.apache.org/xml/ns/j2ee/web/jetty-1.1");
> >> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/
> >> web/jetty-1.0", "http://geronimo.apache.org/xml/ns/j2ee/web/
> >> jetty-1.1");
> >> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/
> >> web/jetty/config", "http://geronimo.apache.org/xml/ns/j2ee/web/
> >> jetty/config-1.0");
> >> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/
> >> web/tomcat", "http://geronimo.apache.org/xml/ns/j2ee/web/
> >> tomcat-1.1");
> >> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/
> >> web/tomcat-1.0", "http://geronimo.apache.org/xml/ns/j2ee/web/
> >> tomcat-1.1");
> >> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/
> >> web/tomcat/config", "http://geronimo.apache.org/xml/ns/j2ee/web/
> >> tomcat/config-1.0");
> >> +        NAMESPACE_UPDATES.put("http://www.openejb.org/xml/ns/
> >> openejb-jar", "http://www.openejb.org/xml/ns/openejb-jar-2.1");
> >> +        NAMESPACE_UPDATES.put("http://www.openejb.org/xml/ns/
> >> openejb-jar-2.0", "http://www.openejb.org/xml/ns/openejb-jar-2.1");
> >> +        NAMESPACE_UPDATES.put("http://www.openejb.org/xml/ns/
> >> pkgen", "http://www.openejb.org/xml/ns/pkgen-2.0");
> >> +        NAMESPACE_UPDATES.put("http://www.openejb.org/xml/ns/
> >> corba-css-config_1_0", "http://www.openejb.org/xml/ns/corba-css-
> >> config-2.0");
> >> +        NAMESPACE_UPDATES.put("http://www.openejb.org/xml/ns/
> >> corba-tss-config_1_0", "http://www.openejb.org/xml/ns/corba-tss-
> >> config-2.0");
> >> +    }
> >> +
> >> +    private static final QName ENVIRONMENT_QNAME = new QName
> >> ("http://geronimo.apache.org/xml/ns/deployment-1.1", "environment");
> >> +    private static final String DEFAULT_GROUPID = "default";
> >> +    private static final String DEFAULT_VERSION = "1-default";
> >> +    private static final QName CLIENT_ENVIRONMENT_QNAME = new
> >> QName("http://geronimo.apache.org/xml/ns/deployment-1.1", "client-
> >> environment");
> >> +    private static final QName PARENT_ENVIRONMENT_QNAME = new
> >> QName("http://geronimo.apache.org/xml/ns/deployment-1.1", "parent-
> >> environment");
> >> +
> >> +    public static void upgrade(InputStream source, Writer target)
> >> throws IOException, XmlException {
> >> +        XmlObject xmlObject = parse(source);
> >> +        XmlCursor cursor = xmlObject.newCursor();
> >> +        XmlCursor.TokenType token;
> >> +        while ((token = cursor.toNextToken()) !=
> >> XmlCursor.TokenType.ENDDOC) {
> >> +            if (token == XmlCursor.TokenType.START) {
> >> +                Artifact configId = extractArtifact("configId",
> >> cursor);
> >> +                Artifact parentId = extractArtifact("parentId",
> >> cursor);
> >> +                Artifact clientConfigId = extractArtifact
> >> ("clientConfigId", cursor);
> >> +                Artifact clientParentId = extractArtifact
> >> ("clientParentId", cursor);
> >> +                if (clientConfigId != null) {
> >> +
> >> +                    insertEnvironment(clientConfigId,
> >> clientParentId, cursor, CLIENT_ENVIRONMENT_QNAME);
> >> +
> >> +                    insertEnvironment(configId, parentId, cursor,
> >> PARENT_ENVIRONMENT_QNAME);
> >> +
> >> +                } else if (configId != null) {
> >> +
> >> +                    insertEnvironment(configId, parentId, cursor,
> >> ENVIRONMENT_QNAME);
> >> +                }
> >> +            }
> >> +        }
> >> +
> >> +        XmlOptions xmlOptions = new XmlOptions();
> >> +        xmlOptions.setSavePrettyPrint();
> >> +        xmlObject.save(target, xmlOptions);
> >> +
> >> +    }
> >> +
> >> +    private static void insertEnvironment(Artifact configId,
> >> Artifact parentId, XmlCursor cursor, QName environmentQname) {
> >> +        positionEnvironment(cursor);
> >> +        Environment environment = new Environment();
> >> +        environment.setConfigId(configId);
> >> +        if (parentId != null ) {
> >> +            environment.addDependency(parentId, ImportType.ALL);
> >> +        }
> >> +        EnvironmentType environmentType =
> >> EnvironmentBuilder.buildEnvironmentType(environment);
> >> +        cursor.beginElement(environmentQname);
> >> +        XmlCursor element = environmentType.newCursor();
> >> +        try {
> >> +            element.copyXmlContents(cursor);
> >> +        } finally {
> >> +            element.dispose();
> >> +        }
> >> +    }
> >> +
> >> +    private static void positionEnvironment(XmlCursor cursor) {
> >> +        XmlCursor.TokenType token;
> >> +        while ((token = cursor.toNextToken()) !=
> >> XmlCursor.TokenType.START && token != XmlCursor.TokenType.END) {
> >> +            //keep going
> >> +        }
> >> +    }
> >> +
> >> +    private static Artifact extractArtifact(String attrName,
> >> XmlCursor cursor) {
> >> +        String attrValue;
> >> +        QName attrQName = new QName(null, attrName);
> >> +        if ((attrValue = cursor.getAttributeText(attrQName)) !=
> >> null) {
> >> +            cursor.removeAttribute(attrQName);
> >> +            try {
> >> +                return Artifact.create(attrValue);
> >> +            } catch (Exception e) {
> >> +                return new Artifact(DEFAULT_GROUPID,
> >> attrValue.replace('/', '_'), DEFAULT_VERSION, "car");
> >> +            }
> >> +        }
> >> +        return null;
> >> +    }
> >> +
> >> +    public static XmlObject parse(InputStream is) throws
> >> IOException, XmlException {
> >> +        ArrayList errors = new ArrayList();
> >> +        XmlObject parsed = XmlObject.Factory.parse(is,
> >> createXmlOptions(errors));
> >> +        if (errors.size() != 0) {
> >> +            throw new XmlException(errors.toArray().toString());
> >> +        }
> >> +        return parsed;
> >> +    }
> >> +
> >> +    public static XmlOptions createXmlOptions(Collection errors) {
> >> +        XmlOptions options = new XmlOptions();
> >> +        options.setLoadLineNumbers();
> >> +        options.setErrorListener(errors);
> >> +        options.setLoadSubstituteNamespaces(NAMESPACE_UPDATES);
> >> +        return options;
> >> +    }
> >> +
> >> +}
> >>
> >> Added: geronimo/branches/1.1/modules/upgrade/src/test-data/
> >> appclient_ejb_1.xml
> >> URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/
> >> upgrade/src/test-data/appclient_ejb_1.xml?rev=389823&view=auto
> >> =====================================================================
> >> =========
> >> --- geronimo/branches/1.1/modules/upgrade/src/test-data/
> >> appclient_ejb_1.xml (added)
> >> +++ geronimo/branches/1.1/modules/upgrade/src/test-data/
> >> appclient_ejb_1.xml Wed Mar 29 08:38:17 2006
> >> @@ -0,0 +1,41 @@
> >> +<?xml version="1.0" encoding="UTF-8"?>
> >> +<application
> >> +    xmlns="http://geronimo.apache.org/xml/ns/j2ee/application"
> >> +    configId="appclient_ejb_1"
> >> +    parentId="${pom.groupId}/server-security/$
> >> {pom.currentVersion}/car">
> >> +    <module>
> >> +        <ejb>appclient_ejb_1_ejb.jar</ejb>
> >> +        <openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-
> >> jar" configId="ejb">
> >> +            <cmp-connection-factory>
> >> +                <resource-link>jdbc/DB1</resource-link>
> >> +            </cmp-connection-factory>
> >> +            <enterprise-beans>
> >> +                <entity>
> >> +                    <ejb-name>CMP20</ejb-name>
> >> +                    <table-name>CMP20_APPCLIENT_TABLE1</table-name>
> >> +                    <cmp-field-mapping>
> >> +                        <cmp-field-name>id</cmp-field-name>
> >> +                        <table-column>ID</table-column>
> >> +                    </cmp-field-mapping>
> >> +                </entity>
> >> +                <entity>
> >> +                    <ejb-name>CMP11</ejb-name>
> >> +                    <table-name>CMP20_APPCLIENT_TABLE2</table-name>
> >> +                    <cmp-field-mapping>
> >> +                        <cmp-field-name>KEY_ID</cmp-field-name>
> >> +                        <table-column>ID</table-column>
> >> +                    </cmp-field-mapping>
> >> +                </entity>
> >> +            </enterprise-beans>
> >> +        </openejb-jar>
> >> +    </module>
> >> +    <module>
> >> +        <java>appclient_ejb_1_client.jar</java>
> >> +        <application-client xmlns="http://geronimo.apache.org/xml/
> >> ns/j2ee/application-client"
> >> +            configId="bar"
> >> +            clientConfigId="appclient_ejb_1/appclient_ejb_1_client"
> >> +            clientParentId="${pom.groupId}/client-database/$
> >> {pom.currentVersion}/car">
> >> +
> >> +        </application-client>
> >> +    </module>
> >> +</application>
> >>
> >> Added: geronimo/branches/1.1/modules/upgrade/src/test/org/apache/
> >> geronimo/upgrade/Upgrade1_0To1_1Test.java
> >> URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/
> >> upgrade/src/test/org/apache/geronimo/upgrade/
> >> Upgrade1_0To1_1Test.java?rev=389823&view=auto
> >> =====================================================================
> >> =========
> >> --- geronimo/branches/1.1/modules/upgrade/src/test/org/apache/
> >> geronimo/upgrade/Upgrade1_0To1_1Test.java (added)
> >> +++ geronimo/branches/1.1/modules/upgrade/src/test/org/apache/
> >> geronimo/upgrade/Upgrade1_0To1_1Test.java Wed Mar 29 08:38:17 2006
> >> @@ -0,0 +1,103 @@
> >> +/**
> >> + *
> >> + * Copyright 2006 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.upgrade;
> >> +
> >> +
> >> +import java.net.URL;
> >> +import java.util.List;
> >> +import java.util.ArrayList;
> >> +import java.io.InputStream;
> >> +import java.io.OutputStream;
> >> +import java.io.StringWriter;
> >> +import java.io.Writer;
> >> +
> >> +import javax.xml.namespace.QName;
> >> +
> >> +import junit.framework.TestCase;
> >> +import org.apache.xmlbeans.XmlObject;
> >> +import org.apache.xmlbeans.XmlCursor;
> >> +import org.apache.geronimo.schema.SchemaConversionUtils;
> >> +
> >> +/**
> >> + * @version $Rev:$ $Date:$
> >> + */
> >> +public class Upgrade1_0To1_1Test extends TestCase {
> >> +
> >> +    private final ClassLoader classLoader = this.getClass
> >> ().getClassLoader();
> >> +
> >> +    public void test1() throws Exception {
> >> +//        InputStream srcXml = classLoader.getResourceAsStream
> >> ("jms-plan.xml");
> >> +        InputStream srcXml = classLoader.getResourceAsStream
> >> ("appclient_ejb_1.xml");
> >> +        Writer targetXml = new StringWriter();
> >> +        Upgrade1_0To1_1.upgrade(srcXml, targetXml);
> >> +
> >> +        String targetString = targetXml.toString();
> >> +        System.out.println(targetString);
> >> +        XmlObject targetXmlObject = XmlObject.Factory.parse
> >> (targetString);
> >> +        //uncomment fail to see output
> >> +//        fail();
> >> +//        URL expectedOutputXml = classLoader.getResource
> >> ("appclient_dep_ejblink_single.ear.xml");
> >> +//        XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
> >> +//        XmlObject expected = XmlObject.Factory.parse
> >> (expectedOutputXml);
> >> +//        SchemaConversionUtils.validateDD(expected);
> >> +//        xmlObject =
> >> SchemaConversionUtils.convertToApplicationClientSchema(xmlObject);
> >> +//        System.out.println(xmlObject.toString());
> >> +//        System.out.println(expected.toString());
> >> +//        List problems = new ArrayList();
> >> +//        boolean ok = compareXmlObjects(xmlObject, expected,
> >> problems);
> >> +//        assertTrue("Differences: " + problems, ok);
> >> +    }
> >> +
> >> +    private boolean compareXmlObjects(XmlObject xmlObject,
> >> XmlObject expectedObject, List problems) {
> >> +        XmlCursor test = xmlObject.newCursor();
> >> +        XmlCursor expected = expectedObject.newCursor();
> >> +        boolean similar = true;
> >> +        int elementCount = 0;
> >> +        while (toNextStartToken(test)) {
> >> +            elementCount++;
> >> +            if (!toNextStartToken(expected)) {
> >> +                problems.add("test longer than expected at
> >> element: " + elementCount);
> >> +                return false;
> >> +            }
> >> +            QName actualQName = test.getName();
> >> +            QName expectedQName = expected.getName();
> >> +            if (!actualQName.equals(expectedQName)) {
> >> +                problems.add("Different elements at elementCount:
> >> " + elementCount + ", test: " + actualQName + ", expected: " +
> >> expectedQName);
> >> +                similar = false;
> >> +            }
> >> +            test.toNextToken();
> >> +            expected.toNextToken();
> >> +        }
> >> +        if (toNextStartToken(expected)) {
> >> +            problems.add("test shorter that expected at element:
> >> " + elementCount);
> >> +            similar = false;
> >> +        }
> >> +        return similar;
> >> +    }
> >> +
> >> +    private boolean toNextStartToken(XmlCursor cursor) {
> >> +        while (!cursor.isStart()) {
> >> +            if (!cursor.hasNextToken()) {
> >> +                return false;
> >> +            }
> >> +            cursor.toNextToken();
> >> +        }
> >> +        return true;
> >> +    }
> >> +
> >> +}
> >>
> >>
> >>
>
>

Re: svn commit: r389823 - in /geronimo/branches/1.1/modules/upgrade: ./ src/ src/java/ src/java/org/ src/java/org/apache/ src/java/org/apache/geronimo/ src/java/org/apache/geronimo/upgrade/ src/test-data/ src/test/ src/test/org/ src/test/org/apache/

Posted by Kevan Miller <ke...@gmail.com>.
Hmmm. Good question. I would guess that David copied the LICENSE.txt  
from the util directory and didn't realize it wasn't the Apache  
license. Is it proper that util <only> contains the BouncyCastle  
license?
--kevan
On Mar 29, 2006, at 12:07 PM, Aaron Mulder wrote:

> Why is the BouncyCastle license used for this module?
>
> Thanks,
>     Aaron
>
> On 3/29/06, djencks@apache.org <dj...@apache.org> wrote:
>> Author: djencks
>> Date: Wed Mar 29 08:38:17 2006
>> New Revision: 389823
>>
>> URL: http://svn.apache.org/viewcvs?rev=389823&view=rev
>> Log:
>> Add the start of a converter utility, also has a loginmodulegbean  
>> change that should be ok but I'm not sure why I didn't commit it  
>> before.  revert if it causes problems.
>>
>> Added:
>>     geronimo/branches/1.1/modules/upgrade/
>>     geronimo/branches/1.1/modules/upgrade/LICENSE.txt
>>     geronimo/branches/1.1/modules/upgrade/NOTICE.txt
>>     geronimo/branches/1.1/modules/upgrade/project.xml
>>     geronimo/branches/1.1/modules/upgrade/src/
>>     geronimo/branches/1.1/modules/upgrade/src/java/
>>     geronimo/branches/1.1/modules/upgrade/src/java/org/
>>     geronimo/branches/1.1/modules/upgrade/src/java/org/apache/
>>     geronimo/branches/1.1/modules/upgrade/src/java/org/apache/ 
>> geronimo/
>>     geronimo/branches/1.1/modules/upgrade/src/java/org/apache/ 
>> geronimo/upgrade/
>>     geronimo/branches/1.1/modules/upgrade/src/java/org/apache/ 
>> geronimo/upgrade/Upgrade1_0To1_1.java
>>     geronimo/branches/1.1/modules/upgrade/src/test/
>>     geronimo/branches/1.1/modules/upgrade/src/test-data/
>>     geronimo/branches/1.1/modules/upgrade/src/test-data/ 
>> appclient_ejb_1.xml
>>     geronimo/branches/1.1/modules/upgrade/src/test/org/
>>     geronimo/branches/1.1/modules/upgrade/src/test/org/apache/
>>     geronimo/branches/1.1/modules/upgrade/src/test/org/apache/ 
>> geronimo/
>>     geronimo/branches/1.1/modules/upgrade/src/test/org/apache/ 
>> geronimo/upgrade/
>>     geronimo/branches/1.1/modules/upgrade/src/test/org/apache/ 
>> geronimo/upgrade/Upgrade1_0To1_1Test.java
>>
>> Added: geronimo/branches/1.1/modules/upgrade/LICENSE.txt
>> URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/ 
>> upgrade/LICENSE.txt?rev=389823&view=auto
>> ===================================================================== 
>> =========
>> --- geronimo/branches/1.1/modules/upgrade/LICENSE.txt (added)
>> +++ geronimo/branches/1.1/modules/upgrade/LICENSE.txt Wed Mar 29  
>> 08:38:17 2006
>> @@ -0,0 +1,20 @@
>> +The Bouncy Castle License
>> +
>> +Copyright (c) 2000-2005 The Legion Of The Bouncy Castle (http:// 
>> www.bouncycastle.org)
>> +
>> +Permission is hereby granted, free of charge, to any person  
>> obtaining a copy of this software
>> +and associated documentation files (the "Software"), to deal in  
>> the Software without restriction,
>> +including without limitation the rights to use, copy, modify,  
>> merge, publish, distribute, sublicense,
>> +and/or sell copies of the Software, and to permit persons to whom  
>> the Software is furnished to do so,
>> +subject to the following conditions:
>> +
>> +The above copyright notice and this permission notice shall be  
>> included in all copies or substantial
>> +portions of the Software.
>> +
>> +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,  
>> EXPRESS OR IMPLIED,
>> +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  
>> FITNESS FOR A PARTICULAR
>> +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR  
>> COPYRIGHT HOLDERS BE
>> +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN  
>> ACTION OF CONTRACT, TORT OR
>> +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE  
>> SOFTWARE OR THE USE OR OTHER
>> +DEALINGS IN THE SOFTWARE.
>> +
>>
>> Added: geronimo/branches/1.1/modules/upgrade/NOTICE.txt
>> URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/ 
>> upgrade/NOTICE.txt?rev=389823&view=auto
>> ===================================================================== 
>> =========
>> --- geronimo/branches/1.1/modules/upgrade/NOTICE.txt (added)
>> +++ geronimo/branches/1.1/modules/upgrade/NOTICE.txt Wed Mar 29  
>> 08:38:17 2006
>> @@ -0,0 +1,3 @@
>> +This product includes software developed by
>> +The Apache Software Foundation (http://www.apache.org/).
>> +
>>
>> Added: geronimo/branches/1.1/modules/upgrade/project.xml
>> URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/ 
>> upgrade/project.xml?rev=389823&view=auto
>> ===================================================================== 
>> =========
>> --- geronimo/branches/1.1/modules/upgrade/project.xml (added)
>> +++ geronimo/branches/1.1/modules/upgrade/project.xml Wed Mar 29  
>> 08:38:17 2006
>> @@ -0,0 +1,158 @@
>> +<?xml version="1.0" encoding="ISO-8859-1"?>
>> +<!--
>> +
>> +    Copyright 2003-2004 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.
>> +-->
>> +
>> +<!-- $Rev: 355877 $ $Date: 2005-12-10 18:48:27 -0800 (Sat, 10 Dec  
>> 2005) $ -->
>> +
>> +<project>
>> +    <pomVersion>3</pomVersion>
>> +    <extend>../../etc/project.xml</extend>
>> +
>> +    <!-- ===================== -->
>> +    <!-- Module Identification -->
>> +    <!-- ===================== -->
>> +
>> +    <name>Geronimo :: Upgrade</name>
>> +    <id>geronimo-upgrade</id>
>> +    <shortDescription>Geronimo Upgrade</shortDescription>
>> +    <description>Geronimo Upgrade</description>
>> +    <url>http://incubator.apache.org/projects/geronimo/kernel/</url>
>> +    <siteDirectory>/www/incubator.apache.org/projects/geronimo/ 
>> kernel</siteDirectory>
>> +    <distributionDirectory>/www/incubator.apache.org/projects/ 
>> geronimo/builds/kernel</distributionDirectory>
>> +
>> +    <package>org.apache.geronimo.ugrade</package>
>> +
>> +    <!-- ============ -->
>> +    <!-- Dependencies -->
>> +    <!-- ============ -->
>> +
>> +    <dependencies>
>> +        <!-- Module Dependencies -->
>> +        <dependency>
>> +            <groupId>geronimo</groupId>
>> +            <artifactId>geronimo-client-builder</artifactId>
>> +            <version>${geronimo_version}</version>
>> +        </dependency>
>> +
>> +        <dependency>
>> +            <groupId>geronimo</groupId>
>> +            <artifactId>geronimo-connector-builder</artifactId>
>> +            <version>${geronimo_version}</version>
>> +        </dependency>
>> +
>> +        <dependency>
>> +            <groupId>geronimo</groupId>
>> +            <artifactId>geronimo-j2ee-builder</artifactId>
>> +            <version>${geronimo_version}</version>
>> +        </dependency>
>> +
>> +        <dependency>
>> +            <groupId>geronimo</groupId>
>> +            <artifactId>geronimo-jetty-builder</artifactId>
>> +            <version>${geronimo_version}</version>
>> +        </dependency>
>> +
>> +        <dependency>
>> +            <groupId>geronimo</groupId>
>> +            <artifactId>geronimo-naming-builder</artifactId>
>> +            <version>${geronimo_version}</version>
>> +        </dependency>
>> +
>> +        <dependency>
>> +            <groupId>geronimo</groupId>
>> +            <artifactId>geronimo-security-builder</artifactId>
>> +            <version>${geronimo_version}</version>
>> +        </dependency>
>> +
>> +        <dependency>
>> +            <groupId>geronimo</groupId>
>> +            <artifactId>geronimo-service-builder</artifactId>
>> +            <version>${geronimo_version}</version>
>> +        </dependency>
>> +
>> +        <dependency>
>> +            <groupId>geronimo</groupId>
>> +            <artifactId>geronimo-tomcat-builder</artifactId>
>> +            <version>${geronimo_version}</version>
>> +        </dependency>
>> +
>> +        <dependency>
>> +            <groupId>geronimo</groupId>
>> +            <artifactId>geronimo-web-builder</artifactId>
>> +            <version>${geronimo_version}</version>
>> +        </dependency>
>> +
>> +        <dependency>
>> +            <groupId>openejb</groupId>
>> +            <artifactId>openejb-builder</artifactId>
>> +            <version>${openejb_version}</version>
>> +        </dependency>
>> +
>> +        <dependency>
>> +            <groupId>xmlbeans</groupId>
>> +            <artifactId>xbean</artifactId>
>> +            <version>${xmlbeans_version}</version>
>> +        </dependency>
>> +
>> +        <dependency>
>> +            <groupId>stax</groupId>
>> +            <artifactId>stax-api</artifactId>
>> +            <version>${stax_api_version}</version>
>> +        </dependency>
>> +
>> +        <dependency>
>> +            <groupId>geronimo</groupId>
>> +            <artifactId>geronimo-j2ee-schema</artifactId>
>> +            <version>${pom.currentVersion}</version>
>> +            <properties>
>> +                <xmlbeans>true</xmlbeans>
>> +            </properties>
>> +        </dependency>
>> +        <dependency>
>> +            <groupId>geronimo</groupId>
>> +            <artifactId>geronimo-kernel</artifactId>
>> +            <version>${pom.currentVersion}</version>
>> +        </dependency>
>> +
>> +    </dependencies>
>> +
>> +    <build>
>> +        <resources>
>> +            <resource>
>> +                <directory>${basedir}/src/java</directory>
>> +                <includes>
>> +                    <include>**/*.xml</include>
>> +                    <include>**/*.properties</include>
>> +                </includes>
>> +            </resource>
>> +        </resources>
>> +        <unitTest>
>> +            <includes>
>> +                <include>**/*Test.java</include>
>> +            </includes>
>> +            <excludes>
>> +                <exclude>**/Abstract*.java</exclude>
>> +            </excludes>
>> +            <resources>
>> +                <resource>
>> +                    <directory>${basedir}/src/test-data</directory>
>> +                </resource>
>> +            </resources>
>> +        </unitTest>
>> +    </build>
>> +
>> +</project>
>>
>> Added: geronimo/branches/1.1/modules/upgrade/src/java/org/apache/ 
>> geronimo/upgrade/Upgrade1_0To1_1.java
>> URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/ 
>> upgrade/src/java/org/apache/geronimo/upgrade/Upgrade1_0To1_1.java? 
>> rev=389823&view=auto
>> ===================================================================== 
>> =========
>> --- geronimo/branches/1.1/modules/upgrade/src/java/org/apache/ 
>> geronimo/upgrade/Upgrade1_0To1_1.java (added)
>> +++ geronimo/branches/1.1/modules/upgrade/src/java/org/apache/ 
>> geronimo/upgrade/Upgrade1_0To1_1.java Wed Mar 29 08:38:17 2006
>> @@ -0,0 +1,167 @@
>> +/**
>> + *
>> + * Copyright 2006 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.upgrade;
>> +
>> +import java.io.InputStream;
>> +import java.io.IOException;
>> +import java.io.Writer;
>> +import java.util.Map;
>> +import java.util.HashMap;
>> +import java.util.ArrayList;
>> +import java.util.Collection;
>> +
>> +import javax.xml.namespace.QName;
>> +
>> +import org.apache.xmlbeans.XmlObject;
>> +import org.apache.xmlbeans.XmlException;
>> +import org.apache.xmlbeans.XmlOptions;
>> +import org.apache.xmlbeans.XmlCursor;
>> +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.deployment.xbeans.EnvironmentType;
>> +import org.apache.geronimo.deployment.service.EnvironmentBuilder;
>> +
>> +/**
>> + * @version $Rev:$ $Date:$
>> + */
>> +public class Upgrade1_0To1_1 {
>> +
>> +    private static final Map NAMESPACE_UPDATES = new HashMap();
>> +
>> +    static {
>> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/ 
>> j2ee/application-client", "http://geronimo.apache.org/xml/ns/j2ee/ 
>> application-client-1.1");
>> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/ 
>> j2ee/application-client-1.0", "http://geronimo.apache.org/xml/ns/ 
>> j2ee/application-client-1.1");
>> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/ 
>> j2ee/application", "http://geronimo.apache.org/xml/ns/j2ee/ 
>> application-1.1");
>> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/ 
>> j2ee/application-1.0", "http://geronimo.apache.org/xml/ns/j2ee/ 
>> application-1.1");
>> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/ 
>> deployment", "http://geronimo.apache.org/xml/ns/deployment-1.1");
>> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/ 
>> deployment-1.0", "http://geronimo.apache.org/xml/ns/deployment-1.1");
>> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/ 
>> j2ee/connector", "http://geronimo.apache.org/xml/ns/j2ee/ 
>> connector-1.1");
>> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/ 
>> deployment/javabean", "http://geronimo.apache.org/xml/ns/ 
>> deployment/javabean-1.0");
>> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/ 
>> loginconfig", "http://geronimo.apache.org/xml/ns/loginconfig-1.0");
>> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/ 
>> loginconfig-1.0", "http://geronimo.apache.org/xml/ns/ 
>> loginconfig-1.0");
>> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/ 
>> naming", "http://geronimo.apache.org/xml/ns/naming-1.1");
>> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/ 
>> naming-1.0", "http://geronimo.apache.org/xml/ns/naming-1.1");
>> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/ 
>> security", "http://geronimo.apache.org/xml/ns/security-1.1");
>> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/ 
>> security-1.0", "http://geronimo.apache.org/xml/ns/security-1.1");
>> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/ 
>> web", "http://geronimo.apache.org/xml/ns/j2ee/web-1.1");
>> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/ 
>> web-1.0", "http://geronimo.apache.org/xml/ns/j2ee/web-1.1");
>> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/ 
>> web/jetty", "http://geronimo.apache.org/xml/ns/j2ee/web/jetty-1.1");
>> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/ 
>> web/jetty-1.0", "http://geronimo.apache.org/xml/ns/j2ee/web/ 
>> jetty-1.1");
>> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/ 
>> web/jetty/config", "http://geronimo.apache.org/xml/ns/j2ee/web/ 
>> jetty/config-1.0");
>> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/ 
>> web/tomcat", "http://geronimo.apache.org/xml/ns/j2ee/web/ 
>> tomcat-1.1");
>> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/ 
>> web/tomcat-1.0", "http://geronimo.apache.org/xml/ns/j2ee/web/ 
>> tomcat-1.1");
>> +        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/ 
>> web/tomcat/config", "http://geronimo.apache.org/xml/ns/j2ee/web/ 
>> tomcat/config-1.0");
>> +        NAMESPACE_UPDATES.put("http://www.openejb.org/xml/ns/ 
>> openejb-jar", "http://www.openejb.org/xml/ns/openejb-jar-2.1");
>> +        NAMESPACE_UPDATES.put("http://www.openejb.org/xml/ns/ 
>> openejb-jar-2.0", "http://www.openejb.org/xml/ns/openejb-jar-2.1");
>> +        NAMESPACE_UPDATES.put("http://www.openejb.org/xml/ns/ 
>> pkgen", "http://www.openejb.org/xml/ns/pkgen-2.0");
>> +        NAMESPACE_UPDATES.put("http://www.openejb.org/xml/ns/ 
>> corba-css-config_1_0", "http://www.openejb.org/xml/ns/corba-css- 
>> config-2.0");
>> +        NAMESPACE_UPDATES.put("http://www.openejb.org/xml/ns/ 
>> corba-tss-config_1_0", "http://www.openejb.org/xml/ns/corba-tss- 
>> config-2.0");
>> +    }
>> +
>> +    private static final QName ENVIRONMENT_QNAME = new QName 
>> ("http://geronimo.apache.org/xml/ns/deployment-1.1", "environment");
>> +    private static final String DEFAULT_GROUPID = "default";
>> +    private static final String DEFAULT_VERSION = "1-default";
>> +    private static final QName CLIENT_ENVIRONMENT_QNAME = new  
>> QName("http://geronimo.apache.org/xml/ns/deployment-1.1", "client- 
>> environment");
>> +    private static final QName PARENT_ENVIRONMENT_QNAME = new  
>> QName("http://geronimo.apache.org/xml/ns/deployment-1.1", "parent- 
>> environment");
>> +
>> +    public static void upgrade(InputStream source, Writer target)  
>> throws IOException, XmlException {
>> +        XmlObject xmlObject = parse(source);
>> +        XmlCursor cursor = xmlObject.newCursor();
>> +        XmlCursor.TokenType token;
>> +        while ((token = cursor.toNextToken()) !=  
>> XmlCursor.TokenType.ENDDOC) {
>> +            if (token == XmlCursor.TokenType.START) {
>> +                Artifact configId = extractArtifact("configId",  
>> cursor);
>> +                Artifact parentId = extractArtifact("parentId",  
>> cursor);
>> +                Artifact clientConfigId = extractArtifact 
>> ("clientConfigId", cursor);
>> +                Artifact clientParentId = extractArtifact 
>> ("clientParentId", cursor);
>> +                if (clientConfigId != null) {
>> +
>> +                    insertEnvironment(clientConfigId,  
>> clientParentId, cursor, CLIENT_ENVIRONMENT_QNAME);
>> +
>> +                    insertEnvironment(configId, parentId, cursor,  
>> PARENT_ENVIRONMENT_QNAME);
>> +
>> +                } else if (configId != null) {
>> +
>> +                    insertEnvironment(configId, parentId, cursor,  
>> ENVIRONMENT_QNAME);
>> +                }
>> +            }
>> +        }
>> +
>> +        XmlOptions xmlOptions = new XmlOptions();
>> +        xmlOptions.setSavePrettyPrint();
>> +        xmlObject.save(target, xmlOptions);
>> +
>> +    }
>> +
>> +    private static void insertEnvironment(Artifact configId,  
>> Artifact parentId, XmlCursor cursor, QName environmentQname) {
>> +        positionEnvironment(cursor);
>> +        Environment environment = new Environment();
>> +        environment.setConfigId(configId);
>> +        if (parentId != null ) {
>> +            environment.addDependency(parentId, ImportType.ALL);
>> +        }
>> +        EnvironmentType environmentType =  
>> EnvironmentBuilder.buildEnvironmentType(environment);
>> +        cursor.beginElement(environmentQname);
>> +        XmlCursor element = environmentType.newCursor();
>> +        try {
>> +            element.copyXmlContents(cursor);
>> +        } finally {
>> +            element.dispose();
>> +        }
>> +    }
>> +
>> +    private static void positionEnvironment(XmlCursor cursor) {
>> +        XmlCursor.TokenType token;
>> +        while ((token = cursor.toNextToken()) !=  
>> XmlCursor.TokenType.START && token != XmlCursor.TokenType.END) {
>> +            //keep going
>> +        }
>> +    }
>> +
>> +    private static Artifact extractArtifact(String attrName,  
>> XmlCursor cursor) {
>> +        String attrValue;
>> +        QName attrQName = new QName(null, attrName);
>> +        if ((attrValue = cursor.getAttributeText(attrQName)) !=  
>> null) {
>> +            cursor.removeAttribute(attrQName);
>> +            try {
>> +                return Artifact.create(attrValue);
>> +            } catch (Exception e) {
>> +                return new Artifact(DEFAULT_GROUPID,  
>> attrValue.replace('/', '_'), DEFAULT_VERSION, "car");
>> +            }
>> +        }
>> +        return null;
>> +    }
>> +
>> +    public static XmlObject parse(InputStream is) throws  
>> IOException, XmlException {
>> +        ArrayList errors = new ArrayList();
>> +        XmlObject parsed = XmlObject.Factory.parse(is,  
>> createXmlOptions(errors));
>> +        if (errors.size() != 0) {
>> +            throw new XmlException(errors.toArray().toString());
>> +        }
>> +        return parsed;
>> +    }
>> +
>> +    public static XmlOptions createXmlOptions(Collection errors) {
>> +        XmlOptions options = new XmlOptions();
>> +        options.setLoadLineNumbers();
>> +        options.setErrorListener(errors);
>> +        options.setLoadSubstituteNamespaces(NAMESPACE_UPDATES);
>> +        return options;
>> +    }
>> +
>> +}
>>
>> Added: geronimo/branches/1.1/modules/upgrade/src/test-data/ 
>> appclient_ejb_1.xml
>> URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/ 
>> upgrade/src/test-data/appclient_ejb_1.xml?rev=389823&view=auto
>> ===================================================================== 
>> =========
>> --- geronimo/branches/1.1/modules/upgrade/src/test-data/ 
>> appclient_ejb_1.xml (added)
>> +++ geronimo/branches/1.1/modules/upgrade/src/test-data/ 
>> appclient_ejb_1.xml Wed Mar 29 08:38:17 2006
>> @@ -0,0 +1,41 @@
>> +<?xml version="1.0" encoding="UTF-8"?>
>> +<application
>> +    xmlns="http://geronimo.apache.org/xml/ns/j2ee/application"
>> +    configId="appclient_ejb_1"
>> +    parentId="${pom.groupId}/server-security/$ 
>> {pom.currentVersion}/car">
>> +    <module>
>> +        <ejb>appclient_ejb_1_ejb.jar</ejb>
>> +        <openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb- 
>> jar" configId="ejb">
>> +            <cmp-connection-factory>
>> +                <resource-link>jdbc/DB1</resource-link>
>> +            </cmp-connection-factory>
>> +            <enterprise-beans>
>> +                <entity>
>> +                    <ejb-name>CMP20</ejb-name>
>> +                    <table-name>CMP20_APPCLIENT_TABLE1</table-name>
>> +                    <cmp-field-mapping>
>> +                        <cmp-field-name>id</cmp-field-name>
>> +                        <table-column>ID</table-column>
>> +                    </cmp-field-mapping>
>> +                </entity>
>> +                <entity>
>> +                    <ejb-name>CMP11</ejb-name>
>> +                    <table-name>CMP20_APPCLIENT_TABLE2</table-name>
>> +                    <cmp-field-mapping>
>> +                        <cmp-field-name>KEY_ID</cmp-field-name>
>> +                        <table-column>ID</table-column>
>> +                    </cmp-field-mapping>
>> +                </entity>
>> +            </enterprise-beans>
>> +        </openejb-jar>
>> +    </module>
>> +    <module>
>> +        <java>appclient_ejb_1_client.jar</java>
>> +        <application-client xmlns="http://geronimo.apache.org/xml/ 
>> ns/j2ee/application-client"
>> +            configId="bar"
>> +            clientConfigId="appclient_ejb_1/appclient_ejb_1_client"
>> +            clientParentId="${pom.groupId}/client-database/$ 
>> {pom.currentVersion}/car">
>> +
>> +        </application-client>
>> +    </module>
>> +</application>
>>
>> Added: geronimo/branches/1.1/modules/upgrade/src/test/org/apache/ 
>> geronimo/upgrade/Upgrade1_0To1_1Test.java
>> URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/ 
>> upgrade/src/test/org/apache/geronimo/upgrade/ 
>> Upgrade1_0To1_1Test.java?rev=389823&view=auto
>> ===================================================================== 
>> =========
>> --- geronimo/branches/1.1/modules/upgrade/src/test/org/apache/ 
>> geronimo/upgrade/Upgrade1_0To1_1Test.java (added)
>> +++ geronimo/branches/1.1/modules/upgrade/src/test/org/apache/ 
>> geronimo/upgrade/Upgrade1_0To1_1Test.java Wed Mar 29 08:38:17 2006
>> @@ -0,0 +1,103 @@
>> +/**
>> + *
>> + * Copyright 2006 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.upgrade;
>> +
>> +
>> +import java.net.URL;
>> +import java.util.List;
>> +import java.util.ArrayList;
>> +import java.io.InputStream;
>> +import java.io.OutputStream;
>> +import java.io.StringWriter;
>> +import java.io.Writer;
>> +
>> +import javax.xml.namespace.QName;
>> +
>> +import junit.framework.TestCase;
>> +import org.apache.xmlbeans.XmlObject;
>> +import org.apache.xmlbeans.XmlCursor;
>> +import org.apache.geronimo.schema.SchemaConversionUtils;
>> +
>> +/**
>> + * @version $Rev:$ $Date:$
>> + */
>> +public class Upgrade1_0To1_1Test extends TestCase {
>> +
>> +    private final ClassLoader classLoader = this.getClass 
>> ().getClassLoader();
>> +
>> +    public void test1() throws Exception {
>> +//        InputStream srcXml = classLoader.getResourceAsStream 
>> ("jms-plan.xml");
>> +        InputStream srcXml = classLoader.getResourceAsStream 
>> ("appclient_ejb_1.xml");
>> +        Writer targetXml = new StringWriter();
>> +        Upgrade1_0To1_1.upgrade(srcXml, targetXml);
>> +
>> +        String targetString = targetXml.toString();
>> +        System.out.println(targetString);
>> +        XmlObject targetXmlObject = XmlObject.Factory.parse 
>> (targetString);
>> +        //uncomment fail to see output
>> +//        fail();
>> +//        URL expectedOutputXml = classLoader.getResource 
>> ("appclient_dep_ejblink_single.ear.xml");
>> +//        XmlObject xmlObject = XmlObject.Factory.parse(srcXml);
>> +//        XmlObject expected = XmlObject.Factory.parse 
>> (expectedOutputXml);
>> +//        SchemaConversionUtils.validateDD(expected);
>> +//        xmlObject =  
>> SchemaConversionUtils.convertToApplicationClientSchema(xmlObject);
>> +//        System.out.println(xmlObject.toString());
>> +//        System.out.println(expected.toString());
>> +//        List problems = new ArrayList();
>> +//        boolean ok = compareXmlObjects(xmlObject, expected,  
>> problems);
>> +//        assertTrue("Differences: " + problems, ok);
>> +    }
>> +
>> +    private boolean compareXmlObjects(XmlObject xmlObject,  
>> XmlObject expectedObject, List problems) {
>> +        XmlCursor test = xmlObject.newCursor();
>> +        XmlCursor expected = expectedObject.newCursor();
>> +        boolean similar = true;
>> +        int elementCount = 0;
>> +        while (toNextStartToken(test)) {
>> +            elementCount++;
>> +            if (!toNextStartToken(expected)) {
>> +                problems.add("test longer than expected at  
>> element: " + elementCount);
>> +                return false;
>> +            }
>> +            QName actualQName = test.getName();
>> +            QName expectedQName = expected.getName();
>> +            if (!actualQName.equals(expectedQName)) {
>> +                problems.add("Different elements at elementCount:  
>> " + elementCount + ", test: " + actualQName + ", expected: " +  
>> expectedQName);
>> +                similar = false;
>> +            }
>> +            test.toNextToken();
>> +            expected.toNextToken();
>> +        }
>> +        if (toNextStartToken(expected)) {
>> +            problems.add("test shorter that expected at element:  
>> " + elementCount);
>> +            similar = false;
>> +        }
>> +        return similar;
>> +    }
>> +
>> +    private boolean toNextStartToken(XmlCursor cursor) {
>> +        while (!cursor.isStart()) {
>> +            if (!cursor.hasNextToken()) {
>> +                return false;
>> +            }
>> +            cursor.toNextToken();
>> +        }
>> +        return true;
>> +    }
>> +
>> +}
>>
>>
>>