FileDocCategorySizeDatePackage
WSDL2Java.javaAPI DocApache Axis 1.413737Sat Apr 22 18:57:26 BST 2006org.apache.axis.wsdl

WSDL2Java

public class WSDL2Java extends org.apache.axis.wsdl.gen.WSDL2
Command line interface to the WSDL2Java utility

Fields Summary
protected static final int
SERVER_OPT
Field SERVER_OPT
protected static final int
SKELETON_DEPLOY_OPT
Field SKELETON_DEPLOY_OPT
protected static final int
NAMESPACE_OPT
Field NAMESPACE_OPT
protected static final int
NAMESPACE_FILE_OPT
Field NAMESPACE_FILE_OPT
protected static final int
OUTPUT_OPT
Field OUTPUT_OPT
protected static final int
SCOPE_OPT
Field SCOPE_OPT
protected static final int
TEST_OPT
Field TEST_OPT
protected static final int
BUILDFILE_OPT
Field BUILDFILE_OPT
protected static final int
PACKAGE_OPT
Field PACKAGE_OPT
protected static final int
ALL_OPT
Field ALL_OPT
protected static final int
TYPEMAPPING_OPT
Field TYPEMAPPING_OPT
protected static final int
FACTORY_CLASS_OPT
Field FACTORY_CLASS_OPT
protected static final int
HELPER_CLASS_OPT
Field HELPER_CLASS_OPT
protected static final int
USERNAME_OPT
Field USERNAME_OPT
protected static final int
PASSWORD_OPT
Field PASSWORD_OPT
protected static final int
CLASSPATH_OPT
protected boolean
bPackageOpt
Field bPackageOpt
protected static final int
NS_INCLUDE_OPT
Field namespace include
protected static final int
NS_EXCLUDE_OPT
Filed namespace exclude
protected static final int
IMPL_CLASS_OPT
Field IMPL_CLASS_OPT
protected static final int
ALLOW_INVALID_URL_OPT
Field ALLOW_INVALID_URL_OPT
protected static final int
WRAP_ARRAYS_OPT
Wrap arrays option
private org.apache.axis.wsdl.toJava.Emitter
emitter
Field emitter
protected static final org.apache.axis.utils.CLOptionDescriptor[]
options
Define the understood options. Each CLOptionDescriptor contains: - The "long" version of the option. Eg, "help" means that "--help" will be recognised. - The option flags, governing the option's argument(s). - The "short" version of the option. Eg, 'h' means that "-h" will be recognised. - A description of the option for the usage message
Constructors Summary
protected WSDL2Java()
Instantiate a WSDL2Java emitter.


             
      

        // emitter is the same as the parent's parser variable.  Just cast it
        // here once so we don't have to cast it every time we use it.
        emitter = (Emitter) parser;

        addOptions(options);
    
Methods Summary
protected org.apache.axis.wsdl.gen.ParsercreateParser()
Instantiate an extension of the Parser

return

        return new Emitter();
    
public static voidmain(java.lang.String[] args)
Main Run the WSDL2Java emitter with the specified command-line arguments

param
args command-line arguments


        WSDL2Java wsdl2java = new WSDL2Java();

        wsdl2java.run(args);
    
protected voidparseOption(org.apache.axis.utils.CLOption option)
Parse an option

param
option is the option


        switch (option.getId()) {

            case FACTORY_CLASS_OPT:
                emitter.setFactory(option.getArgument());
                break;

            case HELPER_CLASS_OPT:
                emitter.setHelperWanted(true);
                break;

            case SKELETON_DEPLOY_OPT:
                emitter.setSkeletonWanted(
                        JavaUtils.isTrueExplicitly(option.getArgument(0)));

                // --skeletonDeploy assumes --server-side, so fall thru
            case SERVER_OPT:
                emitter.setServerSide(true);
                break;

            case NAMESPACE_OPT:
                String namespace = option.getArgument(0);
                String packageName = option.getArgument(1);

                emitter.getNamespaceMap().put(namespace, packageName);
                break;

            case NAMESPACE_FILE_OPT:
                emitter.setNStoPkg(option.getArgument());
                break;

            case PACKAGE_OPT:
                bPackageOpt = true;

                emitter.setPackageName(option.getArgument());
                break;

            case OUTPUT_OPT:
                emitter.setOutputDir(option.getArgument());
                break;

            case SCOPE_OPT:
                String arg = option.getArgument();

                // Provide 'null' default, prevents logging internal error.
                // we have something different to report here.
                Scope scope = Scope.getScope(arg, null);

                if (scope != null) {
                    emitter.setScope(scope);
                } else {
                    System.err.println(Messages.getMessage("badScope00", arg));
                }
                break;

            case TEST_OPT:
                emitter.setTestCaseWanted(true);
                break;
            case BUILDFILE_OPT:
                emitter.setBuildFileWanted(true);
                break;
            case ALL_OPT:
                emitter.setAllWanted(true);
                break;

            case TYPEMAPPING_OPT:
                String tmValue = option.getArgument();

                if (tmValue.equals("1.0")) {
                    emitter.setTypeMappingVersion("1.0");
                } else if (tmValue.equals("1.1")) {
                        emitter.setTypeMappingVersion("1.1");
                } else if (tmValue.equals("1.2")) {
                    emitter.setTypeMappingVersion("1.2");
                } else if (tmValue.equals("1.3")) {
                    emitter.setTypeMappingVersion("1.3");
                } else {
                    System.out.println(
                            Messages.getMessage("badTypeMappingOption00"));
                }
                break;

            case USERNAME_OPT:
                emitter.setUsername(option.getArgument());
                break;

            case PASSWORD_OPT:
                emitter.setPassword(option.getArgument());
                break;

            case CLASSPATH_OPT:
                ClassUtils.setDefaultClassLoader(ClassUtils.createClassLoader(
                        option.getArgument(),
                        this.getClass().getClassLoader()));
                break;

            case NS_INCLUDE_OPT:
                NamespaceSelector include = new NamespaceSelector();
                include.setNamespace(option.getArgument());
                emitter.getNamespaceIncludes().add(include);
                break;
            case NS_EXCLUDE_OPT:
                NamespaceSelector exclude = new NamespaceSelector();
                exclude.setNamespace(option.getArgument());
                emitter.getNamespaceExcludes().add(exclude);
                break;

			case IMPL_CLASS_OPT:
				emitter.setImplementationClassName(option.getArgument());
				break;

            case ALLOW_INVALID_URL_OPT:
                emitter.setAllowInvalidURL(true);
                break;

            case WRAP_ARRAYS_OPT:
                emitter.setWrapArrays(true);
                break;

            default :
                super.parseOption(option);
        }
    
protected voidvalidateOptions()
validateOptions This method is invoked after the options are set to validate the option settings.


        super.validateOptions();

        // validate argument combinations
        if (emitter.isSkeletonWanted() && !emitter.isServerSide()) {
            System.out.println(Messages.getMessage("badSkeleton00"));
            printUsage();
        }

        if (!emitter.getNamespaceMap().isEmpty() && bPackageOpt) {
            System.out.println(Messages.getMessage("badpackage00"));
            printUsage();
        }