You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by li...@apache.org on 2007/10/08 20:45:54 UTC

svn commit: r582928 - in /geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common: ./ META-INF/ src/ src/org/ src/org/apache/ src/org/apache/geronimo/ src/org/apache/geronimo/devtools/ src/org/apache/geronimo/devtools/j2g/ src/org/a...

Author: linsun
Date: Mon Oct  8 11:45:53 2007
New Revision: 582928

URL: http://svn.apache.org/viewvc?rev=582928&view=rev
Log:
update the common plugin for GERONIMODEVTOOLS-221

Added:
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/.classpath   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/.project   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/META-INF/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/META-INF/MANIFEST.MF
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/build.properties   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/plugin.xml   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/pom.xml   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/ConsoleOutput.java   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/FatalToolException.java   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/IFileMigration.java   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/IJavaMigration.java   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/IOutput.java   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/RollbackManager.java   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/Tool.java   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/ToolConstants.java   (with props)
    geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/XMLMigrationTool.java   (with props)

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/.classpath
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/.classpath?rev=582928&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/.classpath (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/.classpath Mon Oct  8 11:45:53 2007
@@ -0,0 +1,6 @@
+<classpath>
+  <classpathentry kind="src" path="." including="plugin.xml" excluding="**/*.java"/>
+  <classpathentry kind="src" path="src"/>
+  <classpathentry kind="output" path="target/classes"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+</classpath>
\ No newline at end of file

Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/.classpath
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/.project
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/.project?rev=582928&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/.project (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/.project Mon Oct  8 11:45:53 2007
@@ -0,0 +1,20 @@
+<projectDescription>
+  <name>org.apache.geronimo.devtools.j2g.common</name>
+  <comment>JBoss to Geronimo Conversion Tool</comment>
+  <projects/>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+    <buildCommand>
+      <name>org.eclipse.pde.ManifestBuilder</name>
+    </buildCommand>
+    <buildCommand>
+      <name>org.eclipse.pde.SchemaBuilder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.pde.PluginNature</nature>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file

Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/.project
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/META-INF/MANIFEST.MF?rev=582928&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/META-INF/MANIFEST.MF (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/META-INF/MANIFEST.MF Mon Oct  8 11:45:53 2007
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: J2G Common Plug-in
+Bundle-SymbolicName: org.apache.geronimo.devtools.j2g.common;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Vendor: Apache.org
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.jdt.core
+Export-Package: 
+ org.apache.geronimo.devtools.j2g.common

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/build.properties
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/build.properties?rev=582928&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/build.properties (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/build.properties Mon Oct  8 11:45:53 2007
@@ -0,0 +1,22 @@
+/**
+ *  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.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml
+

Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/build.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/plugin.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/plugin.xml?rev=582928&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/plugin.xml (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/plugin.xml Mon Oct  8 11:45:53 2007
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<!--
+  ~ 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.
+  -->
+<plugin>
+</plugin>

Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/plugin.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/pom.xml?rev=582928&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/pom.xml (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/pom.xml Mon Oct  8 11:45:53 2007
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<!-- $Rev: 561821 $ $Date: 2007-08-01 11:05:12 -0400 (Wed, 01 Aug 2007) $ -->
+<project>
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.geronimo.devtools.j2g</groupId>
+        <artifactId>plugins</artifactId>
+        <version>1.0.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>org.apache.geronimo.devtools.j2g.common</artifactId>
+    <packaging>jar</packaging>
+    <name>${artifactId}</name>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-dependency-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.geronimo.devtools</groupId>
+                <artifactId>maven-eclipsepde-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <artifactId>maven-jar-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+</project>

Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/ConsoleOutput.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/ConsoleOutput.java?rev=582928&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/ConsoleOutput.java (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/ConsoleOutput.java Mon Oct  8 11:45:53 2007
@@ -0,0 +1,90 @@
+/**
+ *  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.common;
+
+/**
+ * Outputs different kinds of messages to the standard output stream. 
+ */
+public class ConsoleOutput implements IOutput
+{
+	/**   
+	 * Prints info message to the standard output stream. 
+	 * @param message info message to output.
+	 * @param row row in a converting file concerned to message.
+	 * @param col column in a converting file concerned to message.
+	 */
+	public void info(String caller, String message, int row, int col)
+	{
+		System.out.println(caller + "[INFO] " + message + " At row:" + row + ", col:" + col);
+	}
+
+	/**
+	 * Prints warning message to the standard output stream. 
+	 * @param message warning message to output.
+	 * @param row row in a converting file concerned to message.
+	 * @param col column in a converting file concerned to message.
+	 */
+	public void warn(String caller, String message, int row, int col)
+	{
+		System.out.println(caller + "[*WARNING*] " + message + " At row:" + row + ", col:" + col);
+	}
+
+	/**
+	 * Prints error message to the standard output stream. 
+	 * @param message error message to output.
+	 * @param row row in a converting file concerned to message.
+	 * @param col column in a converting file concerned to message.
+	 */
+	public void error(String caller, String message, int row, int col)
+	{
+		System.out.println(caller + "[!ERROR]! " + message + " At row:" + row + ", col:" + col);
+	}
+
+	/**
+	 * Prints error message to the standard output stream. 
+	 * @param message error message to output.
+	 */
+	public void error(String caller, String message) {
+		System.out.println(caller + "[!ERROR!] " + message);
+	}
+
+	/**
+	 * Prints fatal message to the standard output stream. 
+	 * @param message error message to output.
+	 */
+	public void fatal(String caller, String message) {
+		System.out.println("**********************************************************");
+		System.out.println(caller + "[FATAL] " + message);
+		System.out.println("**********************************************************");
+	}
+	
+	/**
+	 * Prints warning message to the standard output stream. 
+	 * @param message error message to output.
+	 */
+	public void warn(String caller, String message) {
+		System.out.println(caller + "[*WARNING*] " + message);
+	}
+	
+	/**
+	 * Prints information message to the standard output stream. 
+	 * @param message error message to output.
+	 */
+	public void info(String caller, String message) {
+		System.out.println(caller + "[INFO] " + message);
+	}
+}

Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/ConsoleOutput.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/FatalToolException.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/FatalToolException.java?rev=582928&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/FatalToolException.java (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/FatalToolException.java Mon Oct  8 11:45:53 2007
@@ -0,0 +1,62 @@
+/**
+ *  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.common;
+
+/**
+ * Exception that indicates fatal tool exception.
+ */
+public class FatalToolException extends Exception {
+
+	/** Serial version UID */
+	private static final long serialVersionUID = 1791680611044657934L;
+
+	/**
+	 * Constructor.
+	 */
+	public FatalToolException() {
+		super();
+	}
+
+	/**
+	 * Constructor.
+	 * 
+	 * @param msg message
+	 * @param cause cause
+	 */
+	public FatalToolException(String msg, Throwable cause) {
+		super(msg, cause);
+	}
+
+	/**
+	 * Constructor.
+	 * 
+	 * @param msg message
+	 */
+	public FatalToolException(String msg) {
+		super(msg);
+	}
+
+	/**
+	 * Constructor.
+	 * 
+	 * @param cause cause
+	 */
+	public FatalToolException(Throwable cause) {
+		super(cause);
+	}
+	
+}
\ No newline at end of file

Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/FatalToolException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/IFileMigration.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/IFileMigration.java?rev=582928&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/IFileMigration.java (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/IFileMigration.java Mon Oct  8 11:45:53 2007
@@ -0,0 +1,32 @@
+/**
+ *  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.common;
+
+import java.io.File;
+
+/**
+ * Interface for descriptors migrators.
+ */
+public interface IFileMigration {
+	/**
+	 * Migrate given descriptor.
+	 * 
+	 * @param source source file
+	 * @return
+	 */
+	boolean migrate(File source, File rootDirectory);
+}

Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/IFileMigration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/IJavaMigration.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/IJavaMigration.java?rev=582928&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/IJavaMigration.java (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/IJavaMigration.java Mon Oct  8 11:45:53 2007
@@ -0,0 +1,32 @@
+/**
+ *  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.common;
+
+import org.eclipse.jdt.core.dom.ASTNode;
+
+/**
+ * Iterface for java sources migrators.
+ */
+public interface IJavaMigration
+{
+	/**
+	 * Migrate given source tree.
+	 * @param source parsed java source.
+	 * @return true in case source was changed.
+	 */
+	boolean migrate(ASTNode source);
+}

Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/IJavaMigration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/IOutput.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/IOutput.java?rev=582928&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/IOutput.java (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/IOutput.java Mon Oct  8 11:45:53 2007
@@ -0,0 +1,72 @@
+/**
+ *  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.common;
+
+/**
+ * Outputs different kinds of messages. 
+ */
+public interface IOutput
+{
+	/**
+	 * Takes to the output an info message. 
+	 * @param message info message to output.
+	 * @param row row in a converting file concerned for message.
+	 * @param col column in a converting file concerned for message.
+	 */
+	public void info(String caller, String message, int row, int col);
+	
+	/**
+	 * Takes to the output a warning message.
+	 * @param message warning message to output.
+	 * @param row row in a converting file concerned for message.
+	 * @param col column in a converting file concerned for message.
+	 */
+	public void warn(String caller, String message, int row, int col);
+	
+	/**
+	 * Takes to the output an error message.
+	 * @param message error message to output.
+	 * @param row row in a converting file concerned for message.
+	 * @param col column in a converting file concerned for message.
+	 */
+	public void error(String caller, String message, int row, int col);
+	
+	/**
+	 * Takes to the output an error message. 
+	 * @param message info message to output.
+	 */
+	public void error(String caller, String message);
+	
+	/**
+	 * Takes to the output an fatal message. 
+	 * @param message info message to output.
+	 */
+	public void fatal(String caller, String message);
+	
+	/**
+	 * Takes to the output an warn message. 
+	 * @param message info message to output.
+	 */
+	public void warn(String caller, String message);
+	
+	/**
+	 * Takes to the output an info message. 
+	 * @param message info message to output.
+	 */
+	public void info(String caller, String message);
+}

Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/IOutput.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/RollbackManager.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/RollbackManager.java?rev=582928&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/RollbackManager.java (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/RollbackManager.java Mon Oct  8 11:45:53 2007
@@ -0,0 +1,68 @@
+/**
+ *  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.common;
+
+import java.io.File;
+import java.io.FileFilter;
+
+/**
+ * Class for restore backup files.
+ */
+public class RollbackManager
+{
+	/** Backup suffix */
+	public final static String BACKUP_SUFFIX = ".j2g";
+	
+	/** 
+	 * Filter for restored files. 
+	 */
+	private FileFilter filter;
+	
+	/**
+	 * Creates RollbackManager with specifed file filter.
+	 * @param filter
+	 */
+	public RollbackManager(FileFilter filter)
+	{
+		this.filter = filter;
+	}
+	
+	/**
+	 * Restore backed up files.
+	 * 
+	 * @param file file to start from
+	 */
+	public void restore(File file) throws FatalToolException {
+		if (file.isDirectory()) {
+			File[] children = file.listFiles(filter);
+			for (int i = 0; i < children.length; ++i) {
+				restore(children[i]);
+			}
+		} else {
+			File backup = new File(file.getParentFile(), file.getName() + BACKUP_SUFFIX);
+			if(backup.exists()) {
+				if(!file.delete()) {
+					throw new FatalToolException("Could not delete already migrated file " + file.getPath());
+				}
+				if(!backup.renameTo(file)) {
+					throw new FatalToolException("Could not rename backed up file " + backup.getPath() + " to the original file " + file.getPath());
+				}
+			}
+		}
+	}
+}

Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/RollbackManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/Tool.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/Tool.java?rev=582928&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/Tool.java (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/Tool.java Mon Oct  8 11:45:53 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.devtools.j2g.common;
+
+import org.eclipse.core.runtime.IPlatformRunnable;
+
+/**
+ * Abstract class implements common functionality of tools.
+ */
+public abstract class Tool implements IPlatformRunnable
+{
+	/**
+	 * Protected default constructor. 
+	 */
+	protected Tool()
+	{
+		current = this;
+		output = new ConsoleOutput();
+	}
+	
+	/**
+	 * Current tool. 
+	 */
+	private static Tool current;
+	
+	/**
+	 * Output for current tool.
+	 */
+	private ConsoleOutput output;
+	
+	/**
+	 * @return current tool.
+	 */
+	public static Tool getCurrent()
+	{
+		return current;
+	}
+	
+	/**
+	 * @return current output.
+	 */
+	public IOutput getOutput()
+	{
+		return output;
+	}
+}
\ No newline at end of file

Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/Tool.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/ToolConstants.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/ToolConstants.java?rev=582928&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/ToolConstants.java (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/ToolConstants.java Mon Oct  8 11:45:53 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.common;
+
+/**
+ * Class provides constants for tools.
+ */
+public class ToolConstants
+{
+	/**
+	 * Temporary project name.
+	 */
+	public static final String TEMPORARY_PROJECT_NAME = "Temporary";
+
+	/**
+	 * Name of the proprerty with classname
+	 */
+	public final static String CLASS_PROPERTY = "class";
+
+	/**
+	 * Pattern for libraries names in project linked from Geronimo repository
+	 * directory.
+	 */
+	public final static String GERONIMO_REP = "geronimo-rep";
+
+	/**
+	 * Pattern for libraries names in project linked from Geronimo lib
+	 * directory.
+	 */
+	public final static String GERONIMO_LIB = "geronimo-lib";
+
+	/**
+	 * Repository folder in Geronimo home path.
+	 */
+	public final static String GERONIMO_REPOSITORY_FOLDER = "repository";
+
+	/**
+	 * Separator for Geronimo artefacts paths.
+	 */
+	public final static char GERONIMO_SEPARATOR_CHAR = '/';
+
+	/**
+	 * Closed constructor.
+	 */
+	private ToolConstants()
+	{
+	}
+
+}

Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/ToolConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/XMLMigrationTool.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/XMLMigrationTool.java?rev=582928&view=auto
==============================================================================
--- geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/XMLMigrationTool.java (added)
+++ geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/XMLMigrationTool.java Mon Oct  8 11:45:53 2007
@@ -0,0 +1,222 @@
+/**
+ *  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.common;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.ILog;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+
+/**
+ * Base class for descriptors and resources migration tool.
+ */
+public abstract class XMLMigrationTool extends Tool {
+
+    /** XML suffix */
+    public final static String XML_SUFFIX = ".xml";
+
+    /** JAVA suffix */
+    public final static String JAVA_SUFFIX = ".java";
+
+    /** .xml files filter */
+    private final FileFilter XML_FILTER = new XMLFilter();
+
+    /**
+     * @see org.eclipse.core.runtime.IPlatformRunnable#run(java.lang.Object)
+     */
+    public Object run(Object a) throws Exception {
+        String[] args = (String[]) a;
+
+        IFileMigration[] plugs = loadPlugins();
+        if (plugs.length == 0) {
+            getOutput().warn(XMLMigrationTool.class.getSimpleName(), "No plugins were found - skipping migration");
+            return new Integer(0);
+        }
+
+        if (args.length == 0) {
+            usage();
+            return new Integer(0);
+        }
+        
+        // save the root directory for later uses
+        String rootDirectory = args[0];
+
+        // Restore backed up files
+        List<File> files = new ArrayList<File>();
+        RollbackManager rollbackManager = new RollbackManager(XML_FILTER);
+        try {
+            for (int i = 0; i < args.length; ++i) {
+                File file = new File(args[i]);
+                if (file.exists()) {
+                    files.add(file);
+                    rollbackManager.restore(file);
+                } else {
+                    getOutput().error(XMLMigrationTool.class.getSimpleName(), 
+                    "Given file or directory (" + args[i]
+                    + ") does not exist, skipping!");
+                }
+            }
+        } catch (FatalToolException ex) {
+            getOutput().fatal(XMLMigrationTool.class.getSimpleName(), ex.getMessage());
+            return new Integer(1);
+        }
+        Set<File> filesToMigrate = new HashSet<File>();
+        // retrieve all of the files we need to migrate
+        filesToMigrate = getFilesToMigrate((File[])files.toArray(new File[files.size()]), filesToMigrate);
+        files.clear();
+        for(Iterator it = filesToMigrate.iterator(); it.hasNext(); ) {
+            files.add((File)it.next());
+        }
+        // sort the files to be migrated
+        sortByExtension(files);        
+        // Migrate descriptors
+        Iterator it = files.iterator();
+        while (it.hasNext()) {
+            File file = (File) it.next();
+            File root = new File(rootDirectory);
+            migrate(plugs, file, root);
+        }
+        return new Integer(0);
+    }
+    
+    private Set<File> getFilesToMigrate(File[] list, Set<File> set) {
+        // retrieve all files under each file/directory in 'list'
+        for(int i = 0; i < list.length; i++) {
+            if(list[i].isDirectory()) {
+                // recurse on this directory
+                Set<File> subSet = getFilesToMigrate(list[i].listFiles(XML_FILTER), set);
+                set.addAll(subSet);
+            } else {
+                // save this to the set
+                set.add(list[i]);
+            }
+        }
+        return set;
+    }
+    
+    private void sortByExtension(List<File> list) {
+        // sort .xml first, then .java
+        // this is the order in which we want to process these files
+        for(int i = 0; i < list.size(); i++) {
+            File file = (File)list.get(i);
+            String filename = file.getName();
+            boolean elementEndsWithXML = filename.endsWith(".xml");
+            // bring all .xml files to the front of the list
+            if( elementEndsWithXML ) {
+                list.add(0, list.remove(i));
+            }
+        }
+    }
+
+    /**
+     * Print tool usage text.
+     */
+    protected void usage() {
+        getOutput().fatal(XMLMigrationTool.class.getSimpleName(), "Usage: " + getToolName() + " file_or_dir_name ...");
+    }
+
+    /**
+     * Migrate given file.
+     * 
+     * @param plugs
+     *                available migration plug-ins
+     * @param file
+     *                file to migrate
+     */
+    protected void migrate(IFileMigration[] plugs, File file, File root) {
+        File jbossXMLDirectory = null;
+        // for each plugin, attempt to migrate
+        for (int i = 0; i < plugs.length; i++) {
+            if (plugs[i].migrate(file, root)) {
+                break;
+            }
+        }
+    }
+
+    /**
+     * Load migration plug-ins from the extension registry
+     * 
+     * @return
+     */
+    protected IFileMigration[] loadPlugins() {
+        List plugins = new ArrayList();
+
+        IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(getExtensionPointId());
+        IExtension[] exts = point.getExtensions();
+        for (int i = 0; i < exts.length; ++i) {
+            IConfigurationElement[] els = exts[i].getConfigurationElements();
+            for (int j = 0; j < els.length; ++j) {
+                try {
+                    plugins
+                    .add(els[j]
+                    .createExecutableExtension(ToolConstants.CLASS_PROPERTY));
+                } catch (CoreException ex) {
+                    ILog log = Platform.getLog(Platform.getBundle(getPluginId()));
+                    log.log(new Status(Status.WARNING, getPluginId(), Status.OK,
+                             "Failed to instantiate migration plug-in.", ex));
+                }
+            }
+        }
+        return (IFileMigration[]) plugins.toArray(new IFileMigration[plugins.size()]);
+    }
+
+    /**
+     * Get id of the extension point with the migration plug-ins.
+     * 
+     * @return id of the extension point with the migration plug-ins.
+     */
+    protected abstract String getExtensionPointId();
+
+    /**
+     * Get id of the tool plug-in.
+     * 
+     * @return id of the tool plug-in.
+     */
+    protected abstract String getPluginId();
+
+    /**
+     * Name of the tool to show in the usage text.
+     * 
+     * @return name of the tool to show in the usage text.
+     */
+    protected abstract String getToolName();
+
+    /**
+     * Filter for .xml descriptors.
+     */
+    protected static class XMLFilter implements FileFilter {
+        /**
+        * @see java.io.FileFilter#accept(java.io.File)
+        */
+        public boolean accept(File file) {
+            return file.isDirectory() || file.getName().endsWith(XML_SUFFIX)
+                    || file.getName().endsWith(JAVA_SUFFIX);
+        }
+    }
+}

Propchange: geronimo/devtools/j2g/trunk/plugins/org.apache.geronimo.devtools.j2g.common/src/org/apache/geronimo/devtools/j2g/common/XMLMigrationTool.java
------------------------------------------------------------------------------
    svn:eol-style = native