Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 72697 invoked from network); 8 Oct 2007 18:53:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Oct 2007 18:53:46 -0000 Received: (qmail 50770 invoked by uid 500); 8 Oct 2007 18:53:34 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 50626 invoked by uid 500); 8 Oct 2007 18:53:34 -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 50615 invoked by uid 99); 8 Oct 2007 18:53:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Oct 2007 11:53:34 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED 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, 08 Oct 2007 18:53:34 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3E5541A9832; Mon, 8 Oct 2007 11:52:44 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r582934 [1/2] - in /geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util: ./ META-INF/ src/ src/org/ src/org/apache/ src/org/apache/geronimo/ src/org/apache/geronimo/devtools/ src/org/apache/geronimo/devtools/j2g/ src/o... Date: Mon, 08 Oct 2007 18:52:41 -0000 To: scm@geronimo.apache.org From: linsun@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071008185244.3E5541A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: linsun Date: Mon Oct 8 11:52:38 2007 New Revision: 582934 URL: http://svn.apache.org/viewvc?rev=582934&view=rev Log: update the util plugin for GERONIMODEVTOOLS-221 Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/.classpath (with props) geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/.project (with props) geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/META-INF/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/META-INF/MANIFEST.MF geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/build.properties (with props) geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/plugin.xml (with props) geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/pom.xml (with props) geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/commons-logging.properties (with props) geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/Constants.java (with props) geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/env/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/env/EnvirionmentElementProcessor.java (with props) geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/naming/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/naming/NamingElementProcessor.java (with props) geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/security/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/security/SecurityElementProcessor.java (with props) geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/xml/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/xml/XMLConversionHelper.java (with props) geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/resources/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/resources/Constants.java (with props) geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/resources/xml/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/resources/xml/XMLConversionHelper.java (with props) geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/test/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/test-apps/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/test-apps/jboss-xml/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/test-apps/jboss-xml/jboss-web.xml (with props) geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/test-apps/jboss-xml/jboss.xml (with props) geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/test-apps/mail/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/test-apps/mail/geronimo-mail-service.xml (with props) geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/test-apps/mail/mail-service.xml (with props) geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/test-apps/test-app-jboss/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/test-apps/test-app-jboss/openejb-jar-serialized.xml (with props) geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/test/org/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/test/org/apache/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/test/org/apache/geronimo/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/test/org/apache/geronimo/devtools/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/test/org/apache/geronimo/devtools/j2g/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/test/org/apache/geronimo/devtools/j2g/util/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/test/org/apache/geronimo/devtools/j2g/util/descriptors/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/test/org/apache/geronimo/devtools/j2g/util/descriptors/xml/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/test/org/apache/geronimo/devtools/j2g/util/descriptors/xml/test/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/test/org/apache/geronimo/devtools/j2g/util/descriptors/xml/test/TestXMLConversionHelper.java (with props) geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/test/org/apache/geronimo/devtools/j2g/util/resources/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/test/org/apache/geronimo/devtools/j2g/util/resources/xml/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/test/org/apache/geronimo/devtools/j2g/util/resources/xml/test/ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/test/org/apache/geronimo/devtools/j2g/util/resources/xml/test/XMLConversionHelperTestCase.java (with props) Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/.classpath URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/.classpath?rev=582934&view=auto ============================================================================== --- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/.classpath (added) +++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/.classpath Mon Oct 8 11:52:38 2007 @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/.classpath ------------------------------------------------------------------------------ svn:eol-style = native Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/.project URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/.project?rev=582934&view=auto ============================================================================== --- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/.project (added) +++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/.project Mon Oct 8 11:52:38 2007 @@ -0,0 +1,29 @@ + + org.apache.geronimo.devtools.j2g.util + JBoss to Geronimo Conversion Tool + + + + org.eclipse.jdt.core.javabuilder + + + org.eclipse.pde.ManifestBuilder + + + org.eclipse.pde.SchemaBuilder + + + org.eclipse.ui.externaltools.ExternalToolBuilder + + + LaunchConfigHandle + <project>/.externalToolBuilders/Maven_Ant_Builder.launch + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + \ No newline at end of file Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/.project ------------------------------------------------------------------------------ svn:eol-style = native Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/META-INF/MANIFEST.MF URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/META-INF/MANIFEST.MF?rev=582934&view=auto ============================================================================== --- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/META-INF/MANIFEST.MF (added) +++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/META-INF/MANIFEST.MF Mon Oct 8 11:52:38 2007 @@ -0,0 +1,75 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: J2G XML Conversion Helper Plug-in +Bundle-SymbolicName: org.apache.geronimo.devtools.j2g.util;singleton:=true +Bundle-Version: 1.0.0 +Bundle-Vendor: Apache.org +Require-Bundle: org.eclipse.core.runtime +Bundle-ClassPath: ., + lib/commons-logging-1.1.jar, + lib/dom4j-1.6.1.jar, + lib/jaxen-1.1.jar, + lib/junit-4.3.1.jar, + lib/pull-parser-2.1.10.jar +Export-Package: + junit.extensions, + junit.framework, + junit.runner, + junit.textui, + org.apache.commons.logging, + org.apache.commons.logging.impl, + org.apache.geronimo.devtools.j2g.util.descriptors, + org.apache.geronimo.devtools.j2g.util.descriptors.env, + org.apache.geronimo.devtools.j2g.util.descriptors.naming, + org.apache.geronimo.devtools.j2g.util.descriptors.security, + org.apache.geronimo.devtools.j2g.util.descriptors.xml, + org.apache.geronimo.devtools.j2g.util.resources, + org.apache.geronimo.devtools.j2g.util.resources.xml, + org.dom4j, + org.dom4j.bean, + org.dom4j.datatype, + org.dom4j.dom, + org.dom4j.dtd, + org.dom4j.io, + org.dom4j.jaxb, + org.dom4j.rule, + org.dom4j.rule.pattern, + org.dom4j.swing, + org.dom4j.tree, + org.dom4j.util, + org.dom4j.xpath, + org.dom4j.xpp, + org.gjt.xpp, + org.gjt.xpp.impl, + org.gjt.xpp.impl.format, + org.gjt.xpp.impl.node, + org.gjt.xpp.impl.pullnode, + org.gjt.xpp.impl.pullparser, + org.gjt.xpp.impl.tag, + org.gjt.xpp.impl.tokenizer, + org.jaxen, + org.jaxen.dom, + org.jaxen.dom4j, + org.jaxen.expr, + org.jaxen.expr.iter, + org.jaxen.function, + org.jaxen.function.ext, + org.jaxen.function.xslt, + org.jaxen.javabean, + org.jaxen.jdom, + org.jaxen.pattern, + org.jaxen.saxpath, + org.jaxen.saxpath.base, + org.jaxen.saxpath.helpers, + org.jaxen.util, + org.jaxen.xom, + org.junit, + org.junit.internal, + org.junit.internal.requests, + org.junit.internal.runners, + org.junit.runner, + org.junit.runner.manipulation, + org.junit.runner.notification, + org.junit.runners, + org.w3c.dom + Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/build.properties URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/build.properties?rev=582934&view=auto ============================================================================== --- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/build.properties (added) +++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/build.properties Mon Oct 8 11:52:38 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. + */ + source.. = src/ +output.. = classes/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + lib/dom4j-1.6.1.jar,\ + lib/jaxen-1.1-beta-6.jar,\ + lib/junit-3.8.1.jar,\ + lib/pull-parser-2.1.10.jar,\ + lib/commons-logging-api-1.1.jar,\ + lib/commons-logging-1.1.jar,\ + lib/jaxen-1.1.jar,\ + lib/junit-4.3.1.jar Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/build.properties ------------------------------------------------------------------------------ svn:eol-style = native Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/plugin.xml URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/plugin.xml?rev=582934&view=auto ============================================================================== --- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/plugin.xml (added) +++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/plugin.xml Mon Oct 8 11:52:38 2007 @@ -0,0 +1,20 @@ + + + + + Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/plugin.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/pom.xml URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/pom.xml?rev=582934&view=auto ============================================================================== --- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/pom.xml (added) +++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/pom.xml Mon Oct 8 11:52:38 2007 @@ -0,0 +1,111 @@ + + + + + 4.0.0 + + + org.apache.geronimo.devtools.j2g + plugins + 1.0.0-SNAPSHOT + ../pom.xml + + + org.apache.geronimo.devtools.j2g.util + jar + ${artifactId} + + + + + . + + plugin.xml + + + + lib + lib + + *.jar + + + + + + maven-dependency-plugin + + + copy + generate-resources + + copy + + + + + commons-logging + commons-logging + + + dom4j + dom4j + + + jaxen + jaxen + + + junit + junit + + + pull-parser + pull-parser + + + lib + + + + + + + + + commons-logging + commons-logging + + + dom4j + dom4j + + + jaxen + jaxen + + + junit + junit + + + pull-parser + pull-parser + + + Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/commons-logging.properties URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/commons-logging.properties?rev=582934&view=auto ============================================================================== --- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/commons-logging.properties (added) +++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/commons-logging.properties Mon Oct 8 11:52:38 2007 @@ -0,0 +1,30 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + # Set root logger level to DEBUG and its only appender to console. +commons-logging.rootLogger=INFO + +#define loggers +#pluging logger +lcommons-logging.logger.com.ibm.j2g= DEBUG,console + +# console is set to be a ConsoleAppender. +commons-logging.appender.console=org.apache.log4j.ConsoleAppender + +# console uses PatternLayout. +commons-logging.appender.console.layout=org.apache.log4j.PatternLayout +#commons-logging.appender.console.layout.ConversionPattern=[%t] %-5p %l - %m%n +commons-logging.appender.console.layout.ConversionPattern=[%t] %-5p - %m%n \ No newline at end of file Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/commons-logging.properties ------------------------------------------------------------------------------ svn:eol-style = native Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/Constants.java URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/Constants.java?rev=582934&view=auto ============================================================================== --- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/Constants.java (added) +++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/Constants.java Mon Oct 8 11:52:38 2007 @@ -0,0 +1,70 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.devtools.j2g.util.descriptors; + +public interface Constants { + + public static final String JBOSS_WEB_XML_FILE = "jboss-web.xml"; + + public static final String GERONIMO_WEB_XML_FILE = "geronimo-web.xml"; + + public static final String JBOSS_JBOSS_XML_FILE = "jboss.xml"; + + public static final String JBOSS_JBOSS_CMP_JDBC_XML_FILE = "jbosscmp-jdbc.xml"; + + public static final String GERONIMO_OPEN_EJB_XML_FILE = "openejb-jar.xml"; + + public static final String EJB_JAR_XML_FILE = "ejb-jar.xml"; + + public static final String JBOSS_JBOSS_APPLICATION_XML_FILE = "jboss-app.xml"; + + public static final String GERONIMO_APPLICATION_XML_FILE = "geronimo-application.xml"; + + public static final String PERSISTENCE_XML_FILE = "persistence.xml"; + + //standard j2ee files + public static final String WEB_XML_FILE = "web.xml"; + + public static final String APPLICATION_XML_FILE = "application.xml"; + + // name spaces + public static final String WEB_NAME_SPACE = "http://geronimo.apache.org/xml/ns/j2ee/web-1.1"; + + public static final String NAMING_NAME_SPACE = "http://geronimo.apache.org/xml/ns/naming-1.1"; + + public static final String SECURITY_NAME_SPACE = "http://geronimo.apache.org/xml/ns/security-1.1"; + + public static final String SYS_NAME_SPACE = "http://geronimo.apache.org/xml/ns/deployment-1.1"; + + public static final String EJB_NAME_SPACE = "http://www.openejb.org/xml/ns/openejb-jar-2.1"; + + public static final String APPLICATION_NAME_SPACE = "http://geronimo.apache.org/xml/ns/j2ee/application-1.1"; + + // prefixes + public static final String NAMING_NAME_SPACE_PREFIX = "naming"; + + public static final String SECURITY_NAME_SPACE_PREFIX = "security"; + + public static final String SYS_NAME_SPACE_PREFIX = "sys"; + + public static final String GERONIMO_WEB_XML_ROOT_NODE = "web-app"; + + public static final String GERONIMO_OPEN_EJB_XML_ROOT_NODE = "openejb-jar"; + + public static final String GERONIMO_APPLICATION_XML_ROOT_NODE = "application"; + +} Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/Constants.java ------------------------------------------------------------------------------ svn:eol-style = native Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/env/EnvirionmentElementProcessor.java URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/env/EnvirionmentElementProcessor.java?rev=582934&view=auto ============================================================================== --- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/env/EnvirionmentElementProcessor.java (added) +++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/env/EnvirionmentElementProcessor.java Mon Oct 8 11:52:38 2007 @@ -0,0 +1,107 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.devtools.j2g.util.descriptors.env; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.geronimo.devtools.j2g.util.descriptors.Constants; +import org.dom4j.Element; +import org.dom4j.Namespace; +import org.dom4j.QName; + + +public class EnvirionmentElementProcessor { + + private Map processedJndiNames; + + private Log logger = LogFactory.getLog(EnvirionmentElementProcessor.class); + + public EnvirionmentElementProcessor() { + this.processedJndiNames = new HashMap(); + } + + public String addDependencyModule(String jndiName, Element geronimoRootElement) { + + String orginalJndiName = jndiName; + // process the invalid chars + jndiName = jndiName.replaceAll("%", "%25"); + jndiName = jndiName.replaceAll("\\\\/", "%2F"); + jndiName = jndiName.replaceAll("\\\\\\\\", "%5F"); + + // add prefix + jndiName = "j2g/" + jndiName; + + String firstPart = jndiName.substring(0, jndiName.lastIndexOf("/")); + String lastPart = jndiName.substring(jndiName.lastIndexOf("/") + 1); + + firstPart = firstPart.replaceAll("/", "."); + logger.debug("Creating a new dependency with groupID ==> " + firstPart + " artifactID ==> " + + lastPart + " version ==> 1.0 type ==> rar"); + + Namespace sysNS = geronimoRootElement + .getNamespaceForPrefix(Constants.SYS_NAME_SPACE_PREFIX); + + // get Dependencies Element + QName envirionmentQName = new QName("environment", sysNS); + Element envirionmentElement = geronimoRootElement.element(envirionmentQName); + QName dependenciesQName = new QName("dependencies", sysNS); + Element geronimoDependenciesElement = envirionmentElement.element(dependenciesQName); + + // adding the dependency + QName depencencyQName = new QName("dependency", sysNS); + Element geronimoDepencyElement = geronimoDependenciesElement.addElement(depencencyQName); + + QName groupIdQName = new QName("groupId", sysNS); + Element geronimoGroupIdElement = geronimoDepencyElement.addElement(groupIdQName); + geronimoGroupIdElement.setText(firstPart); + + QName artifactIdQName = new QName("artifactId", sysNS); + Element geronimoArtifactIdElement = geronimoDepencyElement.addElement(artifactIdQName); + geronimoArtifactIdElement.setText(lastPart); + + QName versionQName = new QName("version", sysNS); + Element geronimoVersionElement = geronimoDepencyElement.addElement(versionQName); + geronimoVersionElement.setText("1.0"); + + QName typeQName = new QName("type", sysNS); + Element geronimoTypeElement = geronimoDepencyElement.addElement(typeQName); + geronimoTypeElement.setText("rar"); + + processedJndiNames.put(orginalJndiName, lastPart); + + return lastPart; + + } + + public boolean isJndiNameProcessed(String jndiName) { + return processedJndiNames.containsKey(jndiName); + } + + /** + * assume jndiName already exists + * + * @param jndiName + * @return artifact ID + */ + + public String getArtifactID(String jndiName) { + return (String) processedJndiNames.get(jndiName); + } +} Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/env/EnvirionmentElementProcessor.java ------------------------------------------------------------------------------ svn:eol-style = native Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/naming/NamingElementProcessor.java URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/naming/NamingElementProcessor.java?rev=582934&view=auto ============================================================================== --- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/naming/NamingElementProcessor.java (added) +++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/naming/NamingElementProcessor.java Mon Oct 8 11:52:38 2007 @@ -0,0 +1,63 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.devtools.j2g.util.descriptors.naming; + +import java.util.Iterator; + +import org.apache.geronimo.devtools.j2g.util.descriptors.Constants; +import org.apache.geronimo.devtools.j2g.util.descriptors.env.EnvirionmentElementProcessor; +import org.dom4j.Element; +import org.dom4j.QName; + + +public class NamingElementProcessor { + + private EnvirionmentElementProcessor envirionmentElementProcessor; + + public NamingElementProcessor(EnvirionmentElementProcessor envirionmentElementProcessor) { + this.envirionmentElementProcessor = envirionmentElementProcessor; + } + + public void migrateResourceRef(Element jbossResourceRef, Element geronimoResourceRef) { + + Element jbossResourceRefChildElement; + for (Iterator iter = jbossResourceRef.elements().iterator(); iter.hasNext();) { + jbossResourceRefChildElement = (Element) iter.next(); + if (jbossResourceRefChildElement.getName().equals("res-ref-name")) { + QName qname = new QName("ref-name", geronimoResourceRef + .getNamespaceForPrefix(Constants.NAMING_NAME_SPACE_PREFIX)); + Element geronimoRefName = geronimoResourceRef.addElement(qname); + geronimoRefName.setText(jbossResourceRefChildElement.getText()); + } else if (jbossResourceRefChildElement.getName().equals("jndi-name")) { + // create a dependency element at the envirionment + String jndiName = jbossResourceRefChildElement.getText(); + String artifactID; + if (envirionmentElementProcessor.isJndiNameProcessed(jndiName)) { + artifactID = envirionmentElementProcessor.getArtifactID(jndiName); + } else { + artifactID = envirionmentElementProcessor.addDependencyModule(jndiName, + geronimoResourceRef.getDocument().getRootElement()); + } + // create the resource link + QName qname = new QName("resource-link", geronimoResourceRef + .getNamespaceForPrefix(Constants.NAMING_NAME_SPACE_PREFIX)); + Element geronimoResourceLink = geronimoResourceRef.addElement(qname); + geronimoResourceLink.setText(artifactID); + } + } + } +} Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/naming/NamingElementProcessor.java ------------------------------------------------------------------------------ svn:eol-style = native Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/security/SecurityElementProcessor.java URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/security/SecurityElementProcessor.java?rev=582934&view=auto ============================================================================== --- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/security/SecurityElementProcessor.java (added) +++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/security/SecurityElementProcessor.java Mon Oct 8 11:52:38 2007 @@ -0,0 +1,122 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.devtools.j2g.util.descriptors.security; + + +import java.util.Iterator; + +import org.apache.geronimo.devtools.j2g.util.descriptors.Constants; +import org.dom4j.Element; +import org.dom4j.Namespace; +import org.dom4j.QName; + + +public class SecurityElementProcessor { + + private boolean isSecurityAdded; + + private String defaultPrincipal = "anonymous"; + + private String securityDomain; + + /** + * converts the security role element in jobss to role mapping + * + * @param jbossSecurityRoleElement + * @param geronimoRoleMapping + */ + public void migrateSecurityRole(Element jbossSecurityRoleElement, Element geronimoRoleMapping) { + + QName roleQname = new QName("role", geronimoRoleMapping.getNamespace()); + Element geronimoRoleElement = geronimoRoleMapping.addElement(roleQname); + + Element jbossSecurityRoleElementChild; + for (Iterator iter = jbossSecurityRoleElement.elements().iterator(); iter.hasNext();) { + jbossSecurityRoleElementChild = (Element) iter.next(); + if (jbossSecurityRoleElementChild.getName().equals("role-name")) { + geronimoRoleElement.addAttribute("role-name", jbossSecurityRoleElementChild + .getText()); + } else if (jbossSecurityRoleElementChild.getName().equals("principal-name")) { + addPrinciple(geronimoRoleElement, jbossSecurityRoleElementChild.getText()); + } + } + } + + /** + * if there is no element created then create new one otherwise return the + * existing one + * + * @param geronimoRootElement + * @return security Rolemapping Element + */ + public Element getGeronimoSecurityRoleElement(Element geronimoRootElement) { + + Element geronimoRoleMappingsElement = null; + if (isSecurityAdded) { + // security element is already there we have to return it + Element geronimoSecurity = geronimoRootElement.element("security"); + geronimoRoleMappingsElement = geronimoSecurity.element("role-mappings"); + } else { + // we have to create a security element + Namespace securityNS = geronimoRootElement + .getNamespaceForPrefix(Constants.SECURITY_NAME_SPACE_PREFIX); + QName securityQname = new QName("security", securityNS); + Element geronimoSecurityElement = geronimoRootElement.addElement(securityQname); + + // add default principle + QName defaultPrincipleQname = new QName("default-principal", securityNS); + Element defaultPrincipleElement = geronimoSecurityElement + .addElement(defaultPrincipleQname); + addPrinciple(defaultPrincipleElement, defaultPrincipal); + + // add security role mappings element + QName roleMappingsQname = new QName("role-mappings", securityNS); + geronimoRoleMappingsElement = geronimoSecurityElement.addElement(roleMappingsQname); + isSecurityAdded = true; + } + + return geronimoRoleMappingsElement; + } + + private void addPrinciple(Element geronimoElement, String name) { + QName principleQname = new QName("realm-principal", geronimoElement.getNamespace()); + Element geronimoPrincipleElement = geronimoElement.addElement(principleQname); + geronimoPrincipleElement.addAttribute("class", + "org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"); + geronimoPrincipleElement.addAttribute("name", name); + if (securityDomain != null) { + geronimoPrincipleElement.addAttribute("domain-name", securityDomain); + geronimoPrincipleElement.addAttribute("realm-name", securityDomain); + } + } + + public String getDefaultPrincipal() { + return defaultPrincipal; + } + + public void setDefaultPrincipal(String defaultPrincipal) { + this.defaultPrincipal = defaultPrincipal; + } + + public String getSecurityDomain() { + return securityDomain; + } + + public void setSecurityDomain(String securityDomain) { + this.securityDomain = securityDomain; + } +} Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/security/SecurityElementProcessor.java ------------------------------------------------------------------------------ svn:eol-style = native Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/xml/XMLConversionHelper.java URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/xml/XMLConversionHelper.java?rev=582934&view=auto ============================================================================== --- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/xml/XMLConversionHelper.java (added) +++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/xml/XMLConversionHelper.java Mon Oct 8 11:52:38 2007 @@ -0,0 +1,412 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.geronimo.devtools.j2g.util.descriptors.xml; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.geronimo.devtools.j2g.util.descriptors.Constants; +import org.dom4j.Attribute; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.DocumentHelper; +import org.dom4j.Element; +import org.dom4j.Namespace; +import org.dom4j.Node; +import org.dom4j.QName; +import org.dom4j.XPath; +import org.dom4j.io.OutputFormat; +import org.dom4j.io.SAXReader; +import org.dom4j.io.XMLWriter; +import org.xml.sax.Attributes; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.XMLFilter; +import org.xml.sax.helpers.AttributesImpl; +import org.xml.sax.helpers.XMLFilterImpl; + + +public class XMLConversionHelper { + + private static Log logger = LogFactory.getLog(XMLConversionHelper.class); + + private static final String NAMESPACE_URI = "http://geronimo.apache.org/xml/ns/j2g-1.0"; + + private static final String PREFIX = "j2g"; + + private static final QName LINE_NUMBER_ATTR = QName.get("lineNumber", PREFIX, NAMESPACE_URI); + + private static final QName COLUMN_NUMBER_ATTR = QName + .get("columnNumber", PREFIX, NAMESPACE_URI); + + public static int getLineNumber(Element element) { + return getIntAttribute(element, LINE_NUMBER_ATTR); + } + + public static int getColumnNumber(Element element) { + return getIntAttribute(element, COLUMN_NUMBER_ATTR); + } + + private static int getIntAttribute(Element element, QName name) { + Attribute attr = element.attribute(name); + return attr == null ? 0 : Integer.parseInt(attr.getValue()); + } + + public static Document getDocument(File file) throws DocumentException { + XMLFilter xmlFilter = new XMLFilterImpl() { + private Locator locator; + + public void setDocumentLocator(Locator locator) { + this.locator = locator; + super.setDocumentLocator(locator); + } + + public void startElement(String uri, String localName, String qName, Attributes atts) + throws SAXException { + Attributes extAtts; + if (locator != null) { + AttributesImpl locationAtts = new AttributesImpl(atts); + addIntAttribute(locationAtts, LINE_NUMBER_ATTR, locator.getLineNumber()); + addIntAttribute(locationAtts, COLUMN_NUMBER_ATTR, locator.getColumnNumber()); + extAtts = locationAtts; + } else { + extAtts = atts; + } + super.startElement(uri, localName, qName, extAtts); + } + + private void addIntAttribute(AttributesImpl locAtts, QName name, int value) { + locAtts.addAttribute(name.getNamespaceURI(), name.getName(), name + .getQualifiedName(), "CDATA", String.valueOf(value)); + } + + }; + SAXReader saxReader = new SAXReader(); + saxReader.setXMLFilter(xmlFilter); + return saxReader.read(file); + } + + /** + * @return a new dom4j document for geronimo-web.xml + */ + + public static Document createNewGeronimoDocument(String namespaceName, String rootName) { + + Document document = getEmptyGeronimoDocument(namespaceName, rootName); + Element rootElement = document.getRootElement(); + Namespace deploymentNS = rootElement.getNamespaceForPrefix(Constants.SYS_NAME_SPACE_PREFIX); + + // add system environment and dependencies element + QName envirionmentQName = new QName("environment", deploymentNS); + Element envirionmentElement = rootElement.addElement(envirionmentQName); + addModuleDetails(envirionmentElement, rootName); + QName dependenciesQName = new QName("dependencies", deploymentNS); + envirionmentElement.addElement(dependenciesQName); + return document; + } + + private static Document getEmptyGeronimoDocument(String namespaceName, String rootName) { + + Namespace namespace = new Namespace("", namespaceName); + QName qname = new QName(rootName, namespace); + Document document = DocumentHelper.createDocument(); + document.addElement(qname); + // adding the other required name spaces + Namespace namingNS = new Namespace(Constants.NAMING_NAME_SPACE_PREFIX, + Constants.NAMING_NAME_SPACE); + Namespace securityNS = new Namespace(Constants.SECURITY_NAME_SPACE_PREFIX, + Constants.SECURITY_NAME_SPACE); + Namespace deploymentNS = new Namespace(Constants.SYS_NAME_SPACE_PREFIX, + Constants.SYS_NAME_SPACE); + + Element rootElement = document.getRootElement(); + rootElement.add(namingNS); + rootElement.add(securityNS); + rootElement.add(deploymentNS); + + return document; + } + + private static void addModuleDetails(Element geronimoEnvirionment, String rooName) { + + QName qname = new QName("moduleId", geronimoEnvirionment.getNamespace()); + Element geronimoModuleID = geronimoEnvirionment.addElement(qname); + + // add groupID + qname = new QName("groupId", geronimoModuleID.getNamespace()); + geronimoModuleID.addElement(qname).setText("j2g"); + + if (rooName.equals(Constants.GERONIMO_WEB_XML_ROOT_NODE)) { + qname = new QName("artifactId", geronimoModuleID.getNamespace()); + geronimoModuleID.addElement(qname).setText("web-module"); + qname = new QName("version", geronimoModuleID.getNamespace()); + geronimoModuleID.addElement(qname).setText("1.0"); + qname = new QName("type", geronimoModuleID.getNamespace()); + geronimoModuleID.addElement(qname).setText("war"); + + } else if (rooName.equals(Constants.GERONIMO_OPEN_EJB_XML_ROOT_NODE)) { + qname = new QName("artifactId", geronimoModuleID.getNamespace()); + geronimoModuleID.addElement(qname).setText("ejb-module"); + qname = new QName("version", geronimoModuleID.getNamespace()); + geronimoModuleID.addElement(qname).setText("1.0"); + qname = new QName("type", geronimoModuleID.getNamespace()); + geronimoModuleID.addElement(qname).setText("jar"); + + } else if (rooName.equals(Constants.GERONIMO_APPLICATION_XML_ROOT_NODE)) { + qname = new QName("artifactId", geronimoModuleID.getNamespace()); + geronimoModuleID.addElement(qname).setText("application"); + qname = new QName("version", geronimoModuleID.getNamespace()); + geronimoModuleID.addElement(qname).setText("1.0"); + qname = new QName("type", geronimoModuleID.getNamespace()); + geronimoModuleID.addElement(qname).setText("ear"); + + } + } + + public static Document getOpenEJBJarDocument(String directoryName) throws DocumentException { + File openEJBJarFile = new File(directoryName + File.separator + + Constants.GERONIMO_OPEN_EJB_XML_FILE); + Document geronimoOpenEjbDocument = null; + if (openEJBJarFile.exists()) { + // get the dom from this file + SAXReader saxReader = new SAXReader(); + geronimoOpenEjbDocument = saxReader.read(openEJBJarFile); + } else { + geronimoOpenEjbDocument = createNewGeronimoDocument(Constants.EJB_NAME_SPACE, + Constants.GERONIMO_OPEN_EJB_XML_ROOT_NODE); + } + return geronimoOpenEjbDocument; + + } + + + public static Document getPersistenceDocument(String directoryName) throws DocumentException { + File persistenceFile = new File(directoryName + File.separator + Constants.PERSISTENCE_XML_FILE); + Document geronimoPersistenceDoc = null; + if(persistenceFile.exists()) { + SAXReader saxReader = new SAXReader(); + geronimoPersistenceDoc = saxReader.read(persistenceFile); + } + return geronimoPersistenceDoc; + } + + /** + * writes the dom4j document object to the file given in fileNmae + * + * @param fileName + * @param document + * @throws IOException + */ + + public static void saveGeronimoDocument(String fileName, Document document) throws IOException { + // delete the file if already exists + File file = new File(fileName); + if (file.exists()) { + logger.debug("Deleting existig open ejb jar file"); + file.delete(); + } + + OutputFormat format = OutputFormat.createPrettyPrint(); + XMLWriter writer = new XMLWriter(new FileWriter(fileName), format); + writer.write(document); + writer.close(); + + } + + /** + * since openejb-jar.xml contains both jboss.xml and jbosscmp-jdbc.xml file + * entries the order, in which elements in the dom tree may not be according + * to the schema. So we have to fix this error by re arranging the elements + * of the document. This method rearrange the elements in the root element + * and the entity element. entity bean element is the only element that both + * jboss.xml and the jbosscmp-jdbc.xml files add entries. + * + * @param fileName + * @param openEJBDocument + * @throws IOException + */ + + public static void saveOpenEJBDocument(String fileName, Document openEJBDocument) + throws IOException { + + // create a new geronimo document + Document emptyOpenEJBDocuemnt = getEmptyGeronimoDocument(Constants.EJB_NAME_SPACE, + Constants.GERONIMO_OPEN_EJB_XML_ROOT_NODE); + + Element openEJBRootElement = openEJBDocument.getRootElement(); + // put existing elements to hashmap + Map elementsMap = getChildrenHashMap(openEJBRootElement); + // add existing elements in order + addElementToEmptyDocument(elementsMap, emptyOpenEJBDocuemnt.getRootElement(), "environment"); + addElementToEmptyDocument(elementsMap, emptyOpenEJBDocuemnt.getRootElement(), + "cmp-connection-factory"); + addEnterpriseBeanToEmptyDocument(elementsMap, emptyOpenEJBDocuemnt.getRootElement()); + addElementToEmptyDocument(elementsMap, emptyOpenEJBDocuemnt.getRootElement(), + "relationships"); + addElementToEmptyDocument(elementsMap, emptyOpenEJBDocuemnt.getRootElement(), "security"); + + saveGeronimoDocument(fileName, emptyOpenEJBDocuemnt); + } + + /** + * this map contains the element name as the key and the elements list as + * the value + * + * @param element + * @return children has map + */ + + public static Map getChildrenHashMap(Element element) { + Map elementsMap = new HashMap(); + Element elementChild; + for (Iterator iter = element.elementIterator(); iter.hasNext();) { + elementChild = (Element) iter.next(); + if (!elementsMap.containsKey(elementChild.getName())) { + // add the element list to map only if key does not exits + elementsMap.put(elementChild.getName(), element.elements(elementChild.getName())); + } + } + return elementsMap; + } + + private static void addElementToEmptyDocument(Map elementsMap, Element element, + String elementName) { + List elementsList; + if (elementsMap.containsKey(elementName)) { + elementsList = (List) elementsMap.get(elementName); + Element elementChild; + for (Iterator iter = elementsList.iterator(); iter.hasNext();) { + elementChild = (Element) iter.next(); + element.add(elementChild.createCopy()); + } + } + } + + /** + * rearrange the enterprise beans element + * + * @param elementsMap + * @param element + */ + + public static void addEnterpriseBeanToEmptyDocument(Map elementsMap, Element element) { + + List enterpriseBeans; + if (elementsMap.containsKey("enterprise-beans")) { + enterpriseBeans = (List) elementsMap.get("enterprise-beans"); + + Element enterpriseBean; + for (Iterator iter = enterpriseBeans.iterator(); iter.hasNext();) { + enterpriseBean = (Element) iter.next(); + + QName qname = new QName("enterprise-beans", element.getNamespace()); + Element geronimoEnterpriseBeans = element.addElement(qname); + + Map childrenMap = getChildrenHashMap(enterpriseBean); + addElementToEmptyDocument(childrenMap, geronimoEnterpriseBeans, "session"); + addEntityBeanToEmptyDocument(childrenMap, geronimoEnterpriseBeans); + } + } + } + + /** + * rearranges the entity bean in correct order + * + * @param elementsMap + * @param element + */ + + public static void addEntityBeanToEmptyDocument(Map elementsMap, Element element) { + + List entityBeans; + if (elementsMap.containsKey("entity")) { + entityBeans = (List) elementsMap.get("entity"); + + Element entityBean; + for (Iterator iter = entityBeans.iterator(); iter.hasNext();) { + entityBean = (Element) iter.next(); + + QName qname = new QName("entity", element.getNamespace()); + Element geronimoEntityBean = element.addElement(qname); + + Map childrenMap = getChildrenHashMap(entityBean); + addElementToEmptyDocument(childrenMap, geronimoEntityBean, "ejb-name"); + addElementToEmptyDocument(childrenMap, geronimoEntityBean, "jndi-name"); + addElementToEmptyDocument(childrenMap, geronimoEntityBean, "local-jndi-name"); + addElementToEmptyDocument(childrenMap, geronimoEntityBean, "table-name"); + addElementToEmptyDocument(childrenMap, geronimoEntityBean, "cmp-field-mapping"); + } + } + } + + /** + * if the element already exists then use it otherwise return a new element + * + * @param parentElement + * @param xpathToNewElemnt + * @param newElementName + * @param newElementNamespace + * @return new element + */ + + public static Element getGeronimoElement(Element parentElement, String xpathToNewElemnt, + String newElementName, Namespace newElementNamespace) { + Document document = parentElement.getDocument(); + XPath xpath = document.createXPath(xpathToNewElemnt); + xpath.setNamespaceURIs(getNamespacesHashMap()); + Node node = xpath.selectSingleNode(document); + Element newElement = null; + if (node == null) { + QName qname = new QName(newElementName, newElementNamespace); + newElement = parentElement.addElement(qname); + } else { + newElement = (Element) node; + } + return newElement; + } + + public static Element getJbossElement(Document jbossDocument, String xpathToElement) { + XPath xpath = jbossDocument.createXPath(xpathToElement); + Node node = xpath.selectSingleNode(jbossDocument); + return (Element) node; + } + + public static boolean isNodeAvailable(Element parentElement, String xpathValue) { + Document document = parentElement.getDocument(); + XPath xpath = document.createXPath(xpathValue); + xpath.setNamespaceURIs(getNamespacesHashMap()); + Node node = xpath.selectSingleNode(parentElement); + return (node != null); + } + + public static Map getNamespacesHashMap() { + Map hashMap = new HashMap(); + hashMap.put("ejb", Constants.EJB_NAME_SPACE); + hashMap.put(Constants.NAMING_NAME_SPACE_PREFIX, Constants.NAMING_NAME_SPACE); + hashMap.put(Constants.SECURITY_NAME_SPACE_PREFIX, Constants.SECURITY_NAME_SPACE); + hashMap.put(Constants.SYS_NAME_SPACE_PREFIX, Constants.SYS_NAME_SPACE); + return hashMap; + } +} Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/descriptors/xml/XMLConversionHelper.java ------------------------------------------------------------------------------ svn:eol-style = native Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/resources/Constants.java URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/resources/Constants.java?rev=582934&view=auto ============================================================================== --- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/resources/Constants.java (added) +++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/resources/Constants.java Mon Oct 8 11:52:38 2007 @@ -0,0 +1,106 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.geronimo.devtools.j2g.util.resources; + +/** + * Constants use by the Resources Tool + */ +public interface Constants { + + // JBoss resources files + public static final String JBOSS_VALID_DS_XML_FILE = "ds.xml"; + + public static final String JBOSS_VALID_SECURITY_XML_FILE = "login-config.xml"; + + public static final String JBOSS_VALID_MAIL_XML_FILE = "mail-service.xml"; + + public static final String JBOSS_VALID_JMS_DESTINATIONS_SERVICES_XML_FILE = "jbossmq-destinations-service.xml"; + + public static final String JBOSS_VALID_JMS_CONNECTION_FACTORY_XML_FILE = "jms-ds.xml"; + + + // Geronimo Resources files + public static final String GERONIMO_PLAN_FILE = "-geronimo-plan.xml"; + + public static final String GERONIMO_SECURITY_PLAN_FILE = "security-geronimo-plan.xml"; + + public static final String GERONIMO_JMS_PLAN_FILE = "jms-geronimo-plan.xml"; + + public static final String GERONIMO_MAIL_PLAN_FILE = "mail-geronimo-plan.xml"; + + // namespaces + public static final String NAMESPACE_CONNECTOR = "http://geronimo.apache.org/xml/ns/j2ee/connector-1.1"; + + public static final String NAMESPACE_ENV = "http://geronimo.apache.org/xml/ns/deployment-1.1"; + + public static final String NAMESPACE_SYS = "http://geronimo.apache.org/xml/ns/deployment-1.1"; + + public static final String NAMESPACE_GERONIMO_LOGGIN = "http://geronimo.apache.org/xml/ns/loginconfig-1.1"; + + public static final String NAMESPACE_GERONIMO_NAMING = "http://geronimo.apache.org/xml/ns/naming-1.1"; + + // prefexes + public static final String ENV_NAMESPACE_PREFIX = "dep"; + + public static final String NAMING_NAME_SPACE_PREFIX = "naming"; + + public static final String SECURITY_NAME_SPACE_PREFIX = "security"; + + public static final String SYS_NAME_SPACE_PREFIX = "sys"; + + // other + public static final String CONNECTION_FACTORY_INTERFACE = "javax.sql.DataSource"; + + public static final String TEST_RESOURCES_DIRECTORY = "test-apps/"; + + public static final String USER_PROPERTIES_FILE_PATH = "var/security/user.properties"; + + public static final String GROUP_PROPERTIES_FILE_PATH = "var/security/user.properties"; + + // section of the Resource Tool + public static final String MAIL_RESOURCE_TOOL = "mail"; + + public static final String JMS_RESOURCE_TOOL = "jms"; + + public static final String SECURITY_RESOURCE_TOOL = "security"; + + public static final String DS_RESOURCE_TOOL = "ds"; + + // Jboss login modules + public static final String JBOSS_LOGIN_MODULE_IDELTITY = "org.jboss.security.auth.spi.IdentityLoginModule"; + + public static final String JBOSS_LOGIN_MODULE_USERS_ROLES = "org.jboss.security.auth.spi.UsersRolesLoginModule"; + + public static final String JBOSS_LOGIN_MODULE_LDAP = "org.jboss.security.auth.spi.LdapLoginModule"; + + public static final String JBOSS_LOGIN_MODULE_DATABASE_SERVER = "org.jboss.security.auth.spi.DatabaseServerLoginModule"; + + // Geronimo login modules + public static final String GERONIMO_LOGIN_MODULE_IDELTITY = "org.jboss.security.auth.spi.IdentityLoginModule"; + + public static final String GERONIMO_LOGIN_MODULE_USERS_ROLES = "org.apche.geronimo.security.realm.providers.PropertiesFileLoginModule"; + + public static final String GERONIMO_LOGIN_MODULE_LDAP = "org.apche.geronimo.security.realm.providers.LDAPLoginModule"; + + public static final String GERONIMO_LOGIN_MODULE_DATABASE_SERVER = "org.apache.geronimo.security.realm.providers.SQLLoginModule"; + + // Jboss jms classes + public static final String TOPIC_CLASS_JBOSS = "org.jboss.mq.server.jmx.Topic"; + + public static final String QUEUE_CLASS_JBOSS = "org.jboss.mq.server.jmx.Queue"; + +} \ No newline at end of file Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.util/src/org/apache/geronimo/devtools/j2g/util/resources/Constants.java ------------------------------------------------------------------------------ svn:eol-style = native