geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmcma...@apache.org
Subject svn commit: r561821 [3/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
Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/comp/dto/Relationships.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/comp/dto/Relationships.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/comp/dto/Relationships.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/EJBDescriptorTool.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/EJBDescriptorTool.java?view=diff&rev=561821&r1=561820&r2=561821
==============================================================================
--- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/EJBDescriptorTool.java (original)
+++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/EJBDescriptorTool.java Wed Aug  1 08:05:12 2007
@@ -1,321 +1,321 @@
-/**
- *  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.descriptors.ejb;
-
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Properties;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.geronimo.j2g.common.ConsoleOutput;
-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.descriptors.ejb.bean.EntityBeanMigrator;
-import org.apache.geronimo.j2g.descriptors.ejb.bean.SessionBeanMigrator;
-import org.apache.geronimo.j2g.util.descriptors.Constants;
-import org.apache.geronimo.j2g.util.descriptors.env.EnvirionmentElementProcessor;
-import org.apache.geronimo.j2g.util.descriptors.naming.NamingElementProcessor;
-import org.apache.geronimo.j2g.util.descriptors.security.SecurityElementProcessor;
-import org.apache.geronimo.j2g.util.descriptors.xml.XMLConversionHelper;
-import org.dom4j.Attribute;
-import org.dom4j.Document;
-import org.dom4j.DocumentException;
-import org.dom4j.Element;
-import org.dom4j.QName;
-
-public class EJBDescriptorTool implements IFileMigration {
-
-    private IOutput out;
-
-    private Log logger = LogFactory.getLog(EJBDescriptorTool.class);
-
-    private EnvirionmentElementProcessor envirionmentElementProcessor;
-
-    private SessionBeanMigrator sessionBeanMigrator;
-
-    private EntityBeanMigrator entityBeanMigrator;
-
-    private NamingElementProcessor namingElementProcessor;
-
-    private SecurityElementProcessor securityElementProcessor;
-        
-    // location of the properties file used to extract the differences
-    private final String PROP_PERSISTENCE_FILENAME = "persistence_differences.properties";
-    private final String PROP_PERSISTENCE_DIRECTORY = System.getenv("ECLIPSE_HOME")+"/plugins/org.apache.geronimo.j2g.descriptors.ejb/";
-  
-
-    public EJBDescriptorTool() {
-    	
-    	Tool currentTool = Tool.getCurrent();
-    	if (currentTool != null) {
-    		out = currentTool.getOutput();
-    	} else {
-    		out = new ConsoleOutput();
-    	}
-        envirionmentElementProcessor = new EnvirionmentElementProcessor();
-        namingElementProcessor = new NamingElementProcessor(envirionmentElementProcessor);
-        sessionBeanMigrator = new SessionBeanMigrator(envirionmentElementProcessor,
-                namingElementProcessor);
-        entityBeanMigrator = new EntityBeanMigrator(envirionmentElementProcessor,
-                namingElementProcessor);
-        securityElementProcessor = new SecurityElementProcessor();
-
-    }
-
-    /**
-     * migrates both the jboss.xml and jbosscmp-jdbc.xml file to openejb-jar.xml
-     * in geronimo
-     * 
-     * @param file
-     * @return migrate sucess or not
-     */
-
-    public boolean migrate(File file, File rootDirectory) {
-        boolean migrated = false;
-            String directoryName = file.getParent();
-            String jbossFileName = file.getName();
-            logger.debug("Directory Name ==> " + directoryName + " jboss file Name ==> "
-                    + jbossFileName);
-
-            if (jbossFileName.equals(Constants.JBOSS_JBOSS_XML_FILE)) {
-                out.info(EJBDescriptorTool.class.getSimpleName(), "Converting Jboss.xml file in " + directoryName);
-                try {
-                    // check whether the jbosscmp-jdbc.xml file is present and
-                    // if so load it and process it.
-                    Document jbossDocument = XMLConversionHelper.getDocument(file);
-                    Document geronimoDocument = XMLConversionHelper
-                            .getOpenEJBJarDocument(directoryName);
-                    migrate(jbossDocument.getRootElement(), geronimoDocument.getRootElement());
-                    String geronimoOpenEjbJarFileName = directoryName + File.separator
-                            + Constants.GERONIMO_OPEN_EJB_XML_FILE;
-                    XMLConversionHelper.saveOpenEJBDocument(geronimoOpenEjbJarFileName,
-                            geronimoDocument);
-                    migrated = true;
-                    out.info(EJBDescriptorTool.class.getSimpleName(), "Successfully migrated the Jboss.xml file in "
-                            + directoryName + ", with the error and warning messages as shown");
-                } catch (DocumentException e) {
-                	out.error(EJBDescriptorTool.class.getSimpleName(), "Error occured while reading xml descriptor "
-    						+ file.getAbsolutePath()
-    						+ ". It is possible that the migrator cannot download the xml schema or the xml file has incorrect syntax. Nested exception:"
-    						+ e.getMessage());
-                } catch (IOException e) {
-                    out.error(EJBDescriptorTool.class.getSimpleName(), "IO exception " + e.getMessage());
-                }
-            } else if (jbossFileName.equals(Constants.EJB_JAR_XML_FILE)){
-                out.info(EJBDescriptorTool.class.getSimpleName(), "Converting ejb-jar.xml file in " + directoryName);
-                out.info(EJBDescriptorTool.class.getSimpleName(), "Nothing to convert. No changes required for this file");
-            }  else if (jbossFileName.equals(Constants.PERSISTENCE_XML_FILE)) {
-	                out.info(EJBDescriptorTool.class.getSimpleName(), "Converting the persistence.xml file in " + directoryName);
-                try {
-                    // get the dom4j representation from the persistence.xml files
-                    Document persistenceDoc = XMLConversionHelper.getPersistenceDocument(directoryName);
-                    // populate the differences
-                    HashMap<String, String> diffs = populatePersistenceDifferences();
-                    // migrate from the jboss persistence.xml to geronimo's persistence.xml
-                    migratePersistence(persistenceDoc.getRootElement(), diffs);
-                    // construct the path
-                    String geronimoPersistenceFileName = directoryName + File.separator
-                                                                       + Constants.PERSISTENCE_XML_FILE;
-                    // save the file
-                    XMLConversionHelper.saveGeronimoDocument(geronimoPersistenceFileName, persistenceDoc);
-                    migrated = true;
-                    out.info(EJBDescriptorTool.class.getSimpleName(), "Successfully migrated the persistence.xml file in "
-                                + directoryName + ", with the error and warning messages as shown");
-                } catch(DocumentException e) {
-                    out.error(EJBDescriptorTool.class.getSimpleName(), "Error occured while reading xml descriptor "
-                        + file.getAbsolutePath()
-                        + ". It is possible that the migrator cannot download the xml schema or the xml file has incorrect syntax. Nested exception:"
-                        + e.getMessage());
-                } catch(IOException e) {
-                    out.error(EJBDescriptorTool.class.getSimpleName(), "IO exception " + e.getMessage());
-                }
-            }
-        return migrated;
-    }
-
-    private void migratePersistence(Element rootElement, HashMap<String, String> diffs) {
-        // iterate through all the elements and convert them accordingly
-        Element rootChildElement;
-        boolean hasJTA = false;
-        boolean hasNonJTA = false;
-        for(Iterator it = rootElement.elements().iterator(); it.hasNext(); ) {
-            rootChildElement = (Element) it.next();
-            if(rootChildElement.getName().equals("jta-data-source")) {
-                hasJTA = true;
-            } else if(rootChildElement.getName().equals("non-jta-data-source")) {
-                hasNonJTA = true;
-            } else if(rootChildElement.getName().equals("property")) {
-                // swap out the name attribute of each <property> element
-                Attribute nameAttr = rootChildElement.attribute("name");
-                String nameValue = nameAttr.getValue();
-                String replacementValue = null;
-                if(diffs.containsKey(nameValue)) {
-                    replacementValue = diffs.get(nameValue);
-                    if(replacementValue.startsWith("suggestion:")) {
-                        // warn the user that there is a possible solution, but requires further configuration
-                        out.warn(EJBDescriptorTool.class.getSimpleName(), "persistence.xml SUGGESTION: " + nameValue + " should probably be replaced by " + replacementValue +
-                                    " but further configuration may be needed.");
-                    } else {
-                        // replace the property.name element with the analogous
-                        nameAttr.setValue(replacementValue);
-                        // update the tree
-                        rootChildElement.addAttribute("name", replacementValue);
-                        // tell them
-                        out.info(EJBDescriptorTool.class.getSimpleName(), "persistence.xml: " + nameValue + " was replaced by " + replacementValue);
-                    }
-                } else {
-                    out.warn(EJBDescriptorTool.class.getSimpleName(), "You should manually convert this property name: " + nameValue);
-                    continue;
-                }
-            } else {
-                // recurse until I get to the end of the tree or when I see the <property> elements
-                migratePersistence(rootChildElement, diffs);
-            }
-        }
-        // when there is a jta-data-source, provide a non-jta-data-source tag
-        // if it does not already exist
-        if(hasJTA && !hasNonJTA) {
-            QName nonJTA = new QName("non-jta-data-source", rootElement.getNamespace());
-            Element nonJTAElement = rootElement.addElement(nonJTA);
-            out.warn(EJBDescriptorTool.class.getSimpleName(), "You should set the text of <non-jta-data-source> to point to a non-JTA datasource.");
-        }
-    }
-	    
-    private HashMap<String, String> populatePersistenceDifferences() {
-        //  populate the hashmap with info from the properties file
-        HashMap<String, String> diffs = new HashMap<String, String>();
-        Properties mappingProps = new Properties();
-        try {
-        	File propertyFile = new File(PROP_PERSISTENCE_DIRECTORY + PROP_PERSISTENCE_FILENAME);
-            mappingProps.load(new FileInputStream( propertyFile ));
-            // fetch all keys from the properties file
-            Enumeration keys = mappingProps.propertyNames();
-            // for each key, store the analogous into the hashmap
-            while(keys.hasMoreElements()) {
-                String key = (String)keys.nextElement();
-                String value = mappingProps.getProperty(key);
-                diffs.put(key, value);
-            }
-        } catch(Exception e) {
-            out.error(EJBDescriptorTool.class.getSimpleName(), "Cannot find properties file: " + PROP_PERSISTENCE_FILENAME);
-        }
-        return diffs;
-    }
-	  
-
-    private void migrate(Element jbossRootElement, Element geronimoRootElement) {
-
-        // iterate through all the elements and convert them accordingly
-        Element jbossRootChildElement;
-        for (Iterator iter = jbossRootElement.elements().iterator(); iter.hasNext();) {
-            jbossRootChildElement = (Element) iter.next();
-            if (jbossRootChildElement.getName().equals("security-domain")) {
-                securityElementProcessor.setSecurityDomain(jbossRootChildElement.getText());
-            } else if (jbossRootChildElement.getName().equals("enterprise-beans")) {
-                logger.debug("migrating enterprise-beans");
-                // process the enterprise bean element
-                // add enterprise beans element to geronimo
-                // this element is in the same name space as the root element
-                Element geronimoEnterpriseBean = XMLConversionHelper.getGeronimoElement(
-                        geronimoRootElement, "//ejb:enterprise-beans", "enterprise-beans",
-                        geronimoRootElement.getNamespace());
-                migrateEnterpriseBeans(jbossRootChildElement, geronimoEnterpriseBean);
-            } else if (jbossRootChildElement.getName().equals("assembly-descriptor")) {
-                migrateAssemblyDescriptor(jbossRootChildElement, geronimoRootElement);
-            } else {
-                out.warn(EJBDescriptorTool.class.getSimpleName(), "The Element '" + jbossRootChildElement.getName() + "' is not supported",
-                        XMLConversionHelper.getLineNumber(jbossRootChildElement),
-                        XMLConversionHelper.getColumnNumber(jbossRootChildElement));
-                logger.debug("The Element '" + jbossRootChildElement.getName()
-                        + "' is not supported");
-            }
-        }
-    }
-
-    private void migrateAssemblyDescriptor(Element jbossAssemblyDescriptor,
-            Element geronimoRootElement) {
-
-        Element jbossAssemblyDescriptorChildElement;
-        for (Iterator iter = jbossAssemblyDescriptor.elements().iterator(); iter.hasNext();) {
-            jbossAssemblyDescriptorChildElement = (Element) iter.next();
-            if (jbossAssemblyDescriptorChildElement.getName().equals("security-role")) {
-                Element geronimoRoleMapping = securityElementProcessor
-                        .getGeronimoSecurityRoleElement(geronimoRootElement);
-                securityElementProcessor.migrateSecurityRole(jbossAssemblyDescriptorChildElement,
-                        geronimoRoleMapping);
-            } else {
-                out.warn(EJBDescriptorTool.class.getSimpleName(), "The Element '" + jbossAssemblyDescriptorChildElement.getName()
-                        + "' is not supported", XMLConversionHelper
-                        .getLineNumber(jbossAssemblyDescriptorChildElement), XMLConversionHelper
-                        .getColumnNumber(jbossAssemblyDescriptorChildElement));
-                logger.debug("The Element '" + jbossAssemblyDescriptorChildElement.getName()
-                        + "' is not supported");
-            }
-        }
-    }
-
-    /**
-     * this migrates the enterprise-beans part
-     * 
-     * @param jbossEnterpriseBeans
-     * @param geronimoEnterpriseBeans
-     */
-    private void migrateEnterpriseBeans(Element jbossEnterpriseBeans,
-            Element geronimoEnterpriseBeans) {
-
-        Element jbossEnterpriseBeanChildElement;
-        for (Iterator iter = jbossEnterpriseBeans.elements().iterator(); iter.hasNext();) {
-            jbossEnterpriseBeanChildElement = (Element) iter.next();
-            if (jbossEnterpriseBeanChildElement.getName().equals("session")) {
-                // session beans can only come from jboss.xml file
-                logger.debug("migrating session beans");
-                QName qname = new QName("session", geronimoEnterpriseBeans.getNamespace());
-                Element geronimoSession = geronimoEnterpriseBeans.addElement(qname);
-                sessionBeanMigrator.migrateBean(jbossEnterpriseBeanChildElement, geronimoSession);
-            } else if (jbossEnterpriseBeanChildElement.getName().equals("entity")) {
-                logger.debug("migrating entity beans");
-                // get the session ejb name
-                Element ejbNameElement = jbossEnterpriseBeanChildElement.element("ejb-name");
-                String ejbName = ejbNameElement.getText();
-                logger.debug("Converting ejb session with name ==> " + ejbName);
-                // create a session bean in geronimo
-                String xpath = "//ejb:enterprise-beans/ejb:entity[ejb:ejb-name/text() = '"
-                        + ejbName + "']";
-                logger.debug("Find existing ejb using query ==>" + xpath);
-                Element geronimoEntity = XMLConversionHelper.getGeronimoElement(
-                        geronimoEnterpriseBeans, xpath, "entity", geronimoEnterpriseBeans
-                                .getNamespace());
-                entityBeanMigrator.migrateBean(jbossEnterpriseBeanChildElement, geronimoEntity);
-            } else {
-                out.warn(EJBDescriptorTool.class.getSimpleName(), "The Element '" + jbossEnterpriseBeanChildElement.getName()
-                        + "' is not supported", XMLConversionHelper
-                        .getLineNumber(jbossEnterpriseBeanChildElement), XMLConversionHelper
-                        .getColumnNumber(jbossEnterpriseBeanChildElement));
-                logger.debug("The Element '" + jbossEnterpriseBeanChildElement.getName()
-                        + "' is not supported");
-            }
-        }
-    }
-}
+/**
+ *  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.descriptors.ejb;
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Properties;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.j2g.common.ConsoleOutput;
+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.descriptors.ejb.bean.EntityBeanMigrator;
+import org.apache.geronimo.j2g.descriptors.ejb.bean.SessionBeanMigrator;
+import org.apache.geronimo.j2g.util.descriptors.Constants;
+import org.apache.geronimo.j2g.util.descriptors.env.EnvirionmentElementProcessor;
+import org.apache.geronimo.j2g.util.descriptors.naming.NamingElementProcessor;
+import org.apache.geronimo.j2g.util.descriptors.security.SecurityElementProcessor;
+import org.apache.geronimo.j2g.util.descriptors.xml.XMLConversionHelper;
+import org.dom4j.Attribute;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.QName;
+
+public class EJBDescriptorTool implements IFileMigration {
+
+    private IOutput out;
+
+    private Log logger = LogFactory.getLog(EJBDescriptorTool.class);
+
+    private EnvirionmentElementProcessor envirionmentElementProcessor;
+
+    private SessionBeanMigrator sessionBeanMigrator;
+
+    private EntityBeanMigrator entityBeanMigrator;
+
+    private NamingElementProcessor namingElementProcessor;
+
+    private SecurityElementProcessor securityElementProcessor;
+        
+    // location of the properties file used to extract the differences
+    private final String PROP_PERSISTENCE_FILENAME = "persistence_differences.properties";
+    private final String PROP_PERSISTENCE_DIRECTORY = System.getenv("ECLIPSE_HOME")+"/plugins/org.apache.geronimo.j2g.descriptors.ejb/";
+  
+
+    public EJBDescriptorTool() {
+    	
+    	Tool currentTool = Tool.getCurrent();
+    	if (currentTool != null) {
+    		out = currentTool.getOutput();
+    	} else {
+    		out = new ConsoleOutput();
+    	}
+        envirionmentElementProcessor = new EnvirionmentElementProcessor();
+        namingElementProcessor = new NamingElementProcessor(envirionmentElementProcessor);
+        sessionBeanMigrator = new SessionBeanMigrator(envirionmentElementProcessor,
+                namingElementProcessor);
+        entityBeanMigrator = new EntityBeanMigrator(envirionmentElementProcessor,
+                namingElementProcessor);
+        securityElementProcessor = new SecurityElementProcessor();
+
+    }
+
+    /**
+     * migrates both the jboss.xml and jbosscmp-jdbc.xml file to openejb-jar.xml
+     * in geronimo
+     * 
+     * @param file
+     * @return migrate sucess or not
+     */
+
+    public boolean migrate(File file, File rootDirectory) {
+        boolean migrated = false;
+            String directoryName = file.getParent();
+            String jbossFileName = file.getName();
+            logger.debug("Directory Name ==> " + directoryName + " jboss file Name ==> "
+                    + jbossFileName);
+
+            if (jbossFileName.equals(Constants.JBOSS_JBOSS_XML_FILE)) {
+                out.info(EJBDescriptorTool.class.getSimpleName(), "Converting Jboss.xml file in " + directoryName);
+                try {
+                    // check whether the jbosscmp-jdbc.xml file is present and
+                    // if so load it and process it.
+                    Document jbossDocument = XMLConversionHelper.getDocument(file);
+                    Document geronimoDocument = XMLConversionHelper
+                            .getOpenEJBJarDocument(directoryName);
+                    migrate(jbossDocument.getRootElement(), geronimoDocument.getRootElement());
+                    String geronimoOpenEjbJarFileName = directoryName + File.separator
+                            + Constants.GERONIMO_OPEN_EJB_XML_FILE;
+                    XMLConversionHelper.saveOpenEJBDocument(geronimoOpenEjbJarFileName,
+                            geronimoDocument);
+                    migrated = true;
+                    out.info(EJBDescriptorTool.class.getSimpleName(), "Successfully migrated the Jboss.xml file in "
+                            + directoryName + ", with the error and warning messages as shown");
+                } catch (DocumentException e) {
+                	out.error(EJBDescriptorTool.class.getSimpleName(), "Error occured while reading xml descriptor "
+    						+ file.getAbsolutePath()
+    						+ ". It is possible that the migrator cannot download the xml schema or the xml file has incorrect syntax. Nested exception:"
+    						+ e.getMessage());
+                } catch (IOException e) {
+                    out.error(EJBDescriptorTool.class.getSimpleName(), "IO exception " + e.getMessage());
+                }
+            } else if (jbossFileName.equals(Constants.EJB_JAR_XML_FILE)){
+                out.info(EJBDescriptorTool.class.getSimpleName(), "Converting ejb-jar.xml file in " + directoryName);
+                out.info(EJBDescriptorTool.class.getSimpleName(), "Nothing to convert. No changes required for this file");
+            }  else if (jbossFileName.equals(Constants.PERSISTENCE_XML_FILE)) {
+	                out.info(EJBDescriptorTool.class.getSimpleName(), "Converting the persistence.xml file in " + directoryName);
+                try {
+                    // get the dom4j representation from the persistence.xml files
+                    Document persistenceDoc = XMLConversionHelper.getPersistenceDocument(directoryName);
+                    // populate the differences
+                    HashMap<String, String> diffs = populatePersistenceDifferences();
+                    // migrate from the jboss persistence.xml to geronimo's persistence.xml
+                    migratePersistence(persistenceDoc.getRootElement(), diffs);
+                    // construct the path
+                    String geronimoPersistenceFileName = directoryName + File.separator
+                                                                       + Constants.PERSISTENCE_XML_FILE;
+                    // save the file
+                    XMLConversionHelper.saveGeronimoDocument(geronimoPersistenceFileName, persistenceDoc);
+                    migrated = true;
+                    out.info(EJBDescriptorTool.class.getSimpleName(), "Successfully migrated the persistence.xml file in "
+                                + directoryName + ", with the error and warning messages as shown");
+                } catch(DocumentException e) {
+                    out.error(EJBDescriptorTool.class.getSimpleName(), "Error occured while reading xml descriptor "
+                        + file.getAbsolutePath()
+                        + ". It is possible that the migrator cannot download the xml schema or the xml file has incorrect syntax. Nested exception:"
+                        + e.getMessage());
+                } catch(IOException e) {
+                    out.error(EJBDescriptorTool.class.getSimpleName(), "IO exception " + e.getMessage());
+                }
+            }
+        return migrated;
+    }
+
+    private void migratePersistence(Element rootElement, HashMap<String, String> diffs) {
+        // iterate through all the elements and convert them accordingly
+        Element rootChildElement;
+        boolean hasJTA = false;
+        boolean hasNonJTA = false;
+        for(Iterator it = rootElement.elements().iterator(); it.hasNext(); ) {
+            rootChildElement = (Element) it.next();
+            if(rootChildElement.getName().equals("jta-data-source")) {
+                hasJTA = true;
+            } else if(rootChildElement.getName().equals("non-jta-data-source")) {
+                hasNonJTA = true;
+            } else if(rootChildElement.getName().equals("property")) {
+                // swap out the name attribute of each <property> element
+                Attribute nameAttr = rootChildElement.attribute("name");
+                String nameValue = nameAttr.getValue();
+                String replacementValue = null;
+                if(diffs.containsKey(nameValue)) {
+                    replacementValue = diffs.get(nameValue);
+                    if(replacementValue.startsWith("suggestion:")) {
+                        // warn the user that there is a possible solution, but requires further configuration
+                        out.warn(EJBDescriptorTool.class.getSimpleName(), "persistence.xml SUGGESTION: " + nameValue + " should probably be replaced by " + replacementValue +
+                                    " but further configuration may be needed.");
+                    } else {
+                        // replace the property.name element with the analogous
+                        nameAttr.setValue(replacementValue);
+                        // update the tree
+                        rootChildElement.addAttribute("name", replacementValue);
+                        // tell them
+                        out.info(EJBDescriptorTool.class.getSimpleName(), "persistence.xml: " + nameValue + " was replaced by " + replacementValue);
+                    }
+                } else {
+                    out.warn(EJBDescriptorTool.class.getSimpleName(), "You should manually convert this property name: " + nameValue);
+                    continue;
+                }
+            } else {
+                // recurse until I get to the end of the tree or when I see the <property> elements
+                migratePersistence(rootChildElement, diffs);
+            }
+        }
+        // when there is a jta-data-source, provide a non-jta-data-source tag
+        // if it does not already exist
+        if(hasJTA && !hasNonJTA) {
+            QName nonJTA = new QName("non-jta-data-source", rootElement.getNamespace());
+            Element nonJTAElement = rootElement.addElement(nonJTA);
+            out.warn(EJBDescriptorTool.class.getSimpleName(), "You should set the text of <non-jta-data-source> to point to a non-JTA datasource.");
+        }
+    }
+	    
+    private HashMap<String, String> populatePersistenceDifferences() {
+        //  populate the hashmap with info from the properties file
+        HashMap<String, String> diffs = new HashMap<String, String>();
+        Properties mappingProps = new Properties();
+        try {
+        	File propertyFile = new File(PROP_PERSISTENCE_DIRECTORY + PROP_PERSISTENCE_FILENAME);
+            mappingProps.load(new FileInputStream( propertyFile ));
+            // fetch all keys from the properties file
+            Enumeration keys = mappingProps.propertyNames();
+            // for each key, store the analogous into the hashmap
+            while(keys.hasMoreElements()) {
+                String key = (String)keys.nextElement();
+                String value = mappingProps.getProperty(key);
+                diffs.put(key, value);
+            }
+        } catch(Exception e) {
+            out.error(EJBDescriptorTool.class.getSimpleName(), "Cannot find properties file: " + PROP_PERSISTENCE_FILENAME);
+        }
+        return diffs;
+    }
+	  
+
+    private void migrate(Element jbossRootElement, Element geronimoRootElement) {
+
+        // iterate through all the elements and convert them accordingly
+        Element jbossRootChildElement;
+        for (Iterator iter = jbossRootElement.elements().iterator(); iter.hasNext();) {
+            jbossRootChildElement = (Element) iter.next();
+            if (jbossRootChildElement.getName().equals("security-domain")) {
+                securityElementProcessor.setSecurityDomain(jbossRootChildElement.getText());
+            } else if (jbossRootChildElement.getName().equals("enterprise-beans")) {
+                logger.debug("migrating enterprise-beans");
+                // process the enterprise bean element
+                // add enterprise beans element to geronimo
+                // this element is in the same name space as the root element
+                Element geronimoEnterpriseBean = XMLConversionHelper.getGeronimoElement(
+                        geronimoRootElement, "//ejb:enterprise-beans", "enterprise-beans",
+                        geronimoRootElement.getNamespace());
+                migrateEnterpriseBeans(jbossRootChildElement, geronimoEnterpriseBean);
+            } else if (jbossRootChildElement.getName().equals("assembly-descriptor")) {
+                migrateAssemblyDescriptor(jbossRootChildElement, geronimoRootElement);
+            } else {
+                out.warn(EJBDescriptorTool.class.getSimpleName(), "The Element '" + jbossRootChildElement.getName() + "' is not supported",
+                        XMLConversionHelper.getLineNumber(jbossRootChildElement),
+                        XMLConversionHelper.getColumnNumber(jbossRootChildElement));
+                logger.debug("The Element '" + jbossRootChildElement.getName()
+                        + "' is not supported");
+            }
+        }
+    }
+
+    private void migrateAssemblyDescriptor(Element jbossAssemblyDescriptor,
+            Element geronimoRootElement) {
+
+        Element jbossAssemblyDescriptorChildElement;
+        for (Iterator iter = jbossAssemblyDescriptor.elements().iterator(); iter.hasNext();) {
+            jbossAssemblyDescriptorChildElement = (Element) iter.next();
+            if (jbossAssemblyDescriptorChildElement.getName().equals("security-role")) {
+                Element geronimoRoleMapping = securityElementProcessor
+                        .getGeronimoSecurityRoleElement(geronimoRootElement);
+                securityElementProcessor.migrateSecurityRole(jbossAssemblyDescriptorChildElement,
+                        geronimoRoleMapping);
+            } else {
+                out.warn(EJBDescriptorTool.class.getSimpleName(), "The Element '" + jbossAssemblyDescriptorChildElement.getName()
+                        + "' is not supported", XMLConversionHelper
+                        .getLineNumber(jbossAssemblyDescriptorChildElement), XMLConversionHelper
+                        .getColumnNumber(jbossAssemblyDescriptorChildElement));
+                logger.debug("The Element '" + jbossAssemblyDescriptorChildElement.getName()
+                        + "' is not supported");
+            }
+        }
+    }
+
+    /**
+     * this migrates the enterprise-beans part
+     * 
+     * @param jbossEnterpriseBeans
+     * @param geronimoEnterpriseBeans
+     */
+    private void migrateEnterpriseBeans(Element jbossEnterpriseBeans,
+            Element geronimoEnterpriseBeans) {
+
+        Element jbossEnterpriseBeanChildElement;
+        for (Iterator iter = jbossEnterpriseBeans.elements().iterator(); iter.hasNext();) {
+            jbossEnterpriseBeanChildElement = (Element) iter.next();
+            if (jbossEnterpriseBeanChildElement.getName().equals("session")) {
+                // session beans can only come from jboss.xml file
+                logger.debug("migrating session beans");
+                QName qname = new QName("session", geronimoEnterpriseBeans.getNamespace());
+                Element geronimoSession = geronimoEnterpriseBeans.addElement(qname);
+                sessionBeanMigrator.migrateBean(jbossEnterpriseBeanChildElement, geronimoSession);
+            } else if (jbossEnterpriseBeanChildElement.getName().equals("entity")) {
+                logger.debug("migrating entity beans");
+                // get the session ejb name
+                Element ejbNameElement = jbossEnterpriseBeanChildElement.element("ejb-name");
+                String ejbName = ejbNameElement.getText();
+                logger.debug("Converting ejb session with name ==> " + ejbName);
+                // create a session bean in geronimo
+                String xpath = "//ejb:enterprise-beans/ejb:entity[ejb:ejb-name/text() = '"
+                        + ejbName + "']";
+                logger.debug("Find existing ejb using query ==>" + xpath);
+                Element geronimoEntity = XMLConversionHelper.getGeronimoElement(
+                        geronimoEnterpriseBeans, xpath, "entity", geronimoEnterpriseBeans
+                                .getNamespace());
+                entityBeanMigrator.migrateBean(jbossEnterpriseBeanChildElement, geronimoEntity);
+            } else {
+                out.warn(EJBDescriptorTool.class.getSimpleName(), "The Element '" + jbossEnterpriseBeanChildElement.getName()
+                        + "' is not supported", XMLConversionHelper
+                        .getLineNumber(jbossEnterpriseBeanChildElement), XMLConversionHelper
+                        .getColumnNumber(jbossEnterpriseBeanChildElement));
+                logger.debug("The Element '" + jbossEnterpriseBeanChildElement.getName()
+                        + "' is not supported");
+            }
+        }
+    }
+}

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/EJBDescriptorTool.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/EJBDescriptorTool.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/EJBDescriptorTool.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/annotation/AnnotationConverter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/annotation/AnnotationConverter.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/annotation/AnnotationConverter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/annotation/AnnotationInstance.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/annotation/AnnotationInstance.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/annotation/AnnotationInstance.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/annotation/AnnotationTool.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/annotation/AnnotationTool.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/annotation/AnnotationTool.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/BeanMigrator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/BeanMigrator.java?view=diff&rev=561821&r1=561820&r2=561821
==============================================================================
--- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/BeanMigrator.java (original)
+++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/BeanMigrator.java Wed Aug  1 08:05:12 2007
@@ -1,196 +1,196 @@
-/**
- *  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.descriptors.ejb.bean;
-
-import java.util.Iterator;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.geronimo.j2g.common.ConsoleOutput;
-import org.apache.geronimo.j2g.common.IOutput;
-import org.apache.geronimo.j2g.common.Tool;
-import org.apache.geronimo.j2g.util.descriptors.Constants;
-import org.apache.geronimo.j2g.util.descriptors.env.EnvirionmentElementProcessor;
-import org.apache.geronimo.j2g.util.descriptors.naming.NamingElementProcessor;
-import org.apache.geronimo.j2g.util.descriptors.xml.XMLConversionHelper;
-import org.dom4j.Element;
-import org.dom4j.QName;
-
-public class BeanMigrator {
-
-    private IOutput out;
-
-    private Log logger = LogFactory.getLog(BeanMigrator.class);
-
-    protected EnvirionmentElementProcessor envirionmentElementProcessor;
-
-    protected NamingElementProcessor namingElementProcessor;
-
-    public BeanMigrator(EnvirionmentElementProcessor envirionmentElementProcessor,
-            NamingElementProcessor namingElementProcessor) {
-    	
-    	Tool currentTool = Tool.getCurrent();
-    	if (currentTool != null) {
-    		out = currentTool.getOutput();
-    	} else {
-    		out = new ConsoleOutput();
-    	}
-        this.envirionmentElementProcessor = envirionmentElementProcessor;
-        this.namingElementProcessor = namingElementProcessor;
-    }
-
-    /**
-     * migrates the common methods for all the methods
-     * 
-     * @param jbossBeanElment
-     * @param geronimoBeanElemnt
-     * @return migrated or not
-     */
-    public boolean migrateBean(Element jbossBeanElment, Element geronimoBeanElemnt) {
-        boolean migrated = true;
-        if (jbossBeanElment.getName().equals("ejb-name")) {
-            // add ejb name to geronimo bean
-            // we have to check the ejb name since ejb name can put by the
-            // jbosscmp-jar as well.
-            String xpath = "//ejb:ejb-name[text() ='" + jbossBeanElment.getText() + "']";
-            logger.debug("Find existing ejb names with xpath ==> " + xpath);
-            if (!XMLConversionHelper.isNodeAvailable(geronimoBeanElemnt, xpath)) {
-                logger.debug("adding ejb-name to bean with name ==> " + jbossBeanElment.getText());
-                QName qname = new QName("ejb-name", geronimoBeanElemnt.getNamespace());
-                Element geronimoEJBName = geronimoBeanElemnt.addElement(qname);
-                geronimoEJBName.setText(jbossBeanElment.getText());
-            } else {
-                logger.debug("ejb-name already exists");
-            }
-
-        } else if (jbossBeanElment.getName().equals("resource-ref")) {
-            QName qname = new QName("resource-ref", geronimoBeanElemnt
-                    .getNamespaceForPrefix(Constants.NAMING_NAME_SPACE_PREFIX));
-            Element geronimoResourceRef = geronimoBeanElemnt.addElement(qname);
-            namingElementProcessor.migrateResourceRef(jbossBeanElment, geronimoResourceRef);
-        } else if (jbossBeanElment.getName().equals("ejb-ref")) {
-            // get the jndi name
-            String jndiName = jbossBeanElment.elementText("jndi-name");
-            // find bean element matching jndiname
-            String xpath = "//enterprise-beans/session[jndi-name/text() ='" + jndiName
-                    + "']/ejb-name";
-            Element element = XMLConversionHelper.getJbossElement(jbossBeanElment.getDocument(),
-                    xpath);
-
-            // check reference for a entity bean
-            if (element == null) {
-                xpath = "//enterprise-beans/entity[jndi-name/text() ='" + jndiName + "']/ejb-name";
-                element = XMLConversionHelper.getJbossElement(jbossBeanElment.getDocument(), xpath);
-            }
-
-            if (element != null) {
-
-                QName qname = new QName("ejb-ref", geronimoBeanElemnt
-                        .getNamespaceForPrefix(Constants.NAMING_NAME_SPACE_PREFIX));
-                Element geronimoEJBRef = geronimoBeanElemnt.addElement(qname);
-                migrateEJBRef(jbossBeanElment, geronimoEJBRef);
-                qname = new QName("ejb-link", geronimoEJBRef
-                        .getNamespaceForPrefix(Constants.NAMING_NAME_SPACE_PREFIX));
-                Element geronimoEJBLink = geronimoEJBRef.addElement(qname);
-                geronimoEJBLink.setText(element.getText());
-
-            } else {
-                out.error(BeanMigrator.class.getSimpleName(), 
-                        "The Element 'ejb-ref' is not supported. It is not possible to determine the EJB name "
-                                + "from the jndi name. Please migrate this element manually",
-                        XMLConversionHelper.getLineNumber(jbossBeanElment), XMLConversionHelper
-                                .getColumnNumber(jbossBeanElment));
-                logger
-                        .error("The Element 'ejb-ref' is not supported. It is not possible to determine the EJB name "
-                                + "from the jndi name. Please migrate this element manually");
-            }
-
-        } else if (jbossBeanElment.getName().equals("ejb-local-ref")) {
-
-            // get the jndi name
-            String jndiName = jbossBeanElment.elementText("local-jndi-name");
-            // find bean element matching jndiname
-            String xpath = "//enterprise-beans/session[local-jndi-name/text() ='" + jndiName
-                    + "']/ejb-name";
-            Element element = XMLConversionHelper.getJbossElement(jbossBeanElment.getDocument(),
-                    xpath);
-
-            // check reference for a entity bean
-            if (element == null) {
-                xpath = "//enterprise-beans/entity[local-jndi-name/text() ='" + jndiName
-                        + "']/ejb-name";
-                element = XMLConversionHelper.getJbossElement(jbossBeanElment.getDocument(), xpath);
-            }
-
-            if (element != null) {
-                logger.debug("EJB reference found");
-                QName qname = new QName("ejb-local-ref", geronimoBeanElemnt
-                        .getNamespaceForPrefix(Constants.NAMING_NAME_SPACE_PREFIX));
-                Element geronimoEJBLocalRef = geronimoBeanElemnt.addElement(qname);
-                migrateEJBLocalRef(jbossBeanElment, geronimoEJBLocalRef);
-                qname = new QName("ejb-link", geronimoEJBLocalRef
-                        .getNamespaceForPrefix(Constants.NAMING_NAME_SPACE_PREFIX));
-                Element geronimoEJBLink = geronimoEJBLocalRef.addElement(qname);
-                geronimoEJBLink.setText(element.getText());
-
-            } else {
-                out.error(BeanMigrator.class.getSimpleName(), 
-                        "The Element 'ejb-local-ref' is not supported. It is not possible to determine the EJB name "
-                                + "from the jndi name. Please migrate this element manually",
-                        XMLConversionHelper.getLineNumber(jbossBeanElment), XMLConversionHelper
-                                .getColumnNumber(jbossBeanElment));
-                logger
-                        .error("The Element 'ejb-local-ref' is not supported. It is not possible to determine the EJB name "
-                                + "from the jndi name. Please migrate this element manually");
-            }
-
-        } else {
-            migrated = false;
-        }
-
-        return migrated;
-    }
-
-    private void migrateEJBRef(Element jbossEJBRef, Element geronimoEJBRef) {
-
-        Element jbossEJBChildRef;
-        for (Iterator iter = jbossEJBRef.elementIterator(); iter.hasNext();) {
-            jbossEJBChildRef = (Element) iter.next();
-            if (jbossEJBChildRef.getName().equals("ejb-ref-name")) {
-                QName qname = new QName("ref-name", geronimoEJBRef
-                        .getNamespaceForPrefix(Constants.NAMING_NAME_SPACE_PREFIX));
-                Element geronimoRefName = geronimoEJBRef.addElement(qname);
-                geronimoRefName.setText(jbossEJBChildRef.getText());
-            }
-        }
-    }
-
-    private void migrateEJBLocalRef(Element jbossEJBRef, Element geronimoEJBRef) {
-
-        Element jbossEJBChildRef;
-        for (Iterator iter = jbossEJBRef.elementIterator(); iter.hasNext();) {
-            jbossEJBChildRef = (Element) iter.next();
-            if (jbossEJBChildRef.getName().equals("ejb-ref-name")) {
-                QName qname = new QName("ref-name", geronimoEJBRef
-                        .getNamespaceForPrefix(Constants.NAMING_NAME_SPACE_PREFIX));
-                Element geronimoRefName = geronimoEJBRef.addElement(qname);
-                geronimoRefName.setText(jbossEJBChildRef.getText());
-            }
-        }
-    }
-
-}
+/**
+ *  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.descriptors.ejb.bean;
+
+import java.util.Iterator;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.j2g.common.ConsoleOutput;
+import org.apache.geronimo.j2g.common.IOutput;
+import org.apache.geronimo.j2g.common.Tool;
+import org.apache.geronimo.j2g.util.descriptors.Constants;
+import org.apache.geronimo.j2g.util.descriptors.env.EnvirionmentElementProcessor;
+import org.apache.geronimo.j2g.util.descriptors.naming.NamingElementProcessor;
+import org.apache.geronimo.j2g.util.descriptors.xml.XMLConversionHelper;
+import org.dom4j.Element;
+import org.dom4j.QName;
+
+public class BeanMigrator {
+
+    private IOutput out;
+
+    private Log logger = LogFactory.getLog(BeanMigrator.class);
+
+    protected EnvirionmentElementProcessor envirionmentElementProcessor;
+
+    protected NamingElementProcessor namingElementProcessor;
+
+    public BeanMigrator(EnvirionmentElementProcessor envirionmentElementProcessor,
+            NamingElementProcessor namingElementProcessor) {
+    	
+    	Tool currentTool = Tool.getCurrent();
+    	if (currentTool != null) {
+    		out = currentTool.getOutput();
+    	} else {
+    		out = new ConsoleOutput();
+    	}
+        this.envirionmentElementProcessor = envirionmentElementProcessor;
+        this.namingElementProcessor = namingElementProcessor;
+    }
+
+    /**
+     * migrates the common methods for all the methods
+     * 
+     * @param jbossBeanElment
+     * @param geronimoBeanElemnt
+     * @return migrated or not
+     */
+    public boolean migrateBean(Element jbossBeanElment, Element geronimoBeanElemnt) {
+        boolean migrated = true;
+        if (jbossBeanElment.getName().equals("ejb-name")) {
+            // add ejb name to geronimo bean
+            // we have to check the ejb name since ejb name can put by the
+            // jbosscmp-jar as well.
+            String xpath = "//ejb:ejb-name[text() ='" + jbossBeanElment.getText() + "']";
+            logger.debug("Find existing ejb names with xpath ==> " + xpath);
+            if (!XMLConversionHelper.isNodeAvailable(geronimoBeanElemnt, xpath)) {
+                logger.debug("adding ejb-name to bean with name ==> " + jbossBeanElment.getText());
+                QName qname = new QName("ejb-name", geronimoBeanElemnt.getNamespace());
+                Element geronimoEJBName = geronimoBeanElemnt.addElement(qname);
+                geronimoEJBName.setText(jbossBeanElment.getText());
+            } else {
+                logger.debug("ejb-name already exists");
+            }
+
+        } else if (jbossBeanElment.getName().equals("resource-ref")) {
+            QName qname = new QName("resource-ref", geronimoBeanElemnt
+                    .getNamespaceForPrefix(Constants.NAMING_NAME_SPACE_PREFIX));
+            Element geronimoResourceRef = geronimoBeanElemnt.addElement(qname);
+            namingElementProcessor.migrateResourceRef(jbossBeanElment, geronimoResourceRef);
+        } else if (jbossBeanElment.getName().equals("ejb-ref")) {
+            // get the jndi name
+            String jndiName = jbossBeanElment.elementText("jndi-name");
+            // find bean element matching jndiname
+            String xpath = "//enterprise-beans/session[jndi-name/text() ='" + jndiName
+                    + "']/ejb-name";
+            Element element = XMLConversionHelper.getJbossElement(jbossBeanElment.getDocument(),
+                    xpath);
+
+            // check reference for a entity bean
+            if (element == null) {
+                xpath = "//enterprise-beans/entity[jndi-name/text() ='" + jndiName + "']/ejb-name";
+                element = XMLConversionHelper.getJbossElement(jbossBeanElment.getDocument(), xpath);
+            }
+
+            if (element != null) {
+
+                QName qname = new QName("ejb-ref", geronimoBeanElemnt
+                        .getNamespaceForPrefix(Constants.NAMING_NAME_SPACE_PREFIX));
+                Element geronimoEJBRef = geronimoBeanElemnt.addElement(qname);
+                migrateEJBRef(jbossBeanElment, geronimoEJBRef);
+                qname = new QName("ejb-link", geronimoEJBRef
+                        .getNamespaceForPrefix(Constants.NAMING_NAME_SPACE_PREFIX));
+                Element geronimoEJBLink = geronimoEJBRef.addElement(qname);
+                geronimoEJBLink.setText(element.getText());
+
+            } else {
+                out.error(BeanMigrator.class.getSimpleName(), 
+                        "The Element 'ejb-ref' is not supported. It is not possible to determine the EJB name "
+                                + "from the jndi name. Please migrate this element manually",
+                        XMLConversionHelper.getLineNumber(jbossBeanElment), XMLConversionHelper
+                                .getColumnNumber(jbossBeanElment));
+                logger
+                        .error("The Element 'ejb-ref' is not supported. It is not possible to determine the EJB name "
+                                + "from the jndi name. Please migrate this element manually");
+            }
+
+        } else if (jbossBeanElment.getName().equals("ejb-local-ref")) {
+
+            // get the jndi name
+            String jndiName = jbossBeanElment.elementText("local-jndi-name");
+            // find bean element matching jndiname
+            String xpath = "//enterprise-beans/session[local-jndi-name/text() ='" + jndiName
+                    + "']/ejb-name";
+            Element element = XMLConversionHelper.getJbossElement(jbossBeanElment.getDocument(),
+                    xpath);
+
+            // check reference for a entity bean
+            if (element == null) {
+                xpath = "//enterprise-beans/entity[local-jndi-name/text() ='" + jndiName
+                        + "']/ejb-name";
+                element = XMLConversionHelper.getJbossElement(jbossBeanElment.getDocument(), xpath);
+            }
+
+            if (element != null) {
+                logger.debug("EJB reference found");
+                QName qname = new QName("ejb-local-ref", geronimoBeanElemnt
+                        .getNamespaceForPrefix(Constants.NAMING_NAME_SPACE_PREFIX));
+                Element geronimoEJBLocalRef = geronimoBeanElemnt.addElement(qname);
+                migrateEJBLocalRef(jbossBeanElment, geronimoEJBLocalRef);
+                qname = new QName("ejb-link", geronimoEJBLocalRef
+                        .getNamespaceForPrefix(Constants.NAMING_NAME_SPACE_PREFIX));
+                Element geronimoEJBLink = geronimoEJBLocalRef.addElement(qname);
+                geronimoEJBLink.setText(element.getText());
+
+            } else {
+                out.error(BeanMigrator.class.getSimpleName(), 
+                        "The Element 'ejb-local-ref' is not supported. It is not possible to determine the EJB name "
+                                + "from the jndi name. Please migrate this element manually",
+                        XMLConversionHelper.getLineNumber(jbossBeanElment), XMLConversionHelper
+                                .getColumnNumber(jbossBeanElment));
+                logger
+                        .error("The Element 'ejb-local-ref' is not supported. It is not possible to determine the EJB name "
+                                + "from the jndi name. Please migrate this element manually");
+            }
+
+        } else {
+            migrated = false;
+        }
+
+        return migrated;
+    }
+
+    private void migrateEJBRef(Element jbossEJBRef, Element geronimoEJBRef) {
+
+        Element jbossEJBChildRef;
+        for (Iterator iter = jbossEJBRef.elementIterator(); iter.hasNext();) {
+            jbossEJBChildRef = (Element) iter.next();
+            if (jbossEJBChildRef.getName().equals("ejb-ref-name")) {
+                QName qname = new QName("ref-name", geronimoEJBRef
+                        .getNamespaceForPrefix(Constants.NAMING_NAME_SPACE_PREFIX));
+                Element geronimoRefName = geronimoEJBRef.addElement(qname);
+                geronimoRefName.setText(jbossEJBChildRef.getText());
+            }
+        }
+    }
+
+    private void migrateEJBLocalRef(Element jbossEJBRef, Element geronimoEJBRef) {
+
+        Element jbossEJBChildRef;
+        for (Iterator iter = jbossEJBRef.elementIterator(); iter.hasNext();) {
+            jbossEJBChildRef = (Element) iter.next();
+            if (jbossEJBChildRef.getName().equals("ejb-ref-name")) {
+                QName qname = new QName("ref-name", geronimoEJBRef
+                        .getNamespaceForPrefix(Constants.NAMING_NAME_SPACE_PREFIX));
+                Element geronimoRefName = geronimoEJBRef.addElement(qname);
+                geronimoRefName.setText(jbossEJBChildRef.getText());
+            }
+        }
+    }
+
+}

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/BeanMigrator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/BeanMigrator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/BeanMigrator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/EntityBeanMigrator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/EntityBeanMigrator.java?view=diff&rev=561821&r1=561820&r2=561821
==============================================================================
--- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/EntityBeanMigrator.java (original)
+++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/EntityBeanMigrator.java Wed Aug  1 08:05:12 2007
@@ -1,61 +1,61 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.geronimo.j2g.descriptors.ejb.bean;
-
-import java.util.Iterator;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.geronimo.j2g.common.ConsoleOutput;
-import org.apache.geronimo.j2g.common.IOutput;
-import org.apache.geronimo.j2g.common.Tool;
-import org.apache.geronimo.j2g.util.descriptors.env.EnvirionmentElementProcessor;
-import org.apache.geronimo.j2g.util.descriptors.naming.NamingElementProcessor;
-import org.dom4j.Element;
-
-public class EntityBeanMigrator extends JNDIBeanMigrator {
-
-    private IOutput out;
-    private Log logger = LogFactory.getLog(EntityBeanMigrator.class);
-
-    public EntityBeanMigrator(EnvirionmentElementProcessor envirionmentElementProcessor,
-            NamingElementProcessor namingElementProcessor) {
-        super(envirionmentElementProcessor, namingElementProcessor);
-    	Tool currentTool = Tool.getCurrent();
-    	if (currentTool != null) {
-    		out = currentTool.getOutput();
-    	} else {
-    		out = new ConsoleOutput();
-    	}
-    }
-
-    public boolean migrateBean(Element jbossEntity, Element geronimoEntity) {
-        Element jbossEntityChildElement;
-        for (Iterator iter = jbossEntity.elements().iterator(); iter.hasNext();) {
-            jbossEntityChildElement = (Element) iter.next();
-
-            // do the migration only if super classes can not
-            if (!super.migrateBean(jbossEntityChildElement, geronimoEntity)) {
-                // TODO: entity bean secific migrations
-                out.warn(EntityBeanMigrator.class.getSimpleName(), "The Element '" + jbossEntityChildElement.getName()
-                        + "' is not supported");
-            }
-        }
-        return true;
-    }
-}
+/**
+ *  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.descriptors.ejb.bean;
+
+import java.util.Iterator;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.j2g.common.ConsoleOutput;
+import org.apache.geronimo.j2g.common.IOutput;
+import org.apache.geronimo.j2g.common.Tool;
+import org.apache.geronimo.j2g.util.descriptors.env.EnvirionmentElementProcessor;
+import org.apache.geronimo.j2g.util.descriptors.naming.NamingElementProcessor;
+import org.dom4j.Element;
+
+public class EntityBeanMigrator extends JNDIBeanMigrator {
+
+    private IOutput out;
+    private Log logger = LogFactory.getLog(EntityBeanMigrator.class);
+
+    public EntityBeanMigrator(EnvirionmentElementProcessor envirionmentElementProcessor,
+            NamingElementProcessor namingElementProcessor) {
+        super(envirionmentElementProcessor, namingElementProcessor);
+    	Tool currentTool = Tool.getCurrent();
+    	if (currentTool != null) {
+    		out = currentTool.getOutput();
+    	} else {
+    		out = new ConsoleOutput();
+    	}
+    }
+
+    public boolean migrateBean(Element jbossEntity, Element geronimoEntity) {
+        Element jbossEntityChildElement;
+        for (Iterator iter = jbossEntity.elements().iterator(); iter.hasNext();) {
+            jbossEntityChildElement = (Element) iter.next();
+
+            // do the migration only if super classes can not
+            if (!super.migrateBean(jbossEntityChildElement, geronimoEntity)) {
+                // TODO: entity bean secific migrations
+                out.warn(EntityBeanMigrator.class.getSimpleName(), "The Element '" + jbossEntityChildElement.getName()
+                        + "' is not supported");
+            }
+        }
+        return true;
+    }
+}

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/EntityBeanMigrator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/EntityBeanMigrator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/EntityBeanMigrator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/JNDIBeanMigrator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/JNDIBeanMigrator.java?view=diff&rev=561821&r1=561820&r2=561821
==============================================================================
--- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/JNDIBeanMigrator.java (original)
+++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/JNDIBeanMigrator.java Wed Aug  1 08:05:12 2007
@@ -1,53 +1,53 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-
-package org.apache.geronimo.j2g.descriptors.ejb.bean;
-
-
-import org.apache.geronimo.j2g.util.descriptors.env.EnvirionmentElementProcessor;
-import org.apache.geronimo.j2g.util.descriptors.naming.NamingElementProcessor;
-import org.dom4j.Element;
-import org.dom4j.QName;
-
-public class JNDIBeanMigrator extends BeanMigrator {
-
-
-    public JNDIBeanMigrator(EnvirionmentElementProcessor envirionmentElementProcessor,
-            NamingElementProcessor namingElementProcessor) {
-        super(envirionmentElementProcessor, namingElementProcessor);
-    }
-
-    public boolean migrateBean(Element jbossBeanElment, Element geronimoBeanElemnt) {
-        boolean migrated = true;
-        if (!super.migrateBean(jbossBeanElment, geronimoBeanElemnt)) {
-            if (jbossBeanElment.getName().equals("jndi-name")) {
-                // add ejb name to geronimo session
-                QName qname = new QName("jndi-name", geronimoBeanElemnt.getNamespace());
-                Element geronimoJndiName = geronimoBeanElemnt.addElement(qname);
-                geronimoJndiName.setText(jbossBeanElment.getText());
-            } else if (jbossBeanElment.getName().equals("local-jndi-name")) {
-                // add ejb name to geronimo session
-                QName qname = new QName("local-jndi-name", geronimoBeanElemnt.getNamespace());
-                Element geronimoLocalJndiName = geronimoBeanElemnt.addElement(qname);
-                geronimoLocalJndiName.setText(jbossBeanElment.getText());
-            } else {
-                migrated = false;
-            }
-        }
-        return migrated;
-    }
-}
+/**
+ *  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.descriptors.ejb.bean;
+
+
+import org.apache.geronimo.j2g.util.descriptors.env.EnvirionmentElementProcessor;
+import org.apache.geronimo.j2g.util.descriptors.naming.NamingElementProcessor;
+import org.dom4j.Element;
+import org.dom4j.QName;
+
+public class JNDIBeanMigrator extends BeanMigrator {
+
+
+    public JNDIBeanMigrator(EnvirionmentElementProcessor envirionmentElementProcessor,
+            NamingElementProcessor namingElementProcessor) {
+        super(envirionmentElementProcessor, namingElementProcessor);
+    }
+
+    public boolean migrateBean(Element jbossBeanElment, Element geronimoBeanElemnt) {
+        boolean migrated = true;
+        if (!super.migrateBean(jbossBeanElment, geronimoBeanElemnt)) {
+            if (jbossBeanElment.getName().equals("jndi-name")) {
+                // add ejb name to geronimo session
+                QName qname = new QName("jndi-name", geronimoBeanElemnt.getNamespace());
+                Element geronimoJndiName = geronimoBeanElemnt.addElement(qname);
+                geronimoJndiName.setText(jbossBeanElment.getText());
+            } else if (jbossBeanElment.getName().equals("local-jndi-name")) {
+                // add ejb name to geronimo session
+                QName qname = new QName("local-jndi-name", geronimoBeanElemnt.getNamespace());
+                Element geronimoLocalJndiName = geronimoBeanElemnt.addElement(qname);
+                geronimoLocalJndiName.setText(jbossBeanElment.getText());
+            } else {
+                migrated = false;
+            }
+        }
+        return migrated;
+    }
+}

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/JNDIBeanMigrator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/JNDIBeanMigrator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/JNDIBeanMigrator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/MessageDrivenBeanMigrator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/MessageDrivenBeanMigrator.java?view=diff&rev=561821&r1=561820&r2=561821
==============================================================================
--- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/MessageDrivenBeanMigrator.java (original)
+++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/MessageDrivenBeanMigrator.java Wed Aug  1 08:05:12 2007
@@ -1,29 +1,29 @@
-/**
- *  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.descriptors.ejb.bean;
-
-import org.apache.geronimo.j2g.util.descriptors.env.EnvirionmentElementProcessor;
-import org.apache.geronimo.j2g.util.descriptors.naming.NamingElementProcessor;
-
-
-public class MessageDrivenBeanMigrator extends BeanMigrator {
-
-    public MessageDrivenBeanMigrator(EnvirionmentElementProcessor envirionmentElementProcessor,
-            NamingElementProcessor namingElementProcessor) {
-        super(envirionmentElementProcessor, namingElementProcessor);
-    }
-}
+/**
+ *  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.descriptors.ejb.bean;
+
+import org.apache.geronimo.j2g.util.descriptors.env.EnvirionmentElementProcessor;
+import org.apache.geronimo.j2g.util.descriptors.naming.NamingElementProcessor;
+
+
+public class MessageDrivenBeanMigrator extends BeanMigrator {
+
+    public MessageDrivenBeanMigrator(EnvirionmentElementProcessor envirionmentElementProcessor,
+            NamingElementProcessor namingElementProcessor) {
+        super(envirionmentElementProcessor, namingElementProcessor);
+    }
+}

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/MessageDrivenBeanMigrator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/MessageDrivenBeanMigrator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/MessageDrivenBeanMigrator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/SessionBeanMigrator.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/SessionBeanMigrator.java?view=diff&rev=561821&r1=561820&r2=561821
==============================================================================
--- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/SessionBeanMigrator.java (original)
+++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/SessionBeanMigrator.java Wed Aug  1 08:05:12 2007
@@ -1,60 +1,60 @@
-/**
- *  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.descriptors.ejb.bean;
-
-import java.util.Iterator;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.geronimo.j2g.common.ConsoleOutput;
-import org.apache.geronimo.j2g.common.IOutput;
-import org.apache.geronimo.j2g.common.Tool;
-import org.apache.geronimo.j2g.util.descriptors.env.EnvirionmentElementProcessor;
-import org.apache.geronimo.j2g.util.descriptors.naming.NamingElementProcessor;
-import org.dom4j.Element;
-
-
-public class SessionBeanMigrator extends JNDIBeanMigrator {
-
-    private static Log logger = LogFactory.getLog(SessionBeanMigrator.class);
-    private IOutput out;
-
-    public SessionBeanMigrator(EnvirionmentElementProcessor envirionmentElementProcessor,
-            NamingElementProcessor namingElementProcessor) {
-        super(envirionmentElementProcessor, namingElementProcessor);
-    	Tool currentTool = Tool.getCurrent();
-    	if (currentTool != null) {
-    		out = currentTool.getOutput();
-    	} else {
-    		out = new ConsoleOutput();
-    	}
-    }
-
-    public boolean migrateBean(Element jbossSession, Element geronimoSession) {
-        Element jbossSessionChildElement;
-        for (Iterator iter = jbossSession.elements().iterator(); iter.hasNext();) {
-            jbossSessionChildElement = (Element) iter.next();
-            // do the migration only if super classes can not
-            if (!super.migrateBean(jbossSessionChildElement, geronimoSession)) {
-                // TODO: session bean secific migrations
-                out.warn(SessionBeanMigrator.class.getSimpleName(), "The Element '" + jbossSessionChildElement.getName()
-                        + "' is not supported");
-            }
-        }
-        return true;
-    }
-}
+/**
+ *  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.descriptors.ejb.bean;
+
+import java.util.Iterator;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.j2g.common.ConsoleOutput;
+import org.apache.geronimo.j2g.common.IOutput;
+import org.apache.geronimo.j2g.common.Tool;
+import org.apache.geronimo.j2g.util.descriptors.env.EnvirionmentElementProcessor;
+import org.apache.geronimo.j2g.util.descriptors.naming.NamingElementProcessor;
+import org.dom4j.Element;
+
+
+public class SessionBeanMigrator extends JNDIBeanMigrator {
+
+    private static Log logger = LogFactory.getLog(SessionBeanMigrator.class);
+    private IOutput out;
+
+    public SessionBeanMigrator(EnvirionmentElementProcessor envirionmentElementProcessor,
+            NamingElementProcessor namingElementProcessor) {
+        super(envirionmentElementProcessor, namingElementProcessor);
+    	Tool currentTool = Tool.getCurrent();
+    	if (currentTool != null) {
+    		out = currentTool.getOutput();
+    	} else {
+    		out = new ConsoleOutput();
+    	}
+    }
+
+    public boolean migrateBean(Element jbossSession, Element geronimoSession) {
+        Element jbossSessionChildElement;
+        for (Iterator iter = jbossSession.elements().iterator(); iter.hasNext();) {
+            jbossSessionChildElement = (Element) iter.next();
+            // do the migration only if super classes can not
+            if (!super.migrateBean(jbossSessionChildElement, geronimoSession)) {
+                // TODO: session bean secific migrations
+                out.warn(SessionBeanMigrator.class.getSimpleName(), "The Element '" + jbossSessionChildElement.getName()
+                        + "' is not supported");
+            }
+        }
+        return true;
+    }
+}

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/SessionBeanMigrator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/SessionBeanMigrator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/SessionBeanMigrator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message