butek 02/03/19 07:42:02 Modified: java axis.properties build.xml java/docs developers-guide.html user-guide.html java/samples/addr readme java/src/org/apache/axis/wsdl Java2WSDL.java WSDL2Java.java java/src/org/apache/axis/wsdl/toJava Emitter.java java/test/utils TestSrcContent.java Added: java/src/org/apache/axis/utils CLArgsParser.java CLOption.java CLOptionDescriptor.java CLUtil.java ParserControl.java Token.java Removed: java/lib clutil.LICENSE clutil.jar Log: I removed clutil.jar and placed the 6 classes from it that we use into org.apache.axis.utils. One less jar to worry about! Revision Changes Path 1.5 +0 -1 xml-axis/java/axis.properties Index: axis.properties =================================================================== RCS file: /home/cvs/xml-axis/java/axis.properties,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- axis.properties 15 Mar 2002 10:19:35 -0000 1.4 +++ axis.properties 19 Mar 2002 15:42:01 -0000 1.5 @@ -17,7 +17,6 @@ wsdl4j.jar=lib/wsdl4j.jar commons-logging.jar=lib/commons-logging.jar log4j-core.jar=lib/log4j-core.jar -clutil.jar=lib/clutil.jar tt-bytecode.jar=lib/tt-bytecode.jar junit.jar=lib/junit.jar 1.126 +0 -8 xml-axis/java/build.xml Index: build.xml =================================================================== RCS file: /home/cvs/xml-axis/java/build.xml,v retrieving revision 1.125 retrieving revision 1.126 diff -u -r1.125 -r1.126 --- build.xml 15 Mar 2002 17:35:50 -0000 1.125 +++ build.xml 19 Mar 2002 15:42:01 -0000 1.126 @@ -81,7 +81,6 @@ <property name="wsdl4j.jar" value="lib/wsdl4j.jar"/> <property name="commons-logging.jar" value="lib/commons-logging.jar"/> <property name="log4j-core.jar" value="lib/log4j-core.jar"/> - <property name="clutil.jar" value="lib/clutil.jar"/> <property name="tt-bytecode.jar" value="lib/tt-bytecode.jar"/> <property name="regexp.jar" value="test/lib/jakarta-oro-2.0.5.jar"/> @@ -109,7 +108,6 @@ <!-- Determine what dependencies are present --> <!-- =================================================================== --> <path id="classpath"> - <pathelement location="${clutil.jar}"/> <pathelement location="${xerces.jar}"/> <pathelement location="${regexp.jar}"/> <pathelement location="${junit.jar}"/> @@ -149,10 +147,6 @@ classname="org.apache.log4j.Category" classpathref="classpath"/> - <available property="clutil.present" - classname="org.apache.avalon.excalibur.cli.CLUtil" - classpathref="classpath"/> - <available property="tt-bytecode.present" classname="com.techtrader.modules.tools.bytecode.BCClass" classpathref="classpath"/> @@ -194,7 +188,6 @@ <echo message="wsdl4j.present=${wsdl4j.present}" /> <echo message="commons-logging.present=${commons-logging.present}" /> <echo message="log4j.present=${log4j.present}" /> - <echo message="clutil.present=${clutil.present}" /> <echo message="tt-bytecode.present=${tt-bytecode.present}" /> <echo message=""/> <echo message="--- Optional Libraries ---" /> @@ -275,7 +268,6 @@ <copy file="${wsdl4j.jar}" toDir="${build.lib}"/> <copy file="${commons-logging.jar}" toDir="${build.lib}"/> <copy file="${log4j-core.jar}" toDir="${build.lib}"/> - <copy file="${clutil.jar}" toDir="${build.lib}"/> <copy file="${tt-bytecode.jar}" toDir="${build.lib}"/> <antcall target="post-compile"/> </target> 1.13 +0 -1 xml-axis/java/docs/developers-guide.html Index: developers-guide.html =================================================================== RCS file: /home/cvs/xml-axis/java/docs/developers-guide.html,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- developers-guide.html 12 Mar 2002 21:03:16 -0000 1.12 +++ developers-guide.html 19 Mar 2002 15:42:01 -0000 1.13 @@ -92,7 +92,6 @@ <br><tt><font color="#009900">G:\\xml-axis\\java\\build\\lib\\wsdl4j.jar</font></tt> <br><tt><font color="#009900">G:\\xml-axis\\java\\build\\lib\\axis.jar</font></tt> <br><tt><font color="#009900">G:\\xml-axis\\java\\build\\lib\\log4j-core.jar</font></tt> -<br><tt><font color="#009900">G:\\xml-axis\\java\\build\\lib\\clutil.jar</font></tt> <br><tt><font color="#009900">G:\\xml-axis\\java\\build\\classes</font></tt></blockquote> </blockquote> If you access the internet via a proxy server, you'll need to set an environment 1.49 +0 -1 xml-axis/java/docs/user-guide.html Index: user-guide.html =================================================================== RCS file: /home/cvs/xml-axis/java/docs/user-guide.html,v retrieving revision 1.48 retrieving revision 1.49 diff -u -r1.48 -r1.49 --- user-guide.html 18 Mar 2002 16:03:44 -0000 1.48 +++ user-guide.html 19 Mar 2002 15:42:01 -0000 1.49 @@ -172,7 +172,6 @@ <ul> <li>xml-axis-beta1/lib/axis.jar</li> <li>xml-axis-beta1/lib/jaxrpc.jar</li> -<li>xml-axis-beta1/lib/clutil.jar</li> <li>xml-axis-beta1/lib/commons-logging.jar</li> <li>xml-axis-beta1/lib/tt-bytecode.jar</li> <li>xml-axis-beta1/lib/wsdl4j.jar</li> 1.8 +1 -1 xml-axis/java/samples/addr/readme Index: readme =================================================================== RCS file: /home/cvs/xml-axis/java/samples/addr/readme,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- readme 11 Mar 2002 22:07:18 -0000 1.7 +++ readme 19 Mar 2002 15:42:01 -0000 1.8 @@ -2,7 +2,7 @@ the AddressBook.wsdl file. First, set up the CLASSPATH. It must contain an XML parser (ie., xerces.jar); -all the jars in the lib directory: axis.jar, clutil.jar, commons-logging.jar, +all the jars in the lib directory: axis.jar, commons-logging.jar, log4j-core.jar, and wsdl4j.jar; and the directory containing the samples subdirectory. 1.1 xml-axis/java/src/org/apache/axis/utils/CLArgsParser.java Index: CLArgsParser.java =================================================================== /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE.txt file. */ // This file is pulled from package org.apache.avalon.excalibur.cli Excalibur // version 4.1 (Jan 30, 2002). Only the package name has been changed. package org.apache.axis.utils; import java.text.ParseException; import java.util.Hashtable; import java.util.Vector; /** * Parser for command line arguments. * * This parses command lines according to the standard (?) of * GNU utilities. * * Note: This is still used in 1.1 libraries so do not add 1.2+ dependencies. * * @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a> * @since 4.0 */ public final class CLArgsParser { private static final int STATE_NORMAL = 0; private static final int STATE_REQUIRE_2ARGS = 1; private static final int STATE_REQUIRE_ARG = 2; private static final int STATE_OPTIONAL_ARG = 3; private static final int STATE_NO_OPTIONS = 4; private static final int STATE_OPTION_MODE = 5; private static final int TOKEN_SEPARATOR = 0; private static final int TOKEN_STRING = 1; private static final char[] ARG2_SEPARATORS = new char[] { (char)0, '=', '-' }; private static final char[] ARG_SEPARATORS = new char[] { (char)0, '=' }; private static final char[] NULL_SEPARATORS = new char[] { (char)0 }; private final CLOptionDescriptor[] m_optionDescriptors; private final Vector m_options; private Hashtable m_optionIndex; private final ParserControl m_control; private String m_errorMessage; private String[] m_unparsedArgs = new String[] {}; //variables used while parsing options. private char ch; private String[] args; private boolean isLong; private int argIndex; private int stringIndex; private int stringLength; //cached character == Integer.MAX_VALUE when invalid private static final int INVALID = Integer.MAX_VALUE; private int m_lastChar = INVALID; private int m_lastOptionId; private CLOption m_option; private int m_state = STATE_NORMAL; public final String[] getUnparsedArgs() { return m_unparsedArgs; } /** * Retrieve a list of options that were parsed from command list. * * @return the list of options */ public final Vector getArguments() { //System.out.println( "Arguments: " + m_options ); return m_options; } /** * Retrieve the {@link CLOption} with specified id, or * <code>null</code> if no command line option is found. * * @param id the command line option id * @return the {@link CLOption) with the specified id, or * <code>null</code> if no CLOption is found. * @see CLOption */ public final CLOption getArgumentById( final int id ) { return (CLOption)m_optionIndex.get( new Integer( id ) ); } /** * Retrieve the {@link CLOption} with specified name, or * <code>null</code> if no command line option is found. * * @param name the command line option name * @return the {@link CLOption) with the specified name, or * <code>null</code> if no CLOption is found. * @see CLOption */ public final CLOption getArgumentByName( final String name) { return (CLOption)m_optionIndex.get( name ); } /** * Get Descriptor for option id. * * @param id the id * @return the descriptor */ private final CLOptionDescriptor getDescriptorFor( final int id ) { for( int i = 0; i < m_optionDescriptors.length; i++ ) { if( m_optionDescriptors[i].getId() == id ) { return m_optionDescriptors[i]; } } return null; } /** * Retrieve a descriptor by name. * * @param name the name * @return the descriptor */ private final CLOptionDescriptor getDescriptorFor( final String name ) { for( int i = 0; i < m_optionDescriptors.length; i++ ) { if( m_optionDescriptors[i].getName().equals( name ) ) { return m_optionDescriptors[i]; } } return null; } /** * Retrieve an error message that occured during parsing if one existed. * * @return the error string */ public final String getErrorString() { //System.out.println( "ErrorString: " + m_errorMessage ); return m_errorMessage; } /** * Require state to be placed in for option. * * @param descriptor the Option Descriptor * @return the state */ private final int getStateFor( final CLOptionDescriptor descriptor ) { int flags = descriptor.getFlags(); if( ( flags & CLOptionDescriptor.ARGUMENTS_REQUIRED_2 ) == CLOptionDescriptor.ARGUMENTS_REQUIRED_2 ) { return STATE_REQUIRE_2ARGS; } else if( ( flags & CLOptionDescriptor.ARGUMENT_REQUIRED ) == CLOptionDescriptor.ARGUMENT_REQUIRED ) { return STATE_REQUIRE_ARG; } else if( ( flags & CLOptionDescriptor.ARGUMENT_OPTIONAL ) == CLOptionDescriptor.ARGUMENT_OPTIONAL ) { return STATE_OPTIONAL_ARG; } else { return STATE_NORMAL; } } /** * Create a parser that can deal with options and parses certain args. * * @param args[] the args, typically that passed to the * <code>public static void main(String[] args)</code> method. * @param optionDescriptors[] the option descriptors */ public CLArgsParser( final String[] args, final CLOptionDescriptor[] optionDescriptors, final ParserControl control ) { m_optionDescriptors = optionDescriptors; m_control = control; m_options = new Vector(); this.args = args; try { parse(); checkIncompatibilities( m_options ); buildOptionIndex(); } catch( final ParseException pe ) { m_errorMessage = pe.getMessage(); } //System.out.println( "Built : " + m_options ); //System.out.println( "From : " + Arrays.asList( args ) ); } /** * Check for duplicates of an option. * It is an error to have duplicates unless appropriate flags is set in descriptor. * * @param arguments the arguments */ private final void checkIncompatibilities( final Vector arguments ) throws ParseException { final int size = arguments.size(); for( int i = 0; i < size; i++ ) { final CLOption option = (CLOption)arguments.elementAt( i ); final int id = option.getId(); final CLOptionDescriptor descriptor = getDescriptorFor( id ); //this occurs when id == 0 and user has not supplied a descriptor //for arguments if( null == descriptor ) { continue; } final int[] incompatible = descriptor.getIncompatble(); checkIncompatible( arguments, incompatible, i ); } } private final void checkIncompatible( final Vector arguments, final int[] incompatible, final int original ) throws ParseException { final int size = arguments.size(); for( int i = 0; i < size; i++ ) { if( original == i ) { continue; } final CLOption option = (CLOption)arguments.elementAt( i ); final int id = option.getId(); final CLOptionDescriptor descriptor = getDescriptorFor( id ); for( int j = 0; j < incompatible.length; j++ ) { if( id == incompatible[ j ] ) { final CLOption originalOption = (CLOption)arguments.elementAt( original ); final int originalId = originalOption.getId(); String message = null; if( id == originalId ) { message = "Duplicate options for " + describeDualOption( originalId ) + " found."; } else { message = "Incompatible options -" + describeDualOption( id ) + " and " + describeDualOption( originalId ) + " found."; } throw new ParseException( message, 0 ); } } } } private final String describeDualOption( final int id ) { final CLOptionDescriptor descriptor = getDescriptorFor( id ); if( null == descriptor ) { return "<parameter>"; } else { final StringBuffer sb = new StringBuffer(); boolean hasCharOption = false; if( Character.isLetter( (char)id ) ) { sb.append( '-' ); sb.append( (char)id ); hasCharOption = true; } final String longOption = descriptor.getName(); if( null != longOption ) { if( hasCharOption ) { sb.append( '/' ); } sb.append( "--" ); sb.append( longOption ); } return sb.toString(); } } /** * Create a parser that deals with options and parses certain args. * * @param args[] the args * @param optionDescriptors[] the option descriptors */ public CLArgsParser( final String[] args, final CLOptionDescriptor[] optionDescriptors ) { this( args, optionDescriptors, null ); } /** * Create a string array that is subset of input array. * The sub-array should start at array entry indicated by index. That array element * should only include characters from charIndex onwards. * * @param array[] the original array * @param index the cut-point in array * @param charIndex the cut-point in element of array * @return the result array */ private final String[] subArray( final String[] array, final int index, final int charIndex ) { final int remaining = array.length - index; final String[] result = new String[ remaining ]; if( remaining > 1 ) { System.arraycopy( array, index + 1, result, 1, remaining - 1 ); } result[0] = array[ index ].substring( charIndex - 1 ); return result; } /** * Actually parse arguments * * @param args[] arguments */ private final void parse() throws ParseException { if( 0 == args.length ) { return; } stringLength = args[ argIndex ].length(); //ch = peekAtChar(); while( true ) { ch = peekAtChar(); //System.out.println( "Pre State=" + m_state ); //System.out.println( "Pre Char=" + (char)ch + "/" + (int)ch ); if( argIndex >= args.length ) { break; } if( null != m_control && m_control.isFinished( m_lastOptionId ) ) { //this may need mangling due to peeks m_unparsedArgs = subArray( args, argIndex, stringIndex ); return; } //System.out.println( "State=" + m_state ); //System.out.println( "Char=" + (char)ch + "/" + (int)ch ); if( STATE_OPTION_MODE == m_state ) { //if get to an arg barrier then return to normal mode //else continue accumulating options if( 0 == ch ) { getChar(); //strip the null m_state = STATE_NORMAL; } else { parseShortOption(); } } else if( STATE_NORMAL == m_state ) { parseNormal(); } else if( STATE_NO_OPTIONS == m_state ) { //should never get to here when stringIndex != 0 addOption( new CLOption( args[ argIndex++ ] ) ); } else if( STATE_OPTIONAL_ARG == m_state && '-' == ch ) { m_state = STATE_NORMAL; addOption( m_option ); } else { parseArguments(); } } if( m_option != null ) { if( STATE_OPTIONAL_ARG == m_state ) { m_options.addElement( m_option ); } else if( STATE_REQUIRE_ARG == m_state ) { final CLOptionDescriptor descriptor = getDescriptorFor( m_option.getId() ); final String message = "Missing argument to option " + getOptionDescription( descriptor ); throw new ParseException( message, 0 ); } else if( STATE_REQUIRE_2ARGS == m_state ) { if( 1 == m_option.getArgumentCount() ) { m_option.addArgument( "" ); m_options.addElement( m_option ); } else { final CLOptionDescriptor descriptor = getDescriptorFor( m_option.getId() ); final String message = "Missing argument to option " + getOptionDescription( descriptor ); throw new ParseException( message, 0 ); } } else { throw new ParseException( "IllegalState " + m_state + ": " + m_option, 0 ); } } } private final String getOptionDescription( final CLOptionDescriptor descriptor ) { if( isLong ) { return "--" + descriptor.getName(); } else { return "-" + (char)descriptor.getId(); } } private final char peekAtChar() { if( INVALID == m_lastChar ) { m_lastChar = readChar(); } return (char)m_lastChar; } private final char getChar() { if( INVALID != m_lastChar ) { final char result = (char)m_lastChar; m_lastChar = INVALID; return result; } else { return readChar(); } } private final char readChar() { if( stringIndex >= stringLength ) { argIndex++; stringIndex = 0; if( argIndex < args.length ) { stringLength = args[ argIndex ].length(); } else { stringLength = 0; } return 0; } if( argIndex >= args.length ) return 0; return args[ argIndex ].charAt( stringIndex++ ); } private final Token nextToken( final char[] separators ) { ch = getChar(); if( isSeparator( ch, separators ) ) { ch = getChar(); return new Token( TOKEN_SEPARATOR, null ); } final StringBuffer sb = new StringBuffer(); do { sb.append( ch ); ch = getChar(); } while( !isSeparator( ch, separators ) ); return new Token( TOKEN_STRING, sb.toString() ); } private final boolean isSeparator( final char ch, final char[] separators ) { for( int i = 0; i < separators.length; i++ ) { if( ch == separators[ i ] ) { return true; } } return false; } private final void addOption( final CLOption option ) { m_options.addElement( option ); m_lastOptionId = option.getId(); m_option = null; } private final void parseOption( final CLOptionDescriptor descriptor, final String optionString ) throws ParseException { if( null == descriptor ) { throw new ParseException( "Unknown option " + optionString, 0 ); } m_state = getStateFor( descriptor ); m_option = new CLOption( descriptor.getId() ); if( STATE_NORMAL == m_state ) { addOption( m_option ); } } private final void parseShortOption() throws ParseException { ch = getChar(); final CLOptionDescriptor descriptor = getDescriptorFor( ch ); isLong = false; parseOption( descriptor, "-" + ch ); if( STATE_NORMAL == m_state ) { m_state = STATE_OPTION_MODE; } } private final void parseArguments() throws ParseException { if( STATE_REQUIRE_ARG == m_state ) { if( '=' == ch || 0 == ch ) { getChar(); } final Token token = nextToken( NULL_SEPARATORS ); m_option.addArgument( token.getValue() ); addOption( m_option ); m_state = STATE_NORMAL; } else if( STATE_OPTIONAL_ARG == m_state ) { if( '-' == ch || 0 == ch ) { getChar(); //consume stray character addOption( m_option ); m_state = STATE_NORMAL; return; } if( '=' == ch ) { getChar(); } final Token token = nextToken( NULL_SEPARATORS ); m_option.addArgument( token.getValue() ); addOption( m_option ); m_state = STATE_NORMAL; } else if( STATE_REQUIRE_2ARGS == m_state ) { if( 0 == m_option.getArgumentCount() ) { final Token token = nextToken( ARG_SEPARATORS ); if( TOKEN_SEPARATOR == token.getType() ) { final CLOptionDescriptor descriptor = getDescriptorFor( m_option.getId() ); final String message = "Unable to parse first argument for option " + getOptionDescription( descriptor ); throw new ParseException( message, 0 ); } else { m_option.addArgument( token.getValue() ); } } else //2nd argument { final StringBuffer sb = new StringBuffer(); ch = getChar(); if( '-' == ch ) { m_lastChar = ch; } while( !isSeparator( ch, ARG2_SEPARATORS ) ) { sb.append( ch ); ch = getChar(); } final String argument = sb.toString(); //System.out.println( "Arguement:" + argument ); m_option.addArgument( argument ); addOption( m_option ); m_option = null; m_state = STATE_NORMAL; } } } /** * Parse Options from Normal mode. */ private final void parseNormal() throws ParseException { if( '-' != ch ) { //Parse the arguments that are not options final String argument = nextToken( NULL_SEPARATORS ).getValue(); addOption( new CLOption( argument ) ); m_state = STATE_NORMAL; } else { getChar(); // strip the - if( 0 == peekAtChar() ) { throw new ParseException( "Malformed option -", 0 ); } else { ch = peekAtChar(); //if it is a short option then parse it else ... if( '-' != ch ) { parseShortOption(); } else { getChar(); // strip the - //-- sequence .. it can either mean a change of state //to STATE_NO_OPTIONS or else a long option if( 0 == peekAtChar() ) { getChar(); m_state = STATE_NO_OPTIONS; } else { //its a long option final String optionName = nextToken( ARG_SEPARATORS ).getValue(); final CLOptionDescriptor descriptor = getDescriptorFor( optionName ); isLong = true; parseOption( descriptor, "--" + optionName ); } } } } } /** * Build the m_optionIndex lookup map for the parsed options. */ private final void buildOptionIndex() { m_optionIndex = new Hashtable( m_options.size() * 2 ); for( int i = 0; i < m_options.size(); i++ ) { final CLOption option = (CLOption)m_options.get( i ); final CLOptionDescriptor optionDescriptor = getDescriptorFor( option.getId() ); m_optionIndex.put( new Integer( option.getId() ), option ); if( null != optionDescriptor ) { m_optionIndex.put( optionDescriptor.getName(), option ); } } } } 1.1 xml-axis/java/src/org/apache/axis/utils/CLOption.java Index: CLOption.java =================================================================== /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE.txt file. */ // This file is pulled from package org.apache.avalon.excalibur.cli Excalibur // version 4.1 (Jan 30, 2002). Only the package name has been changed. package org.apache.axis.utils; import java.util.Arrays; /** * Basic class describing an instance of option. * * @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a> * @since 4.0 */ public final class CLOption { /** * Value of {@link #getId} when the option is a text argument. */ public static final int TEXT_ARGUMENT = 0; private final int m_id; private String[] m_arguments; /** * Retrieve argument to option if it takes arguments. * * @return the (first) argument */ public final String getArgument() { return getArgument( 0 ); } /** * Retrieve indexed argument to option if it takes arguments. * * @param index The argument index, from 0 to * {@link #getArgumentCount()}-1. * @return the argument */ public final String getArgument( final int index ) { if( null == m_arguments || index < 0 || index >= m_arguments.length ) { return null; } else { return m_arguments[ index ]; } } /** * Retrieve id of option. * * The id is eqivalent to character code if it can be a single letter option. * * @return the id */ public final int getId() { return m_id; } /** * Constructor taking an id (that must be a proper character code) * * @param id the new id */ public CLOption( final int id ) { m_id = id; } /** * Constructor taking argument for option. * * @param argument the argument */ public CLOption( final String argument ) { this( TEXT_ARGUMENT ); addArgument( argument ); } /** * Mutator of Argument property. * * @param argument the argument */ public final void addArgument( final String argument ) { if( null == m_arguments ) m_arguments = new String[] { argument }; else { final String[] arguments = new String[ m_arguments.length + 1 ]; System.arraycopy( m_arguments, 0, arguments, 0, m_arguments.length ); arguments[ m_arguments.length ] = argument; m_arguments = arguments; } } /** * Get number of arguments. */ public final int getArgumentCount() { if( null == m_arguments ) { return 0; } else { return m_arguments.length; } } /** * Convert to String. * * @return the string value */ public final String toString() { final StringBuffer sb = new StringBuffer(); sb.append( "[Option " ); sb.append( (char)m_id ); if( null != m_arguments ) { sb.append( ", " ); sb.append( Arrays.asList( m_arguments ) ); } sb.append( " ]" ); return sb.toString(); } } 1.1 xml-axis/java/src/org/apache/axis/utils/CLOptionDescriptor.java Index: CLOptionDescriptor.java =================================================================== /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE.txt file. */ // This file is pulled from package org.apache.avalon.excalibur.cli Excalibur // version 4.1 (Jan 30, 2002). Only the package name has been changed. package org.apache.axis.utils; /** * Basic class describing an type of option. * Typically, one creates a static array of <code>CLOptionDescriptor</code>s, * and passes it to {@link CLArgsParser#CLArgsParser(String[], CLOptionDescriptor[])}. * * @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a> * @since 4.0 */ public final class CLOptionDescriptor { /** Flag to say that one argument is required */ public static final int ARGUMENT_REQUIRED = 1 << 1; /** Flag to say that the argument is optional */ public static final int ARGUMENT_OPTIONAL = 1 << 2; /** Flag to say this option does not take arguments */ public static final int ARGUMENT_DISALLOWED = 1 << 3; /** Flag to say this option requires 2 arguments */ public static final int ARGUMENTS_REQUIRED_2 = 1 << 4; /** Flag to say this option may be repeated on the command line */ public static final int DUPLICATES_ALLOWED = 1 << 5; private final int m_id; private final int m_flags; private final String m_name; private final String m_description; private final int[] m_incompatible; /** * Constructor. * * @param name the name/long option * @param flags the flags * @param id the id/character option * @param description description of option usage */ public CLOptionDescriptor( final String name, final int flags, final int id, final String description ) { this( name, flags, id, description, ((flags & CLOptionDescriptor.DUPLICATES_ALLOWED) > 0) ? new int[] {} : new int[] { id } ); } /** * Constructor. * * @param name the name/long option * @param flags the flags * @param id the id/character option * @param description description of option usage */ public CLOptionDescriptor( final String name, final int flags, final int id, final String description, final int[] incompatable ) { m_id = id; m_name = name; m_flags = flags; m_description = description; m_incompatible = incompatable; } /** * @deprecated Use the correctly spelled {@link #getIncompatible} instead. */ protected final int[] getIncompatble() { return getIncompatible(); } protected final int[] getIncompatible() { return m_incompatible; } /** * Retrieve textual description. * * @return the description */ public final String getDescription() { return m_description; } /** * Retrieve flags about option. * Flags include details such as whether it allows parameters etc. * * @return the flags */ public final int getFlags() { return m_flags; } /** * Retrieve the id for option. * The id is also the character if using single character options. * * @return the id */ public final int getId() { return m_id; } /** * Retrieve name of option which is also text for long option. * * @return name/long option */ public final String getName() { return m_name; } /** * Convert to String. * * @return the converted value to string. */ public final String toString() { return new StringBuffer() .append("[OptionDescriptor ").append(m_name) .append(", ").append(m_id).append(", ").append(m_flags) .append(", ").append(m_description).append(" ]").toString(); } } 1.1 xml-axis/java/src/org/apache/axis/utils/CLUtil.java Index: CLUtil.java =================================================================== /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE.txt file. */ // This file is pulled from package org.apache.avalon.excalibur.cli Excalibur // version 4.1 (Jan 30, 2002). Only the package name has been changed. package org.apache.axis.utils; /** * CLUtil offers basic utility operations for use both internal and external to package. * * @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a> * @since 4.0 */ public final class CLUtil { private final static int MAX_DESCRIPTION_COLUMN_LENGTH = 60; /** * Format options into StringBuffer and return. This is typically used to * print "Usage" text in response to a "--help" or invalid option. * * @param options[] the option descriptors * @return the formatted description/help for options */ public final static StringBuffer describeOptions( final CLOptionDescriptor[] options ) { final String lSep = System.getProperty( "line.separator" ); final StringBuffer sb = new StringBuffer(); for( int i = 0; i < options.length; i++ ) { final char ch = (char) options[i].getId(); final String name = options[i].getName(); String description = options[i].getDescription(); int flags = options[i].getFlags(); boolean argumentRequired = ( (flags & CLOptionDescriptor.ARGUMENT_REQUIRED) == CLOptionDescriptor.ARGUMENT_REQUIRED); boolean twoArgumentsRequired = ( (flags & CLOptionDescriptor.ARGUMENTS_REQUIRED_2) == CLOptionDescriptor.ARGUMENTS_REQUIRED_2); boolean needComma = false; if (twoArgumentsRequired) argumentRequired = true; sb.append('\t'); if( Character.isLetter(ch) ) { sb.append( "-" ); sb.append( ch ); needComma = true; } if( null != name ) { if( needComma ) { sb.append( ", " ); } sb.append( "--" ); sb.append( name ); if (argumentRequired) { sb.append(" <argument>"); } if (twoArgumentsRequired) { sb.append("=<value>"); } sb.append( lSep ); } if( null != description ) { while( description.length() > MAX_DESCRIPTION_COLUMN_LENGTH ) { final String descriptionPart = description.substring( 0, MAX_DESCRIPTION_COLUMN_LENGTH ); description = description.substring( MAX_DESCRIPTION_COLUMN_LENGTH ); sb.append( "\t\t" ); sb.append( descriptionPart ); sb.append( lSep ); } sb.append( "\t\t" ); sb.append( description ); sb.append( lSep ); } } return sb; } /** * Private Constructor so that no instance can ever be created. * */ private CLUtil() { } } 1.1 xml-axis/java/src/org/apache/axis/utils/ParserControl.java Index: ParserControl.java =================================================================== /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE.txt file. */ // This file is pulled from package org.apache.avalon.excalibur.cli Excalibur // version 4.1 (Jan 30, 2002). Only the package name has been changed. package org.apache.axis.utils; /** * ParserControl is used to control particular behaviour of the parser. * * @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a> * @since 4.0 */ public interface ParserControl { boolean isFinished( int lastOptionCode ); } 1.1 xml-axis/java/src/org/apache/axis/utils/Token.java Index: Token.java =================================================================== /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE.txt file. */ // This file is pulled from package org.apache.avalon.excalibur.cli Excalibur // version 4.1 (Jan 30, 2002). Only the package name has been changed. package org.apache.axis.utils; /** * Token handles tokenizing the CLI arguments * * @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a> * @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a> * @since 4.0 */ class Token { /** Type for a separator token */ public static final int TOKEN_SEPARATOR = 0; /** Type for a text token */ public static final int TOKEN_STRING = 1; private final int m_type; private final String m_value; /** * New Token object with a type and value */ public Token( final int type, final String value ) { m_type = type; m_value = value; } /** * Get the value of the token */ public final String getValue() { return m_value; } /** * Get the type of the token */ public final int getType() { return m_type; } /** * Convert to a string */ public final String toString() { return new StringBuffer().append(m_type).append(":").append(m_value).toString(); } } 1.12 +5 -5 xml-axis/java/src/org/apache/axis/wsdl/Java2WSDL.java Index: Java2WSDL.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/Java2WSDL.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- Java2WSDL.java 18 Mar 2002 16:10:41 -0000 1.11 +++ Java2WSDL.java 19 Mar 2002 15:42:02 -0000 1.12 @@ -54,13 +54,13 @@ */ package org.apache.axis.wsdl; -import org.apache.avalon.excalibur.cli.CLArgsParser; -import org.apache.avalon.excalibur.cli.CLOption; -import org.apache.avalon.excalibur.cli.CLOptionDescriptor; -import org.apache.avalon.excalibur.cli.CLUtil; +import org.apache.axis.utils.CLArgsParser; +import org.apache.axis.utils.CLOption; +import org.apache.axis.utils.CLOptionDescriptor; +import org.apache.axis.utils.CLUtil; +import org.apache.axis.utils.JavaUtils; import org.apache.axis.wsdl.fromJava.Emitter; -import org.apache.axis.utils.JavaUtils; import org.apache.axis.encoding.DefaultTypeMappingImpl; import org.apache.axis.encoding.DefaultSOAP12TypeMappingImpl; 1.15 +4 -5 xml-axis/java/src/org/apache/axis/wsdl/WSDL2Java.java Index: WSDL2Java.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/WSDL2Java.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- WSDL2Java.java 13 Mar 2002 20:07:06 -0000 1.14 +++ WSDL2Java.java 19 Mar 2002 15:42:02 -0000 1.15 @@ -54,11 +54,10 @@ */ package org.apache.axis.wsdl; -import org.apache.avalon.excalibur.cli.CLArgsParser; -import org.apache.avalon.excalibur.cli.CLOption; -import org.apache.avalon.excalibur.cli.CLOptionDescriptor; -import org.apache.avalon.excalibur.cli.CLUtil; - +import org.apache.axis.utils.CLArgsParser; +import org.apache.axis.utils.CLOption; +import org.apache.axis.utils.CLOptionDescriptor; +import org.apache.axis.utils.CLUtil; import org.apache.axis.utils.JavaUtils; import org.apache.axis.wsdl.toJava.Emitter; 1.26 +4 -5 xml-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java Index: Emitter.java =================================================================== RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- Emitter.java 13 Mar 2002 15:19:26 -0000 1.25 +++ Emitter.java 19 Mar 2002 15:42:02 -0000 1.26 @@ -54,11 +54,10 @@ */ package org.apache.axis.wsdl.toJava; -import org.apache.avalon.excalibur.cli.CLArgsParser; -import org.apache.avalon.excalibur.cli.CLOption; -import org.apache.avalon.excalibur.cli.CLOptionDescriptor; -import org.apache.avalon.excalibur.cli.CLUtil; - +import org.apache.axis.utils.CLArgsParser; +import org.apache.axis.utils.CLOption; +import org.apache.axis.utils.CLOptionDescriptor; +import org.apache.axis.utils.CLUtil; import org.apache.axis.utils.JavaUtils; import org.apache.axis.utils.XMLUtils; 1.6 +3 -1 xml-axis/java/test/utils/TestSrcContent.java Index: TestSrcContent.java =================================================================== RCS file: /home/cvs/xml-axis/java/test/utils/TestSrcContent.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- TestSrcContent.java 25 Feb 2002 21:47:44 -0000 1.5 +++ TestSrcContent.java 19 Mar 2002 15:42:02 -0000 1.6 @@ -146,10 +146,11 @@ "org\\.apache\\.log4j", false), // Verify that axis java files do not use System.out.println - // or System.err.println, expect: + // or System.err.println, except: // - utils/tcpmon.java // - client/AdminClient.java // - providers/BSFProvider.java + // - utils/CLArgsParser.java // - Version.java // - tooling in 'org/apache/axis/wsdl' // @@ -158,6 +159,7 @@ + "(?!utils\\1tcpmon\\.java" + "|client\\1AdminClient\\.java" + "|providers\\1BSFProvider\\.java" + + "|utils\\1CLArgsParser\\.java" + "|Version\\.java" + "|wsdl\\1)" + "([a-zA-Z0-9_]+\\1)*"