geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmcma...@apache.org
Subject svn commit: r561821 [7/12] - in /geronimo/sandbox/j2g: ./ configurator/ doc/ plugins/ plugins/org.apache.geronimo.j2g.common/ plugins/org.apache.geronimo.j2g.descriptors/ plugins/org.apache.geronimo.j2g.descriptors/src/ plugins/org.apache.geronimo.j2g....
Date Wed, 01 Aug 2007 15:05:17 GMT
Modified: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/src/org/apache/geronimo/j2g/resources/security/SecurityResourcesTool.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/src/org/apache/geronimo/j2g/resources/security/SecurityResourcesTool.java?view=diff&rev=561821&r1=561820&r2=561821
==============================================================================
--- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/src/org/apache/geronimo/j2g/resources/security/SecurityResourcesTool.java (original)
+++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/src/org/apache/geronimo/j2g/resources/security/SecurityResourcesTool.java Wed Aug  1 08:05:12 2007
@@ -1,575 +1,575 @@
-/**
- *  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.j2g.resources.security;
-
-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.j2g.common.IFileMigration;
-import org.apache.geronimo.j2g.common.IOutput;
-import org.apache.geronimo.j2g.common.Tool;
-import org.apache.geronimo.j2g.util.resources.Constants;
-import org.apache.geronimo.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 Security Resource File Migration 
- */
-public class SecurityResourcesTool implements IFileMigration {
-
-    // Initialization of the IOutput for SecurityResourcesTool class
-    IOutput out = Tool.getCurrent().getOutput();
-    // Initialization of the logger for SecurityResourcesTool class
-    Log logger = LogFactory.getLog(SecurityResourcesTool.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) {
-        // read the login-config.xml file and then make the changes to the
-        // geronimo side
-        boolean migrated = false;
-            String fileName = sourceFile.getPath();
-            String directoryName = fileName.substring(0, fileName.lastIndexOf(File.separator));
-            String jbossSecirityFileName = sourceFile.getName();
-            logger.debug("Directory Name ==> " + directoryName);
-            logger.debug("jboss security file Name ==> " + jbossSecirityFileName);
-            // Checking wether file is a valid login-config.xml file
-            if (jbossSecirityFileName.equals(Constants.JBOSS_VALID_SECURITY_XML_FILE)) {
-                out.info(SecurityResourcesTool.class.getSimpleName(), "Converting Jboss login-config.xml file in " + directoryName);
-                try {
-                    Document jbossDocument = XMLConversionHelper.getJbossDocument(sourceFile);
-                    Document geronimoDocument = migrationFromJboss2Geronimo(jbossDocument
-                            .getRootElement());
-                    String geronimoSecurityFileName = directoryName + File.separator
-                            + Constants.GERONIMO_SECURITY_PLAN_FILE;
-                    // Check whether the file already exists if so back up
-                    // that and save that or check the req
-                    // This was done at upper level of the tool
-                    XMLConversionHelper.saveGeronimoDocument(geronimoSecurityFileName,
-                            geronimoDocument);
-                    migrated = true;
-                    out.info(SecurityResourcesTool.class.getSimpleName(), "The Security Resource File Migration Complete !!!\n");
-                } catch (DocumentException e) {
-                	out.error(SecurityResourcesTool.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(SecurityResourcesTool.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 geronimoDocument = XMLConversionHelper.createNewGeronimoDocument(
-                Constants.NAMESPACE_ENV, "module", Constants.SECURITY_RESOURCE_TOOL, "", "");
-        Document geronimoNewDocument = createGBeanElement(jbossRootElement, geronimoDocument);
-        return geronimoNewDocument;
-    }
-
-    /**
-     * Create the GBeanElement by refering the jboss side elamanets
-     * 
-     * @param jbossRootElement
-     * @param geronimoDocument
-     * @return geronimo security plan which contains the GBean Element
-     */
-    private Document createGBeanElement(Element jbossRootElement, Document geronimoDocument) {
-        Namespace rootNamespace = geronimoDocument.getRootElement().getNamespace();
-        Element gbeanElement = DocumentHelper.createElement(new QName("gbean", rootNamespace));
-        gbeanElement.add(DocumentHelper.createAttribute(gbeanElement, "name", "SecurityRealm"));
-        gbeanElement.add(DocumentHelper.createAttribute(gbeanElement, "class",
-                "org.apache.geronimo.security.realm.GenericSecurityRealm"));
-        Element attributeElement = DocumentHelper.createElement(new QName("attribute",
-                rootNamespace));
-        attributeElement.add(DocumentHelper.createAttribute(gbeanElement, "name", "realmName"));
-        attributeElement.addText("SecurityRealm");
-        gbeanElement.add(createReferenceElement("ServerInfo", "ServerInfo", rootNamespace));
-        gbeanElement.add(createReferenceElement("LoginService", "JaasLoginService", rootNamespace));
-        Element xml_referenceElement = DocumentHelper.createElement(new QName("xml-reference",
-                rootNamespace));
-        xml_referenceElement.add(DocumentHelper.createAttribute(xml_referenceElement, "name",
-                "LoginModuleConfiguration"));
-        Element loginConfigElement = createLoginConfigElement();
-        Element newLoginConfigElement = createLoginModulesByReferingJbossDocument(
-                loginConfigElement, jbossRootElement);
-        xml_referenceElement.add(newLoginConfigElement);
-        gbeanElement.add(xml_referenceElement);
-        geronimoDocument.getRootElement().add(gbeanElement);
-        return geronimoDocument;
-    }
-
-    /**
-     * create the reference element
-     * 
-     * @param name
-     * @param contain
-     * @param rootNamespace
-     * @return return the reference element
-     */
-    private Element createReferenceElement(String name, String contain, Namespace rootNamespace) {
-        Element referenceElement = DocumentHelper.createElement(new QName("reference",
-                rootNamespace));
-        referenceElement.add(DocumentHelper.createAttribute(referenceElement, "name", name));
-        Element nameElement = DocumentHelper.createElement(new QName("name", rootNamespace));
-        nameElement.addText(contain);
-        referenceElement.add(nameElement);
-        return referenceElement;
-
-    }
-
-    /**
-     * create the login config elament
-     * 
-     * @return login config element
-     */
-    private Element createLoginConfigElement() {
-        Namespace loginNamespace = new Namespace("log", Constants.NAMESPACE_GERONIMO_LOGGIN);
-        Element login_configElement = DocumentHelper.createElement(new QName("login-config",
-                loginNamespace));
-        return login_configElement;
-    }
-
-    /**
-     * create the login module by referencing the jboss document
-     * 
-     * @param loginConfigElement
-     * @param jbossRootElement
-     * @return the login module
-     */
-    private Element createLoginModulesByReferingJbossDocument(Element loginConfigElement,
-            Element jbossRootElement) {
-        String login_domain_name = null;
-        String control_flag = null;
-        String login_module_class = null;
-        Element login_moduleElement = null;
-        Iterator elementIterator = jbossRootElement.elementIterator();
-        while (elementIterator.hasNext()) {
-            Element itElement = (Element) elementIterator.next();
-            if (itElement.getName().equals("application-policy")) {
-                out.info(SecurityResourcesTool.class.getSimpleName(), "Starting Module Migration");
-                if (validateSecurityPolicy(itElement)) {
-                    login_domain_name = obtainLoginDomainName(itElement);
-                    if (XMLConversionHelper.containSubElement(itElement, "authentication")) {
-                        Element authenticationElement = XMLConversionHelper.obtainSubElement(
-                                itElement, "authentication");
-                        if (XMLConversionHelper.containSubElement(authenticationElement,
-                                "login-module")) {
-                            login_moduleElement = XMLConversionHelper.obtainSubElement(
-                                    authenticationElement, "login-module");
-                            control_flag = obtainControlFlagFromLoginModuleElement(login_moduleElement);
-                            login_module_class = obtainLoginModuleClassFromLoginModuleElement(login_moduleElement);
-                        }
-                    }
-                    Element geronimo_login_moduleElement = createLoginModuleElementbyReferingJbossApplicationPolicyElement(
-                            login_moduleElement, loginConfigElement, control_flag,
-                            login_domain_name, login_module_class);
-                    loginConfigElement.add(geronimo_login_moduleElement);
-                    out.info(SecurityResourcesTool.class.getSimpleName(), "Finishing Module Migration");
-                } else {
-                    out.error(SecurityResourcesTool.class.getSimpleName(), "The security resource conversion tool does not support module functionality");
-                    out.info(SecurityResourcesTool.class.getSimpleName(), "Finishing Module Migration");
-                }
-            }
-        }
-        return loginConfigElement;
-    }
-
-    /**
-     * return the login module class from the login module element
-     * 
-     * @param login_moduleElement
-     * @return String version of the login module class
-     */
-    private String obtainLoginModuleClassFromLoginModuleElement(Element login_moduleElement) {
-        String login_module_class = null;
-        Iterator attribIterator = login_moduleElement.attributeIterator();
-        while (attribIterator.hasNext()) {
-            Attribute itAttribute = (Attribute) attribIterator.next();
-            if (itAttribute.getName().equals("code")) {
-                login_module_class = itAttribute.getText();
-                if (login_module_class.equals(Constants.JBOSS_LOGIN_MODULE_IDELTITY)) {
-                    return Constants.GERONIMO_LOGIN_MODULE_IDELTITY;
-                } else if (login_module_class.equals(Constants.JBOSS_LOGIN_MODULE_LDAP)) {
-                    return Constants.GERONIMO_LOGIN_MODULE_LDAP;
-                } else if (login_module_class.equals(Constants.JBOSS_LOGIN_MODULE_DATABASE_SERVER)) {
-                    return Constants.GERONIMO_LOGIN_MODULE_DATABASE_SERVER;
-                } else if (login_module_class.equals(Constants.JBOSS_LOGIN_MODULE_USERS_ROLES)) {
-                    return Constants.GERONIMO_LOGIN_MODULE_USERS_ROLES;
-                }
-            }
-        }
-        return login_module_class;
-    }
-
-    /**
-     * obtain the login domain name from the element
-     * 
-     * @param application_policyElement
-     * @return String version of the login domain name
-     */
-    private String obtainLoginDomainName(Element application_policyElement) {
-        String login_domain_name = null;
-        Iterator attribIterator = application_policyElement.attributeIterator();
-        while (attribIterator.hasNext()) {
-            Attribute itAttribute = (Attribute) attribIterator.next();
-            if (itAttribute.getName().equals("name")) {
-                login_domain_name = itAttribute.getText();
-            }
-        }
-        return login_domain_name;
-    }
-
-    /**
-     * creates the mudule elements by referencing the jboss side apllication
-     * policy elamentsS
-     * 
-     * @param jbossLoginModuleElement
-     * @param geronimoLoginConfigElement
-     * @param control_flag
-     * @param login_domain_name
-     * @param login_module_class
-     * @return login module element
-     */
-    private Element createLoginModuleElementbyReferingJbossApplicationPolicyElement(
-            Element jbossLoginModuleElement, Element geronimoLoginConfigElement,
-            String control_flag, String login_domain_name, String login_module_class) {
-        Element login_moduleElement = DocumentHelper.createElement(new QName("login-module",
-                geronimoLoginConfigElement.getNamespace()));
-        login_moduleElement.add(DocumentHelper.createAttribute(login_moduleElement, "control-flag",
-                control_flag.toUpperCase()));
-        // Adding this defaults
-        login_moduleElement.add(DocumentHelper.createAttribute(login_moduleElement, "server-side",
-                "true"));
-        login_moduleElement.add(DocumentHelper.createAttribute(login_moduleElement,
-                "wrap-principals", "false"));
-        login_moduleElement.add(XMLConversionHelper.createSibling("login-domain-name",
-                login_domain_name, geronimoLoginConfigElement.getNamespace()));
-        login_moduleElement.add(XMLConversionHelper.createSibling("login-module-class",
-                login_module_class, geronimoLoginConfigElement.getNamespace()));
-        if (XMLConversionHelper.containSubElement(jbossLoginModuleElement, "module-option")) {
-            login_moduleElement = addAppropriateOptionToAppropriateLoginModule(
-                    jbossLoginModuleElement, login_moduleElement, login_module_class);
-        }
-        return login_moduleElement;
-    }
-
-    /**
-     * adding the appropriate options for the appropriate login modules
-     * 
-     * @param jbossLoginModuleElement
-     * @param geronimoLoginmoduleElement
-     * @param login_module_class
-     * @return returns the login module
-     */
-    private Element addAppropriateOptionToAppropriateLoginModule(Element jbossLoginModuleElement,
-            Element geronimoLoginmoduleElement, String login_module_class) {
-        String option_value = null;
-        String option_attrib_name_value = null;
-        Element[] extraOptionsElement = new Element[4];
-        int countIterations = 0;
-        Iterator elementIterator = jbossLoginModuleElement.elementIterator();
-        while (elementIterator.hasNext()) {
-            Element itElement = (Element) elementIterator.next();
-            if (itElement.getName().equals("module-option")) {
-                option_value = itElement.getText();
-                Iterator attribIterator = itElement.attributeIterator();
-                while (attribIterator.hasNext()) {
-                    Attribute itAttribute = (Attribute) attribIterator.next();
-                    if (itAttribute.getName().equals("name")) {
-                        option_attrib_name_value = itAttribute.getText();
-                    }
-                }
-                Element optionElement = null;
-                if (login_module_class.equals(Constants.GERONIMO_LOGIN_MODULE_DATABASE_SERVER)) {
-                    if (option_attrib_name_value.equals("principalsQuery")) {
-                        option_attrib_name_value = "userSelect";
-                    }
-                    if (option_attrib_name_value.equals("rolesQuery")) {
-                        option_attrib_name_value = "groupSelect";
-                    }
-                    if (option_attrib_name_value.equals("dsJndiName")) {
-                        option_attrib_name_value = "dataSourceName";
-                        // This is to be modified to the algorithm that
-                        // cuts only the last tocken
-                        option_value = option_value.substring(option_value.indexOf(File.separator) + 1,
-                                option_value.length());
-                    }
-                    if (!(option_attrib_name_value.equals("unauthenticatedIdentity"))) {
-                        optionElement = XMLConversionHelper.createSiblingWithAttrib("option",
-                                option_value, "name", option_attrib_name_value,
-                                geronimoLoginmoduleElement.getNamespace());
-                    }
-                }
-                // No Need , because of no Geronimo side support
-                // else if
-                // (login_module_class.equals(Constants.GERONIMO_LOGIN_MODULE_IDELTITY)){
-                // optionElement =
-                // XMLConversionHelper.createSiblingWithAttrib("option",
-                // option_value, "name", option_attrib_name_value,
-                // geronimoLoginmoduleElement.getNamespace());
-                // }
-                else if (login_module_class.equals(Constants.GERONIMO_LOGIN_MODULE_LDAP)) {
-
-                    if (option_attrib_name_value.equals("java.naming.factory.initial")) {
-                        option_attrib_name_value = "initialContextFactory";
-                        optionElement = XMLConversionHelper.createSiblingWithAttrib("option",
-                                option_value, "name", option_attrib_name_value,
-                                geronimoLoginmoduleElement.getNamespace());
-                    }
-                    if (option_attrib_name_value.equals("java.naming.provider.url")) {
-                        String connectionURLString = "ldap://localhost:";
-                        if (XMLConversionHelper.containSubElementWithAttribute(
-                                jbossLoginModuleElement, "module-option", "name",
-                                "java.naming.security.protocol")) {
-                            Element securityProtocolElement = XMLConversionHelper
-                                    .obtainSubElementWithAttribute(jbossLoginModuleElement,
-                                            "module-option", "name",
-                                            "java.naming.security.protocol");
-                            String securityProtocolElementString = securityProtocolElement
-                                    .getText();
-                            if (securityProtocolElementString.equals("ssl")) {
-                                connectionURLString += "636";
-                            } else {
-                                connectionURLString += "389";
-                            }
-                        }
-                        option_attrib_name_value = "connectionURL";
-                        option_value = connectionURLString;
-                        optionElement = XMLConversionHelper.createSiblingWithAttrib("option",
-                                option_value, "name", option_attrib_name_value,
-                                geronimoLoginmoduleElement.getNamespace());
-                    }
-                    if (option_attrib_name_value.equals("java.naming.security.protocol")) {
-                        option_attrib_name_value = "connectionProtocol";
-                        optionElement = XMLConversionHelper.createSiblingWithAttrib("option",
-                                option_value, "name", option_attrib_name_value,
-                                geronimoLoginmoduleElement.getNamespace());
-                    }
-                    if (option_attrib_name_value.equals("java.naming.security.authentication")) {
-                        option_attrib_name_value = "authentication";
-                        optionElement = XMLConversionHelper.createSiblingWithAttrib("option",
-                                option_value, "name", option_attrib_name_value,
-                                geronimoLoginmoduleElement.getNamespace());
-                    }
-                    if (option_attrib_name_value.equals("roleAttributeID")) {
-                        option_attrib_name_value = "roleName";
-                        option_value = "roles";
-                        optionElement = XMLConversionHelper.createSiblingWithAttrib("option",
-                                option_value, "name", option_attrib_name_value,
-                                geronimoLoginmoduleElement.getNamespace());
-                    }
-                    if (option_attrib_name_value.equals("java.naming.security.protocol")) {
-                        option_attrib_name_value = "connectionProtocol";
-                        optionElement = XMLConversionHelper.createSiblingWithAttrib("option",
-                                option_value, "name", option_attrib_name_value,
-                                geronimoLoginmoduleElement.getNamespace());
-                    }
-                    if (option_attrib_name_value.equals("principalDNPrefix")) {
-                        if (XMLConversionHelper.containSubElementWithAttribute(
-                                jbossLoginModuleElement, "module-option", "name",
-                                "principalDNSuffix")) {
-                            Element principalDNSuffixElement = XMLConversionHelper
-                                    .obtainSubElementWithAttribute(jbossLoginModuleElement,
-                                            "module-option", "name", "principalDNSuffix");
-                            String principalDNSuffixElementString = principalDNSuffixElement
-                                    .getText();
-                            if (principalDNSuffixElementString != null) {
-                                // option_value+=principalDNSuffixElementString.substring(0,
-                                // principalDNSuffixElementString.indexOf(","));
-                                option_value += "{0}" + principalDNSuffixElementString;
-                            } else {
-                                option_value += "{0}";
-                            }
-                        }
-                        option_attrib_name_value = "userSearchMatching";
-                        optionElement = XMLConversionHelper.createSiblingWithAttrib("option",
-                                option_value, "name", option_attrib_name_value,
-                                geronimoLoginmoduleElement.getNamespace());
-                    }
-                    if (option_attrib_name_value.equals("rolesCtxDN")) {
-                        option_attrib_name_value = "roleSearchMatching";
-                        if (XMLConversionHelper.containSubElementWithAttribute(
-                                jbossLoginModuleElement, "module-option", "name", "matchOnUserDN")) {
-                            Element matchOnUserDNElement = XMLConversionHelper
-                                    .obtainSubElementWithAttribute(jbossLoginModuleElement,
-                                            "module-option", "name", "matchOnUserDN");
-                            String matchOnUserDNString = matchOnUserDNElement.getText();
-                            if (XMLConversionHelper.containSubElementWithAttribute(
-                                    jbossLoginModuleElement, "module-option", "name",
-                                    "matchOnUserDN")) {
-                                Element uidAttributeIDElement = XMLConversionHelper
-                                        .obtainSubElementWithAttribute(jbossLoginModuleElement,
-                                                "module-option", "name", "uidAttributeID");
-                                String uidAttributeIDString = uidAttributeIDElement.getText();
-                                // String first_part_of_option_value =
-                                // option_value.substring(0,
-                                // option_value.indexOf(","));
-                                // String secoend_part_of_option_value =
-                                // first_part_of_option_value.substring(0,
-                                // option_value.indexOf(","));
-                                String first_part_of_option_value = "{0}";
-                                String secoend_part_of_option_value = "{1}";
-                                option_value = option_value
-                                        + "???("
-                                        + uidAttributeIDString
-                                        + "="
-                                        + (matchOnUserDNString.equals("true") ? first_part_of_option_value
-                                                : secoend_part_of_option_value) + ")";
-                            }
-                        }
-                        optionElement = XMLConversionHelper.createSiblingWithAttrib("option",
-                                option_value, "name", option_attrib_name_value,
-                                geronimoLoginmoduleElement.getNamespace());
-                    }
-                    extraOptionsElement[0] = XMLConversionHelper.createSiblingWithAttrib("option",
-                            "", "name", "userBase", geronimoLoginmoduleElement.getNamespace());
-                    extraOptionsElement[1] = XMLConversionHelper.createSiblingWithAttrib("option",
-                            "", "name", "roleBase", geronimoLoginmoduleElement.getNamespace());
-                    extraOptionsElement[2] = XMLConversionHelper.createSiblingWithAttrib("option",
-                            "true", "name", "userSearchSubtree", geronimoLoginmoduleElement
-                                    .getNamespace());
-                    extraOptionsElement[3] = XMLConversionHelper.createSiblingWithAttrib("option",
-                            "true", "name", "roleSearchSubtree", geronimoLoginmoduleElement
-                                    .getNamespace());
-                } else if (login_module_class.equals(Constants.GERONIMO_LOGIN_MODULE_USERS_ROLES)) {
-                    if (option_attrib_name_value.equals("usersProperties")) {
-                        option_attrib_name_value = "usersURI";
-                        option_value = Constants.USER_PROPERTIES_FILE_PATH;
-                        out
-                           .info(SecurityResourcesTool.class.getSimpleName(), "Security Resources Tool Assumes user properties are in location =>"
-                                    + Constants.USER_PROPERTIES_FILE_PATH);
-                    }
-                    if (option_attrib_name_value.equals("rolesProperties")) {
-                        option_attrib_name_value = "groupsURI";
-                        option_value = Constants.GROUP_PROPERTIES_FILE_PATH;
-                        out
-                           .info(SecurityResourcesTool.class.getSimpleName(), "Security Resources Tool Assumes groups properties are in location =>"
-                                    + Constants.GROUP_PROPERTIES_FILE_PATH);
-                    }
-                    optionElement = XMLConversionHelper.createSiblingWithAttrib("option",
-                            option_value, "name", option_attrib_name_value,
-                            geronimoLoginmoduleElement.getNamespace());
-                }
-                if (optionElement != null)
-                    geronimoLoginmoduleElement.add(optionElement);
-                if (countIterations == 0) {
-                    for (int i = 0; i < extraOptionsElement.length; i++) {
-                        if (extraOptionsElement[i] != null)
-                            geronimoLoginmoduleElement.add(extraOptionsElement[i]);
-                    }
-                }
-                countIterations += 1;
-            }
-        }
-        return geronimoLoginmoduleElement;
-    }
-
-    /**
-     * validate the wether the jeronimo side policy is a valid policy
-     * 
-     * @param application_policyElement
-     * @return boolean status of the check
-     */
-    private boolean validateSecurityPolicy(Element application_policyElement) {
-        String jbossLoginModule = null;
-        if (XMLConversionHelper.containSubElement(application_policyElement, "authentication")) {
-            Element authenticationElement = XMLConversionHelper.obtainSubElement(
-                    application_policyElement, "authentication");
-            if (XMLConversionHelper.containSubElement(authenticationElement, "login-module")) {
-                Element login_moduleElement = XMLConversionHelper.obtainSubElement(
-                        authenticationElement, "login-module");
-                Iterator attribIterator = login_moduleElement.attributeIterator();
-                while (attribIterator.hasNext()) {
-                    Attribute itAttribute = (Attribute) attribIterator.next();
-                    if (itAttribute.getName().equals("code")) {
-                        jbossLoginModule = itAttribute.getText();
-                        boolean return_value = validateJbossLoginModule(jbossLoginModule);
-                        return return_value;
-                    }
-                }
-            }
-        }
-        return false;
-    }
-
-    /**
-     * obtain the control flag from the login module element
-     * 
-     * @param login_moduleElement
-     * @return String version of the control flag
-     */
-    private String obtainControlFlagFromLoginModuleElement(Element login_moduleElement) {
-        String control_flag = null;
-        Iterator attribIterator = login_moduleElement.attributeIterator();
-        while (attribIterator.hasNext()) {
-            Attribute itAttribute = (Attribute) attribIterator.next();
-            if (itAttribute.getName().equals("flag")) {
-                control_flag = itAttribute.getText();
-                return control_flag;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * validate the jboss security modules wethere these are acceptable for the
-     * geronimo side
-     * 
-     * @param jbossLoginModule
-     * @return boolean status of the validation
-     */
-    private boolean validateJbossLoginModule(String jbossLoginModule) {
-        boolean status = false;
-        logger.debug("Jboss login module class name => " + jbossLoginModule);
-        if (jbossLoginModule.equals(Constants.JBOSS_LOGIN_MODULE_DATABASE_SERVER)) {
-            status = true;
-        } else if (jbossLoginModule.equals(Constants.JBOSS_LOGIN_MODULE_LDAP)) {
-            status =  true;
-        } else if (jbossLoginModule.equals(Constants.JBOSS_LOGIN_MODULE_USERS_ROLES)) {
-            status =  true;
-        }else {
-            out.error(SecurityResourcesTool.class.getSimpleName(), "The security resource conversion tool does not support "+
-                       jbossLoginModule+" module functionality");
-        }
-        return status;
-    }
-
-}
+/**
+ *  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.j2g.resources.security;
+
+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.j2g.common.IFileMigration;
+import org.apache.geronimo.j2g.common.IOutput;
+import org.apache.geronimo.j2g.common.Tool;
+import org.apache.geronimo.j2g.util.resources.Constants;
+import org.apache.geronimo.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 Security Resource File Migration 
+ */
+public class SecurityResourcesTool implements IFileMigration {
+
+    // Initialization of the IOutput for SecurityResourcesTool class
+    IOutput out = Tool.getCurrent().getOutput();
+    // Initialization of the logger for SecurityResourcesTool class
+    Log logger = LogFactory.getLog(SecurityResourcesTool.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) {
+        // read the login-config.xml file and then make the changes to the
+        // geronimo side
+        boolean migrated = false;
+            String fileName = sourceFile.getPath();
+            String directoryName = fileName.substring(0, fileName.lastIndexOf(File.separator));
+            String jbossSecirityFileName = sourceFile.getName();
+            logger.debug("Directory Name ==> " + directoryName);
+            logger.debug("jboss security file Name ==> " + jbossSecirityFileName);
+            // Checking wether file is a valid login-config.xml file
+            if (jbossSecirityFileName.equals(Constants.JBOSS_VALID_SECURITY_XML_FILE)) {
+                out.info(SecurityResourcesTool.class.getSimpleName(), "Converting Jboss login-config.xml file in " + directoryName);
+                try {
+                    Document jbossDocument = XMLConversionHelper.getJbossDocument(sourceFile);
+                    Document geronimoDocument = migrationFromJboss2Geronimo(jbossDocument
+                            .getRootElement());
+                    String geronimoSecurityFileName = directoryName + File.separator
+                            + Constants.GERONIMO_SECURITY_PLAN_FILE;
+                    // Check whether the file already exists if so back up
+                    // that and save that or check the req
+                    // This was done at upper level of the tool
+                    XMLConversionHelper.saveGeronimoDocument(geronimoSecurityFileName,
+                            geronimoDocument);
+                    migrated = true;
+                    out.info(SecurityResourcesTool.class.getSimpleName(), "The Security Resource File Migration Complete !!!\n");
+                } catch (DocumentException e) {
+                	out.error(SecurityResourcesTool.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(SecurityResourcesTool.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 geronimoDocument = XMLConversionHelper.createNewGeronimoDocument(
+                Constants.NAMESPACE_ENV, "module", Constants.SECURITY_RESOURCE_TOOL, "", "");
+        Document geronimoNewDocument = createGBeanElement(jbossRootElement, geronimoDocument);
+        return geronimoNewDocument;
+    }
+
+    /**
+     * Create the GBeanElement by refering the jboss side elamanets
+     * 
+     * @param jbossRootElement
+     * @param geronimoDocument
+     * @return geronimo security plan which contains the GBean Element
+     */
+    private Document createGBeanElement(Element jbossRootElement, Document geronimoDocument) {
+        Namespace rootNamespace = geronimoDocument.getRootElement().getNamespace();
+        Element gbeanElement = DocumentHelper.createElement(new QName("gbean", rootNamespace));
+        gbeanElement.add(DocumentHelper.createAttribute(gbeanElement, "name", "SecurityRealm"));
+        gbeanElement.add(DocumentHelper.createAttribute(gbeanElement, "class",
+                "org.apache.geronimo.security.realm.GenericSecurityRealm"));
+        Element attributeElement = DocumentHelper.createElement(new QName("attribute",
+                rootNamespace));
+        attributeElement.add(DocumentHelper.createAttribute(gbeanElement, "name", "realmName"));
+        attributeElement.addText("SecurityRealm");
+        gbeanElement.add(createReferenceElement("ServerInfo", "ServerInfo", rootNamespace));
+        gbeanElement.add(createReferenceElement("LoginService", "JaasLoginService", rootNamespace));
+        Element xml_referenceElement = DocumentHelper.createElement(new QName("xml-reference",
+                rootNamespace));
+        xml_referenceElement.add(DocumentHelper.createAttribute(xml_referenceElement, "name",
+                "LoginModuleConfiguration"));
+        Element loginConfigElement = createLoginConfigElement();
+        Element newLoginConfigElement = createLoginModulesByReferingJbossDocument(
+                loginConfigElement, jbossRootElement);
+        xml_referenceElement.add(newLoginConfigElement);
+        gbeanElement.add(xml_referenceElement);
+        geronimoDocument.getRootElement().add(gbeanElement);
+        return geronimoDocument;
+    }
+
+    /**
+     * create the reference element
+     * 
+     * @param name
+     * @param contain
+     * @param rootNamespace
+     * @return return the reference element
+     */
+    private Element createReferenceElement(String name, String contain, Namespace rootNamespace) {
+        Element referenceElement = DocumentHelper.createElement(new QName("reference",
+                rootNamespace));
+        referenceElement.add(DocumentHelper.createAttribute(referenceElement, "name", name));
+        Element nameElement = DocumentHelper.createElement(new QName("name", rootNamespace));
+        nameElement.addText(contain);
+        referenceElement.add(nameElement);
+        return referenceElement;
+
+    }
+
+    /**
+     * create the login config elament
+     * 
+     * @return login config element
+     */
+    private Element createLoginConfigElement() {
+        Namespace loginNamespace = new Namespace("log", Constants.NAMESPACE_GERONIMO_LOGGIN);
+        Element login_configElement = DocumentHelper.createElement(new QName("login-config",
+                loginNamespace));
+        return login_configElement;
+    }
+
+    /**
+     * create the login module by referencing the jboss document
+     * 
+     * @param loginConfigElement
+     * @param jbossRootElement
+     * @return the login module
+     */
+    private Element createLoginModulesByReferingJbossDocument(Element loginConfigElement,
+            Element jbossRootElement) {
+        String login_domain_name = null;
+        String control_flag = null;
+        String login_module_class = null;
+        Element login_moduleElement = null;
+        Iterator elementIterator = jbossRootElement.elementIterator();
+        while (elementIterator.hasNext()) {
+            Element itElement = (Element) elementIterator.next();
+            if (itElement.getName().equals("application-policy")) {
+                out.info(SecurityResourcesTool.class.getSimpleName(), "Starting Module Migration");
+                if (validateSecurityPolicy(itElement)) {
+                    login_domain_name = obtainLoginDomainName(itElement);
+                    if (XMLConversionHelper.containSubElement(itElement, "authentication")) {
+                        Element authenticationElement = XMLConversionHelper.obtainSubElement(
+                                itElement, "authentication");
+                        if (XMLConversionHelper.containSubElement(authenticationElement,
+                                "login-module")) {
+                            login_moduleElement = XMLConversionHelper.obtainSubElement(
+                                    authenticationElement, "login-module");
+                            control_flag = obtainControlFlagFromLoginModuleElement(login_moduleElement);
+                            login_module_class = obtainLoginModuleClassFromLoginModuleElement(login_moduleElement);
+                        }
+                    }
+                    Element geronimo_login_moduleElement = createLoginModuleElementbyReferingJbossApplicationPolicyElement(
+                            login_moduleElement, loginConfigElement, control_flag,
+                            login_domain_name, login_module_class);
+                    loginConfigElement.add(geronimo_login_moduleElement);
+                    out.info(SecurityResourcesTool.class.getSimpleName(), "Finishing Module Migration");
+                } else {
+                    out.error(SecurityResourcesTool.class.getSimpleName(), "The security resource conversion tool does not support module functionality");
+                    out.info(SecurityResourcesTool.class.getSimpleName(), "Finishing Module Migration");
+                }
+            }
+        }
+        return loginConfigElement;
+    }
+
+    /**
+     * return the login module class from the login module element
+     * 
+     * @param login_moduleElement
+     * @return String version of the login module class
+     */
+    private String obtainLoginModuleClassFromLoginModuleElement(Element login_moduleElement) {
+        String login_module_class = null;
+        Iterator attribIterator = login_moduleElement.attributeIterator();
+        while (attribIterator.hasNext()) {
+            Attribute itAttribute = (Attribute) attribIterator.next();
+            if (itAttribute.getName().equals("code")) {
+                login_module_class = itAttribute.getText();
+                if (login_module_class.equals(Constants.JBOSS_LOGIN_MODULE_IDELTITY)) {
+                    return Constants.GERONIMO_LOGIN_MODULE_IDELTITY;
+                } else if (login_module_class.equals(Constants.JBOSS_LOGIN_MODULE_LDAP)) {
+                    return Constants.GERONIMO_LOGIN_MODULE_LDAP;
+                } else if (login_module_class.equals(Constants.JBOSS_LOGIN_MODULE_DATABASE_SERVER)) {
+                    return Constants.GERONIMO_LOGIN_MODULE_DATABASE_SERVER;
+                } else if (login_module_class.equals(Constants.JBOSS_LOGIN_MODULE_USERS_ROLES)) {
+                    return Constants.GERONIMO_LOGIN_MODULE_USERS_ROLES;
+                }
+            }
+        }
+        return login_module_class;
+    }
+
+    /**
+     * obtain the login domain name from the element
+     * 
+     * @param application_policyElement
+     * @return String version of the login domain name
+     */
+    private String obtainLoginDomainName(Element application_policyElement) {
+        String login_domain_name = null;
+        Iterator attribIterator = application_policyElement.attributeIterator();
+        while (attribIterator.hasNext()) {
+            Attribute itAttribute = (Attribute) attribIterator.next();
+            if (itAttribute.getName().equals("name")) {
+                login_domain_name = itAttribute.getText();
+            }
+        }
+        return login_domain_name;
+    }
+
+    /**
+     * creates the mudule elements by referencing the jboss side apllication
+     * policy elamentsS
+     * 
+     * @param jbossLoginModuleElement
+     * @param geronimoLoginConfigElement
+     * @param control_flag
+     * @param login_domain_name
+     * @param login_module_class
+     * @return login module element
+     */
+    private Element createLoginModuleElementbyReferingJbossApplicationPolicyElement(
+            Element jbossLoginModuleElement, Element geronimoLoginConfigElement,
+            String control_flag, String login_domain_name, String login_module_class) {
+        Element login_moduleElement = DocumentHelper.createElement(new QName("login-module",
+                geronimoLoginConfigElement.getNamespace()));
+        login_moduleElement.add(DocumentHelper.createAttribute(login_moduleElement, "control-flag",
+                control_flag.toUpperCase()));
+        // Adding this defaults
+        login_moduleElement.add(DocumentHelper.createAttribute(login_moduleElement, "server-side",
+                "true"));
+        login_moduleElement.add(DocumentHelper.createAttribute(login_moduleElement,
+                "wrap-principals", "false"));
+        login_moduleElement.add(XMLConversionHelper.createSibling("login-domain-name",
+                login_domain_name, geronimoLoginConfigElement.getNamespace()));
+        login_moduleElement.add(XMLConversionHelper.createSibling("login-module-class",
+                login_module_class, geronimoLoginConfigElement.getNamespace()));
+        if (XMLConversionHelper.containSubElement(jbossLoginModuleElement, "module-option")) {
+            login_moduleElement = addAppropriateOptionToAppropriateLoginModule(
+                    jbossLoginModuleElement, login_moduleElement, login_module_class);
+        }
+        return login_moduleElement;
+    }
+
+    /**
+     * adding the appropriate options for the appropriate login modules
+     * 
+     * @param jbossLoginModuleElement
+     * @param geronimoLoginmoduleElement
+     * @param login_module_class
+     * @return returns the login module
+     */
+    private Element addAppropriateOptionToAppropriateLoginModule(Element jbossLoginModuleElement,
+            Element geronimoLoginmoduleElement, String login_module_class) {
+        String option_value = null;
+        String option_attrib_name_value = null;
+        Element[] extraOptionsElement = new Element[4];
+        int countIterations = 0;
+        Iterator elementIterator = jbossLoginModuleElement.elementIterator();
+        while (elementIterator.hasNext()) {
+            Element itElement = (Element) elementIterator.next();
+            if (itElement.getName().equals("module-option")) {
+                option_value = itElement.getText();
+                Iterator attribIterator = itElement.attributeIterator();
+                while (attribIterator.hasNext()) {
+                    Attribute itAttribute = (Attribute) attribIterator.next();
+                    if (itAttribute.getName().equals("name")) {
+                        option_attrib_name_value = itAttribute.getText();
+                    }
+                }
+                Element optionElement = null;
+                if (login_module_class.equals(Constants.GERONIMO_LOGIN_MODULE_DATABASE_SERVER)) {
+                    if (option_attrib_name_value.equals("principalsQuery")) {
+                        option_attrib_name_value = "userSelect";
+                    }
+                    if (option_attrib_name_value.equals("rolesQuery")) {
+                        option_attrib_name_value = "groupSelect";
+                    }
+                    if (option_attrib_name_value.equals("dsJndiName")) {
+                        option_attrib_name_value = "dataSourceName";
+                        // This is to be modified to the algorithm that
+                        // cuts only the last tocken
+                        option_value = option_value.substring(option_value.indexOf(File.separator) + 1,
+                                option_value.length());
+                    }
+                    if (!(option_attrib_name_value.equals("unauthenticatedIdentity"))) {
+                        optionElement = XMLConversionHelper.createSiblingWithAttrib("option",
+                                option_value, "name", option_attrib_name_value,
+                                geronimoLoginmoduleElement.getNamespace());
+                    }
+                }
+                // No Need , because of no Geronimo side support
+                // else if
+                // (login_module_class.equals(Constants.GERONIMO_LOGIN_MODULE_IDELTITY)){
+                // optionElement =
+                // XMLConversionHelper.createSiblingWithAttrib("option",
+                // option_value, "name", option_attrib_name_value,
+                // geronimoLoginmoduleElement.getNamespace());
+                // }
+                else if (login_module_class.equals(Constants.GERONIMO_LOGIN_MODULE_LDAP)) {
+
+                    if (option_attrib_name_value.equals("java.naming.factory.initial")) {
+                        option_attrib_name_value = "initialContextFactory";
+                        optionElement = XMLConversionHelper.createSiblingWithAttrib("option",
+                                option_value, "name", option_attrib_name_value,
+                                geronimoLoginmoduleElement.getNamespace());
+                    }
+                    if (option_attrib_name_value.equals("java.naming.provider.url")) {
+                        String connectionURLString = "ldap://localhost:";
+                        if (XMLConversionHelper.containSubElementWithAttribute(
+                                jbossLoginModuleElement, "module-option", "name",
+                                "java.naming.security.protocol")) {
+                            Element securityProtocolElement = XMLConversionHelper
+                                    .obtainSubElementWithAttribute(jbossLoginModuleElement,
+                                            "module-option", "name",
+                                            "java.naming.security.protocol");
+                            String securityProtocolElementString = securityProtocolElement
+                                    .getText();
+                            if (securityProtocolElementString.equals("ssl")) {
+                                connectionURLString += "636";
+                            } else {
+                                connectionURLString += "389";
+                            }
+                        }
+                        option_attrib_name_value = "connectionURL";
+                        option_value = connectionURLString;
+                        optionElement = XMLConversionHelper.createSiblingWithAttrib("option",
+                                option_value, "name", option_attrib_name_value,
+                                geronimoLoginmoduleElement.getNamespace());
+                    }
+                    if (option_attrib_name_value.equals("java.naming.security.protocol")) {
+                        option_attrib_name_value = "connectionProtocol";
+                        optionElement = XMLConversionHelper.createSiblingWithAttrib("option",
+                                option_value, "name", option_attrib_name_value,
+                                geronimoLoginmoduleElement.getNamespace());
+                    }
+                    if (option_attrib_name_value.equals("java.naming.security.authentication")) {
+                        option_attrib_name_value = "authentication";
+                        optionElement = XMLConversionHelper.createSiblingWithAttrib("option",
+                                option_value, "name", option_attrib_name_value,
+                                geronimoLoginmoduleElement.getNamespace());
+                    }
+                    if (option_attrib_name_value.equals("roleAttributeID")) {
+                        option_attrib_name_value = "roleName";
+                        option_value = "roles";
+                        optionElement = XMLConversionHelper.createSiblingWithAttrib("option",
+                                option_value, "name", option_attrib_name_value,
+                                geronimoLoginmoduleElement.getNamespace());
+                    }
+                    if (option_attrib_name_value.equals("java.naming.security.protocol")) {
+                        option_attrib_name_value = "connectionProtocol";
+                        optionElement = XMLConversionHelper.createSiblingWithAttrib("option",
+                                option_value, "name", option_attrib_name_value,
+                                geronimoLoginmoduleElement.getNamespace());
+                    }
+                    if (option_attrib_name_value.equals("principalDNPrefix")) {
+                        if (XMLConversionHelper.containSubElementWithAttribute(
+                                jbossLoginModuleElement, "module-option", "name",
+                                "principalDNSuffix")) {
+                            Element principalDNSuffixElement = XMLConversionHelper
+                                    .obtainSubElementWithAttribute(jbossLoginModuleElement,
+                                            "module-option", "name", "principalDNSuffix");
+                            String principalDNSuffixElementString = principalDNSuffixElement
+                                    .getText();
+                            if (principalDNSuffixElementString != null) {
+                                // option_value+=principalDNSuffixElementString.substring(0,
+                                // principalDNSuffixElementString.indexOf(","));
+                                option_value += "{0}" + principalDNSuffixElementString;
+                            } else {
+                                option_value += "{0}";
+                            }
+                        }
+                        option_attrib_name_value = "userSearchMatching";
+                        optionElement = XMLConversionHelper.createSiblingWithAttrib("option",
+                                option_value, "name", option_attrib_name_value,
+                                geronimoLoginmoduleElement.getNamespace());
+                    }
+                    if (option_attrib_name_value.equals("rolesCtxDN")) {
+                        option_attrib_name_value = "roleSearchMatching";
+                        if (XMLConversionHelper.containSubElementWithAttribute(
+                                jbossLoginModuleElement, "module-option", "name", "matchOnUserDN")) {
+                            Element matchOnUserDNElement = XMLConversionHelper
+                                    .obtainSubElementWithAttribute(jbossLoginModuleElement,
+                                            "module-option", "name", "matchOnUserDN");
+                            String matchOnUserDNString = matchOnUserDNElement.getText();
+                            if (XMLConversionHelper.containSubElementWithAttribute(
+                                    jbossLoginModuleElement, "module-option", "name",
+                                    "matchOnUserDN")) {
+                                Element uidAttributeIDElement = XMLConversionHelper
+                                        .obtainSubElementWithAttribute(jbossLoginModuleElement,
+                                                "module-option", "name", "uidAttributeID");
+                                String uidAttributeIDString = uidAttributeIDElement.getText();
+                                // String first_part_of_option_value =
+                                // option_value.substring(0,
+                                // option_value.indexOf(","));
+                                // String secoend_part_of_option_value =
+                                // first_part_of_option_value.substring(0,
+                                // option_value.indexOf(","));
+                                String first_part_of_option_value = "{0}";
+                                String secoend_part_of_option_value = "{1}";
+                                option_value = option_value
+                                        + "???("
+                                        + uidAttributeIDString
+                                        + "="
+                                        + (matchOnUserDNString.equals("true") ? first_part_of_option_value
+                                                : secoend_part_of_option_value) + ")";
+                            }
+                        }
+                        optionElement = XMLConversionHelper.createSiblingWithAttrib("option",
+                                option_value, "name", option_attrib_name_value,
+                                geronimoLoginmoduleElement.getNamespace());
+                    }
+                    extraOptionsElement[0] = XMLConversionHelper.createSiblingWithAttrib("option",
+                            "", "name", "userBase", geronimoLoginmoduleElement.getNamespace());
+                    extraOptionsElement[1] = XMLConversionHelper.createSiblingWithAttrib("option",
+                            "", "name", "roleBase", geronimoLoginmoduleElement.getNamespace());
+                    extraOptionsElement[2] = XMLConversionHelper.createSiblingWithAttrib("option",
+                            "true", "name", "userSearchSubtree", geronimoLoginmoduleElement
+                                    .getNamespace());
+                    extraOptionsElement[3] = XMLConversionHelper.createSiblingWithAttrib("option",
+                            "true", "name", "roleSearchSubtree", geronimoLoginmoduleElement
+                                    .getNamespace());
+                } else if (login_module_class.equals(Constants.GERONIMO_LOGIN_MODULE_USERS_ROLES)) {
+                    if (option_attrib_name_value.equals("usersProperties")) {
+                        option_attrib_name_value = "usersURI";
+                        option_value = Constants.USER_PROPERTIES_FILE_PATH;
+                        out
+                           .info(SecurityResourcesTool.class.getSimpleName(), "Security Resources Tool Assumes user properties are in location =>"
+                                    + Constants.USER_PROPERTIES_FILE_PATH);
+                    }
+                    if (option_attrib_name_value.equals("rolesProperties")) {
+                        option_attrib_name_value = "groupsURI";
+                        option_value = Constants.GROUP_PROPERTIES_FILE_PATH;
+                        out
+                           .info(SecurityResourcesTool.class.getSimpleName(), "Security Resources Tool Assumes groups properties are in location =>"
+                                    + Constants.GROUP_PROPERTIES_FILE_PATH);
+                    }
+                    optionElement = XMLConversionHelper.createSiblingWithAttrib("option",
+                            option_value, "name", option_attrib_name_value,
+                            geronimoLoginmoduleElement.getNamespace());
+                }
+                if (optionElement != null)
+                    geronimoLoginmoduleElement.add(optionElement);
+                if (countIterations == 0) {
+                    for (int i = 0; i < extraOptionsElement.length; i++) {
+                        if (extraOptionsElement[i] != null)
+                            geronimoLoginmoduleElement.add(extraOptionsElement[i]);
+                    }
+                }
+                countIterations += 1;
+            }
+        }
+        return geronimoLoginmoduleElement;
+    }
+
+    /**
+     * validate the wether the jeronimo side policy is a valid policy
+     * 
+     * @param application_policyElement
+     * @return boolean status of the check
+     */
+    private boolean validateSecurityPolicy(Element application_policyElement) {
+        String jbossLoginModule = null;
+        if (XMLConversionHelper.containSubElement(application_policyElement, "authentication")) {
+            Element authenticationElement = XMLConversionHelper.obtainSubElement(
+                    application_policyElement, "authentication");
+            if (XMLConversionHelper.containSubElement(authenticationElement, "login-module")) {
+                Element login_moduleElement = XMLConversionHelper.obtainSubElement(
+                        authenticationElement, "login-module");
+                Iterator attribIterator = login_moduleElement.attributeIterator();
+                while (attribIterator.hasNext()) {
+                    Attribute itAttribute = (Attribute) attribIterator.next();
+                    if (itAttribute.getName().equals("code")) {
+                        jbossLoginModule = itAttribute.getText();
+                        boolean return_value = validateJbossLoginModule(jbossLoginModule);
+                        return return_value;
+                    }
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * obtain the control flag from the login module element
+     * 
+     * @param login_moduleElement
+     * @return String version of the control flag
+     */
+    private String obtainControlFlagFromLoginModuleElement(Element login_moduleElement) {
+        String control_flag = null;
+        Iterator attribIterator = login_moduleElement.attributeIterator();
+        while (attribIterator.hasNext()) {
+            Attribute itAttribute = (Attribute) attribIterator.next();
+            if (itAttribute.getName().equals("flag")) {
+                control_flag = itAttribute.getText();
+                return control_flag;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * validate the jboss security modules wethere these are acceptable for the
+     * geronimo side
+     * 
+     * @param jbossLoginModule
+     * @return boolean status of the validation
+     */
+    private boolean validateJbossLoginModule(String jbossLoginModule) {
+        boolean status = false;
+        logger.debug("Jboss login module class name => " + jbossLoginModule);
+        if (jbossLoginModule.equals(Constants.JBOSS_LOGIN_MODULE_DATABASE_SERVER)) {
+            status = true;
+        } else if (jbossLoginModule.equals(Constants.JBOSS_LOGIN_MODULE_LDAP)) {
+            status =  true;
+        } else if (jbossLoginModule.equals(Constants.JBOSS_LOGIN_MODULE_USERS_ROLES)) {
+            status =  true;
+        }else {
+            out.error(SecurityResourcesTool.class.getSimpleName(), "The security resource conversion tool does not support "+
+                       jbossLoginModule+" module functionality");
+        }
+        return status;
+    }
+
+}

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/src/org/apache/geronimo/j2g/resources/security/SecurityResourcesTool.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/src/org/apache/geronimo/j2g/resources/security/SecurityResourcesTool.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/src/org/apache/geronimo/j2g/resources/security/SecurityResourcesTool.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/hsqldb-ds.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/hsqldb-ds.xml?view=diff&rev=561821&r1=561820&r2=561821
==============================================================================
--- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/hsqldb-ds.xml (original)
+++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/hsqldb-ds.xml Wed Aug  1 08:05:12 2007
@@ -1,120 +1,120 @@
-<?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. -->
-
-<!-- The Hypersonic embedded database JCA connection factory config
-$Id: hsqldb-ds.xml 546303 2007-06-11 22:11:35Z pmcmahan $ -->
-
-
-<datasources>
-   <local-tx-datasource>
-
-      <!-- The jndi name of the DataSource, it is prefixed with java:/ -->
-      <!-- Datasources are not available outside the virtual machine -->
-      <jndi-name>DefaultDS</jndi-name>
-
-      <!-- for tcp connection, allowing other processes to use the hsqldb
-      database. This requires the org.jboss.jdbc.HypersonicDatabase mbean.
-      <connection-url>jdbc:hsqldb:hsql://localhost:1701</connection-url>
--->
-      <!-- for totally in-memory db, not saved when jboss stops. 
-      The org.jboss.jdbc.HypersonicDatabase mbean necessary
-      <connection-url>jdbc:hsqldb:.</connection-url>
--->
-      <!-- for in-process persistent db, saved when jboss stops. The
-      org.jboss.jdbc.HypersonicDatabase mbean is necessary for properly db shutdown
--->
-      <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>
-
-      <!-- The driver class -->
-      <driver-class>org.hsqldb.jdbcDriver</driver-class>
-
-      <!-- The login and password -->
-      <user-name>sa</user-name>
-      <password></password>
-
-      <!--example of how to specify class that determines if exception means connection should be destroyed-->
-      <!--exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyExceptionSorter</exception-sorter-class-name-->
-
-      <!-- this will be run before a managed connection is removed from the pool for use by a client-->
-      <!--<check-valid-connection-sql>select * from something</check-valid-connection-sql> -->
-
-      <!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
-      <min-pool-size>5</min-pool-size>
-
-      <!-- The maximum connections in a pool/sub-pool -->
-      <max-pool-size>20</max-pool-size>
-
-      <!-- The time before an unused connection is destroyed -->
-      <!-- NOTE: This is the check period. It will be destroyed somewhere between 1x and 2x this timeout after last use -->
-      <!-- TEMPORARY FIX! - Disable idle connection removal, HSQLDB has a problem with not reaping threads on closed connections -->
-      <idle-timeout-minutes>0</idle-timeout-minutes>
-
-      <!-- sql to call when connection is created
-        <new-connection-sql>some arbitrary sql</new-connection-sql>
-      -->
-
-      <!-- sql to call on an existing pooled connection when it is obtained from pool 
-         <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
-      -->
-
-      <!-- example of how to specify a class that determines a connection is valid before it is handed out from the pool
-         <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyValidConnectionChecker</valid-connection-checker-class-name>
-      -->
-
-      <!-- Whether to check all statements are closed when the connection is returned to the pool,
-           this is a debugging feature that should be turned off in production -->
-      <track-statements/>
-
-      <!-- Use the getConnection(user, pw) for logins
-        <application-managed-security/>
-      -->
-
-      <!-- Use the security domain defined in conf/login-config.xml -->
-      <security-domain>HsqlDbRealm</security-domain>
-
-      <!-- Use the security domain defined in conf/login-config.xml or the
-           getConnection(user, pw) for logins. The security domain takes precedence.
-        <security-domain-and-application>HsqlDbRealm</security-domain-and-application>
-      -->
-
-      <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
-      <metadata>
-         <type-mapping>Hypersonic SQL</type-mapping>
-      </metadata>
-
-      <!-- This mbean can be used when using in process persistent hypersonic -->
-      <depends>jboss:service=Hypersonic,database=localDB</depends>
-   </local-tx-datasource>
-
-   <!-- This mbean should be used only when using tcp connections. Uncomment
-   when the tcp based connection-url is used. 
-   <mbean code="org.jboss.jdbc.HypersonicDatabase" 
-     name="jboss:service=Hypersonic">
-     <attribute name="Port">1701</attribute>
-     <attribute name="Silent">true</attribute>
-     <attribute name="Database">default</attribute>
-     <attribute name="Trace">false</attribute>
-     <attribute name="No_system_exit">true</attribute>
-   </mbean>
- -->
-
-   <!-- This mbean can be used when using in process persistent db -->
-   <mbean code="org.jboss.jdbc.HypersonicDatabase" 
-     name="jboss:service=Hypersonic,database=localDB">
-     <attribute name="Database">localDB</attribute>
-     <attribute name="InProcessMode">true</attribute>
-   </mbean>
-</datasources>
+<?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. -->
+
+<!-- The Hypersonic embedded database JCA connection factory config
+$Id$ -->
+
+
+<datasources>
+   <local-tx-datasource>
+
+      <!-- The jndi name of the DataSource, it is prefixed with java:/ -->
+      <!-- Datasources are not available outside the virtual machine -->
+      <jndi-name>DefaultDS</jndi-name>
+
+      <!-- for tcp connection, allowing other processes to use the hsqldb
+      database. This requires the org.jboss.jdbc.HypersonicDatabase mbean.
+      <connection-url>jdbc:hsqldb:hsql://localhost:1701</connection-url>
+-->
+      <!-- for totally in-memory db, not saved when jboss stops. 
+      The org.jboss.jdbc.HypersonicDatabase mbean necessary
+      <connection-url>jdbc:hsqldb:.</connection-url>
+-->
+      <!-- for in-process persistent db, saved when jboss stops. The
+      org.jboss.jdbc.HypersonicDatabase mbean is necessary for properly db shutdown
+-->
+      <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url>
+
+      <!-- The driver class -->
+      <driver-class>org.hsqldb.jdbcDriver</driver-class>
+
+      <!-- The login and password -->
+      <user-name>sa</user-name>
+      <password></password>
+
+      <!--example of how to specify class that determines if exception means connection should be destroyed-->
+      <!--exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyExceptionSorter</exception-sorter-class-name-->
+
+      <!-- this will be run before a managed connection is removed from the pool for use by a client-->
+      <!--<check-valid-connection-sql>select * from something</check-valid-connection-sql> -->
+
+      <!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
+      <min-pool-size>5</min-pool-size>
+
+      <!-- The maximum connections in a pool/sub-pool -->
+      <max-pool-size>20</max-pool-size>
+
+      <!-- The time before an unused connection is destroyed -->
+      <!-- NOTE: This is the check period. It will be destroyed somewhere between 1x and 2x this timeout after last use -->
+      <!-- TEMPORARY FIX! - Disable idle connection removal, HSQLDB has a problem with not reaping threads on closed connections -->
+      <idle-timeout-minutes>0</idle-timeout-minutes>
+
+      <!-- sql to call when connection is created
+        <new-connection-sql>some arbitrary sql</new-connection-sql>
+      -->
+
+      <!-- sql to call on an existing pooled connection when it is obtained from pool 
+         <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
+      -->
+
+      <!-- example of how to specify a class that determines a connection is valid before it is handed out from the pool
+         <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyValidConnectionChecker</valid-connection-checker-class-name>
+      -->
+
+      <!-- Whether to check all statements are closed when the connection is returned to the pool,
+           this is a debugging feature that should be turned off in production -->
+      <track-statements/>
+
+      <!-- Use the getConnection(user, pw) for logins
+        <application-managed-security/>
+      -->
+
+      <!-- Use the security domain defined in conf/login-config.xml -->
+      <security-domain>HsqlDbRealm</security-domain>
+
+      <!-- Use the security domain defined in conf/login-config.xml or the
+           getConnection(user, pw) for logins. The security domain takes precedence.
+        <security-domain-and-application>HsqlDbRealm</security-domain-and-application>
+      -->
+
+      <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
+      <metadata>
+         <type-mapping>Hypersonic SQL</type-mapping>
+      </metadata>
+
+      <!-- This mbean can be used when using in process persistent hypersonic -->
+      <depends>jboss:service=Hypersonic,database=localDB</depends>
+   </local-tx-datasource>
+
+   <!-- This mbean should be used only when using tcp connections. Uncomment
+   when the tcp based connection-url is used. 
+   <mbean code="org.jboss.jdbc.HypersonicDatabase" 
+     name="jboss:service=Hypersonic">
+     <attribute name="Port">1701</attribute>
+     <attribute name="Silent">true</attribute>
+     <attribute name="Database">default</attribute>
+     <attribute name="Trace">false</attribute>
+     <attribute name="No_system_exit">true</attribute>
+   </mbean>
+ -->
+
+   <!-- This mbean can be used when using in process persistent db -->
+   <mbean code="org.jboss.jdbc.HypersonicDatabase" 
+     name="jboss:service=Hypersonic,database=localDB">
+     <attribute name="Database">localDB</attribute>
+     <attribute name="InProcessMode">true</attribute>
+   </mbean>
+</datasources>

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/hsqldb-ds.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/hsqldb-ds.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/hsqldb-ds.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/hsqldb-geronimo-plan.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/hsqldb-geronimo-plan.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/hsqldb-geronimo-plan.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/mysql-ds.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/mysql-ds.xml?view=diff&rev=561821&r1=561820&r2=561821
==============================================================================
--- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/mysql-ds.xml (original)
+++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/mysql-ds.xml Wed Aug  1 08:05:12 2007
@@ -1,33 +1,33 @@
-<?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. -->
-
-<!-- $Id: mysql-ds.xml 546303 2007-06-11 22:11:35Z pmcmahan $ -->
-<!--  Datasource config for MySQL using 3.0.9 available from:
-http://www.mysql.com/downloads/api-jdbc-stable.html
--->
-
-<datasources>
-
-  <local-tx-datasource>
-        <jndi-name>jdbc/TradeDB</jndi-name>
-        <connection-url>jdbc:mysql://localhost:3306/tradedb</connection-url>
-        <driver-class>com.mysql.jdbc.Driver</driver-class>
-        <user-name>root</user-name>
-        <password>password</password>
-        <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>        
-  </local-tx-datasource>
- </datasources>
-
+<?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. -->
+
+<!-- $Id$ -->
+<!--  Datasource config for MySQL using 3.0.9 available from:
+http://www.mysql.com/downloads/api-jdbc-stable.html
+-->
+
+<datasources>
+
+  <local-tx-datasource>
+        <jndi-name>jdbc/TradeDB</jndi-name>
+        <connection-url>jdbc:mysql://localhost:3306/tradedb</connection-url>
+        <driver-class>com.mysql.jdbc.Driver</driver-class>
+        <user-name>root</user-name>
+        <password>password</password>
+        <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>        
+  </local-tx-datasource>
+ </datasources>
+

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/mysql-ds.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/mysql-ds.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/mysql-ds.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/mysql-geronimo-plan.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/mysql-geronimo-plan.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/mysql-geronimo-plan.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/oracle-ds.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/oracle-ds.xml?view=diff&rev=561821&r1=561820&r2=561821
==============================================================================
--- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/oracle-ds.xml (original)
+++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/oracle-ds.xml Wed Aug  1 08:05:12 2007
@@ -1,33 +1,33 @@
-<?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. -->
-
-<!-- $Id: oracle-ds.xml 546303 2007-06-11 22:11:35Z pmcmahan $ -->
-<!--  Datasource config for MySQL using 3.0.9 available from:
-http://www.mysql.com/downloads/api-jdbc-stable.html
--->
-
-<datasources>
-
-  <local-tx-datasource>
-        <jndi-name>jdbc/TradeDB</jndi-name>
-        <connection-url>jdbc:oracle://localhost:3306/tradedb</connection-url>
-        <driver-class>oracle.jdbc.OracleDriver</driver-class>
-        <user-name>root</user-name>
-        <password>password</password>
-        <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>        
-  </local-tx-datasource>
- </datasources>
-
+<?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. -->
+
+<!-- $Id$ -->
+<!--  Datasource config for MySQL using 3.0.9 available from:
+http://www.mysql.com/downloads/api-jdbc-stable.html
+-->
+
+<datasources>
+
+  <local-tx-datasource>
+        <jndi-name>jdbc/TradeDB</jndi-name>
+        <connection-url>jdbc:oracle://localhost:3306/tradedb</connection-url>
+        <driver-class>oracle.jdbc.OracleDriver</driver-class>
+        <user-name>root</user-name>
+        <password>password</password>
+        <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>        
+  </local-tx-datasource>
+ </datasources>
+

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/oracle-ds.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/oracle-ds.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/oracle-ds.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/oracle-geronimo-plan.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/oracle-geronimo-plan.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/test-apps/ds/oracle-geronimo-plan.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message