geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lin...@apache.org
Subject svn commit: r582931 [1/3] - in /geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources: ./ META-INF/ schema/ src/ src/org/ src/org/apache/ src/org/apache/geronimo/ src/org/apache/geronimo/devtools/ src/org/apache/geronimo/devtoo...
Date Mon, 08 Oct 2007 18:50:09 GMT
Author: linsun
Date: Mon Oct  8 11:50:05 2007
New Revision: 582931

URL: http://svn.apache.org/viewvc?rev=582931&view=rev
Log:
update the resources plugin for GERONIMODEVTOOLS-221

Added:
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/.classpath   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/.project   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/META-INF/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/META-INF/MANIFEST.MF
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/build.properties   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/plugin.xml   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/pom.xml   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/schema/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/schema/tool.migrations.exsd
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/commons-logging.properties   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/ResourcesTool.java   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/datasource/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/datasource/DSResourcesTool.java   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/jms/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/jms/JMSResourcesTool.java   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/mail/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/mail/MailResourcesTool.java   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/security/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/security/SecurityResourcesTool.java   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test-apps/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test-apps/ds/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test-apps/ds/hsqldb-ds.xml   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test-apps/ds/hsqldb-geronimo-plan.xml   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test-apps/ds/mysql-ds.xml   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test-apps/ds/mysql-geronimo-plan.xml   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test-apps/ds/oracle-ds.xml   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test-apps/ds/oracle-geronimo-plan.xml   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test-apps/jms/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test-apps/jms/geronimo-jms-resource-plan.xml   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test-apps/jms/jbossmq-destinations-service.xml   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test-apps/jms/jms-ds.xml   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test-apps/jms/jms-geronimo-plan.xml   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test-apps/mail/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test-apps/mail/err/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test-apps/mail/err/mail-service.xml   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test-apps/mail/geronimo-mail-service.xml   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test-apps/mail/mail-geronimo-plan.xml
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test-apps/mail/mail-service.xml   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test-apps/security/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test-apps/security/geronimo-secutiry-plan.xml   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test-apps/security/login-config.xml   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test-apps/security/security-geronimo-plan.xml   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test/org/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test/org/apache/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test/org/apache/geronimo/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test/org/apache/geronimo/devtools/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test/org/apache/geronimo/devtools/j2g/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test/org/apache/geronimo/devtools/j2g/resources/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test/org/apache/geronimo/devtools/j2g/resources/datasource/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test/org/apache/geronimo/devtools/j2g/resources/datasource/test/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test/org/apache/geronimo/devtools/j2g/resources/datasource/test/DSResouresToolTestCase.java   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test/org/apache/geronimo/devtools/j2g/resources/jms/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test/org/apache/geronimo/devtools/j2g/resources/jms/test/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test/org/apache/geronimo/devtools/j2g/resources/jms/test/JMSResouresToolTestCase.java   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test/org/apache/geronimo/devtools/j2g/resources/mail/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test/org/apache/geronimo/devtools/j2g/resources/mail/test/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test/org/apache/geronimo/devtools/j2g/resources/mail/test/MailResouresToolTestCase.java   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test/org/apache/geronimo/devtools/j2g/resources/security/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test/org/apache/geronimo/devtools/j2g/resources/security/test/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/test/org/apache/geronimo/devtools/j2g/resources/security/test/SecurityResouresToolTestCase.java   (with props)

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/.classpath
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/.classpath?rev=582931&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/.classpath (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/.classpath Mon Oct  8 11:50:05 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.resources/.classpath
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/.project
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/.project?rev=582931&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/.project (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/.project Mon Oct  8 11:50:05 2007
@@ -0,0 +1,22 @@
+<projectDescription>
+  <name>org.apache.geronimo.j2g.resources</name>
+  <comment>JBoss to Geronimo Conversion Tool</comment>
+  <projects>
+    <project>org.apache.geronimo.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.resources/.project
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/META-INF/MANIFEST.MF?rev=582931&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/META-INF/MANIFEST.MF (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/META-INF/MANIFEST.MF Mon Oct  8 11:50:05 2007
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: J2G Resources Plug-in
+Bundle-SymbolicName: org.apache.geronimo.devtools.j2g.resources;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
+Bundle-ClassPath: .

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/build.properties
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/build.properties?rev=582931&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/build.properties (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/build.properties Mon Oct  8 11:50:05 2007
@@ -0,0 +1,22 @@
+/**
+ *  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
+source.. = src/

Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/build.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/plugin.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/plugin.xml?rev=582931&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/plugin.xml (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/plugin.xml Mon Oct  8 11:50:05 2007
@@ -0,0 +1,53 @@
+<?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="Resources Migrations Extension Point" schema="schema/tool.migrations.exsd"/>
+   <extension
+         id="tool"
+         name="Resources Migration Tool"
+         point="org.eclipse.core.runtime.applications">
+      <application>
+         <run class="org.apache.geronimo.devtools.j2g.resources.ResourcesTool"/>
+      </application>
+   </extension>
+   <extension
+         point="org.apache.geronimo.devtools.j2g.resources.migrations">
+      <migration
+            class="org.apache.geronimo.devtools.j2g.resources.datasource.DSResourcesTool">
+      </migration>
+   </extension>
+   <extension
+         point="org.apache.geronimo.devtools.j2g.resources.migrations">
+      <migration
+            class="org.apache.geronimo.devtools.j2g.resources.jms.JMSResourcesTool">
+      </migration>
+   </extension>
+   <extension
+         point="org.apache.geronimo.devtools.j2g.resources.migrations">
+      <migration
+            class="org.apache.geronimo.devtools.j2g.resources.mail.MailResourcesTool">
+      </migration>
+   </extension>
+   <extension
+         point="org.apache.geronimo.devtools.j2g.resources.migrations">
+      <migration
+            class="org.apache.geronimo.devtools.j2g.resources.security.SecurityResourcesTool">
+      </migration>
+   </extension>
+</plugin>

Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/plugin.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/pom.xml?rev=582931&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/pom.xml (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/pom.xml Mon Oct  8 11:50:05 2007
@@ -0,0 +1,58 @@
+<?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.resources</artifactId>
+    <packaging>jar</packaging>
+    <name>${artifactId}</name>
+    
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-dependency-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.geronimo.devtools</groupId>
+                <artifactId>maven-eclipsepde-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <artifactId>maven-jar-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.resources/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/schema/tool.migrations.exsd
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/schema/tool.migrations.exsd?rev=582931&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/schema/tool.migrations.exsd (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/schema/tool.migrations.exsd Mon Oct  8 11:50:05 2007
@@ -0,0 +1,92 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.apache.geronimo.devtools.j2g.resources">
+<annotation>
+      <appInfo>
+         <meta.schema plugin="org.apache.geronimo.devtools.j2g.resources" id="org.apache.geronimo.devtools.j2g.resources.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>
+         &lt;pre&gt;
+   &lt;extension
+         point=&quot;org.apache.geronimo.devtools.j2g.resources.tool.migrations&quot;&gt;
+      &lt;migration class=&quot;org.apache.geronimo.devtools.j2g.resources.jms.JMSResourcesFileMigration&quot;/&gt;
+   &lt;/extension&gt;
+&lt;/pre&gt;
+      </documentation>
+   </annotation>
+
+   <annotation>
+      <appInfo>
+         <meta.section type="copyright"/>
+      </appInfo>
+      <documentation>
+         
+      </documentation>
+   </annotation>
+
+</schema>

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/commons-logging.properties
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/commons-logging.properties?rev=582931&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/commons-logging.properties (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/commons-logging.properties Mon Oct  8 11:50:05 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.resources/src/commons-logging.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/ResourcesTool.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/ResourcesTool.java?rev=582931&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/ResourcesTool.java (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/ResourcesTool.java Mon Oct  8 11:50:05 2007
@@ -0,0 +1,53 @@
+/**
+ *  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.resources;
+
+import org.apache.geronimo.devtools.j2g.common.XMLMigrationTool;
+
+/**
+ * Descriptors migration tool.
+ */
+public class ResourcesTool extends XMLMigrationTool {
+
+	/** Plug-in id */
+	public final static String PLUGIN_ID = "org.apache.geronimo.devtools.j2g.resources";
+
+	/** Extension point id */
+	public final static String EXTENSION_POINT_ID = PLUGIN_ID
+			+ ".migrations";
+
+	/**
+	 * @see org.apache.geronimo.devtools.j2g.common.XMLMigrationTool#getExtensionPointId()
+	 */
+	protected String getExtensionPointId() {
+		return EXTENSION_POINT_ID;
+	}
+
+	/**
+	 * @see org.apache.geronimo.devtools.j2g.common.XMLMigrationTool#getPluginId()
+	 */
+	protected String getPluginId() {
+		return PLUGIN_ID;
+	}
+
+	/**
+	 * @see org.apache.geronimo.devtools.j2g.common.XMLMigrationTool#getToolName()
+	 */
+	protected String getToolName() {
+		return "jres2g.cmd";
+	}
+}

Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/ResourcesTool.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/datasource/DSResourcesTool.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/datasource/DSResourcesTool.java?rev=582931&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/datasource/DSResourcesTool.java (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/datasource/DSResourcesTool.java Mon Oct  8 11:50:05 2007
@@ -0,0 +1,355 @@
+/**
+ *  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.resources.datasource;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+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.resources.Constants;
+import org.apache.geronimo.devtools.j2g.util.resources.xml.XMLConversionHelper;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.DocumentHelper;
+import org.dom4j.Element;
+import org.dom4j.Namespace;
+import org.dom4j.QName;
+
+/**
+ * Class which implement the Data Source File Migration 
+ */
+public class DSResourcesTool implements IFileMigration {
+
+    // Initialization of the IOutput for DSResourcesTool class
+    IOutput out = Tool.getCurrent().getOutput();
+    // Initialization of the logger for DSResourcesTool class
+    Log logger = LogFactory.getLog(DSResourcesTool.class);
+
+    /**
+     * mgration method from data source jboss discripters to geronimo
+     * discriptors
+     * 
+     * @param sourceFile :data source jboss discriptor file
+     * @return status of the migration
+     */
+    public boolean migrate(File sourceFile, File rootDirectory) {
+        boolean migrated = false;
+            String directoryName = sourceFile.getParent();
+            String jbossDSFileName = sourceFile.getName();
+            logger.debug("Directory Name ==> " + directoryName
+                    + " jboss data source file Name ==> " + jbossDSFileName);
+
+            if (jbossDSFileName.endsWith(Constants.JBOSS_VALID_DS_XML_FILE)) {
+                // Checking wether file is a valid *-ds.xml file
+                String driverType = jbossDSFileName.substring(0, jbossDSFileName.lastIndexOf("-"));
+                out.info(DSResourcesTool.class.getSimpleName(), "Converting Jboss datasource xml file in " + directoryName);
+                try {
+                    Document jbossDocument = XMLConversionHelper.getJbossDocument(sourceFile);
+                    Document geronimoDocument = migrationFromJboss2Geronimo(jbossDocument
+                            .getRootElement());
+                    String geronimoDSFileName = directoryName + File.separator + driverType
+                            + Constants.GERONIMO_PLAN_FILE;
+                    // Check whether the file already exists if so
+                    // back up at and save that or check the req
+                    // This was done in upper level of the tool
+                    XMLConversionHelper.saveGeronimoDocument(geronimoDSFileName, geronimoDocument);
+                    migrated = true;
+                    out.info(DSResourcesTool.class.getSimpleName(), "The Datasource Resource File Migration Complete!!!\n");
+                } catch (DocumentException e) {
+                    out.error(DSResourcesTool.class.getSimpleName(), "Error occured while reading xml descriptor "
+    								+ sourceFile.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(DSResourcesTool.class.getSimpleName(), "IO exception " + e.getMessage());
+                }
+            }
+        return migrated;
+    }
+
+    /**
+     * Accepts the jboss side Elements that holdes the discripter infomation and
+     * return the geronimo discripter
+     * 
+     * @param jbossRootElement
+     * @return geronimo plan
+     */
+    private Document migrationFromJboss2Geronimo(Element jbossRootElement) {
+        Document geronimo_ds_plan = createNewGeronimoDocument(jbossRootElement);
+        return geronimo_ds_plan;
+    }
+
+    /**
+     * Createt the new geronimo document from the given namesppace and the root
+     * elament with default elements
+     * 
+     * @param namespaceName
+     *            String of the namespace
+     * @param rootName
+     *            String root Element name
+     * @return a new dom4j document for geronimo-ds-plan.xml
+     */
+    public Document createNewGeronimoDocument(Element jbossRootElement) {
+        Namespace connectorNamespace = new Namespace("", Constants.NAMESPACE_CONNECTOR);
+        Namespace environmentNamespace = new Namespace(Constants.ENV_NAMESPACE_PREFIX,
+                Constants.NAMESPACE_ENV);
+
+        Element local_tx_datasurceElement = XMLConversionHelper.obtainSubElement(jbossRootElement,
+                "local-tx-datasource");
+        Element jndi_name = XMLConversionHelper.obtainSubElement(local_tx_datasurceElement,
+                "jndi-name");
+        Element connection_url = XMLConversionHelper.obtainSubElement(local_tx_datasurceElement,
+                "connection-url");
+        Element driver_class = XMLConversionHelper.obtainSubElement(local_tx_datasurceElement,
+                "driver-class");
+        Element user_name = XMLConversionHelper.obtainSubElement(local_tx_datasurceElement,
+                "user-name");
+        Element password = XMLConversionHelper.obtainSubElement(local_tx_datasurceElement,
+                "password");
+        Element dependenciesElement = createDependenciesElement(driver_class.getStringValue(),
+                environmentNamespace);
+        Element connectiondefinition_instanceElement = DocumentHelper.createElement(new QName(
+                "connectiondefinition-instance", connectorNamespace));
+        connectiondefinition_instanceElement.add(XMLConversionHelper.createSibling("name",
+                XMLConversionHelper.obtainNameFromJNDINAME(XMLConversionHelper
+                        .readElementValue(jndi_name)), connectorNamespace));
+        connectiondefinition_instanceElement.add(XMLConversionHelper.createSiblingWithAttrib(
+                "config-property-setting", XMLConversionHelper.readElementValue(user_name), "name",
+                "UserName", connectorNamespace));
+        connectiondefinition_instanceElement.add(XMLConversionHelper.createSiblingWithAttrib(
+                "config-property-setting", XMLConversionHelper.readElementValue(password), "name",
+                "Password", connectorNamespace));
+        connectiondefinition_instanceElement.add(XMLConversionHelper.createSiblingWithAttrib(
+                "config-property-setting", XMLConversionHelper.readElementValue(driver_class),
+                "name", "Driver", connectorNamespace));
+        connectiondefinition_instanceElement.add(XMLConversionHelper.createSiblingWithAttrib(
+                "config-property-setting", XMLConversionHelper.readElementValue(connection_url),
+                "name", "ConnectionURL", connectorNamespace));
+        Element connection_managerElement = null;
+        if (checkForConnectionMangerDetails(local_tx_datasurceElement)) {
+            connection_managerElement = createConnectionManagerElement(local_tx_datasurceElement,
+                    connectorNamespace);
+        } else {
+            connection_managerElement = createDefaultConnectionManagerElement(connectorNamespace);
+        }
+        connectiondefinition_instanceElement.add(connection_managerElement);
+        QName connectorQName = new QName("connector", connectorNamespace);
+        QName environmentQName = new QName("environment", environmentNamespace);
+        Element artifactIdElement = DocumentHelper.createElement((new QName("artifactId",
+                environmentNamespace)));
+        artifactIdElement.addText(XMLConversionHelper.obtainNameFromJNDINAME(XMLConversionHelper
+                .readElementValue(jndi_name)));
+        Element moduleIdElement = DocumentHelper.createElement((new QName("moduleId",
+                environmentNamespace)));
+        moduleIdElement.add(artifactIdElement);
+        Element conenctorElement = DocumentHelper.createElement(connectorQName);
+        dependenciesElement.add(environmentNamespace);
+        Element environmentElement = conenctorElement.addElement(environmentQName);
+        environmentElement.add(moduleIdElement);
+        environmentElement.add(dependenciesElement);
+        QName resourceadapterQName = new QName("resourceadapter", connectorNamespace);
+        Element resourceadapterElement = conenctorElement.addElement(resourceadapterQName);
+        Element outbound_resourceadapterElement = DocumentHelper.createElement(new QName(
+                "outbound-resourceadapter", connectorNamespace));
+        Element connector_definitionElement = DocumentHelper.createElement(new QName(
+                "connection-definition", connectorNamespace));
+        Element connecttionfactory_interfaceElement = DocumentHelper.createElement(new QName(
+                "connectionfactory-interface", connectorNamespace));
+        connecttionfactory_interfaceElement.addText(Constants.CONNECTION_FACTORY_INTERFACE);
+        connector_definitionElement.add(connecttionfactory_interfaceElement);
+        connector_definitionElement.add(connectiondefinition_instanceElement);
+        resourceadapterElement.add(outbound_resourceadapterElement);
+        outbound_resourceadapterElement.add(connector_definitionElement);
+        Document document = DocumentHelper.createDocument();
+        document.add(conenctorElement);
+        out.warn(DSResourcesTool.class.getSimpleName(), "The JAR holding the " + driver_class.getStringValue()
+                + " JDBC Driver should be installed under <GERONIMO_HOME>/repository/");
+        return document;
+    }
+
+    /**
+     * creates the connection manager element by refereing the jboss side
+     * localtxelement
+     * 
+     * @param local_tx_datasurceElement
+     * @param environmentNamespace
+     * @return the connection manager element for geronimo ds plan
+     */
+    public Element createConnectionManagerElement(Element local_tx_datasurceElement,
+            Namespace environmentNamespace) {
+        Element connectionmanagerElement = DocumentHelper.createElement(new QName(
+                "connectionmanager", environmentNamespace));
+        Element local_transactionElement = DocumentHelper.createElement(new QName(
+                "local-transaction", environmentNamespace));
+        Element single_poolElement = DocumentHelper.createElement(new QName("single-pool",
+                environmentNamespace));
+        Element max_sizeElement = DocumentHelper.createElement(new QName("max-size",
+                environmentNamespace));
+        Element min_sizeElement = DocumentHelper.createElement(new QName("min-size",
+                environmentNamespace));
+        Element blocking_timeout_millisecondsElement = DocumentHelper.createElement(new QName(
+                "blocking-timeout-milliseconds", environmentNamespace));
+        Element idle_timeout_minutesElement = DocumentHelper.createElement(new QName(
+                "idle-timeout-minutes", environmentNamespace));
+        Element match_oneElement = DocumentHelper.createElement(new QName("match-one",
+                environmentNamespace));
+        if (XMLConversionHelper.containSubElement(local_tx_datasurceElement, "max-pool-size")) {
+            Element max_sizeElement_jboss = XMLConversionHelper.obtainSubElement(
+                    local_tx_datasurceElement, "max-pool-size");
+            max_sizeElement.addText(XMLConversionHelper.readElementValue(max_sizeElement_jboss));
+        } else {
+            max_sizeElement.addText("10");
+        }
+        if (XMLConversionHelper.containSubElement(local_tx_datasurceElement, "min-pool-size")) {
+            Element min_sizeElement_jboss = XMLConversionHelper.obtainSubElement(
+                    local_tx_datasurceElement, "min-pool-size");
+            min_sizeElement.addText(XMLConversionHelper.readElementValue(min_sizeElement_jboss));
+        } else {
+            min_sizeElement.addText("0");
+        }
+        if (XMLConversionHelper.containSubElement(local_tx_datasurceElement,
+                "blocking-timeout-milliseconds")) {
+            Element blocking_timeout_millisecondsElement_jboss = XMLConversionHelper
+                    .obtainSubElement(local_tx_datasurceElement, "blocking-timeout-milliseconds");
+            blocking_timeout_millisecondsElement.addText(XMLConversionHelper
+                    .readElementValue(blocking_timeout_millisecondsElement_jboss));
+        } else {
+            blocking_timeout_millisecondsElement.addText("5000");
+        }
+        if (XMLConversionHelper
+                .containSubElement(local_tx_datasurceElement, "idle-timeout-minutes")) {
+            Element idle_timeout_minutesElement_jboss = XMLConversionHelper.obtainSubElement(
+                    local_tx_datasurceElement, "idle-timeout-minutes");
+            idle_timeout_minutesElement.addText(XMLConversionHelper
+                    .readElementValue(idle_timeout_minutesElement_jboss));
+        } else {
+            idle_timeout_minutesElement.addText("30");
+        }
+        single_poolElement.add(max_sizeElement);
+        single_poolElement.add(min_sizeElement);
+        single_poolElement.add(blocking_timeout_millisecondsElement);
+        single_poolElement.add(idle_timeout_minutesElement);
+        single_poolElement.add(match_oneElement);
+        connectionmanagerElement.add(local_transactionElement);
+        connectionmanagerElement.add(single_poolElement);
+        return connectionmanagerElement;
+    }
+
+    /**
+     * create the dependencies element by refering the driver class string
+     * 
+     * @param driver_class
+     * @return dependencies element
+     */
+    private Element createDependenciesElement(String driver_class, Namespace environmentNamespace) {
+        String id_combination = null;
+        String groupId = null;
+        String artifactId = null;
+        logger.debug("The input driver class to the Dependancy element : " + driver_class);
+        HashMap driverMap = XMLConversionHelper.createDriverStoreHashMap();
+        // if the driver is already in the driver map or else
+        if (driverMap.containsKey(driver_class)) {
+            id_combination = (String) driverMap.get(driver_class);
+        } else {
+            id_combination = XMLConversionHelper
+                    .createIdConbinationWhenDriverMapRetrnsEmpty(driver_class);
+        }
+        groupId = id_combination.substring(0, id_combination.indexOf("/"));
+        artifactId = id_combination.substring(id_combination.indexOf("/") + 1, id_combination
+                .length());
+        QName groupIdQName = new QName("groupId", environmentNamespace);
+        Element groupIdElement = DocumentHelper.createElement(groupIdQName);
+        groupIdElement.addText(groupId);
+        QName artifactIdQName = new QName("artifactId", environmentNamespace);
+        Element artifactIdElement = DocumentHelper.createElement(artifactIdQName);
+        artifactIdElement.addText(artifactId);
+        QName typeQName = new QName("type", environmentNamespace);
+        Element typeElement = DocumentHelper.createElement(typeQName);
+        typeElement.addText("jar");
+        QName dependenciesQName = new QName("dependencies", environmentNamespace);
+        Element dependenciesElement = DocumentHelper.createElement(dependenciesQName);
+        QName dependencyQName = new QName("dependency", environmentNamespace);
+        Element dependencyElement = DocumentHelper.createElement(dependencyQName);
+        dependencyElement.add(groupIdElement);
+        dependencyElement.add(artifactIdElement);
+        dependencyElement.add(typeElement);
+        dependenciesElement.add(dependencyElement);
+        return dependenciesElement;
+    }
+
+    /**
+     * creates the default connection manager element
+     * 
+     * @param environmentNamespace
+     * @return the connection manager element
+     */
+    public Element createDefaultConnectionManagerElement(Namespace environmentNamespace) {
+        Element connectionmanagerElement = DocumentHelper.createElement(new QName(
+                "connectionmanager", environmentNamespace));
+        Element local_transactionElement = DocumentHelper.createElement(new QName(
+                "local-transaction", environmentNamespace));
+        Element single_poolElement = DocumentHelper.createElement(new QName("single-pool",
+                environmentNamespace));
+        Element max_sizeElement = DocumentHelper.createElement(new QName("max-size",
+                environmentNamespace));
+        Element min_sizeElement = DocumentHelper.createElement(new QName("min-size",
+                environmentNamespace));
+        Element blocking_timeout_millisecondsElement = DocumentHelper.createElement(new QName(
+                "blocking-timeout-milliseconds", environmentNamespace));
+        Element idle_timeout_minutesElement = DocumentHelper.createElement(new QName(
+                "idle-timeout-minutes", environmentNamespace));
+        Element match_oneElement = DocumentHelper.createElement(new QName("match-one",
+                environmentNamespace));
+        max_sizeElement.addText("10");
+        min_sizeElement.addText("0");
+        blocking_timeout_millisecondsElement.addText("5000");
+        idle_timeout_minutesElement.addText("30");
+        single_poolElement.add(max_sizeElement);
+        single_poolElement.add(min_sizeElement);
+        single_poolElement.add(blocking_timeout_millisecondsElement);
+        single_poolElement.add(idle_timeout_minutesElement);
+        single_poolElement.add(match_oneElement);
+        connectionmanagerElement.add(local_transactionElement);
+        connectionmanagerElement.add(single_poolElement);
+        return connectionmanagerElement;
+    }
+
+    /**
+     * retuns true if any of the elements were found on JBoss side
+     * 
+     * @param local_tx_datasurceElement
+     * @return status
+     */
+    private boolean checkForConnectionMangerDetails(Element local_tx_datasurceElement) {
+        if (XMLConversionHelper.containSubElement(local_tx_datasurceElement, "min-pool-size")
+                || XMLConversionHelper
+                        .containSubElement(local_tx_datasurceElement, "max-pool-size")
+                || XMLConversionHelper.containSubElement(local_tx_datasurceElement,
+                        "idle-timeout-minutes")
+                || XMLConversionHelper.containSubElement(local_tx_datasurceElement,
+                        "blocking-timeout-milliseconds")) {
+            return true;
+        }
+        return false;
+    }
+
+}

Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/datasource/DSResourcesTool.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/jms/JMSResourcesTool.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/jms/JMSResourcesTool.java?rev=582931&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/jms/JMSResourcesTool.java (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/jms/JMSResourcesTool.java Mon Oct  8 11:50:05 2007
@@ -0,0 +1,496 @@
+/**
+ *  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.resources.jms;
+
+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.IFileMigration;
+import org.apache.geronimo.devtools.j2g.common.IOutput;
+import org.apache.geronimo.devtools.j2g.common.Tool;
+import org.apache.geronimo.devtools.j2g.util.resources.Constants;
+import org.apache.geronimo.devtools.j2g.util.resources.xml.XMLConversionHelper;
+import org.dom4j.Attribute;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.DocumentHelper;
+import org.dom4j.Element;
+import org.dom4j.Namespace;
+import org.dom4j.QName;
+
+/**
+ * Class which implement the JMS Source File Migration 
+ */
+public class JMSResourcesTool implements IFileMigration {
+
+    // Initialization of the IOutput for JMSResourcesTool class
+    IOutput out = Tool.getCurrent().getOutput();
+    // Initialization of the logger for JMSResourcesTool class
+    Log logger = LogFactory.getLog(JMSResourcesTool.class);
+
+    /**
+     * mgration method from jms jboss discripters to geronimo discriptors
+     * 
+     * @param sourceFile :
+     *            jms jboss discriptor file
+     * @return status of the migration
+     */
+    public boolean migrate(File sourceFile, File rootDirectory) {
+        // read any *-servise files and then migrate that to the geronimo jms
+        // resources
+        boolean migrated = false;
+            String directoryName = sourceFile.getParent();
+            String jbossJMSFileName = sourceFile.getName();
+            logger.debug("JMS resources Directory Name ==> " + directoryName);
+            logger.debug("jboss jms file Name ==> " + jbossJMSFileName);
+            // Checking wether file is a valid jbossmq-destinations-service.xml
+            // file
+            if (jbossJMSFileName.equals(Constants.JBOSS_VALID_JMS_DESTINATIONS_SERVICES_XML_FILE)) {
+                logger.debug("Searching for jboss-ds.xml file inside the current directory");
+                if (XMLConversionHelper.isFileExists(directoryName,
+                        Constants.JBOSS_VALID_JMS_CONNECTION_FACTORY_XML_FILE)) {
+                    logger.debug("jboss jms connection factory xml file Name ==> "
+                            + Constants.JBOSS_VALID_JMS_CONNECTION_FACTORY_XML_FILE);
+                    File jbossJMSDestinationServicesFile = new File(directoryName,
+                            Constants.JBOSS_VALID_JMS_CONNECTION_FACTORY_XML_FILE);
+                    logger.debug("Converting Jboss jms files in " + directoryName);
+                    try {
+                        Document jbossJMSConnectioFactoryDocument = null;
+                        try{
+                        jbossJMSConnectioFactoryDocument = XMLConversionHelper
+                                .getJbossDocument(jbossJMSDestinationServicesFile);
+                        } catch (DocumentException e){
+                        	out.error(JMSResourcesTool.class.getSimpleName(), "Error occured while reading xml descriptor "
+            						+ jbossJMSDestinationServicesFile.getAbsolutePath()
+            						+ ". It is possible that the migrator cannot download the xml schema or the xml file has incorrect syntax. Nested exception:"
+            						+ e.getMessage());
+                        	throw e;
+                        }
+                        Document jbossJMSDestinationServicesDocument = null;
+                        try {
+                        	jbossJMSDestinationServicesDocument = XMLConversionHelper
+                                .getJbossDocument(sourceFile);
+                        } catch(DocumentException e){
+                        	out.error(JMSResourcesTool.class.getSimpleName(), "Error occured while reading xml descriptor "
+            						+ sourceFile.getAbsolutePath()
+            						+ ". It is possible that the migrator cannot download the xml schema or the xml file has incorrect syntax. Nested exception:"
+            						+ e.getMessage());
+                        	throw e;
+                        }
+                        Document geronimoDocument = migrationFromJboss2Geronimo(
+                                jbossJMSDestinationServicesDocument.getRootElement(),
+                                jbossJMSConnectioFactoryDocument.getRootElement());
+                        String geronimoJMSFileName = directoryName + File.separator
+                                + Constants.GERONIMO_JMS_PLAN_FILE;
+                        // check whether the file already exists if so
+                        // back up that and save that or check the req
+                        // This was done at the upper level of the tool
+                        XMLConversionHelper.saveGeronimoDocument(geronimoJMSFileName,
+                                geronimoDocument);
+                        migrated = true;
+                        out.info(JMSResourcesTool.class.getSimpleName(), "The JMS Resource File Migration Complete !!!\n");
+                    } catch(DocumentException ignore){
+                    } catch (IOException e) {
+                        out.error(JMSResourcesTool.class.getSimpleName(), "IO exception " + e.getMessage());
+                    }
+                } else {
+                    out.error(JMSResourcesTool.class.getSimpleName(), "Inorder to continue the JMS Resources Tool the "
+                            + Constants.JBOSS_VALID_JMS_CONNECTION_FACTORY_XML_FILE
+                            + " needs to be present in the working directory ");
+                }
+            }
+
+        return migrated;
+    }
+
+    /**
+     * Accepts the jboss side Elements that holdes the discripter infomation and
+     * return the geronimo discripter
+     * 
+     * @param jbossJMSDestinationServicesElement
+     * @param jbossJMSConnectioFactoryElement
+     * @return created geronimo Document
+     */
+    private Document migrationFromJboss2Geronimo(Element jbossJMSDestinationServicesElement,
+            Element jbossJMSConnectioFactoryElement) {
+        Document newGeronimoDocument = null;
+        if (XMLConversionHelper.containSubElement(jbossJMSConnectioFactoryElement,
+                "tx-connection-factory")) {
+            Element tx_connection_factoryElement = XMLConversionHelper.obtainSubElement(
+                    jbossJMSConnectioFactoryElement, "tx-connection-factory");
+            Element jndi_nameElement = XMLConversionHelper.obtainSubElement(
+                    tx_connection_factoryElement, "jndi-name");
+            String jndi_nameString = jndi_nameElement.getText();
+            Document geronimoDocument = XMLConversionHelper.createNewGeronimoDocument(
+                    Constants.NAMESPACE_CONNECTOR, "connector", Constants.JMS_RESOURCE_TOOL,
+                    jndi_nameString, Constants.NAMESPACE_ENV);
+            newGeronimoDocument = addResourceAdapterElement(geronimoDocument,
+                    jbossJMSDestinationServicesElement, jbossJMSConnectioFactoryElement);
+
+        } else {
+            out
+               .error(JMSResourcesTool.class.getSimpleName(), "The supplied jboss-ds.xml file does not contain the nessesary tx-connection-factory details");
+        }
+        return newGeronimoDocument;
+    }
+
+    /**
+     * Add the resource adapter element to the geronimodocument
+     * 
+     * @param geronimoDocument
+     * @param jbossJMSDestinationServicesElement
+     * @param jbossJMSConnectioFactoryElement
+     * @return geronimo document with added resource adapter
+     */
+    private Document addResourceAdapterElement(Document geronimoDocument,
+            Element jbossJMSDestinationServicesElement, Element jbossJMSConnectioFactoryElement) {
+        Namespace rootNamespace = geronimoDocument.getRootElement().getNamespace();
+        Element resourceAdapterElement = DocumentHelper.createElement(new QName("resourceadapter",
+                rootNamespace));
+        Element resourceAdapter_instanceElement = DocumentHelper.createElement(new QName(
+                "resourceadapter-instance", rootNamespace));
+        Element resourceAdapter_nameElement = DocumentHelper.createElement(new QName(
+                "resourceadapter-name", rootNamespace));
+        Element tx_connection_factoryElement = XMLConversionHelper.obtainSubElement(
+                jbossJMSConnectioFactoryElement, "tx-connection-factory");
+        if (XMLConversionHelper.containSubElementWithAttribute(tx_connection_factoryElement,
+                "config-property", "name", "JmsProviderAdapterJNDI")) {
+            Element config_propertyElement = XMLConversionHelper.obtainSubElementWithAttribute(
+                    tx_connection_factoryElement, "config-property", "name",
+                    "JmsProviderAdapterJNDI");
+            String name = XMLConversionHelper.obtainNameFromJNDINAME(config_propertyElement
+                    .getText());
+            resourceAdapter_nameElement.addText(name);
+        } else {
+            resourceAdapter_nameElement.addText("MY JMS Resource");
+        }
+        resourceAdapter_instanceElement.add(resourceAdapter_nameElement);
+        resourceAdapter_instanceElement.add(XMLConversionHelper.createSiblingWithAttrib(
+                "config-property-setting", "tcp://localhost:61616", "name", "ServerURL",
+                rootNamespace));
+        resourceAdapter_instanceElement.add(XMLConversionHelper.createSiblingWithAttrib(
+                "config-property-setting", "geronimo", "name", "UserName", rootNamespace));
+        resourceAdapter_instanceElement.add(XMLConversionHelper.createSiblingWithAttrib(
+                "config-property-setting", "geronimo", "name", "Password", rootNamespace));
+        Namespace namingNamespace = new Namespace("naming", Constants.NAMESPACE_GERONIMO_NAMING);
+        Element workmanagerElement = DocumentHelper.createElement(new QName("workmanager",
+                namingNamespace));
+        workmanagerElement.add(XMLConversionHelper.createSibling("gbean-link",
+                "DefaultWorkManager", namingNamespace));
+        resourceAdapter_instanceElement.add(workmanagerElement);
+        resourceAdapterElement.add(resourceAdapter_instanceElement);
+        //Add outboundresource adapters and adminobjects (check what are
+        // the mapping that exist for those things)
+        Element outboundresourceElement = addOutBoundResourcesAdapterElement(geronimoDocument,
+                jbossJMSDestinationServicesElement, jbossJMSConnectioFactoryElement);
+        resourceAdapterElement.add(outboundresourceElement);
+        geronimoDocument.getRootElement().add(resourceAdapterElement);
+        geronimoDocument = addAdminObjectElement(geronimoDocument,
+                jbossJMSDestinationServicesElement, jbossJMSConnectioFactoryElement);
+        return geronimoDocument;
+    }
+
+    /**
+     * Add the outbound resource adapter to the geronimo document
+     * 
+     * @param geronimoDocument
+     * @param jbossJMSDestinationServicesElement
+     * @param jbossJMSConnectioFactoryElement
+     * @return geronimo document with the added outbound resource adapter
+     */
+    private Element addOutBoundResourcesAdapterElement(Document geronimoDocument,
+            Element jbossJMSDestinationServicesElement, Element jbossJMSConnectioFactoryElement) {
+        Namespace rootNamespace = geronimoDocument.getRootElement().getNamespace();
+        Element outbound_resourceAdapterElement = DocumentHelper.createElement(new QName(
+                "outbound-resourceadapter", rootNamespace));
+        Element connection_definitionElement = DocumentHelper.createElement(new QName(
+                "connection-definition", rootNamespace));
+        Element connectionfactory_interfaceElement = DocumentHelper.createElement(new QName(
+                "connectionfactory-interface", rootNamespace));
+        connectionfactory_interfaceElement.addText("javax.jms.ConnectionFactory");
+        Element connectiondefinition_instanceElement = DocumentHelper.createElement(new QName(
+                "connectiondefinition-instance", rootNamespace));
+        connectiondefinition_instanceElement.add(XMLConversionHelper.createSibling("name",
+                "MyConnectionFactory", rootNamespace));
+        connectiondefinition_instanceElement.add(XMLConversionHelper.createSibling(
+                "implemented-interface", "javax.jms.QueueConnectionFactory", rootNamespace));
+        connectiondefinition_instanceElement.add(XMLConversionHelper.createSibling(
+                "implemented-interface", "javax.jms.TopicConnectionFactory", rootNamespace));
+        Element tx_connection_factoryElement = XMLConversionHelper.obtainSubElement(
+                jbossJMSConnectioFactoryElement, "tx-connection-factory");
+        if (checkConnectionMangerDetailsExistsInJboss(tx_connection_factoryElement)) {
+            connectiondefinition_instanceElement.add(connectionMangerDetailsExistsInJboss(
+                    tx_connection_factoryElement, rootNamespace));
+        } else {
+            connectiondefinition_instanceElement
+                    .add(createDefaultConnectionManagerElement(rootNamespace));
+        }
+        connection_definitionElement.add(connectionfactory_interfaceElement);
+        connection_definitionElement.add(connectiondefinition_instanceElement);
+        outbound_resourceAdapterElement.add(connection_definitionElement);
+        return outbound_resourceAdapterElement;
+    }
+
+    /**
+     * add the admin objects to the currently existing geronimo document
+     * 
+     * @param geronimoDocument
+     * @param jbossJMSDestinationServicesElement
+     * @param jbossJMSConnectioFactoryElement
+     * @return return the geronimo document which contains the admin objects
+     */
+    private Document addAdminObjectElement(Document geronimoDocument,
+            Element jbossJMSDestinationServicesElement, Element jbossJMSConnectioFactoryElement) {
+
+        Iterator elementIterator = jbossJMSDestinationServicesElement.elementIterator();
+        while (elementIterator.hasNext()) {
+            Element itElement = (Element) elementIterator.next();
+            if (itElement.getName().equals("mbean")) {
+                String queueOrTopic = null;
+                String queueOrTopicName = null;
+                String newQueueOrTopicName = null;
+                Iterator attribIterator = itElement.attributeIterator();
+                while (attribIterator.hasNext()) {
+                    Attribute itAttribute = (Attribute) attribIterator.next();
+                    if (itAttribute.getName().equals("code")) {
+                        if (itAttribute.getData().equals(Constants.TOPIC_CLASS_JBOSS)) {
+                            queueOrTopic = "topic";
+                        }
+                        if (itAttribute.getData().equals(Constants.QUEUE_CLASS_JBOSS)) {
+                            queueOrTopic = "queue";
+                        }
+                    } else if (itAttribute.getName().equals("name")) {
+                        queueOrTopicName = (String) itAttribute.getData();
+                        newQueueOrTopicName = queueOrTopicName.substring(queueOrTopicName
+                                .indexOf("name=") + 5, queueOrTopicName.length());
+                    }
+                }
+                if (queueOrTopic.equals("queue")) {
+                    geronimoDocument = addTopicElement(geronimoDocument, newQueueOrTopicName);
+                }
+                if (queueOrTopic.equals("topic")) {
+                    geronimoDocument = addQueueElement(geronimoDocument, newQueueOrTopicName);
+                }
+                boolean securityCheck = checkForSecurityConfIndideMBeanElement(itElement);
+                if (securityCheck) {
+                    logger
+                            .warn("destination JBoss descriptor has the SecurityConf attribute inside the MBean Element "
+                                    + "which are decoded");
+                }
+            }
+        }
+        return geronimoDocument;
+    }
+
+    /**
+     * check wether the passed mbean element have any security configuration
+     * details
+     * 
+     * @param itElement
+     *            passesd mbean element
+     * @return boolean wether contains or not
+     */
+    private boolean checkForSecurityConfIndideMBeanElement(Element itElement) {
+        return XMLConversionHelper.containSubElementWithAttribute(itElement, "attribute", "name",
+                "SecurityConf");
+    }
+
+    /**
+     * add the topic element to the existing geronimo document
+     * 
+     * @param geronimoDocument
+     * @param jbossJMSDestinationServicesElement
+     * @param jbossJMSConnectioFactoryElement
+     * @return geronimo document with the topic element added as a admin object
+     */
+    private Document addTopicElement(Document geronimoDocument, String topicName) {
+        Namespace rootNamespace = geronimoDocument.getRootElement().getNamespace();
+        Element adminobjectElement = DocumentHelper.createElement(new QName("adminobject",
+                rootNamespace));
+        adminobjectElement.add(XMLConversionHelper.createSibling("adminobject-interface",
+                "javax.jms.Topic", rootNamespace));
+        adminobjectElement.add(XMLConversionHelper.createSibling("adminobject-class",
+                "org.activemq.message.ActiveMQTopic", rootNamespace));
+        Element adminobject_instanceElement = DocumentHelper.createElement(new QName(
+                "adminobject-instance", rootNamespace));
+        adminobject_instanceElement.add(XMLConversionHelper.createSibling(
+                "message-destination-name", topicName, rootNamespace));
+        adminobject_instanceElement.add(XMLConversionHelper.createSiblingWithAttrib(
+                "config-property-setting", " Mytopic", "name", "PhysicalName", rootNamespace));
+        adminobjectElement.add(adminobject_instanceElement);
+        geronimoDocument.getRootElement().add(adminobjectElement);
+        return geronimoDocument;
+    }
+
+    /**
+     * add queue elament to the geronimo existing document
+     * 
+     * @param geronimoDocument
+     * @param jbossJMSDestinationServicesElement
+     * @param jbossJMSConnectioFactoryElement
+     * @return the geronimo document by adding the Queue as a admin object
+     */
+    private Document addQueueElement(Document geronimoDocument, String queueName) {
+        Namespace rootNamespace = geronimoDocument.getRootElement().getNamespace();
+        Element adminobjectElement = DocumentHelper.createElement(new QName("adminobject",
+                rootNamespace));
+        adminobjectElement.add(XMLConversionHelper.createSibling("adminobject-interface",
+                "javax.jms.Queue", rootNamespace));
+        adminobjectElement.add(XMLConversionHelper.createSibling("adminobject-class",
+                "org.activemq.message.ActiveMQTopic", rootNamespace));
+        Element adminobject_instanceElement = DocumentHelper.createElement(new QName(
+                "adminobject-instance", rootNamespace));
+        adminobject_instanceElement.add(XMLConversionHelper.createSibling(
+                "message-destination-name", queueName, rootNamespace));
+        adminobject_instanceElement.add(XMLConversionHelper.createSiblingWithAttrib(
+                "config-property-setting", " MyQueue", "name", "PhysicalName", rootNamespace));
+        adminobjectElement.add(adminobject_instanceElement);
+        geronimoDocument.getRootElement().add(adminobjectElement);
+        return geronimoDocument;
+    }
+
+    /**
+     * Creates a default connection manager elements with the defaults values
+     * 
+     * @param environmentNamespace
+     * @return default commection manager elament
+     */
+    public Element createDefaultConnectionManagerElement(Namespace environmentNamespace) {
+        Element connectionmanagerElement = DocumentHelper.createElement(new QName(
+                "connectionmanager", environmentNamespace));
+        Element local_transactionElement = DocumentHelper.createElement(new QName(
+                "local-transaction", environmentNamespace));
+        Element single_poolElement = DocumentHelper.createElement(new QName("single-pool",
+                environmentNamespace));
+        Element max_sizeElement = DocumentHelper.createElement(new QName("max-size",
+                environmentNamespace));
+        Element min_sizeElement = DocumentHelper.createElement(new QName("min-size",
+                environmentNamespace));
+        Element blocking_timeout_millisecondsElement = DocumentHelper.createElement(new QName(
+                "blocking-timeout-milliseconds", environmentNamespace));
+        Element idle_timeout_minutesElement = DocumentHelper.createElement(new QName(
+                "idle-timeout-minutes", environmentNamespace));
+        Element match_oneElement = DocumentHelper.createElement(new QName("match-one",
+                environmentNamespace));
+        max_sizeElement.addText("10");
+        min_sizeElement.addText("0");
+        blocking_timeout_millisecondsElement.addText("5000");
+        idle_timeout_minutesElement.addText("30");
+        single_poolElement.add(max_sizeElement);
+        single_poolElement.add(min_sizeElement);
+        single_poolElement.add(blocking_timeout_millisecondsElement);
+        single_poolElement.add(idle_timeout_minutesElement);
+        single_poolElement.add(match_oneElement);
+        connectionmanagerElement.add(local_transactionElement);
+        connectionmanagerElement.add(single_poolElement);
+        return connectionmanagerElement;
+    }
+
+    /**
+     * check wether the connection manager details are there at the jboss side
+     * 
+     * @param jbossJMSConnectioFactoryElement
+     * @return boolean check of the existance
+     */
+    private boolean checkConnectionMangerDetailsExistsInJboss(Element tx_connection_factoryElement) {
+        boolean check = false;
+        if (XMLConversionHelper.containSubElement(tx_connection_factoryElement, "min-pool-size")) {
+            check = true;
+        }
+        if (XMLConversionHelper.containSubElement(tx_connection_factoryElement, "max-pool-size")) {
+            check = true;
+        }
+        if (XMLConversionHelper.containSubElement(tx_connection_factoryElement,
+                "blocking-timeout-millis")) {
+            check = true;
+        }
+        if (XMLConversionHelper.containSubElement(tx_connection_factoryElement,
+                "idle-timeout-minutes")) {
+            check = true;
+        }
+        return check;
+    }
+
+    /**
+     * this method created the connection manager element refering the existing
+     * elements at the jboss side
+     * 
+     * @param jbossJMSConnectioFactoryElement
+     * @return connectionMangerElement
+     */
+    private Element connectionMangerDetailsExistsInJboss(Element tx_connection_factoryElement,
+            Namespace environmentNamespace) {
+        Element connectionmanagerElement = DocumentHelper.createElement(new QName(
+                "connectionmanager", environmentNamespace));
+        Element local_transactionElement = DocumentHelper.createElement(new QName(
+                "local-transaction", environmentNamespace));
+        Element single_poolElement = DocumentHelper.createElement(new QName("single-pool",
+                environmentNamespace));
+        Element max_sizeElement = DocumentHelper.createElement(new QName("max-size",
+                environmentNamespace));
+        Element min_sizeElement = DocumentHelper.createElement(new QName("min-size",
+                environmentNamespace));
+        Element blocking_timeout_millisecondsElement = DocumentHelper.createElement(new QName(
+                "blocking-timeout-milliseconds", environmentNamespace));
+        Element idle_timeout_minutesElement = DocumentHelper.createElement(new QName(
+                "idle-timeout-minutes", environmentNamespace));
+        Element match_oneElement = DocumentHelper.createElement(new QName("match-one",
+                environmentNamespace));
+        if (XMLConversionHelper.containSubElement(tx_connection_factoryElement, "max-pool-size")) {
+            String value = XMLConversionHelper.obtainSubElement(tx_connection_factoryElement,
+                    "max-pool-size").getText();
+            max_sizeElement.addText(value);
+        } else {
+            max_sizeElement.addText("10");
+        }
+        if (XMLConversionHelper.containSubElement(tx_connection_factoryElement, "min-pool-size")) {
+            String value = XMLConversionHelper.obtainSubElement(tx_connection_factoryElement,
+                    "min-pool-size").getText();
+            min_sizeElement.addText(value);
+        } else {
+            min_sizeElement.addText("0");
+        }
+        if (XMLConversionHelper.containSubElement(tx_connection_factoryElement,
+                "blocking-timeout-millis")) {
+            String value = XMLConversionHelper.obtainSubElement(tx_connection_factoryElement,
+                    "blocking-timeout-millis").getText();
+            blocking_timeout_millisecondsElement.addText(value);
+        } else {
+            blocking_timeout_millisecondsElement.addText("5000");
+        }
+        if (XMLConversionHelper.containSubElement(tx_connection_factoryElement,
+                "idle-timeout-minutes")) {
+            String value = XMLConversionHelper.obtainSubElement(tx_connection_factoryElement,
+                    "idle-timeout-minutes").getText();
+            idle_timeout_minutesElement.addText(value);
+        } else {
+            idle_timeout_minutesElement.addText("30");
+        }
+        single_poolElement.add(max_sizeElement);
+        single_poolElement.add(min_sizeElement);
+        single_poolElement.add(blocking_timeout_millisecondsElement);
+        single_poolElement.add(idle_timeout_minutesElement);
+        single_poolElement.add(match_oneElement);
+        connectionmanagerElement.add(local_transactionElement);
+        connectionmanagerElement.add(single_poolElement);
+        return connectionmanagerElement;
+    }
+
+}

Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/jms/JMSResourcesTool.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/mail/MailResourcesTool.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/mail/MailResourcesTool.java?rev=582931&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/mail/MailResourcesTool.java (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/mail/MailResourcesTool.java Mon Oct  8 11:50:05 2007
@@ -0,0 +1,174 @@
+/**
+ *  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.resources.mail;
+
+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.IFileMigration;
+import org.apache.geronimo.devtools.j2g.common.IOutput;
+import org.apache.geronimo.devtools.j2g.common.Tool;
+import org.apache.geronimo.devtools.j2g.util.resources.Constants;
+import org.apache.geronimo.devtools.j2g.util.resources.xml.XMLConversionHelper;
+import org.dom4j.Attribute;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.DocumentHelper;
+import org.dom4j.Element;
+import org.dom4j.Namespace;
+import org.dom4j.QName;
+ 
+/**
+ * Class which implement the Mail Source File Migration 
+ */
+public class MailResourcesTool implements IFileMigration {
+
+    // Initialization of the IOutput for MailResourcesTool class
+    IOutput out = Tool.getCurrent().getOutput();
+    // Initialization of the logger for MailResourcesTool class
+    Log logger = LogFactory.getLog(MailResourcesTool.class);
+    
+    /**
+     * mgration method from jms jboss discripters to geronimo discriptors
+     * 
+     * @param sourceFile :jms jboss d"iscriptor file
+     * @return status of the migration
+     */
+    public boolean migrate(File sourceFile, File rootDirectory) {
+        boolean migrated = false;
+            String directoryName = sourceFile.getParent();
+            String mailFilename = sourceFile.getName();
+            logger.debug("Directory Name ==> " + directoryName
+                    + " jboss mail source file Name ==> " + mailFilename);
+            if (mailFilename.equals(Constants.JBOSS_VALID_MAIL_XML_FILE)) {
+                out.info(MailResourcesTool.class.getSimpleName(), "Converting Jboss mail xml file in " + directoryName);
+                try {
+                    Document jbossDocument = XMLConversionHelper.getJbossDocument(sourceFile);
+                    // check the existance of the plain password
+                    // authentication in the jboss RootElement
+                    if (XMLConversionHelper.containSubElementWithAttribute(XMLConversionHelper
+                            .obtainSubElement(jbossDocument.getRootElement(), "mbean"),
+                            "attribute", "name", "Password")) {
+                        out
+                           .error(MailResourcesTool.class.getSimpleName(), "The mail descripter file "
+                                   + mailFilename
+                                   + " contains the plain text password authentication, Aborting the Process !!!");
+                    } else {
+                        Document geronimoDocument = migrationFromJboss2Geronimo(jbossDocument
+                                .getRootElement());
+                        String geronimoMailFileName = directoryName + File.separator
+                                + Constants.GERONIMO_MAIL_PLAN_FILE;
+                        // check whether the file already exists if so
+                        // back up that and save that or check the req
+                        // This being done at upper level
+                        XMLConversionHelper.saveGeronimoDocument(geronimoMailFileName,
+                                geronimoDocument);
+                        migrated = true;
+                        out.info(MailResourcesTool.class.getSimpleName(), "The Mail Resource File Migration Complete!!!\n");
+                    }
+                } catch (DocumentException e) {
+                	out.error(MailResourcesTool.class.getSimpleName(), "Error occured while reading xml descriptor "
+    						+ sourceFile.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(MailResourcesTool.class.getSimpleName(), "IO exception " + e.getMessage());
+                }
+            }
+        return migrated;
+    }
+
+    /**
+     * Accepts the jboss side Elements that holdes the discripter infomation and
+     * return the geronimo discripter
+     * 
+     * @param jbossRootElement
+     * @return geronimo plan
+     */
+    private Document migrationFromJboss2Geronimo(Element jbossRootElement) {
+        Element gbeanElament = XMLConversionHelper.obtainSubElement(jbossRootElement, "mbean");
+        Element jbossAttributeElement = XMLConversionHelper.obtainSubElementWithAttribute(
+                gbeanElament, "attribute", "name", "JNDIName");
+        Document geronimoDocument = XMLConversionHelper.createNewGeronimoDocument(
+                Constants.NAMESPACE_ENV, "module", Constants.MAIL_RESOURCE_TOOL,
+                jbossAttributeElement.getStringValue(), "");
+        Document newGeronimoDocument = createMailGBean(geronimoDocument, jbossRootElement);
+        return newGeronimoDocument;
+    }
+
+    /**
+     * create the MailGBean element by refering the jboss side mbean elaments
+     * 
+     * @param geronimoDocument
+     * @param jbossRootElement
+     * @return the MailGbean element
+     */
+    private Document createMailGBean(Document geronimoDocument, Element jbossRootElement) {
+        Namespace rootNamespace = geronimoDocument.getRootElement().getNamespace();
+        Element gbeanElement = DocumentHelper.createElement(new QName("gbean", rootNamespace));
+        gbeanElement.add(DocumentHelper.createAttribute(gbeanElement, "name", "mailSession"));
+        gbeanElement.add(DocumentHelper.createAttribute(gbeanElement, "class",
+                "org.apache.geronimo.mail.MailGBean"));
+        Element attributeElement = DocumentHelper.createElement(new QName("attribute",
+                rootNamespace));
+        attributeElement.add(DocumentHelper.createAttribute(gbeanElement, "name", "properties"));
+        Element gbeanElament = XMLConversionHelper.obtainSubElement(jbossRootElement, "mbean");
+        Element jbossAttributeElement = XMLConversionHelper.obtainSubElementWithAttribute(
+                gbeanElament, "attribute", "name", "Configuration");
+        Element configurationelement = XMLConversionHelper.obtainSubElement(jbossAttributeElement,
+                "configuration");
+        attributeElement.add(DocumentHelper
+                .createCDATA(obtainMailConfigurationString(configurationelement)));
+//                .createText(obtainMailConfigurationString(configurationelement)));
+        gbeanElement.add(attributeElement);
+        geronimoDocument.getRootElement().add(gbeanElement);
+        return geronimoDocument;
+    }
+
+    /**
+     * obtain the mail configuration elemant from the configuration element
+     * 
+     * @param configurationElement
+     * @return sring of mail configuration
+     */
+    private String obtainMailConfigurationString(Element configurationElement) {
+        Iterator elementIterator = configurationElement.elementIterator();
+        String configurationString = "";
+        String name = null;
+        String value = null;
+        while (elementIterator.hasNext()) {
+            Element itElement = (Element) elementIterator.next();
+            if (itElement.getName().equals("property")) {
+                Iterator attribIterator = itElement.attributeIterator();
+                while (attribIterator.hasNext()) {
+                    Attribute itAttribute = (Attribute) attribIterator.next();
+                    if (itAttribute.getName().equals("name")) {
+                        name = itAttribute.getText();
+                    } else if (itAttribute.getName().equals("value")) {
+                        value = itAttribute.getText();
+                    }
+                }
+                configurationString += ("\r\n" + name + "=" + value );
+            }
+        }
+        return configurationString;
+    }
+
+}

Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.resources/src/org/apache/geronimo/devtools/j2g/resources/mail/MailResourcesTool.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message