geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmcma...@apache.org
Subject svn commit: r520023 [7/10] - in /geronimo/sandbox/j2g: ./ bin/ doc/ src/ src/common/ src/common/META-INF/ src/common/src/ src/common/src/org/ src/common/src/org/apache/ src/common/src/org/apache/apps/ src/common/src/org/apache/apps/j2gmigrator/ src/con...
Date Mon, 19 Mar 2007 17:43:49 GMT
Propchange: geronimo/sandbox/j2g/src2/enterprise-migration-plugin/src/org/apache/apps/j2gmigrator/descriptors/app/ApplicationDescriptorTool.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/src2/enterprise-migration-plugin/src/org/apache/apps/j2gmigrator/descriptors/app/ApplicationDescriptorTool.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/src2/enterprise-migration-plugin/src/org/apache/apps/j2gmigrator/descriptors/app/ApplicationDescriptorTool.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/j2g/src2/enterprise-migration-plugin/test-resources/geronimo-application.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/src2/enterprise-migration-plugin/test-resources/geronimo-application.xml?view=auto&rev=520023
==============================================================================
--- geronimo/sandbox/j2g/src2/enterprise-migration-plugin/test-resources/geronimo-application.xml (added)
+++ geronimo/sandbox/j2g/src2/enterprise-migration-plugin/test-resources/geronimo-application.xml Mon Mar 19 10:43:27 2007
@@ -0,0 +1,44 @@
+/**
+ *  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.
+ */
+ <?xml version="1.0" encoding="UTF-8"?>
+
+<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-1.1" xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.1" xmlns:security="http://geronimo.apache.org/xml/ns/security-1.1" xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1">
+  <sys:environment>
+    <sys:moduleId>
+      <sys:groupId>j2g</sys:groupId>
+      <sys:artifactId>application</sys:artifactId>
+      <sys:version>1.0</sys:version>
+      <sys:type>ear</sys:type>
+    </sys:moduleId>
+    <sys:dependencies/>
+  </sys:environment>
+  <security:security>
+    <security:default-principal>
+      <security:realm-principal class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal" name="amila" domain-name="securiyDomain" realm-name="securiyDomain"/>
+    </security:default-principal>
+    <security:role-mappings>
+      <security:role role-name="admin">
+        <security:realm-principal class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal" name="amila" domain-name="securiyDomain" realm-name="securiyDomain"/>
+        <security:realm-principal class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal" name="rasika" domain-name="securiyDomain" realm-name="securiyDomain"/>
+      </security:role>
+      <security:role role-name="manager">
+        <security:realm-principal class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal" name="sandakith" domain-name="securiyDomain" realm-name="securiyDomain"/>
+        <security:realm-principal class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal" name="sris" domain-name="securiyDomain" realm-name="securiyDomain"/>
+      </security:role>
+    </security:role-mappings>
+  </security:security>
+</application>

Propchange: geronimo/sandbox/j2g/src2/enterprise-migration-plugin/test-resources/geronimo-application.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/src2/enterprise-migration-plugin/test-resources/geronimo-application.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/src2/enterprise-migration-plugin/test-resources/geronimo-application.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/sandbox/j2g/src2/enterprise-migration-plugin/test-resources/jboss-app.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/src2/enterprise-migration-plugin/test-resources/jboss-app.xml?view=auto&rev=520023
==============================================================================
--- geronimo/sandbox/j2g/src2/enterprise-migration-plugin/test-resources/jboss-app.xml (added)
+++ geronimo/sandbox/j2g/src2/enterprise-migration-plugin/test-resources/jboss-app.xml Mon Mar 19 10:43:27 2007
@@ -0,0 +1,44 @@
+/**
+ *  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.
+ */
+ <?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE jboss-app
+    PUBLIC "-//JBoss//DTD J2EE Application 1.4//EN"
+    "http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd">
+
+<jboss-app>
+    <security-domain>securiyDomain</security-domain>
+    <unauthenticated-principal>amila</unauthenticated-principal>
+    <jmx-name>messaging</jmx-name>
+    <module>
+        <service>mailservice.sar</service>
+    </module>
+    <module>
+        <har>hibanate.sar</har>
+    </module>
+    <security-role>
+        <role-name>admin</role-name>
+        <principal-name>amila</principal-name>
+        <principal-name>rasika</principal-name>
+    </security-role>
+    <security-role>
+        <role-name>manager</role-name>
+        <principal-name>sandakith</principal-name>
+        <principal-name>sris</principal-name>
+    </security-role>
+
+</jboss-app>
\ No newline at end of file

Propchange: geronimo/sandbox/j2g/src2/enterprise-migration-plugin/test-resources/jboss-app.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/src2/enterprise-migration-plugin/test-resources/jboss-app.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/src2/enterprise-migration-plugin/test-resources/jboss-app.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/sandbox/j2g/src2/enterprise-migration-plugin/test/org/apache/apps/j2gmigrator/descriptors/app/TestApplicationDescriptorTool.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/src2/enterprise-migration-plugin/test/org/apache/apps/j2gmigrator/descriptors/app/TestApplicationDescriptorTool.java?view=auto&rev=520023
==============================================================================
--- geronimo/sandbox/j2g/src2/enterprise-migration-plugin/test/org/apache/apps/j2gmigrator/descriptors/app/TestApplicationDescriptorTool.java (added)
+++ geronimo/sandbox/j2g/src2/enterprise-migration-plugin/test/org/apache/apps/j2gmigrator/descriptors/app/TestApplicationDescriptorTool.java Mon Mar 19 10:43:27 2007
@@ -0,0 +1,43 @@
+/**
+ *  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.apps.j2gmigrator.descriptors.app;
+
+import junit.framework.TestCase;
+
+import java.io.File;
+
+import org.apache.apps.j2gmigrator.descriptors.DescriptorsTool;
+import org.apache.apps.j2gmigrator.descriptors.app.ApplicationDescriptorTool;
+
+
+/**
+ * Author: amila
+ * Date: Aug 31, 2006
+ */
+public class TestApplicationDescriptorTool extends TestCase {
+
+    public void testMigrate() {
+        DescriptorsTool descriptorsTool = new DescriptorsTool();
+        String jbossApplicatinXmlFile = "test-resources/jboss-app.xml";
+        ApplicationDescriptorTool applicationDescriptorTool = new ApplicationDescriptorTool();
+        applicationDescriptorTool.migrate(new File(jbossApplicatinXmlFile));
+
+        System.out.println("Migrated...");
+    }
+
+
+}

Propchange: geronimo/sandbox/j2g/src2/enterprise-migration-plugin/test/org/apache/apps/j2gmigrator/descriptors/app/TestApplicationDescriptorTool.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/src2/enterprise-migration-plugin/test/org/apache/apps/j2gmigrator/descriptors/app/TestApplicationDescriptorTool.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/src2/enterprise-migration-plugin/test/org/apache/apps/j2gmigrator/descriptors/app/TestApplicationDescriptorTool.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/j2g/src2/jms-plugin/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/src2/jms-plugin/META-INF/MANIFEST.MF?view=auto&rev=520023
==============================================================================
--- geronimo/sandbox/j2g/src2/jms-plugin/META-INF/MANIFEST.MF (added)
+++ geronimo/sandbox/j2g/src2/jms-plugin/META-INF/MANIFEST.MF Mon Mar 19 10:43:27 2007
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Jms_plugin Plug-in
+Bundle-SymbolicName: jms_plugin; singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Vendor: ibm
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime,
+ com.ibm.j2g,
+ com.ibm.j2g.resources,
+ com.ibm.j2g.util
+Eclipse-LazyStart: true
+Bundle-ClassPath: .

Added: geronimo/sandbox/j2g/src2/jms-plugin/build.properties
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/src2/jms-plugin/build.properties?view=auto&rev=520023
==============================================================================
--- geronimo/sandbox/j2g/src2/jms-plugin/build.properties (added)
+++ geronimo/sandbox/j2g/src2/jms-plugin/build.properties Mon Mar 19 10:43:27 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.. = classes/
+bin.includes = plugin.xml,\
+               META-INF/,\
+               .,\

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/build.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/build.properties
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/build.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/j2g/src2/jms-plugin/plugin.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/src2/jms-plugin/plugin.xml?view=auto&rev=520023
==============================================================================
--- geronimo/sandbox/j2g/src2/jms-plugin/plugin.xml (added)
+++ geronimo/sandbox/j2g/src2/jms-plugin/plugin.xml Mon Mar 19 10:43:27 2007
@@ -0,0 +1,23 @@
+/**
+ *  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.
+ */
+ <?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+    <extension point="com.ibm.j2g.resources.migrations">
+      	<migration class="com.ibm.j2g.resources.jms.JMSResourcesTool"/>
+   </extension>
+</plugin>

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/plugin.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/plugin.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/plugin.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/sandbox/j2g/src2/jms-plugin/src/commons-logging.properties
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/src2/jms-plugin/src/commons-logging.properties?view=auto&rev=520023
==============================================================================
--- geronimo/sandbox/j2g/src2/jms-plugin/src/commons-logging.properties (added)
+++ geronimo/sandbox/j2g/src2/jms-plugin/src/commons-logging.properties Mon Mar 19 10:43:27 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.
+commons-logging.rootLogger=INFO
+
+#define loggers
+#pluging logger
+lcommons-logging.logger.com.ibm.j2g= DEBUG,console
+
+# console is set to be a ConsoleAppender.
+commons-logging.appender.console=org.apache.log4j.ConsoleAppender
+
+# console uses PatternLayout.
+commons-logging.appender.console.layout=org.apache.log4j.PatternLayout
+#commons-logging.appender.console.layout.ConversionPattern=[%t] %-5p %l - %m%n
+commons-logging.appender.console.layout.ConversionPattern=[%t] %-5p - %m%n
\ No newline at end of file

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/src/commons-logging.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/src/commons-logging.properties
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/src/commons-logging.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/j2g/src2/jms-plugin/src/org/apache/apps/j2gmigrator/resources/jms/JMSResourcesTool.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/src2/jms-plugin/src/org/apache/apps/j2gmigrator/resources/jms/JMSResourcesTool.java?view=auto&rev=520023
==============================================================================
--- geronimo/sandbox/j2g/src2/jms-plugin/src/org/apache/apps/j2gmigrator/resources/jms/JMSResourcesTool.java (added)
+++ geronimo/sandbox/j2g/src2/jms-plugin/src/org/apache/apps/j2gmigrator/resources/jms/JMSResourcesTool.java Mon Mar 19 10:43:27 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.apps.j2gmigrator.resources.jms;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+
+import org.apache.apps.j2gmigrator.IFileMigration;
+import org.apache.apps.j2gmigrator.IOutput;
+import org.apache.apps.j2gmigrator.Tool;
+import org.apache.apps.j2gmigrator.resources.utils.Constants;
+import org.apache.apps.j2gmigrator.resources.xmlutil.XMLConversionHelper;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+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) {
+        // 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("Errors occurs while reading xml descriptor "
+            						+ jbossJMSDestinationServicesFile.getAbsolutePath()
+            						+ ". It is possible that the migrator cannot download an xml schema or xml file has a wrong syntax. Nested exception:"
+            						+ e.getMessage());
+                        	throw e;
+                        }
+                        Document jbossJMSDestinationServicesDocument = null;
+                        try {
+                        	jbossJMSDestinationServicesDocument = XMLConversionHelper
+                                .getJbossDocument(sourceFile);
+                        } catch(DocumentException e){
+                        	out.error("Errors occurs while reading xml descriptor "
+            						+ sourceFile.getAbsolutePath()
+            						+ ". It is possible that the migrator cannot download an xml schema or xml file has a wrong 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("The JMS Resource File Migration Complete !!!\n");
+                    } catch(DocumentException ignore){
+                    } catch (IOException e) {
+                        out.error("IO exception " + e.getMessage());
+                    }
+                } else {
+                    out.error("Inorder to continue the JMS Resources Tool the "
+                            + Constants.JBOSS_VALID_JMS_CONNECTION_FACTORY_XML_FILE
+                            + " need to present in 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("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/sandbox/j2g/src2/jms-plugin/src/org/apache/apps/j2gmigrator/resources/jms/JMSResourcesTool.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/src/org/apache/apps/j2gmigrator/resources/jms/JMSResourcesTool.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/src/org/apache/apps/j2gmigrator/resources/jms/JMSResourcesTool.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/geronimo-jms-resource-plan.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/geronimo-jms-resource-plan.xml?view=auto&rev=520023
==============================================================================
--- geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/geronimo-jms-resource-plan.xml (added)
+++ geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/geronimo-jms-resource-plan.xml Mon Mar 19 10:43:27 2007
@@ -0,0 +1,127 @@
+/**
+ *  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.
+ */
+ <?xml version="1.0" encoding="UTF-8"?>
+<connector
+    xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.1">
+    <environment
+        xmlns="http://geronimo.apache.org/xml/ns/deployment-1.1">
+        <moduleId>
+            <groupId>console.jms</groupId>
+            <artifactId>SampleResourceGroup</artifactId>
+            <version>1.0</version>
+            <type>rar</type>
+        </moduleId>
+        <dependencies>
+            <dependency>
+                 <groupId>geronimo</groupId>
+                 <artifactId>activemq-broker</artifactId>
+                 <type>car</type>
+            </dependency>
+        </dependencies>
+    </environment>
+  <resourceadapter>
+    <!-- how to connect to the JMS Server -->
+    <resourceadapter-instance>
+      <resourceadapter-name>
+        My JMS Resources
+      </resourceadapter-name>
+      <config-property-setting name="ServerUrl">
+        tcp://localhost:61616
+      </config-property-setting>
+      <config-property-setting name="UserName">
+        geronimo
+      </config-property-setting>
+      <config-property-setting name="Password">
+        geronimo
+      </config-property-setting>
+      <workmanager>
+                               105
+                  JMS Configuration [DRAFT (1.1)]
+      <gbean-link>DefaultWorkManager</gbean-link>
+    </workmanager>
+  </resourceadapter-instance>
+  <!-- defines a ConnectionFactory -->
+  <outbound-resourceadapter>
+    <connection-definition>
+      <connectionfactory-interface>
+        javax.jms.ConnectionFactory
+      </connectionfactory-interface>
+      <connectiondefinition-instance>
+        <name>MyConnectionFactory</name>
+        <implemented-interface>
+          javax.jms.QueueConnectionFactory
+        </implemented-interface>
+        <implemented-interface>
+          javax.jms.TopicConnectionFactory
+        </implemented-interface>
+        <connectionmanager>
+          <xa-transaction>
+            <transaction-caching />
+          </xa-transaction>
+          <single-pool>
+            <max-size>10</max-size>
+            <min-size>0</min-size>
+            <blocking-timeout-milliseconds>
+               5000
+            </blocking-timeout-milliseconds>
+            <idle-timeout-minutes>
+               0
+            </idle-timeout-minutes>
+            <match-one/>
+          </single-pool>
+        </connectionmanager>
+      </connectiondefinition-instance>
+    </connection-definition>
+  </outbound-resourceadapter>
+</resourceadapter>
+<!-- defines a Topic -->
+<adminobject>
+  <adminobject-interface>
+    javax.jms.Topic
+  </adminobject-interface>
+  <adminobject-class>
+    org.activemq.message.ActiveMQTopic
+  </adminobject-class>
+  <adminobject-instance>
+    <message-destination-name>
+      MyTopic
+    </message-destination-name>
+    <config-property-setting name="PhysicalName">
+      MyTopic
+    </config-property-setting>
+  </adminobject-instance>
+</adminobject>
+<!-- defines a Queue -->
+<adminobject>
+  <adminobject-interface>
+    javax.jms.Queue
+  </adminobject-interface>
+  <adminobject-class>
+    org.activemq.message.ActiveMQQueue
+  </adminobject-class>
+  <adminobject-instance>
+    <message-destination-name>
+                               106
+                   JMS Configuration [DRAFT (1.1)]
+        MyQueue
+      </message-destination-name>
+      <config-property-setting name="PhysicalName">
+        MyQueue
+      </config-property-setting>
+    </adminobject-instance>
+  </adminobject>
+</connector>

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/geronimo-jms-resource-plan.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/geronimo-jms-resource-plan.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/geronimo-jms-resource-plan.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/jbossmq-destinations-service.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/jbossmq-destinations-service.xml?view=auto&rev=520023
==============================================================================
--- geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/jbossmq-destinations-service.xml (added)
+++ geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/jbossmq-destinations-service.xml Mon Mar 19 10:43:27 2007
@@ -0,0 +1,111 @@
+/**
+ *  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.
+ */
+ <?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE server
+    PUBLIC "-//JBoss//DTD MBean Service 4.0//EN"
+    "http://www.jboss.org/j2ee/dtd/jboss-service_4_0.dtd">
+
+
+<!-- $Id$ -->
+
+<!-- 
+   | This file defines the default Queues and Topics that JBossMQ
+   | ships with.  The default Queues and Topics are used by the 
+   | JBoss test suite and by the sample jms programs.
+   |
+   | You can add other destinations to this file, or you can create other
+   | *-service.xml files to contain your application's destinations.
+ -->
+
+<server>
+  <!-- Destination without a configured SecurityManager or without a 
+       a SecurityConf will default to role guest with read=true, write=true,
+       create=false.
+  -->
+  <mbean code="org.jboss.mq.server.jmx.Topic"
+	 name="jboss.mq.destination:service=Topic,name=testTopic">
+    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+    <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>
+    <attribute name="SecurityConf">
+      <security>
+        <role name="guest" read="true" write="true"/>
+        <role name="publisher" read="true" write="true" create="false"/>
+        <role name="durpublisher" read="true" write="true" create="true"/>
+      </security>
+    </attribute>
+  </mbean>
+
+  <mbean code="org.jboss.mq.server.jmx.Topic"
+	 name="jboss.mq.destination:service=Topic,name=securedTopic">
+    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+    <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>
+    <attribute name="SecurityConf">
+      <security>
+        <role name="publisher" read="true" write="true" create="false"/>
+      </security>
+    </attribute>
+  </mbean>
+
+  <mbean code="org.jboss.mq.server.jmx.Topic"
+	 name="jboss.mq.destination:service=Topic,name=testDurableTopic">
+    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+    <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>
+    <attribute name="SecurityConf">
+       <security>
+         <role name="guest" read="true" write="true"/>
+         <role name="publisher" read="true" write="true" create="false"/>
+         <role name="durpublisher" read="true" write="true" create="true"/>
+      </security>
+    </attribute>
+  </mbean>
+
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+	 name="jboss.mq.destination:service=Queue,name=testQueue">
+    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+    <depends optional-attribute-name="SecurityManager">jboss.mq:service=SecurityManager</depends>
+    <attribute name="MessageCounterHistoryDayLimit">-1</attribute>
+    <attribute name="SecurityConf">
+      <security>
+        <role name="guest" read="true" write="true"/>
+        <role name="publisher" read="true" write="true" create="false"/>
+        <role name="noacc" read="false" write="false" create="false"/>
+      </security>
+    </attribute>
+  </mbean>
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+	 name="jboss.mq.destination:service=Queue,name=A">
+    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+  </mbean>
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+	 name="jboss.mq.destination:service=Queue,name=B">
+    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+  </mbean>
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+	 name="jboss.mq.destination:service=Queue,name=C">
+	 <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+  </mbean>
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+	 name="jboss.mq.destination:service=Queue,name=D">
+    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+  </mbean>
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+	 name="jboss.mq.destination:service=Queue,name=ex">
+    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+  </mbean>
+
+</server>

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/jbossmq-destinations-service.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/jbossmq-destinations-service.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/jbossmq-destinations-service.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/jms-ds.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/jms-ds.xml?view=auto&rev=520023
==============================================================================
--- geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/jms-ds.xml (added)
+++ geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/jms-ds.xml Mon Mar 19 10:43:27 2007
@@ -0,0 +1,79 @@
+/**
+ *  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.
+ */
+ <?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE connection-factories
+    PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
+    "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
+
+
+<connection-factories>
+ 
+  <!-- ==================================================================== -->
+  <!-- JMS Stuff                                                            -->
+  <!-- ==================================================================== -->
+
+  <!-- The JMS provider loader -->
+  <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
+	 name="jboss.mq:service=JMSProviderLoader,name=JMSProvider">
+    <attribute name="ProviderName">DefaultJMSProvider</attribute>
+    <attribute name="ProviderAdapterClass">
+      org.jboss.jms.jndi.JNDIProviderAdapter
+    </attribute>
+    <!-- The combined connection factory -->
+    <attribute name="FactoryRef">java:/XAConnectionFactory</attribute>
+    <!-- The queue connection factory -->
+    <attribute name="QueueFactoryRef">java:/XAConnectionFactory</attribute>
+    <!-- The topic factory -->
+    <attribute name="TopicFactoryRef">java:/XAConnectionFactory</attribute>
+    <!-- Uncomment to use HAJNDI to access JMS
+    <attribute name="Properties">
+       java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+       java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
+       java.naming.provider.url=localhost:1100
+    </attribute>
+    -->
+  </mbean>
+
+  <!-- The server session pool for Message Driven Beans -->
+  <mbean code="org.jboss.jms.asf.ServerSessionPoolLoader"
+	 name="jboss.mq:service=ServerSessionPoolMBean,name=StdJMSPool">
+    <depends optional-attribute-name="XidFactory">jboss:service=XidFactory</depends>
+    <attribute name="PoolName">StdJMSPool</attribute>
+    <attribute name="PoolFactoryClass">
+      org.jboss.jms.asf.StdServerSessionPoolFactory
+    </attribute>
+  </mbean>
+
+  <!-- JMS XA Resource adapter, use this to get transacted JMS in beans -->
+  <tx-connection-factory>
+    <jndi-name>JmsXA</jndi-name>
+    <xa-transaction/>
+    <rar-name>jms-ra.rar</rar-name>
+    <connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
+    <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
+    <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>
+	<max-pool-size>11</max-pool-size>
+<!--
+	<min-pool-size>1</min-pool-size>
+	<blocking-timeout-millis>5001</blocking-timeout-millis> 
+	<idle-timeout-minutes>31</idle-timeout-minutes>
+-->	
+    <security-domain-and-application>JmsXARealm</security-domain-and-application>
+  </tx-connection-factory>
+
+</connection-factories>

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/jms-ds.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/jms-ds.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/jms-geronimo-plan.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/jms-geronimo-plan.xml?view=auto&rev=520023
==============================================================================
--- geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/jms-geronimo-plan.xml (added)
+++ geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/jms-geronimo-plan.xml Mon Mar 19 10:43:27 2007
@@ -0,0 +1,139 @@
+/**
+ *  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.
+ */
+ <?xml version="1.0" encoding="UTF-8"?>
+
+<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.1">
+  <sys:environment xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1">
+    <sys:moduleId>
+      <sys:groupId>j2g</sys:groupId>
+      <sys:artifactId>jms</sys:artifactId>
+      <sys:version>1.0</sys:version>
+      <sys:type>jar</sys:type>
+    </sys:moduleId>
+    <sys:dependencies>
+      <sys:dependency>
+        <sys:groupId>j2g</sys:groupId>
+        <sys:artifactId>jms</sys:artifactId>
+        <sys:version>1.0</sys:version>
+        <sys:type>jar</sys:type>
+      </sys:dependency>
+    </sys:dependencies>
+  </sys:environment>
+  <resourceadapter>
+    <resourceadapter-instance>
+      <resourceadapter-name>DefaultJMSProvider</resourceadapter-name>
+      <config-property-setting name="ServerURL">tcp://localhost:61616</config-property-setting>
+      <config-property-setting name="UserName">geronimo</config-property-setting>
+      <config-property-setting name="Password">geronimo</config-property-setting>
+      <naming:workmanager xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.1">
+        <naming:gbean-link>DefaultWorkManager</naming:gbean-link>
+      </naming:workmanager>
+    </resourceadapter-instance>
+    <outbound-resourceadapter>
+      <connection-definition>
+        <connectionfactory-interface>javax.jms.ConnectionFactory</connectionfactory-interface>
+        <connectiondefinition-instance>
+          <name>MyConnectionFactory</name>
+          <implemented-interface>javax.jms.QueueConnectionFactory</implemented-interface>
+          <implemented-interface>javax.jms.TopicConnectionFactory</implemented-interface>
+          <connectionmanager>
+            <local-transaction/>
+            <single-pool>
+              <max-size>11</max-size>
+              <min-size>0</min-size>
+              <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
+              <idle-timeout-minutes>30</idle-timeout-minutes>
+              <match-one/>
+            </single-pool>
+          </connectionmanager>
+        </connectiondefinition-instance>
+      </connection-definition>
+    </outbound-resourceadapter>
+  </resourceadapter>
+  <adminobject>
+    <adminobject-interface>javax.jms.Queue</adminobject-interface>
+    <adminobject-class>org.activemq.message.ActiveMQTopic</adminobject-class>
+    <adminobject-instance>
+      <message-destination-name>testTopic</message-destination-name>
+      <config-property-setting name="PhysicalName">MyQueue</config-property-setting>
+    </adminobject-instance>
+  </adminobject>
+  <adminobject>
+    <adminobject-interface>javax.jms.Queue</adminobject-interface>
+    <adminobject-class>org.activemq.message.ActiveMQTopic</adminobject-class>
+    <adminobject-instance>
+      <message-destination-name>securedTopic</message-destination-name>
+      <config-property-setting name="PhysicalName">MyQueue</config-property-setting>
+    </adminobject-instance>
+  </adminobject>
+  <adminobject>
+    <adminobject-interface>javax.jms.Queue</adminobject-interface>
+    <adminobject-class>org.activemq.message.ActiveMQTopic</adminobject-class>
+    <adminobject-instance>
+      <message-destination-name>testDurableTopic</message-destination-name>
+      <config-property-setting name="PhysicalName">MyQueue</config-property-setting>
+    </adminobject-instance>
+  </adminobject>
+  <adminobject>
+    <adminobject-interface>javax.jms.Topic</adminobject-interface>
+    <adminobject-class>org.activemq.message.ActiveMQTopic</adminobject-class>
+    <adminobject-instance>
+      <message-destination-name>testQueue</message-destination-name>
+      <config-property-setting name="PhysicalName">Mytopic</config-property-setting>
+    </adminobject-instance>
+  </adminobject>
+  <adminobject>
+    <adminobject-interface>javax.jms.Topic</adminobject-interface>
+    <adminobject-class>org.activemq.message.ActiveMQTopic</adminobject-class>
+    <adminobject-instance>
+      <message-destination-name>A</message-destination-name>
+      <config-property-setting name="PhysicalName">Mytopic</config-property-setting>
+    </adminobject-instance>
+  </adminobject>
+  <adminobject>
+    <adminobject-interface>javax.jms.Topic</adminobject-interface>
+    <adminobject-class>org.activemq.message.ActiveMQTopic</adminobject-class>
+    <adminobject-instance>
+      <message-destination-name>B</message-destination-name>
+      <config-property-setting name="PhysicalName">Mytopic</config-property-setting>
+    </adminobject-instance>
+  </adminobject>
+  <adminobject>
+    <adminobject-interface>javax.jms.Topic</adminobject-interface>
+    <adminobject-class>org.activemq.message.ActiveMQTopic</adminobject-class>
+    <adminobject-instance>
+      <message-destination-name>C</message-destination-name>
+      <config-property-setting name="PhysicalName">Mytopic</config-property-setting>
+    </adminobject-instance>
+  </adminobject>
+  <adminobject>
+    <adminobject-interface>javax.jms.Topic</adminobject-interface>
+    <adminobject-class>org.activemq.message.ActiveMQTopic</adminobject-class>
+    <adminobject-instance>
+      <message-destination-name>D</message-destination-name>
+      <config-property-setting name="PhysicalName">Mytopic</config-property-setting>
+    </adminobject-instance>
+  </adminobject>
+  <adminobject>
+    <adminobject-interface>javax.jms.Topic</adminobject-interface>
+    <adminobject-class>org.activemq.message.ActiveMQTopic</adminobject-class>
+    <adminobject-instance>
+      <message-destination-name>ex</message-destination-name>
+      <config-property-setting name="PhysicalName">Mytopic</config-property-setting>
+    </adminobject-instance>
+  </adminobject>
+</connector>

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/jms-geronimo-plan.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/jms-geronimo-plan.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/test-apps/jms/jms-geronimo-plan.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/sandbox/j2g/src2/jms-plugin/test/org/apache/apps/j2gmigrator/resources/jms/test/JMSResouresToolTestCase.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/src2/jms-plugin/test/org/apache/apps/j2gmigrator/resources/jms/test/JMSResouresToolTestCase.java?view=auto&rev=520023
==============================================================================
--- geronimo/sandbox/j2g/src2/jms-plugin/test/org/apache/apps/j2gmigrator/resources/jms/test/JMSResouresToolTestCase.java (added)
+++ geronimo/sandbox/j2g/src2/jms-plugin/test/org/apache/apps/j2gmigrator/resources/jms/test/JMSResouresToolTestCase.java Mon Mar 19 10:43:27 2007
@@ -0,0 +1,48 @@
+/**
+ *  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.apps.j2gmigrator.resources.jms.test;
+
+import java.io.File;
+
+import org.apache.apps.j2gmigrator.resources.ResourcesTool;
+import org.apache.apps.j2gmigrator.resources.jms.JMSResourcesTool;
+import org.apache.apps.j2gmigrator.resources.utils.Constants;
+
+import junit.framework.TestCase;
+
+/**
+ * Test Case for the JMSResouresTool
+ */
+public class JMSResouresToolTestCase extends TestCase {
+    
+    @Override //the setup method 
+    protected void setUp() throws Exception {
+        // To set the IOutput intialize the DescripterTool
+        ResourcesTool desTool = new ResourcesTool();
+        super.setUp();
+    }
+    
+    // Test for JMS Resources Migration
+    public void testJMSResourcesFileMigration() {
+        String fileLocation = Constants.TEST_RESOURCES_DIRECTORY + "jms/"
+                + Constants.JBOSS_VALID_JMS_DESTINATIONS_SERVICES_XML_FILE;
+        File file = new File(fileLocation);
+        JMSResourcesTool jmsResourcesTool = new JMSResourcesTool();
+        boolean result = jmsResourcesTool.migrate(file);
+        assertTrue(result);
+    }
+}

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/test/org/apache/apps/j2gmigrator/resources/jms/test/JMSResouresToolTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/test/org/apache/apps/j2gmigrator/resources/jms/test/JMSResouresToolTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/src2/jms-plugin/test/org/apache/apps/j2gmigrator/resources/jms/test/JMSResouresToolTestCase.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/j2g/src2/mail-plugin/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/src2/mail-plugin/META-INF/MANIFEST.MF?view=auto&rev=520023
==============================================================================
--- geronimo/sandbox/j2g/src2/mail-plugin/META-INF/MANIFEST.MF (added)
+++ geronimo/sandbox/j2g/src2/mail-plugin/META-INF/MANIFEST.MF Mon Mar 19 10:43:27 2007
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Mail_plugin Plug-in
+Bundle-SymbolicName: mail_plugin; singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Vendor: ibm
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime,
+ com.ibm.j2g,
+ com.ibm.j2g.resources,
+ com.ibm.j2g.util
+Eclipse-LazyStart: true
+Bundle-ClassPath: .

Added: geronimo/sandbox/j2g/src2/mail-plugin/build.properties
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/src2/mail-plugin/build.properties?view=auto&rev=520023
==============================================================================
--- geronimo/sandbox/j2g/src2/mail-plugin/build.properties (added)
+++ geronimo/sandbox/j2g/src2/mail-plugin/build.properties Mon Mar 19 10:43:27 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.. = classes/
+bin.includes = plugin.xml,\
+               META-INF/,\
+               .,\

Propchange: geronimo/sandbox/j2g/src2/mail-plugin/build.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/src2/mail-plugin/build.properties
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/src2/mail-plugin/build.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/j2g/src2/mail-plugin/plugin.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/src2/mail-plugin/plugin.xml?view=auto&rev=520023
==============================================================================
--- geronimo/sandbox/j2g/src2/mail-plugin/plugin.xml (added)
+++ geronimo/sandbox/j2g/src2/mail-plugin/plugin.xml Mon Mar 19 10:43:27 2007
@@ -0,0 +1,24 @@
+/**
+ *  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.
+ */
+ <?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+    <extension point="com.ibm.j2g.resources.migrations">
+      	<migration class="com.ibm.j2g.resources.mail.MailResourcesTool"/>
+   </extension>
+</plugin>
+

Propchange: geronimo/sandbox/j2g/src2/mail-plugin/plugin.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/src2/mail-plugin/plugin.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/src2/mail-plugin/plugin.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/sandbox/j2g/src2/mail-plugin/src/commons-logging.properties
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/src2/mail-plugin/src/commons-logging.properties?view=auto&rev=520023
==============================================================================
--- geronimo/sandbox/j2g/src2/mail-plugin/src/commons-logging.properties (added)
+++ geronimo/sandbox/j2g/src2/mail-plugin/src/commons-logging.properties Mon Mar 19 10:43:27 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.
+commons-logging.rootLogger=INFO
+
+#define loggers
+#pluging logger
+lcommons-logging.logger.com.ibm.j2g= DEBUG,console
+
+# console is set to be a ConsoleAppender.
+commons-logging.appender.console=org.apache.log4j.ConsoleAppender
+
+# console uses PatternLayout.
+commons-logging.appender.console.layout=org.apache.log4j.PatternLayout
+#commons-logging.appender.console.layout.ConversionPattern=[%t] %-5p %l - %m%n
+commons-logging.appender.console.layout.ConversionPattern=[%t] %-5p - %m%n
\ No newline at end of file

Propchange: geronimo/sandbox/j2g/src2/mail-plugin/src/commons-logging.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/src2/mail-plugin/src/commons-logging.properties
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/src2/mail-plugin/src/commons-logging.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/j2g/src2/mail-plugin/src/org/apache/apps/j2gmigrator/resources/mail/MailResourcesTool.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/src2/mail-plugin/src/org/apache/apps/j2gmigrator/resources/mail/MailResourcesTool.java?view=auto&rev=520023
==============================================================================
--- geronimo/sandbox/j2g/src2/mail-plugin/src/org/apache/apps/j2gmigrator/resources/mail/MailResourcesTool.java (added)
+++ geronimo/sandbox/j2g/src2/mail-plugin/src/org/apache/apps/j2gmigrator/resources/mail/MailResourcesTool.java Mon Mar 19 10:43:27 2007
@@ -0,0 +1,175 @@
+/**
+ *  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.apps.j2gmigrator.resources.mail;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Iterator;
+
+import org.apache.apps.j2gmigrator.IFileMigration;
+import org.apache.apps.j2gmigrator.IOutput;
+import org.apache.apps.j2gmigrator.Tool;
+import org.apache.apps.j2gmigrator.resources.utils.Constants;
+import org.apache.apps.j2gmigrator.resources.xmlutil.XMLConversionHelper;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+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.Node;
+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 discriptor file
+     * @return status of the migration
+     */
+    public boolean migrate(File sourceFile) {
+        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("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("The mail discripter file "
+                                   + mailFilename
+                                   + " contains the plain text password authentocation, 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("The Mail Resource File Migration Complete !!!\n");
+                    }
+                } catch (DocumentException e) {
+                	out.error("Errors occurs while reading xml descriptor "
+    						+ sourceFile.getAbsolutePath()
+    						+ ". It is possible that the migrator cannot download an xml schema or xml file has a wrong syntax. Nested exception:"
+    						+ e.getMessage());
+                } catch (IOException e) {
+                    out.error("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;
+    }
+
+}



Mime
View raw message