[jboss-svn-commits] JBossWS SVN: r1064 - in trunk/src/main: etc java/org/jboss/ws/tools/helpers

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Sep 27 09:58:39 EDT 2006


Author: heiko.braun at jboss.com
Date: 2006-09-27 09:58:35 -0400 (Wed, 27 Sep 2006)
New Revision: 1064

Added:
   trunk/src/main/etc/reformat.sh
   trunk/src/main/java/org/jboss/ws/tools/helpers/ReformatXML.java
Log:
reformatting utility

Added: trunk/src/main/etc/reformat.sh
===================================================================
--- trunk/src/main/etc/reformat.sh	2006-09-27 13:57:42 UTC (rev 1063)
+++ trunk/src/main/etc/reformat.sh	2006-09-27 13:58:35 UTC (rev 1064)
@@ -0,0 +1,91 @@
+#!/bin/sh
+
+# $Id: wstools.sh 499 2006-06-21 22:33:41Z jason.greene at jboss.com $
+
+DIRNAME=`dirname $0`
+PROGNAME=`basename $0`
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false;
+case "`uname`" in
+    CYGWIN*)
+        cygwin=true
+        ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+    [ -n "$JBOSS_HOME" ] &&
+        JBOSS_HOME=`cygpath --unix "$JBOSS_HOME"`
+    [ -n "$JAVA_HOME" ] &&
+        JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Setup JBOSS_HOME
+if [ "x$JBOSS_HOME" = "x" ]; then
+    # get the full path (without any relative bits)
+    JBOSS_HOME=`cd $DIRNAME/..; pwd`
+fi
+export JBOSS_HOME
+
+# Setup the JVM
+if [ "x$JAVA" = "x" ]; then
+    if [ "x$JAVA_HOME" != "x" ]; then
+	JAVA="$JAVA_HOME/bin/java"
+    else
+	JAVA="java"
+    fi
+fi
+
+#JPDA options. Uncomment and modify as appropriate to enable remote debugging .
+#JAVA_OPTS="-classic -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n $JAVA_OPTS"
+
+# Setup JBoss sepecific properties
+JAVA_OPTS="$JAVA_OPTS"
+
+# Setup the java endorsed dirs
+JBOSS_ENDORSED_DIRS="$JBOSS_HOME/lib/endorsed"
+
+# Setup the wstools classpath
+WSTOOLS_CLASSPATH="$WSTOOLS_CLASSPATH:$JBOSS_HOME/client/jboss-xml-binding.jar"
+WSTOOLS_CLASSPATH="$WSTOOLS_CLASSPATH:$JBOSS_HOME/client/activation.jar"
+WSTOOLS_CLASSPATH="$WSTOOLS_CLASSPATH:$JBOSS_HOME/client/javassist.jar"
+WSTOOLS_CLASSPATH="$WSTOOLS_CLASSPATH:$JBOSS_HOME/client/jbossall-client.jar"
+WSTOOLS_CLASSPATH="$WSTOOLS_CLASSPATH:$JBOSS_HOME/client/jbossretro-rt.jar"
+WSTOOLS_CLASSPATH="$WSTOOLS_CLASSPATH:$JBOSS_HOME/client/jboss-backport-concurrent.jar"
+WSTOOLS_CLASSPATH="$WSTOOLS_CLASSPATH:$JBOSS_HOME/client/jbossws14-client.jar"
+WSTOOLS_CLASSPATH="$WSTOOLS_CLASSPATH:$JBOSS_HOME/client/jbossws-client.jar"
+WSTOOLS_CLASSPATH="$WSTOOLS_CLASSPATH:$JBOSS_HOME/client/log4j.jar"
+WSTOOLS_CLASSPATH="$WSTOOLS_CLASSPATH:$JBOSS_HOME/client/mail.jar"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+    JBOSS_HOME=`cygpath --path --windows "$JBOSS_HOME"`
+    JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+    WSTOOLS_CLASSPATH=`cygpath --path --windows "$WSTOOLS_CLASSPATH"`
+    JBOSS_ENDORSED_DIRS=`cygpath --path --windows "$JBOSS_ENDORSED_DIRS"`
+fi
+
+# Display our environment
+echo "========================================================================="
+echo ""
+echo "  WSTools Environment"
+echo ""
+echo "  JBOSS_HOME: $JBOSS_HOME"
+echo ""
+echo "  JAVA: $JAVA"
+echo ""
+echo "  JAVA_OPTS: $JAVA_OPTS"
+echo ""
+#echo "  CLASSPATH: $WSTOOLS_CLASSPATH"
+#echo ""
+echo "========================================================================="
+echo ""
+
+# Execute the JVM
+"$JAVA" $JAVA_OPTS \
+   -Djava.endorsed.dirs="$JBOSS_ENDORSED_DIRS" \
+   -Dlog4j.configuration=wstools-log4j.xml \
+   -classpath "$WSTOOLS_CLASSPATH" \
+   org.jboss.ws.tools.helpers.ReformatXML "$@"
+

Added: trunk/src/main/java/org/jboss/ws/tools/helpers/ReformatXML.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/tools/helpers/ReformatXML.java	2006-09-27 13:57:42 UTC (rev 1063)
+++ trunk/src/main/java/org/jboss/ws/tools/helpers/ReformatXML.java	2006-09-27 13:58:35 UTC (rev 1064)
@@ -0,0 +1,62 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.ws.tools.helpers;
+
+import org.w3c.dom.Element;
+import org.jboss.ws.utils.DOMUtils;
+import org.jboss.ws.utils.DOMWriter;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+
+
+/**
+ * @author Heiko Braun <heiko.braun at jboss.com>
+ * @version $Id$
+ * @since Sep 27, 2006
+ */
+public class ReformatXML {
+
+   public static void main(String[] args) throws Exception
+   {
+      if(args.length == 0)
+         throw new IllegalArgumentException("Please specify a filename");
+
+      ReformatXML formatter = new ReformatXML();
+      try
+      {
+         FileInputStream in = new FileInputStream(args[0]);
+         System.out.println( formatter.reformat(in));
+      }
+      catch (FileNotFoundException e)
+      {
+         System.err.println("Failed to read from file " + args[0] +": "+e.getMessage());
+      }
+   }
+
+   public String reformat(InputStream in) throws Exception
+   {
+      Element root = DOMUtils.parse(in);
+      return DOMWriter.printNode(root, true);
+   }
+}


Property changes on: trunk/src/main/java/org/jboss/ws/tools/helpers/ReformatXML.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF




More information about the jboss-svn-commits mailing list