Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 12078 invoked from network); 2 Jul 2007 18:31:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Jul 2007 18:31:12 -0000 Received: (qmail 60337 invoked by uid 500); 2 Jul 2007 18:31:12 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 60311 invoked by uid 500); 2 Jul 2007 18:31:12 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 60288 invoked by uid 99); 2 Jul 2007 18:31:12 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Jul 2007 11:31:12 -0700 X-ASF-Spam-Status: No, hits=-98.6 required=10.0 tests=ALL_TRUSTED,INFO_TLD,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Jul 2007 11:31:04 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 3EC531A9823; Mon, 2 Jul 2007 11:30:43 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r552557 [2/6] - in /geronimo/sandbox/j2g/plugins: org.apache.geronimo.j2g.descriptors.app/ org.apache.geronimo.j2g.descriptors.cmp/ org.apache.geronimo.j2g.descriptors.ejb/ org.apache.geronimo.j2g.descriptors.web/ org.apache.geronimo.j2g.de... Date: Mon, 02 Jul 2007 18:30:40 -0000 To: scm@geronimo.apache.org From: pmcmahan@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070702183043.3EC531A9823@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: 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=auto&rev=552557 ============================================================================== --- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/BeanMigrator.java (added) +++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/BeanMigrator.java Mon Jul 2 11:30:34 2007 @@ -0,0 +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( + "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( + "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()); + } + } + } + +} Added: 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=auto&rev=552557 ============================================================================== --- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/EntityBeanMigrator.java (added) +++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/EntityBeanMigrator.java Mon Jul 2 11:30:34 2007 @@ -0,0 +1,61 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.geronimo.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("The Element '" + jbossEntityChildElement.getName() + + "' is not supported"); + } + } + return true; + } +} Added: 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=auto&rev=552557 ============================================================================== --- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/JNDIBeanMigrator.java (added) +++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/JNDIBeanMigrator.java Mon Jul 2 11:30:34 2007 @@ -0,0 +1,53 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.geronimo.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; + } +} Added: 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=auto&rev=552557 ============================================================================== --- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/MessageDrivenBeanMigrator.java (added) +++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/MessageDrivenBeanMigrator.java Mon Jul 2 11:30:34 2007 @@ -0,0 +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); + } +} Added: 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=auto&rev=552557 ============================================================================== --- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/SessionBeanMigrator.java (added) +++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/ejb/bean/SessionBeanMigrator.java Mon Jul 2 11:30:34 2007 @@ -0,0 +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("The Element '" + jbossSessionChildElement.getName() + + "' is not supported"); + } + } + return true; + } +} Added: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/web/WebDescriptorTool.java URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/web/WebDescriptorTool.java?view=auto&rev=552557 ============================================================================== --- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/web/WebDescriptorTool.java (added) +++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/src/org/apache/geronimo/j2g/descriptors/web/WebDescriptorTool.java Mon Jul 2 11:30:34 2007 @@ -0,0 +1,154 @@ +/** + * 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.web; + +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.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.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.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.QName; + +public class WebDescriptorTool implements IFileMigration { + + private IOutput out; + + private static Log logger = LogFactory.getLog(WebDescriptorTool.class); + + private EnvirionmentElementProcessor envirionmentElementProcessor; + + private SecurityElementProcessor securityElementProcessor; + + private NamingElementProcessor namingElementProcessor; + + public WebDescriptorTool() { + + Tool currentTool = Tool.getCurrent(); + if (currentTool != null) { + out = currentTool.getOutput(); + } else { + out = new ConsoleOutput(); + } + envirionmentElementProcessor = new EnvirionmentElementProcessor(); + securityElementProcessor = new SecurityElementProcessor(); + namingElementProcessor = new NamingElementProcessor(envirionmentElementProcessor); + } + + public boolean migrate(File file) { + + 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_WEB_XML_FILE)) { + out.info("Converting Jboss-web.xml file in " + directoryName); + try { + Document jbossDocument = XMLConversionHelper.getDocument(file); + Document geronimoDocument = XMLConversionHelper.createNewGeronimoDocument( + Constants.WEB_NAME_SPACE, Constants.GERONIMO_WEB_XML_ROOT_NODE); + migrate(jbossDocument.getRootElement(), geronimoDocument.getRootElement()); + String geronimoWebFileName = directoryName + File.separator + + Constants.GERONIMO_WEB_XML_FILE; + XMLConversionHelper.saveGeronimoDocument(geronimoWebFileName, geronimoDocument); + migrated = true; + out.info("Successfully migrated the jboss-web.xml file in " + + directoryName + ", with the error and warning messages as shown"); + } catch (DocumentException e) { + out.error("Errors occurs while reading xml descriptor " + + file.getAbsolutePath() + + ". It is possible that the migrator cannot download an xml schema or xml file has a wrong syntax. Nested exception:" + + e.getMessage()); + } catch (IOException e) { + out.error("IO exception " + e.getMessage()); + } + } else if (jbossFileName.equals(Constants.WEB_XML_FILE)){ + out.info("Converting web.xml file in " + directoryName); + out.info("Nothing to convert. Keep the file as it is"); + } + return migrated; + } + + private void migrate(Element jbossRootElement, Element geronimoRootElement) { + + // migrate the web descriptor componets here + Element jbossRootChildElement; + for (Iterator iter = jbossRootElement.elements().iterator(); iter.hasNext();) { + jbossRootChildElement = (Element) iter.next(); + if (jbossRootChildElement.getName().equals("context-root")) { + QName qname = new QName("context-root", geronimoRootElement.getNamespace()); + Element contextRootElement = geronimoRootElement.addElement(qname); + contextRootElement.setText(jbossRootChildElement.getText()); + } else if (jbossRootChildElement.getName().equals("security-domain")) { + QName qname = new QName("security-realm-name", geronimoRootElement.getNamespace()); + Element realmNameElement = geronimoRootElement.addElement(qname); + realmNameElement.setText(jbossRootChildElement.getText()); + securityElementProcessor.setSecurityDomain(jbossRootChildElement.getText()); + } else if (jbossRootChildElement.getName().equals("security-role")) { + Element geronimoRoleMapping = securityElementProcessor + .getGeronimoSecurityRoleElement(geronimoRootElement); + securityElementProcessor.migrateSecurityRole(jbossRootChildElement, + geronimoRoleMapping); + } else if (jbossRootChildElement.getName().equals("resource-ref")) { + QName qname = new QName("resource-ref", geronimoRootElement + .getNamespaceForPrefix(Constants.NAMING_NAME_SPACE_PREFIX)); + Element geronimoResourceRef = geronimoRootElement.addElement(qname); + namingElementProcessor.migrateResourceRef(jbossRootChildElement, + geronimoResourceRef); + } else if (jbossRootChildElement.getName().equals("ejb-ref")) { + out.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", + XMLConversionHelper.getLineNumber(jbossRootChildElement), + XMLConversionHelper.getColumnNumber(jbossRootChildElement)); + logger + .debug("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 (jbossRootChildElement.getName().equals("ejb-local-ref")) { + out.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", + XMLConversionHelper.getLineNumber(jbossRootChildElement), + XMLConversionHelper.getColumnNumber(jbossRootChildElement)); + logger + .debug("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 { + out.warn( + "The Element '" + jbossRootChildElement.getName() + "' is not supported. ", + XMLConversionHelper.getLineNumber(jbossRootChildElement), + XMLConversionHelper.getColumnNumber(jbossRootChildElement)); + logger.debug("The Element '" + jbossRootChildElement.getName() + + "' is not supported. "); + } + } + } + +} Added: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/ejb-jar.xml URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/ejb-jar.xml?view=auto&rev=552557 ============================================================================== --- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/ejb-jar.xml (added) +++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/ejb-jar.xml Mon Jul 2 11:30:34 2007 @@ -0,0 +1,242 @@ + + + + + + + CMP 2.0 Lab Jar + + + + JUnit Session Bean Test Runner + EJBTestRunnerEJB + net.sourceforge.junitejb.EJBTestRunnerHome + net.sourceforge.junitejb.EJBTestRunner + net.sourceforge.junitejb.EJBTestRunnerBean + Stateless + Bean + + + + Organization Entity Bean + OrganizationEJB + + org.jboss.docs.cmp2.crimeportal.OrganizationHome + org.jboss.docs.cmp2.crimeportal.Organization + org.jboss.docs.cmp2.crimeportal.OrganizationBean + + Container + java.lang.String + False + 2.x + organization + + name + description + + name + + + + Gangster Entity Bean + GangsterEJB + + org.jboss.docs.cmp2.crimeportal.GangsterHome + org.jboss.docs.cmp2.crimeportal.Gangster + org.jboss.docs.cmp2.crimeportal.GangsterBean + + Container + java.lang.Integer + False + 2.x + gangster + + gangsterId + name + nickName + badness + + gangsterId + + + + findBadDudes + int + + ?1 + ]]> + + + + + ejbSelectBoss + + java.lang.String + + + + + + + + Job Entity Bean + JobEJB + + org.jboss.docs.cmp2.crimeportal.JobHome + org.jboss.docs.cmp2.crimeportal.Job + org.jboss.docs.cmp2.crimeportal.JobBean + + Container + java.lang.String + False + 2.x + job + + name + score + setupCost + + name + + + + + + Organization-Gangster + + + org-has-gangsters + + One + + + OrganizationEJB + + + + memberGangsters + java.util.Set + + + + + gangster-belongs-to-org + + Many + + + GangsterEJB + + + + organization + + + + + + Gangster-Jobs + + + gangster-has-jobs + + Many + + + GangsterEJB + + + + jobs + java.util.Set + + + + + job-has-gangsters + + Many + + + JobEJB + + + + gangsters + java.util.Set + + + + + + Organization-Boss + + + organization-has-a-boss + + One + + + OrganizationEJB + + + + theBoss + + + + + boss-runs-an-organization + + One + + + GangsterEJB + + + + + + + + + + + OrganizationEJB + * + + + GangsterEJB + * + + + JobEJB + * + + Required + + + + Added: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/geronimo-application.xml URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/geronimo-application.xml?view=auto&rev=552557 ============================================================================== --- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/geronimo-application.xml (added) +++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/geronimo-application.xml Mon Jul 2 11:30:34 2007 @@ -0,0 +1,28 @@ + + + + + + j2g + application + 1.0 + ear + + + + + + + + + + + + + + + + + + + Added: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/geronimo-web.xml URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/geronimo-web.xml?view=auto&rev=552557 ============================================================================== --- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/geronimo-web.xml (added) +++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/geronimo-web.xml Mon Jul 2 11:30:34 2007 @@ -0,0 +1,39 @@ + + + + + + j2g + web-module + 1.0 + war + + + + j2g.jdbc + TestDB + 1.0 + rar + + + + securityDomation + /myApp + + resource1 + TestDB + + + + + + + + + + + + + + + Added: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/jboss-app.xml URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/jboss-app.xml?view=auto&rev=552557 ============================================================================== --- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/jboss-app.xml (added) +++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/jboss-app.xml Mon Jul 2 11:30:34 2007 @@ -0,0 +1,42 @@ + + + + + + + securiyDomain + amila + messaging + + mailservice.sar + + + hibanate.sar + + + admin + amila + rasika + + + manager + sandakith + sris + + + \ No newline at end of file Added: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/jboss.xml URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/jboss.xml?view=auto&rev=552557 ============================================================================== --- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/jboss.xml (added) +++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/jboss.xml Mon Jul 2 11:30:34 2007 @@ -0,0 +1,40 @@ + + + + + + + + + EJBTestRunnerEJB + ejb/EJBTestRunner + + + OrganizationEJB + crimeportal/Organization + + + GangsterEJB + crimeportal/Gangster + + + JobEJB + crimeportal/Job + + + Added: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/jbosscmp-jdbc.xml URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/jbosscmp-jdbc.xml?view=auto&rev=552557 ============================================================================== --- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/jbosscmp-jdbc.xml (added) +++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/jbosscmp-jdbc.xml Mon Jul 2 11:30:34 2007 @@ -0,0 +1,151 @@ + + + + + + + + + java:/DefaultDS + Hypersonic SQL + true + true + true + foreign-key + + + + + + OrganizationEJB + organization + + + name + name + + + description + desc + + + + + GangsterEJB + gangster + + + gangsterId + id + + + name + name + + + nickName + nick_name + VARCHAR + VARCHAR(64) + + + badness + badness + + + + + JobEJB + job + + + name + name + + + score + score + + + setupCost + setup_cost + + + + + + + Organization-Gangster + + + org-has-gangsters + + + name + organization + + + + + + gangster-belongs-to-org + + + + + Gangster-Jobs + + gangster_job + + + + gangster-has-jobs + + + gangsterId + gangster + + + + + + job-has-gangsters + + + name + job + + + + + + + Organization-Boss + + + organization-has-a-boss + + + name + boss + + + + + + Added: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/openejb-jar.xml URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/openejb-jar.xml?view=auto&rev=552557 ============================================================================== --- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/openejb-jar.xml (added) +++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test-resources/openejb-jar.xml Mon Jul 2 11:30:34 2007 @@ -0,0 +1,145 @@ + + + + + + j2g + ejb-module + 1.0 + jar + + + + j2g.java: + DefaultDS + 1.0 + rar + + + + + DefaultDS + + + + OrganizationEJB + organization + + name + name + + + description + desc + + + + GangsterEJB + gangster + + gangsterId + id + + + name + name + + + nickName + nick_name + + + badness + badness + + + + JobEJB + job + + name + name + + + score + score + + + setupCost + setup_cost + + + + + + Organization-Gangster + + org-has-gangsters + + OrganizationEJB + + + memberGangsters + + + + name + organization + + + + + + Gangster-Jobs + gangster_job + + gangster-has-jobs + + GangsterEJB + + + jobs + + + + id + gangster + + + + + job-has-gangsters + + JobEJB + + + gangsters + + + + name + job + + + + + + Organization-Boss + + organization-has-a-boss + + OrganizationEJB + + + theBoss + + + + name + boss + + + + + + Added: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test/org/apache/geronimo/j2g/descriptors/app/test/TestApplicationDescriptorTool.java URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test/org/apache/geronimo/j2g/descriptors/app/test/TestApplicationDescriptorTool.java?view=auto&rev=552557 ============================================================================== --- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test/org/apache/geronimo/j2g/descriptors/app/test/TestApplicationDescriptorTool.java (added) +++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test/org/apache/geronimo/j2g/descriptors/app/test/TestApplicationDescriptorTool.java Mon Jul 2 11:30:34 2007 @@ -0,0 +1,33 @@ +/** + * 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.app.test; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.geronimo.j2g.descriptors.app.ApplicationDescriptorTool; + +public class TestApplicationDescriptorTool extends TestCase { + + public void testMigrate() { + String jbossApplicatinXmlFile = "test-resources/jboss-app.xml"; + ApplicationDescriptorTool applicationDescriptorTool = new ApplicationDescriptorTool(); + applicationDescriptorTool.migrate(new File(jbossApplicatinXmlFile)); + } + +} Added: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test/org/apache/geronimo/j2g/descriptors/cmp/test/TestCMPDescriptorsTool.java URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test/org/apache/geronimo/j2g/descriptors/cmp/test/TestCMPDescriptorsTool.java?view=auto&rev=552557 ============================================================================== --- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test/org/apache/geronimo/j2g/descriptors/cmp/test/TestCMPDescriptorsTool.java (added) +++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test/org/apache/geronimo/j2g/descriptors/cmp/test/TestCMPDescriptorsTool.java Mon Jul 2 11:30:34 2007 @@ -0,0 +1,34 @@ +/** + * 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.cmp.test; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.geronimo.j2g.descriptors.comp.CMPDescriptorTool; + +public class TestCMPDescriptorsTool extends TestCase { + + public void testMigrate() { + File file = new File("test-resources/jbosscmp-jdbc.xml"); + CMPDescriptorTool cmpDescriptorTool = new CMPDescriptorTool(); + cmpDescriptorTool.migrate(file); + } + +} Added: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test/org/apache/geronimo/j2g/descriptors/cmp/test/TestEJBjarXmlProcessor.java URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test/org/apache/geronimo/j2g/descriptors/cmp/test/TestEJBjarXmlProcessor.java?view=auto&rev=552557 ============================================================================== --- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test/org/apache/geronimo/j2g/descriptors/cmp/test/TestEJBjarXmlProcessor.java (added) +++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test/org/apache/geronimo/j2g/descriptors/cmp/test/TestEJBjarXmlProcessor.java Mon Jul 2 11:30:34 2007 @@ -0,0 +1,35 @@ +/** + * 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.cmp.test; + +import junit.framework.TestCase; + +import org.apache.geronimo.j2g.descriptors.comp.EJBJarXmlProcessor; +import org.dom4j.DocumentException; + +public class TestEJBjarXmlProcessor extends TestCase { + + public void testGetRelationships(){ + EJBJarXmlProcessor ejbJarXmlProcessor = new EJBJarXmlProcessor("test-resources/ejb-jar.xml"); + try { + ejbJarXmlProcessor.getRelationships(); + } catch (DocumentException e) { + e.printStackTrace(); + } + } +} Added: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test/org/apache/geronimo/j2g/descriptors/ejb/test/TestEJBDescriptorTool.java URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test/org/apache/geronimo/j2g/descriptors/ejb/test/TestEJBDescriptorTool.java?view=auto&rev=552557 ============================================================================== --- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test/org/apache/geronimo/j2g/descriptors/ejb/test/TestEJBDescriptorTool.java (added) +++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test/org/apache/geronimo/j2g/descriptors/ejb/test/TestEJBDescriptorTool.java Mon Jul 2 11:30:34 2007 @@ -0,0 +1,33 @@ +/** + * 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.test; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.geronimo.j2g.descriptors.ejb.EJBDescriptorTool; + +public class TestEJBDescriptorTool extends TestCase { + + public void testMigrate() { + File file = new File("test-resources/jboss.xml"); + EJBDescriptorTool ejbDescriptorTool = new EJBDescriptorTool(); + ejbDescriptorTool.migrate(file); + } + +} Added: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test/org/apache/geronimo/j2g/descriptors/web/test/TestWebDescriptorTool.java URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test/org/apache/geronimo/j2g/descriptors/web/test/TestWebDescriptorTool.java?view=auto&rev=552557 ============================================================================== --- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test/org/apache/geronimo/j2g/descriptors/web/test/TestWebDescriptorTool.java (added) +++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.descriptors/test/org/apache/geronimo/j2g/descriptors/web/test/TestWebDescriptorTool.java Mon Jul 2 11:30:34 2007 @@ -0,0 +1,33 @@ +/** + * 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.web.test; + +import java.io.File; + +import junit.framework.TestCase; + +import org.apache.geronimo.j2g.descriptors.web.WebDescriptorTool; + +public class TestWebDescriptorTool extends TestCase { + + public void testMigration() { + File file = new File("test-resources/jboss-web.xml"); + WebDescriptorTool webMigrationTool = new WebDescriptorTool(); + webMigrationTool.migrate(file); + } + +} Added: geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/src/commons-logging.properties URL: http://svn.apache.org/viewvc/geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/src/commons-logging.properties?view=auto&rev=552557 ============================================================================== --- geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/src/commons-logging.properties (added) +++ geronimo/sandbox/j2g/plugins/org.apache.geronimo.j2g.resources/src/commons-logging.properties Mon Jul 2 11:30:34 2007 @@ -0,0 +1,30 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + # Set root logger level to DEBUG and its only appender to console. +log4j.rootLogger=INFO + +#define loggers +#pluging logger +log4j.logger.com.ibm.j2g=DEBUG,console + +# console is set to be a ConsoleAppender. +log4j.appender.console=org.apache.log4j.ConsoleAppender + +# console uses PatternLayout. +log4j.appender.console.layout=org.apache.log4j.PatternLayout +#log4j.appender.console.layout.ConversionPattern=[%t] %-5p %l - %m%n +log4j.appender.console.layout.ConversionPattern=[%t] %-5p - %m%n \ No newline at end of file