You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by li...@apache.org on 2007/10/08 20:48:39 UTC
svn commit: r582929 [1/3] - in
/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors:
./ META-INF/ schema/ src/ src/org/ src/org/apache/ src/org/apache/geronimo/
src/org/apache/geronimo/devtools/ src/org/apache/geronimo/devt...
Author: linsun
Date: Mon Oct 8 11:48:35 2007
New Revision: 582929
URL: http://svn.apache.org/viewvc?rev=582929&view=rev
Log:
update the descriptors plugin for GERONIMODEVTOOLS-221
Added:
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/.classpath (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/.project (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/META-INF/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/META-INF/MANIFEST.MF
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/build.properties (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/plugin.xml (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/pom.xml (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/schema/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/schema/tool.migrations.exsd
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/commons-logging.properties (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/DescriptorsTool.java (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/app/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/app/ApplicationDescriptorTool.java (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/CMPDescriptorTool.java (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/CMPEntityBeanMigrator.java (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/EJBJarXmlProcessor.java (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/dto/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/dto/EJBRelation.java (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/dto/EJBRelationshipRole.java (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/dto/Relationships.java (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/ejb/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/ejb/EJBDescriptorTool.java (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/ejb/annotation/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/ejb/annotation/AnnotationConverter.java (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/ejb/annotation/AnnotationInstance.java (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/ejb/annotation/AnnotationTool.java (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/ejb/bean/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/ejb/bean/BeanMigrator.java (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/ejb/bean/EntityBeanMigrator.java (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/ejb/bean/JNDIBeanMigrator.java (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/ejb/bean/MessageDrivenBeanMigrator.java (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/ejb/bean/SessionBeanMigrator.java (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/web/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/web/WebDescriptorTool.java (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test-resources/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test-resources/ejb-jar.xml (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test-resources/geronimo-application.xml (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test-resources/geronimo-web.xml (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test-resources/jboss-app.xml (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test-resources/jboss.xml (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test-resources/jbosscmp-jdbc.xml (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test-resources/openejb-jar.xml (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test/org/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test/org/apache/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test/org/apache/geronimo/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test/org/apache/geronimo/devtools/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test/org/apache/geronimo/devtools/j2g/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test/org/apache/geronimo/devtools/j2g/descriptors/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test/org/apache/geronimo/devtools/j2g/descriptors/app/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test/org/apache/geronimo/devtools/j2g/descriptors/app/test/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test/org/apache/geronimo/devtools/j2g/descriptors/app/test/TestApplicationDescriptorTool.java (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test/org/apache/geronimo/devtools/j2g/descriptors/cmp/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test/org/apache/geronimo/devtools/j2g/descriptors/cmp/test/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test/org/apache/geronimo/devtools/j2g/descriptors/cmp/test/TestCMPDescriptorsTool.java (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test/org/apache/geronimo/devtools/j2g/descriptors/cmp/test/TestEJBjarXmlProcessor.java (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test/org/apache/geronimo/devtools/j2g/descriptors/ejb/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test/org/apache/geronimo/devtools/j2g/descriptors/ejb/test/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test/org/apache/geronimo/devtools/j2g/descriptors/ejb/test/TestEJBDescriptorTool.java (with props)
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test/org/apache/geronimo/devtools/j2g/descriptors/web/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test/org/apache/geronimo/devtools/j2g/descriptors/web/test/
geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/test/org/apache/geronimo/devtools/j2g/descriptors/web/test/TestWebDescriptorTool.java (with props)
Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/.classpath
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/.classpath?rev=582929&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/.classpath (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/.classpath Mon Oct 8 11:48:35 2007
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="test"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="src" path="/org.apache.geronimo.devtools.j2g.common"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/.classpath
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/.project
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/.project?rev=582929&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/.project (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/.project Mon Oct 8 11:48:35 2007
@@ -0,0 +1,22 @@
+<projectDescription>
+ <name>org.apache.geronimo.devtools.j2g.descriptors</name>
+ <comment>JBoss to Geronimo Conversion Tool</comment>
+ <projects>
+ <project>org.apache.geronimo.devtools.j2g.common</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
\ No newline at end of file
Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/.project
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/META-INF/MANIFEST.MF?rev=582929&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/META-INF/MANIFEST.MF (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/META-INF/MANIFEST.MF Mon Oct 8 11:48:35 2007
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: J2G Descriptor Migration Tool Plug-in
+Bundle-SymbolicName: org.apache.geronimo.devtools.j2g.descriptors;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Vendor: Apache.org
+Bundle-Localization: plugin
+Require-Bundle: org.apache.geronimo.devtools.j2g.common,
+ org.apache.geronimo.devtools.j2g.util,
+ org.eclipse.core.runtime,
+ org.eclipse.jdt.core
+Bundle-ClassPath: .
Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/build.properties
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/build.properties?rev=582929&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/build.properties (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/build.properties Mon Oct 8 11:48:35 2007
@@ -0,0 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+ source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/plugin.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/plugin.xml?rev=582929&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/plugin.xml (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/plugin.xml Mon Oct 8 11:48:35 2007
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You 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.
+ -->
+<plugin>
+ <extension-point id="migrations" name="Descriptors Migrations Extension Point" schema="schema/tool.migrations.exsd"/>
+ <extension
+ id="tool"
+ name="Descriptors Migration Tool"
+ point="org.eclipse.core.runtime.applications">
+ <application>
+ <run class="org.apache.geronimo.devtools.j2g.descriptors.DescriptorsTool"/>
+ </application>
+ </extension>
+ <extension
+ point="org.apache.geronimo.devtools.j2g.descriptors.migrations">
+ <migration
+ class="org.apache.geronimo.devtools.j2g.descriptors.app.ApplicationDescriptorTool">
+ </migration>
+ </extension>
+ <extension
+ point="org.apache.geronimo.devtools.j2g.descriptors.migrations">
+ <migration
+ class="org.apache.geronimo.devtools.j2g.descriptors.comp.CMPDescriptorTool">
+ </migration>
+ </extension>
+ <extension
+ point="org.apache.geronimo.devtools.j2g.descriptors.migrations">
+ <migration
+ class="org.apache.geronimo.devtools.j2g.descriptors.ejb.EJBDescriptorTool">
+ </migration>
+ </extension>
+ <extension
+ point="org.apache.geronimo.devtools.j2g.descriptors.migrations">
+ <migration
+ class="org.apache.geronimo.devtools.j2g.descriptors.web.WebDescriptorTool">
+ </migration>
+ </extension>
+ <extension
+ point="org.apache.geronimo.devtools.j2g.descriptors.migrations">
+ <migration
+ class="org.apache.geronimo.devtools.j2g.descriptors.ejb.annotation.AnnotationTool">
+ </migration>
+ </extension>
+</plugin>
Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/plugin.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/pom.xml?rev=582929&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/pom.xml (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/pom.xml Mon Oct 8 11:48:35 2007
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You 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: 561821 $ $Date: 2007-08-01 11:05:12 -0400 (Wed, 01 Aug 2007) $ -->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.geronimo.devtools.j2g</groupId>
+ <artifactId>plugins</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>org.apache.geronimo.devtools.j2g.descriptors</artifactId>
+ <packaging>jar</packaging>
+ <name>${artifactId}</name>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>../../src/main/resources/properties/org.apache.geronimo.devtools.j2g.descriptors.ejb</directory>
+ <targetPath>.</targetPath>
+ <includes>
+ <include>persistence_differences.properties</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>../../src/main/resources/properties/org.apache.geronimo.devtools.j2g.descriptors.ejb.annotation</directory>
+ <targetPath>.</targetPath>
+ <includes>
+ <include>annotation_differences.properties</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>.</directory>
+ <includes>
+ <include>plugin.xml</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.geronimo.devtools</groupId>
+ <artifactId>maven-eclipsepde-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.devtools.j2g</groupId>
+ <artifactId>org.apache.geronimo.devtools.j2g.common</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.devtools.j2g</groupId>
+ <artifactId>org.apache.geronimo.devtools.j2g.util</artifactId>
+ <version>${version}</version>
+ </dependency>
+ </dependencies>
+</project>
Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/schema/tool.migrations.exsd
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/schema/tool.migrations.exsd?rev=582929&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/schema/tool.migrations.exsd (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/schema/tool.migrations.exsd Mon Oct 8 11:48:35 2007
@@ -0,0 +1,92 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.apache.geronimo.devtools.j2g.descriptors">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.apache.geronimo.devtools.j2g.descriptors" id="org.apache.geronimo.devtools.j2g.descriptors.tool.migrations" name="Descriptors Migrations Extension Point"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="migration"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="migration">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ Descriptor migration plug-in implementation class.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.apache.geronimo.devtools.j2g.common.IFileMigration"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 1.0.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ <pre>
+ <extension
+ point="org.apache.geronimo.devtools.j2g.descriptors.tool.migrations">
+ <migration class="org.apache.geronimo.devtools.j2g.descriptors.web.WebDescriptorFileMigration"/>
+ </extension>
+</pre>
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/commons-logging.properties
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/commons-logging.properties?rev=582929&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/commons-logging.properties (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/commons-logging.properties Mon Oct 8 11:48:35 2007
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+ # Set root logger level to DEBUG and its only appender to console.
+log4j.rootLogger=INFO
+
+#define loggers
+#pluging logger
+log4j.logger.com.ibm.j2g= DEBUG,console
+
+# console is set to be a ConsoleAppender.
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+
+# console uses PatternLayout.
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+#log4j.appender.console.layout.ConversionPattern=[%t] %-5p %l - %m%n
+log4j.appender.console.layout.ConversionPattern=[%t] %-5p - %m%n
\ No newline at end of file
Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/commons-logging.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/DescriptorsTool.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/DescriptorsTool.java?rev=582929&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/DescriptorsTool.java (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/DescriptorsTool.java Mon Oct 8 11:48:35 2007
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.devtools.j2g.descriptors;
+
+import org.apache.geronimo.devtools.j2g.common.XMLMigrationTool;
+
+/**
+ * Descriptors migration tool.
+ */
+public class DescriptorsTool extends XMLMigrationTool {
+
+ /** Plug-in id */
+ public final static String PLUGIN_ID = "org.apache.geronimo.devtools.j2g.descriptors";
+
+ /** Extension point id */
+ public final static String EXTENSION_POINT_ID = PLUGIN_ID
+ + ".migrations";
+
+ /**
+ * @see org.apache.geronimo.j2g.common.XMLMigrationTool#getExtensionPointId()
+ */
+ protected String getExtensionPointId() {
+ return EXTENSION_POINT_ID;
+ }
+
+ /**
+ * @see org.apache.geronimo.j2g.common.XMLMigrationTool#getPluginId()
+ */
+ protected String getPluginId() {
+ return PLUGIN_ID;
+ }
+
+ /**
+ * @see org.apache.geronimo.j2g.common.XMLMigrationTool#getToolName()
+ */
+ protected String getToolName() {
+ return "jdesc2g.cmd";
+ }
+
+}
Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/DescriptorsTool.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/app/ApplicationDescriptorTool.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/app/ApplicationDescriptorTool.java?rev=582929&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/app/ApplicationDescriptorTool.java (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/app/ApplicationDescriptorTool.java Mon Oct 8 11:48:35 2007
@@ -0,0 +1,151 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.devtools.j2g.descriptors.app;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.devtools.j2g.common.ConsoleOutput;
+import org.apache.geronimo.devtools.j2g.common.IFileMigration;
+import org.apache.geronimo.devtools.j2g.common.IOutput;
+import org.apache.geronimo.devtools.j2g.common.Tool;
+import org.apache.geronimo.devtools.j2g.util.descriptors.Constants;
+import org.apache.geronimo.devtools.j2g.util.descriptors.security.SecurityElementProcessor;
+import org.apache.geronimo.devtools.j2g.util.descriptors.xml.XMLConversionHelper;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.QName;
+
+public class ApplicationDescriptorTool implements IFileMigration {
+
+ private IOutput out;
+
+ private String directoryName;
+
+ private Log logger = LogFactory.getLog(ApplicationDescriptorTool.class);
+
+ private SecurityElementProcessor securityElementProcessor;
+
+ public ApplicationDescriptorTool() {
+ Tool currentTool = Tool.getCurrent();
+ if (currentTool != null) {
+ out = currentTool.getOutput();
+ } else {
+ out = new ConsoleOutput();
+ }
+ securityElementProcessor = new SecurityElementProcessor();
+ }
+
+ public boolean migrate(File file, File rootDirectory) {
+ boolean migrated = false;
+ directoryName = file.getParent();
+ String jbossFileName = file.getName();
+ logger.debug("Directory Name ==> " + directoryName + " jboss file Name ==> "
+ + jbossFileName);
+
+ if (jbossFileName.equals(Constants.JBOSS_JBOSS_APPLICATION_XML_FILE)) {
+ out.info(ApplicationDescriptorTool.class.getSimpleName(), "Converting Jboss-app.xml file in " + directoryName);
+ try {
+ // check whether the jbosscmp-jdbc.xml file is present and
+ // if so load it and process it.
+ Document jbossDocument = XMLConversionHelper.getDocument(file);
+ Document geronimoDocument = XMLConversionHelper.createNewGeronimoDocument(
+ Constants.APPLICATION_NAME_SPACE, "application");
+ migrate(jbossDocument.getRootElement(), geronimoDocument.getRootElement());
+ String geronimoOpenEjbJarFileName = directoryName + File.separator
+ + Constants.GERONIMO_APPLICATION_XML_FILE;
+ XMLConversionHelper.saveGeronimoDocument(geronimoOpenEjbJarFileName,
+ geronimoDocument);
+ migrated = true;
+ out.info(ApplicationDescriptorTool.class.getSimpleName(), "Successfully migrated the Jboss-app.xml file in "
+ + directoryName + ", with the error and warning messages as shown");
+ } catch (DocumentException e) {
+ out.error(ApplicationDescriptorTool.class.getSimpleName(), "Error occured while reading xml descriptor "
+ + file.getAbsolutePath()
+ + ". It is possible that the migrator cannot download the xml schema or that the xml file has incorrect wrong syntax. Nested exception:"
+ + e.getMessage());
+ } catch (IOException e) {
+ out.error(ApplicationDescriptorTool.class.getSimpleName(), "IO exception " + e.getMessage());
+ }
+ } else if (jbossFileName.equals(Constants.APPLICATION_XML_FILE)){
+ out.info(ApplicationDescriptorTool.class.getSimpleName(), "Converting application.xml file in " + directoryName);
+ out.info(ApplicationDescriptorTool.class.getSimpleName(), "Nothing to convert. No changes required for this file");
+ }
+ return migrated;
+ }
+
+ private void migrate(Element jbossRootElement, Element geronimoRootElement) {
+
+ Element jbossRootChildElement;
+ for (Iterator iter = jbossRootElement.elements().iterator(); iter.hasNext();) {
+ jbossRootChildElement = (Element) iter.next();
+ if (jbossRootChildElement.getName().equals("security-domain")) {
+ securityElementProcessor.setSecurityDomain(jbossRootChildElement.getText());
+ } else if (jbossRootChildElement.getName().equals("unauthenticated-principal")) {
+ // set the default principal in security element processor
+ securityElementProcessor.setDefaultPrincipal(jbossRootChildElement.getText());
+ } else if (jbossRootChildElement.getName().equals("security-role")) {
+ Element geronimoRoleMapping = securityElementProcessor
+ .getGeronimoSecurityRoleElement(geronimoRootElement);
+ securityElementProcessor.migrateSecurityRole(jbossRootChildElement,
+ geronimoRoleMapping);
+ } else {
+ out.warn(ApplicationDescriptorTool.class.getSimpleName(), "The Element '" + jbossRootChildElement.getName() + "' is not supported ",
+ XMLConversionHelper.getLineNumber(jbossRootChildElement),
+ XMLConversionHelper.getColumnNumber(jbossRootChildElement));
+ logger.debug("The Element '" + jbossRootChildElement.getName()
+ + "' is not supported ");
+ }
+ }
+ }
+
+ private void migrateModule(Element jbossModule, Element geronimoModule) {
+
+ Element jbossModuleChildElement;
+ for (Iterator iter = jbossModule.elements().iterator(); iter.hasNext();) {
+ jbossModuleChildElement = (Element) iter.next();
+ if (jbossModuleChildElement.getName().equals("service")) {
+ // TODO: figure out properly
+ // for the moment we add connector element to replace the
+ // service
+ String serviceName = jbossModuleChildElement.getText();
+ String firstPart = serviceName.substring(0, serviceName.lastIndexOf("."));
+ // add conector element
+ QName qname = new QName("connector", geronimoModule.getNamespace());
+ Element connectorElement = geronimoModule.addElement(qname);
+ connectorElement.setText(firstPart + ".rar");
+
+ // add alt-dd element
+ qname = new QName("alt-dd", geronimoModule.getNamespace());
+ Element altDDElement = geronimoModule.addElement(qname);
+ altDDElement.setText(firstPart + ".xml");
+ } else {
+ out.warn(ApplicationDescriptorTool.class.getSimpleName(), "The Element '" + jbossModuleChildElement.getName()
+ + "' is not supported ", XMLConversionHelper
+ .getLineNumber(jbossModuleChildElement), XMLConversionHelper
+ .getColumnNumber(jbossModuleChildElement));
+ logger.debug("The Element '" + jbossModuleChildElement.getName()
+ + "' is not supported ");
+ }
+ }
+ }
+}
Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/app/ApplicationDescriptorTool.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/CMPDescriptorTool.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/CMPDescriptorTool.java?rev=582929&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/CMPDescriptorTool.java (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/CMPDescriptorTool.java Mon Oct 8 11:48:35 2007
@@ -0,0 +1,453 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.devtools.j2g.descriptors.comp;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.devtools.j2g.common.ConsoleOutput;
+import org.apache.geronimo.devtools.j2g.common.IFileMigration;
+import org.apache.geronimo.devtools.j2g.common.IOutput;
+import org.apache.geronimo.devtools.j2g.common.Tool;
+import org.apache.geronimo.devtools.j2g.descriptors.comp.dto.EJBRelation;
+import org.apache.geronimo.devtools.j2g.descriptors.comp.dto.EJBRelationshipRole;
+import org.apache.geronimo.devtools.j2g.descriptors.comp.dto.Relationships;
+import org.apache.geronimo.devtools.j2g.util.descriptors.Constants;
+import org.apache.geronimo.devtools.j2g.util.descriptors.env.EnvirionmentElementProcessor;
+import org.apache.geronimo.devtools.j2g.util.descriptors.xml.XMLConversionHelper;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.QName;
+
+public class CMPDescriptorTool implements IFileMigration {
+
+ private IOutput out;
+
+ private Log logger = LogFactory.getLog(CMPDescriptorTool.class);
+
+ private EnvirionmentElementProcessor envirionmentElementProcessor;
+
+ private CMPEntityBeanMigrator cmpEntityBeanMigrator;
+
+ private String directoryName;
+
+ private Map ejbKeyColumnMapper;
+
+ public CMPDescriptorTool() {
+ Tool currentTool = Tool.getCurrent();
+ if (currentTool != null){
+ out = currentTool.getOutput();
+ } else {
+ out = new ConsoleOutput();
+ }
+ envirionmentElementProcessor = new EnvirionmentElementProcessor();
+ cmpEntityBeanMigrator = new CMPEntityBeanMigrator();
+ ejbKeyColumnMapper = new HashMap();
+ }
+
+ public boolean migrate(File file, File rootDirectory) {
+ boolean migrated = false;
+ directoryName = file.getParent();
+ String jbossFileName = file.getName();
+ logger.debug("Directory Name ==> " + directoryName + " jboss file Name ==> "
+ + jbossFileName);
+
+ if (jbossFileName.equals(Constants.JBOSS_JBOSS_CMP_JDBC_XML_FILE)) {
+ out.info(CMPDescriptorTool.class.getSimpleName(), "Converting file " + file.getAbsolutePath() + ".");
+ try {
+ // check whether the jbosscmp-jdbc.xml file is present and
+ // if so load it and process it.
+ String geronimoOpenEjbJarFileName = directoryName + File.separator
+ + Constants.GERONIMO_OPEN_EJB_XML_FILE;
+ File tempFile = new File(geronimoOpenEjbJarFileName);
+ if (tempFile.exists()) {
+ out.warn(CMPDescriptorTool.class.getSimpleName(), "Deleting the pre-existing openejb-jar.xml file");
+ tempFile.delete();
+ }
+ Document jbossDocument = XMLConversionHelper.getDocument(file);
+ Document geronimoDocument = XMLConversionHelper.getOpenEJBJarDocument(directoryName);
+ migrate(jbossDocument.getRootElement(), geronimoDocument.getRootElement());
+ XMLConversionHelper.saveOpenEJBDocument(geronimoOpenEjbJarFileName,
+ geronimoDocument);
+ migrated = true;
+ out.info(CMPDescriptorTool.class.getSimpleName(), "Successfully migrated the Jbosscmp-jdbc.xml file in "
+ + directoryName + ", with the error and warning messages as shown");
+ } catch (DocumentException e) {
+ out.error(CMPDescriptorTool.class.getSimpleName(), "Error occured while reading xml descriptor "
+ + file.getAbsolutePath()
+ + ". It is possible that the migrator cannot download the xml schema or the xml file has incorrect syntax. Nested exception:"
+ + e.getMessage());
+ } catch (IOException e) {
+ out.error(CMPDescriptorTool.class.getSimpleName(), "IO exception " + e.getMessage());
+ }
+ }
+ return migrated;
+ }
+
+ private void migrate(Element jbossRootElement, Element geronimoRootElement) {
+ Element jbossRootChildElement;
+ logger.debug("migrating the root elements");
+ for (Iterator iter = jbossRootElement.elements().iterator(); iter.hasNext();) {
+ jbossRootChildElement = (Element) iter.next();
+ if (jbossRootChildElement.getName().equals("defaults")) {
+ logger.debug("migrating the defaults");
+ migrateDefaults(jbossRootChildElement, geronimoRootElement);
+ } else if (jbossRootChildElement.getName().equals("enterprise-beans")) {
+ logger.debug("migrating the enterprise beans");
+ // process the enterprise bean element
+ // add enterprise beans element to geronimo
+ // this element is in the same name space as the root element
+ Element geronimoEnterpriseBean = XMLConversionHelper.getGeronimoElement(
+ geronimoRootElement, "//ejb:enterprise-beans", "enterprise-beans",
+ geronimoRootElement.getNamespace());
+ migrateEnterpriseBeans(jbossRootChildElement, geronimoEnterpriseBean);
+ } else if (jbossRootChildElement.getName().equals("relationships")) {
+ QName qname = new QName("relationships", geronimoRootElement.getNamespace());
+ Element geronimoReleationship = geronimoRootElement.addElement(qname);
+ migrateRelationships(jbossRootChildElement, geronimoReleationship);
+ } else {
+ out.warn(CMPDescriptorTool.class.getSimpleName(), "The Element '" + jbossRootChildElement.getName() + "' is not supported ",
+ XMLConversionHelper.getLineNumber(jbossRootChildElement),
+ XMLConversionHelper.getColumnNumber(jbossRootChildElement));
+ logger.debug("The Element '" + jbossRootChildElement.getName()
+ + "' is not supported ");
+ }
+ }
+ }
+
+ private void migrateRelationships(Element jbossRelationships, Element geronimoRelationships) {
+
+ Element jbossRelationshipsChildElement;
+ String fileName = directoryName + File.separator + Constants.EJB_JAR_XML_FILE;
+ EJBJarXmlProcessor ejbJarXmlProcessor = new EJBJarXmlProcessor(fileName);
+ try {
+ Relationships relationships = ejbJarXmlProcessor.getRelationships();
+ for (Iterator iter = jbossRelationships.elements().iterator(); iter.hasNext();) {
+ jbossRelationshipsChildElement = (Element) iter.next();
+ if (jbossRelationshipsChildElement.getName().equals("ejb-relation")) {
+ QName qname = new QName("ejb-relation", geronimoRelationships.getNamespace());
+ Element geronimoEJBRelation = geronimoRelationships.addElement(qname);
+
+ Element ejbRelationName = jbossRelationshipsChildElement
+ .element("ejb-relation-name");
+ if(relationships.getEJBRelation(ejbRelationName.getText().trim()) == null) {
+ out.error(CMPDescriptorTool.class.getSimpleName(), "There is not a mapping to " + ejbRelationName.getText().trim() + ".");
+ } else {
+ migrateEJBRelation(jbossRelationshipsChildElement, geronimoEJBRelation,
+ relationships.getEJBRelation(ejbRelationName.getText().trim()));
+ }
+ }
+ }
+ } catch (DocumentException e) {
+ out.error(CMPDescriptorTool.class.getSimpleName(), "No ejb-jar.xml file exists. We can not migrate relationships");
+ }
+ }
+
+ private void migrateEJBRelation(Element jbossEJBRelation, Element geronimoEJBRelation,
+ EJBRelation ejbRelation) {
+ Element jbossEJBRelationChildElement;
+ Element noKeyFieldsRelationshipRole = null;
+ Element noCmrFieldRelationshipRole = null;
+ boolean isRelationshipRoleMigrated = false;
+ for (Iterator iter = jbossEJBRelation.elements().iterator(); iter.hasNext();) {
+ jbossEJBRelationChildElement = (Element) iter.next();
+ if (jbossEJBRelationChildElement.getName().equals("ejb-relation-name")) {
+ QName qname = new QName("ejb-relation-name", geronimoEJBRelation.getNamespace());
+ Element geronimoEJBRelationName = geronimoEJBRelation.addElement(qname);
+ geronimoEJBRelationName.setText(jbossEJBRelationChildElement.getText());
+ } else if (jbossEJBRelationChildElement.getName().equals("relation-table-mapping")) {
+ QName qname = new QName("many-to-many-table-name", geronimoEJBRelation
+ .getNamespace());
+ Element geronimoManyToMany = geronimoEJBRelation.addElement(qname);
+ migrateRelationTableMapping(jbossEJBRelationChildElement, geronimoManyToMany);
+ } else if (jbossEJBRelationChildElement.getName().equals("ejb-relationship-role")) {
+ Element keyFields = jbossEJBRelationChildElement.element("key-fields");
+ if ((keyFields == null) || (keyFields.elements().isEmpty())) {
+ logger.debug("Key field is empty. No need to convert this element");
+ // we store this element to process later if other ejb-relationship-role
+ // does not have a cmr field.
+ noKeyFieldsRelationshipRole = jbossEJBRelationChildElement;
+ } else {
+ QName qname = new QName("ejb-relationship-role", geronimoEJBRelation
+ .getNamespace());
+ Element ejbRelationshipRoleName = jbossEJBRelationChildElement
+ .element("ejb-relationship-role-name");
+ EJBRelationshipRole ejbRelationshipRole =
+ ejbRelation.getEJBRelationshipRole(ejbRelationshipRoleName.getText().trim());
+ try {
+ if (ejbRelationshipRole.getCmrFieldName() != null) {
+ Element geronimoEJBRelationshipRole = geronimoEJBRelation.addElement(qname);
+
+ migrateEJBRelationshipRole(jbossEJBRelationChildElement,
+ geronimoEJBRelationshipRole, ejbRelationshipRole);
+ isRelationshipRoleMigrated = true;
+ } else {
+ // we store this ejb-relationship-role element to process later
+ noCmrFieldRelationshipRole = jbossEJBRelationChildElement;
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ if (!isRelationshipRoleMigrated) {
+ // i.e. the ejbrelationship role which has the key fields does not contain a cmr field.
+ QName qname = new QName("ejb-relationship-role", geronimoEJBRelation
+ .getNamespace());
+ Element geronimoEJBRelationshipRole = geronimoEJBRelation.addElement(qname);
+ migrateEJBRelationshipRole(noKeyFieldsRelationshipRole,
+ noCmrFieldRelationshipRole,
+ geronimoEJBRelationshipRole,
+ ejbRelation);
+ }
+ }
+
+ private void migrateEJBRelationshipRole(Element jbossNoKeyEJBRelationshipRole,
+ Element jbossNoCmrEJBRelationshipRole,
+ Element geronimoEJBRelationshipRole,
+ EJBRelation ejbRelation) {
+
+ // adding ejb-relationship-role element
+ Element jbossNoKeyEJBRelationshipRoleName =
+ jbossNoKeyEJBRelationshipRole.element("ejb-relationship-role-name");
+ QName qname = new QName("ejb-relationship-role-name", geronimoEJBRelationshipRole
+ .getNamespace());
+ Element ejbRoleNameElement = geronimoEJBRelationshipRole.addElement(qname);
+ ejbRoleNameElement.setText(jbossNoKeyEJBRelationshipRoleName.getText());
+
+ EJBRelationshipRole ejbNoKeyRelationshipRole =
+ ejbRelation.getEJBRelationshipRole(jbossNoKeyEJBRelationshipRoleName.getText().trim());
+
+ // add the relationship role source
+ qname = new QName("relationship-role-source", geronimoEJBRelationshipRole
+ .getNamespace());
+ Element ejbRoleSourceElement = geronimoEJBRelationshipRole.addElement(qname);
+
+ qname = new QName("ejb-name", geronimoEJBRelationshipRole.getNamespace());
+ Element ejbNameElement = ejbRoleSourceElement.addElement(qname);
+ ejbNameElement.setText(ejbNoKeyRelationshipRole.getSource());
+
+ // add cmr field
+ // add the cmr field name field
+ if (ejbNoKeyRelationshipRole.getCmrFieldName() != null) {
+ qname = new QName("cmr-field", geronimoEJBRelationshipRole.getNamespace());
+ Element cmrFieldElement = geronimoEJBRelationshipRole.addElement(qname);
+
+ qname = new QName("cmr-field-name", geronimoEJBRelationshipRole.getNamespace());
+ Element cmrFieldName = cmrFieldElement.addElement(qname);
+ cmrFieldName.setText(ejbNoKeyRelationshipRole.getCmrFieldName());
+ } else {
+ out.error(CMPDescriptorTool.class.getSimpleName(), "No cmr field given to relationship " + ejbRelation.getEjbRelationName());
+ }
+
+ // put foreign-key-column-on-source
+ if (ejbNoKeyRelationshipRole.getMultiplicity().equals("Many")){
+ qname = new QName("foreign-key-column-on-source", geronimoEJBRelationshipRole.getNamespace());
+ geronimoEJBRelationshipRole.addElement(qname);
+ }
+
+
+ // add role mapping
+ Element jbossNoCMREJBRelationshipRoleName =
+ jbossNoKeyEJBRelationshipRole.element("ejb-relationship-role-name");
+ EJBRelationshipRole ejbNoCmrRelationshipRole =
+ ejbRelation.getEJBRelationshipRole(jbossNoCMREJBRelationshipRoleName.getText().trim());
+
+ // add key fields
+ Element jbossNoCMRKeyFieles = jbossNoCmrEJBRelationshipRole.element("key-fields");
+ qname = new QName("role-mapping", geronimoEJBRelationshipRole.getNamespace());
+ Element geronimoRoleMapping = geronimoEJBRelationshipRole.addElement(qname);
+ migrateKeyFields(jbossNoCMRKeyFieles, geronimoRoleMapping,
+ (Map) ejbKeyColumnMapper.get(ejbNoCmrRelationshipRole.getSource()));
+
+
+ }
+
+ private void migrateEJBRelationshipRole(Element jbossEJBRelationshipRole,
+ Element geronimoEJBRelationshipRole, EJBRelationshipRole ejbRelationshipRole) {
+ Element jbossRelationshipChildElement;
+ String ejbName = null;
+ for (Iterator iter = jbossEJBRelationshipRole.elements().iterator(); iter.hasNext();) {
+ jbossRelationshipChildElement = (Element) iter.next();
+
+ if (jbossRelationshipChildElement.getName().equals("ejb-relationship-role-name")) {
+ // add ejb relationship element
+ QName qname = new QName("ejb-relationship-role-name", geronimoEJBRelationshipRole
+ .getNamespace());
+ Element ejbRoleNameElement = geronimoEJBRelationshipRole.addElement(qname);
+ ejbRoleNameElement.setText(jbossRelationshipChildElement.getText());
+
+ // add the relationship role source
+ qname = new QName("relationship-role-source", geronimoEJBRelationshipRole
+ .getNamespace());
+ Element ejbRoleSourceElement = geronimoEJBRelationshipRole.addElement(qname);
+
+ qname = new QName("ejb-name", geronimoEJBRelationshipRole.getNamespace());
+ Element ejbNameElement = ejbRoleSourceElement.addElement(qname);
+ ejbNameElement.setText(ejbRelationshipRole.getSource());
+
+ // add the cmr field name field
+ qname = new QName("cmr-field", geronimoEJBRelationshipRole.getNamespace());
+ Element cmrFieldElement = geronimoEJBRelationshipRole.addElement(qname);
+
+ qname = new QName("cmr-field-name", geronimoEJBRelationshipRole.getNamespace());
+ Element cmrFieldName = cmrFieldElement.addElement(qname);
+ cmrFieldName.setText(ejbRelationshipRole.getCmrFieldName());
+
+ ejbName = ejbRelationshipRole.getSource();
+
+
+ } else if (jbossRelationshipChildElement.getName().equals("key-fields")) {
+ QName qname = new QName("role-mapping", geronimoEJBRelationshipRole.getNamespace());
+ Element geronimoRoleMapping = geronimoEJBRelationshipRole.addElement(qname);
+ migrateKeyFields(jbossRelationshipChildElement, geronimoRoleMapping,
+ (Map) ejbKeyColumnMapper.get(ejbName));
+ }
+ }
+
+ }
+
+ private void migrateKeyFields(Element jbossKeyField, Element geronimoRoleMapping,
+ Map keyFieldMap) {
+
+ Element jbossKeyFieldChild;
+ for (Iterator iter = jbossKeyField.elements().iterator(); iter.hasNext();) {
+ jbossKeyFieldChild = (Element) iter.next();
+ if (jbossKeyFieldChild.getName().equals("key-field")) {
+ QName qname = new QName("cmr-field-mapping", geronimoRoleMapping.getNamespace());
+ Element geronimoCMRFieldMapping = geronimoRoleMapping.addElement(qname);
+ migrateKeyField(jbossKeyFieldChild, geronimoCMRFieldMapping, keyFieldMap);
+ }
+ }
+ }
+
+ private void migrateKeyField(Element jbossKeyField, Element geronimoCMRFieldMapping,
+ Map keyFieldMap) {
+ Element jbossKeyFieldChild;
+ for (Iterator iter = jbossKeyField.elements().iterator(); iter.hasNext();) {
+ jbossKeyFieldChild = (Element) iter.next();
+ if (jbossKeyFieldChild.getName().equals("field-name")) {
+ QName qname = new QName("key-column", geronimoCMRFieldMapping.getNamespace());
+ Element geronimoKeyColumn = geronimoCMRFieldMapping.addElement(qname);
+ geronimoKeyColumn.setText(jbossKeyFieldChild.getText().trim());
+ } else if (jbossKeyFieldChild.getName().equals("column-name")) {
+ QName qname = new QName("foreign-key-column", geronimoCMRFieldMapping
+ .getNamespace());
+ Element geronimoForegnKeyColumn = geronimoCMRFieldMapping.addElement(qname);
+ geronimoForegnKeyColumn.setText(jbossKeyFieldChild.getText());
+ }
+ }
+ }
+
+ /**
+ * this method may be use ful in future
+ *
+ * @param jbossTableMappingElement
+ * @param geronimoManytoManyTable
+ */
+
+ private void migrateRelationTableMapping(Element jbossTableMappingElement,
+ Element geronimoManytoManyTable) {
+
+ Element jbossTableMappingChildElement;
+ for (Iterator iter = jbossTableMappingElement.elements().iterator(); iter.hasNext();) {
+ jbossTableMappingChildElement = (Element) iter.next();
+ if (jbossTableMappingChildElement.getName().equals("table-name")) {
+ geronimoManytoManyTable.setText(jbossTableMappingChildElement.getText());
+ }
+ }
+ }
+
+ /**
+ * this migrates the enterprise-beans part
+ *
+ * @param jbossEnterpriseBeans
+ * @param geronimoEnterpriseBeans
+ */
+ private void migrateEnterpriseBeans(Element jbossEnterpriseBeans,
+ Element geronimoEnterpriseBeans) {
+
+ Element jbossEnterpriseBeanChildElement;
+ for (Iterator iter = jbossEnterpriseBeans.elements().iterator(); iter.hasNext();) {
+ jbossEnterpriseBeanChildElement = (Element) iter.next();
+ if (jbossEnterpriseBeanChildElement.getName().equals("entity")) {
+
+ // get the entity ejb name
+ Element ejbNameElement = jbossEnterpriseBeanChildElement.element("ejb-name");
+ String ejbName = ejbNameElement.getText().trim();
+ logger.debug("Converting ejb session with name ==> " + ejbName);
+ // create a session bean in geronimo
+ String xpath = "//ejb:enterprise-beans/ejb:entity[ejb:ejb-name/text() = '"
+ + ejbName + "']";
+ logger.debug("Find existing ejb using query ==>" + xpath);
+ Element geronimoEntity = XMLConversionHelper.getGeronimoElement(
+ geronimoEnterpriseBeans, xpath, "entity", geronimoEnterpriseBeans
+ .getNamespace());
+ cmpEntityBeanMigrator.migrateBean(jbossEnterpriseBeanChildElement, geronimoEntity);
+ // put the key columns to hash map
+ ejbKeyColumnMapper.put(ejbName, cmpEntityBeanMigrator.getKeyColumnMap());
+ }
+ }
+ }
+
+ private void migrateDefaults(Element jbossDefaultsElement, Element geronimoRootElement) {
+
+ Element jbossDefaultsChildElement;
+ for (Iterator iter = jbossDefaultsElement.elements().iterator(); iter.hasNext();) {
+ jbossDefaultsChildElement = (Element) iter.next();
+ if (jbossDefaultsChildElement.getName().equals("datasource")) {
+ // creates the cmp connection factory element
+ logger.debug("migrating the datasource");
+ QName qname = new QName("cmp-connection-factory", geronimoRootElement
+ .getNamespaceForPrefix(Constants.NAMING_NAME_SPACE_PREFIX));
+ Element geronimoCMPConnectionFactoryElement = geronimoRootElement.addElement(qname);
+ logger.debug("cmp-connection-factory added to geromimo");
+ String jndiName = jbossDefaultsChildElement.getText();
+ String artifactID;
+ if (!envirionmentElementProcessor.isJndiNameProcessed(jndiName)) {
+ artifactID = envirionmentElementProcessor.addDependencyModule(jndiName,
+ geronimoCMPConnectionFactoryElement.getDocument().getRootElement());
+ } else {
+ artifactID = envirionmentElementProcessor.getArtifactID(jndiName);
+ }
+ qname = new QName("resource-link", geronimoCMPConnectionFactoryElement
+ .getNamespaceForPrefix(Constants.NAMING_NAME_SPACE_PREFIX));
+ Element geronimoResourceLink = geronimoCMPConnectionFactoryElement
+ .addElement(qname);
+ geronimoResourceLink.setText(artifactID);
+ logger.debug("resource-link added to geronimo");
+ } else {
+ out.warn(CMPDescriptorTool.class.getSimpleName(), "The Element '" + jbossDefaultsChildElement.getName()
+ + "' is not supported", XMLConversionHelper
+ .getLineNumber(jbossDefaultsChildElement), XMLConversionHelper
+ .getColumnNumber(jbossDefaultsChildElement));
+ logger.debug("The Element '" + jbossDefaultsChildElement.getName()
+ + "' is not supported");
+ }
+ }
+ }
+}
Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/CMPDescriptorTool.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/CMPEntityBeanMigrator.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/CMPEntityBeanMigrator.java?rev=582929&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/CMPEntityBeanMigrator.java (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/CMPEntityBeanMigrator.java Mon Oct 8 11:48:35 2007
@@ -0,0 +1,132 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.devtools.j2g.descriptors.comp;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.devtools.j2g.common.ConsoleOutput;
+import org.apache.geronimo.devtools.j2g.common.IOutput;
+import org.apache.geronimo.devtools.j2g.common.Tool;
+import org.apache.geronimo.devtools.j2g.util.descriptors.xml.XMLConversionHelper;
+import org.dom4j.Element;
+import org.dom4j.QName;
+
+
+public class CMPEntityBeanMigrator {
+
+ private IOutput out;
+
+ private Log logger = LogFactory.getLog(CMPEntityBeanMigrator.class);
+
+ // this is used to keep the filed name and column name
+ // key field name vaue column name
+ private Map keyColumnMap;
+
+ public CMPEntityBeanMigrator () {
+ Tool currentTool = Tool.getCurrent();
+ if (currentTool != null) {
+ out = currentTool.getOutput();
+ } else {
+ out = new ConsoleOutput();
+ }
+ }
+
+ public void migrateBean(Element jbossEntity, Element geronimoEntity) {
+
+ Element jbossEntityChildElement;
+ keyColumnMap = new HashMap();
+ for (Iterator iter = jbossEntity.elements().iterator(); iter.hasNext();) {
+ jbossEntityChildElement = (Element) iter.next();
+ if (jbossEntityChildElement.getName().equals("ejb-name")) {
+ // we have to check the ejb name since ejb name can put by the
+ // jboss.xml as well.
+ String xpath = "//ejb:ejb-name[text() ='" + jbossEntityChildElement.getText()
+ + "']";
+ logger.debug("Find existing ejb names with xpath ==> " + xpath);
+ if (!XMLConversionHelper.isNodeAvailable(geronimoEntity, xpath)) {
+ logger.debug("migrating the ejb name");
+ QName qname = new QName("ejb-name", geronimoEntity.getNamespace());
+ Element geronimoEJBName = geronimoEntity.addElement(qname);
+ geronimoEJBName.setText(jbossEntityChildElement.getText());
+ logger.debug("added ejb-name to geromimo");
+ }
+
+ } else if (jbossEntityChildElement.getName().equals("table-name")) {
+ logger.debug("migrating the table name");
+ QName qname = new QName("table-name", geronimoEntity.getNamespace());
+ Element geronimoTableName = geronimoEntity.addElement(qname);
+ geronimoTableName.setText(jbossEntityChildElement.getText());
+ logger.debug("added table name");
+ } else if (jbossEntityChildElement.getName().equals("cmp-field")) {
+ QName qname = new QName("cmp-field-mapping", geronimoEntity.getNamespace());
+ Element geronimoCMPFieldMapping = geronimoEntity.addElement(qname);
+ migrateCMPFieldMapping(jbossEntityChildElement, geronimoCMPFieldMapping);
+ } else {
+ out.warn(CMPEntityBeanMigrator.class.getSimpleName(), "The Element '" + jbossEntityChildElement.getName() + "' is not supported",
+ XMLConversionHelper.getLineNumber(jbossEntityChildElement),
+ XMLConversionHelper.getColumnNumber(jbossEntityChildElement));
+ logger.debug("The Element '" + jbossEntityChildElement.getName()
+ + "' is not supported");
+ }
+
+ }
+ }
+
+ private void migrateCMPFieldMapping(Element jbossCMPField, Element geronimoCMPFieldMapping) {
+
+ Element jbossCMPFieldChild;
+ String fieldName = null;
+ String columnName = null;
+ for (Iterator iter = jbossCMPField.elements().iterator(); iter.hasNext();) {
+ jbossCMPFieldChild = (Element) iter.next();
+ if (jbossCMPFieldChild.getName().equals("field-name")) {
+ QName qname = new QName("cmp-field-name", geronimoCMPFieldMapping.getNamespace());
+ Element geronimoCMPFieldName = geronimoCMPFieldMapping.addElement(qname);
+ geronimoCMPFieldName.setText(jbossCMPFieldChild.getText());
+ fieldName = jbossCMPFieldChild.getText().trim();
+ } else if (jbossCMPFieldChild.getName().equals("column-name")) {
+ QName qname = new QName("table-column", geronimoCMPFieldMapping.getNamespace());
+ Element geronimoTableColumn = geronimoCMPFieldMapping.addElement(qname);
+ geronimoTableColumn.setText(jbossCMPFieldChild.getText());
+ columnName = jbossCMPFieldChild.getText().trim();
+ } else {
+ out.warn(CMPEntityBeanMigrator.class.getSimpleName(), "The Element '" + jbossCMPFieldChild.getName() + "' is not supported",
+ XMLConversionHelper.getLineNumber(jbossCMPFieldChild),
+ XMLConversionHelper.getColumnNumber(jbossCMPFieldChild));
+ logger.debug("The Element '" + jbossCMPFieldChild.getName()
+ + "' is not supported");
+ }
+ }
+
+ if ((fieldName != null) && (columnName != null)){
+ keyColumnMap.put(fieldName,columnName);
+ }
+ }
+
+ public Map getKeyColumnMap() {
+ return keyColumnMap;
+ }
+
+ public void setKeyColumnMap(Map keyColumnMap) {
+ this.keyColumnMap = keyColumnMap;
+ }
+}
Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/CMPEntityBeanMigrator.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/EJBJarXmlProcessor.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/EJBJarXmlProcessor.java?rev=582929&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/EJBJarXmlProcessor.java (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/EJBJarXmlProcessor.java Mon Oct 8 11:48:35 2007
@@ -0,0 +1,117 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.devtools.j2g.descriptors.comp;
+
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.geronimo.devtools.j2g.descriptors.comp.dto.EJBRelation;
+import org.apache.geronimo.devtools.j2g.descriptors.comp.dto.EJBRelationshipRole;
+import org.apache.geronimo.devtools.j2g.descriptors.comp.dto.Relationships;
+import org.apache.geronimo.devtools.j2g.util.descriptors.xml.XMLConversionHelper;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+
+public class EJBJarXmlProcessor {
+
+ private String fileName;
+
+ public EJBJarXmlProcessor(String fileName) {
+ this.fileName = fileName;
+ }
+
+ /**
+ * @return relationships of the ejb jar xml file
+ */
+
+ public Relationships getRelationships() throws DocumentException {
+ Document document = XMLConversionHelper.getDocument(new File(fileName));
+ List ejbRelations = null; // store ejb relationships
+ List e = document.selectNodes("/ejb-jar[@*]"); // get a handle of root element
+ Element relationElement = null; // stores the <relationships> element
+ Element ejbJarNode = null; // stores the <ejb-jar> root element
+ if(e.size() >= 1) {
+ ejbJarNode = (Element)e.get(0);
+ }
+
+ // find a <relationships> element and save it
+ for(Iterator it = ejbJarNode.elementIterator(); it.hasNext(); ) {
+ Element element = (Element)it.next();
+ if(element.getName().equals("relationships")) {
+ relationElement = element;
+ break;
+ }
+ }
+
+ // store the <ejb-relation> elements
+ if(relationElement != null) {
+ ejbRelations = relationElement.elements();
+ }
+
+ Relationships relationships = new Relationships();
+ Element ejbRelationsChileElement;
+ for (Iterator iter = ejbRelations.iterator(); iter.hasNext();) {
+ ejbRelationsChileElement = (Element) iter.next();
+ if (ejbRelationsChileElement.getName().equals("ejb-relation")) {
+ relationships.addEJBRealtion(getEJBRelation(ejbRelationsChileElement));
+ }
+ }
+
+ return relationships;
+ }
+
+ private EJBRelation getEJBRelation(Element ejbRelationElement) {
+
+ EJBRelation ejbRelation = new EJBRelation();
+ Element ejbRelationChildElement;
+ for (Iterator iter = ejbRelationElement.elements().iterator(); iter.hasNext();) {
+ ejbRelationChildElement = (Element) iter.next();
+ if (ejbRelationChildElement.getName().equals("ejb-relation-name")) {
+ ejbRelation.setEjbRelationName(ejbRelationChildElement.getText().trim());
+ } else if (ejbRelationChildElement.getName().equals("ejb-relationship-role")) {
+ ejbRelation.addRelationshipRole(getEJBRelationshipRole(ejbRelationChildElement));
+ }
+ }
+ return ejbRelation;
+ }
+
+ private EJBRelationshipRole getEJBRelationshipRole(Element ejbRelationshipRoleElement) {
+
+ EJBRelationshipRole ejbRelationshipRole = new EJBRelationshipRole();
+ Element ejbRelationshipRoleChildElement;
+ for (Iterator iter = ejbRelationshipRoleElement.elements().iterator(); iter.hasNext();) {
+ ejbRelationshipRoleChildElement = (Element) iter.next();
+ if (ejbRelationshipRoleChildElement.getName().equals("ejb-relationship-role-name")) {
+ ejbRelationshipRole.setName(ejbRelationshipRoleChildElement.getText().trim());
+ } else if (ejbRelationshipRoleChildElement.getName().equals("multiplicity")) {
+ ejbRelationshipRole.setMultiplicity(ejbRelationshipRoleChildElement.getText().trim());
+ } else if (ejbRelationshipRoleChildElement.getName().equals("relationship-role-source")) {
+ Element ejbName = ejbRelationshipRoleChildElement.element("ejb-name");
+ ejbRelationshipRole.setSource(ejbName.getText().trim());
+ } else if (ejbRelationshipRoleChildElement.getName().equals("cmr-field")){
+ Element cmrFieldName = ejbRelationshipRoleChildElement.element("cmr-field-name");
+ ejbRelationshipRole.setCmrFieldName(cmrFieldName.getText().trim());
+ }
+ }
+ return ejbRelationshipRole;
+ }
+
+}
Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/EJBJarXmlProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/dto/EJBRelation.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/dto/EJBRelation.java?rev=582929&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/dto/EJBRelation.java (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/dto/EJBRelation.java Mon Oct 8 11:48:35 2007
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.devtools.j2g.descriptors.comp.dto;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * keep ejb relation details of the ejb-jar.xml file
+ *
+ */
+public class EJBRelation {
+ private String ejbRelationName;
+
+ private Map ejbRelationshipRoles;
+
+ public EJBRelation(String ejbRelationName) {
+ this.ejbRelationName = ejbRelationName;
+ this.ejbRelationshipRoles = new HashMap();
+ }
+
+ public EJBRelation() {
+ this.ejbRelationshipRoles = new HashMap();
+ }
+
+ public void addRelationshipRole(EJBRelationshipRole ejbRelationshipRole) {
+ ejbRelationshipRoles.put(ejbRelationshipRole.getName(), ejbRelationshipRole);
+ }
+
+ public EJBRelationshipRole getEJBRelationshipRole(String name) {
+ return (EJBRelationshipRole) this.ejbRelationshipRoles.get(name);
+ }
+
+ public String getEjbRelationName() {
+ return ejbRelationName;
+ }
+
+ public void setEjbRelationName(String ejbRelationName) {
+ this.ejbRelationName = ejbRelationName;
+ }
+
+}
Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/dto/EJBRelation.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/dto/EJBRelationshipRole.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/dto/EJBRelationshipRole.java?rev=582929&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/dto/EJBRelationshipRole.java (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/dto/EJBRelationshipRole.java Mon Oct 8 11:48:35 2007
@@ -0,0 +1,61 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.devtools.j2g.descriptors.comp.dto;
+
+public class EJBRelationshipRole {
+
+ private String name;
+
+ private String multiplicity;
+
+ private String source;
+
+ private String cmrFieldName;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getMultiplicity() {
+ return multiplicity;
+ }
+
+ public void setMultiplicity(String multiplicity) {
+ this.multiplicity = multiplicity;
+ }
+
+ public String getSource() {
+ return source;
+ }
+
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+ public String getCmrFieldName() {
+ return cmrFieldName;
+ }
+
+ public void setCmrFieldName(String cmrFieldName) {
+ this.cmrFieldName = cmrFieldName;
+ }
+}
Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/dto/EJBRelationshipRole.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/dto/Relationships.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/dto/Relationships.java?rev=582929&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/dto/Relationships.java (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/dto/Relationships.java Mon Oct 8 11:48:35 2007
@@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.devtools.j2g.descriptors.comp.dto;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class Relationships {
+
+ private Map ejbRelations;
+
+ public Relationships() {
+ this.ejbRelations = new HashMap();
+ }
+
+ public void addEJBRealtion(EJBRelation ejbRelation) {
+ this.ejbRelations.put(ejbRelation.getEjbRelationName(), ejbRelation);
+ }
+
+ public EJBRelation getEJBRelation(String name) {
+ return (EJBRelation) this.ejbRelations.get(name);
+ }
+
+}
Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.descriptors/src/org/apache/geronimo/devtools/j2g/descriptors/comp/dto/Relationships.java
------------------------------------------------------------------------------
svn:eol-style = native