butek       02/03/04 06:22:48

  Modified:    java/src/org/apache/axis/utils resources.properties
               java/src/org/apache/axis/wsdl WSDL2Java.java
               java/src/org/apache/axis/wsdl/toJava Emitter.java
  Log:
  Last week Sam added programmatic support to WSDL2Java for changing the
  name of the NStoPkg.properties file.  This commit adds the command line support
  for this as well.  By default, WSDL2Java looks for a file called 
"NStoPkg.properties".
  If you specify --fileNStoPkg <name>, it will look for a file called <name> instead.
  
  Revision  Changes    Path
  1.63      +4 -1      xml-axis/java/src/org/apache/axis/utils/resources.properties
  
  Index: resources.properties
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/resources.properties,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- resources.properties      27 Feb 2002 17:13:32 -0000      1.62
  +++ resources.properties      4 Mar 2002 14:22:48 -0000       1.63
  @@ -427,6 +427,9 @@
   # NOTE:  in optionMsgCtx00, do not translate "MessageContext"
   optionMsgCtx00=emit a MessageContext parameter to skeleton methods
   
  +# NOTE:  in optionFileNStoPkg00, do not translate "NStoPkg.properties"
  +optionFileNStoPkg00=file of NStoPkg mappings (default NStoPkg.properties)
  +
   # NOTE:  in optionNStoPkg00, do not translate "namespace", "package"
   optionNStoPkg00=mapping of namespace to package
   
  @@ -680,4 +683,4 @@
   instantiationException00=InstantiationException: 
   malformedURLException00=MalformedURLException: 
   axisFault00=AxisFault:
  -axisFault01=AxisFault: {0}
  \ No newline at end of file
  +axisFault01=AxisFault: {0}
  
  
  
  1.9       +20 -4     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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- WSDL2Java.java    27 Feb 2002 23:09:15 -0000      1.8
  +++ WSDL2Java.java    4 Mar 2002 14:22:48 -0000       1.9
  @@ -94,6 +94,7 @@
       protected static final int SKELETON_OPT = 's';
       protected static final int SKELETON_DEPLOY_OPT = 'S';
       protected static final int NAMESPACE_OPT = 'N';
  +    protected static final int NAMESPACE_FILE_OPT = 'f';
       protected static final int OUTPUT_OPT = 'o';
       protected static final int SCOPE_OPT = 'd';
       protected static final int TEST_OPT = 't';
  @@ -144,6 +145,10 @@
                   CLOptionDescriptor.DUPLICATES_ALLOWED + 
CLOptionDescriptor.ARGUMENTS_REQUIRED_2,
                   NAMESPACE_OPT,
                   JavaUtils.getMessage("optionNStoPkg00")),
  +        new CLOptionDescriptor("fileNStoPkg",
  +                CLOptionDescriptor.ARGUMENT_REQUIRED,
  +                NAMESPACE_FILE_OPT,
  +                JavaUtils.getMessage("optionFileNStoPkg00")),
           new CLOptionDescriptor("package",
                   CLOptionDescriptor.ARGUMENT_REQUIRED,
                   PACKAGE_OPT,
  @@ -339,11 +344,18 @@
       } // getScope
   
       /**
  -     * Get the scope for the deploy.xml file.
  +     * Set the NStoPkg mappings filename.
        */
  -    public void setNStoPkg(File NStoPkg) {
  -        emitter.setNStoPkg(NStoPkg);
  -    } // getScope
  +    public void setNStoPkg(String NStoPkgFilename) {
  +        emitter.setNStoPkg(NStoPkgFilename);
  +    } // setNStoPkg
  +
  +    /**
  +     * Set the NStoPkg mappings file.
  +     */
  +    public void setNStoPkg(File NStoPkgFile) {
  +        emitter.setNStoPkg(NStoPkgFile);
  +    } // setNStoPkg
   
       //
       // Command line switches
  @@ -464,6 +476,10 @@
                           String namespace = option.getArgument(0);
                           String packageName = option.getArgument(1);
                           namespaceMap.put(namespace, packageName);
  +                        break;
  +
  +                    case NAMESPACE_FILE_OPT:
  +                        wsdl2java.setNStoPkg(option.getArgument());
                           break;
   
                       case PACKAGE_OPT:
  
  
  
  1.22      +27 -8     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.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- Emitter.java      27 Feb 2002 23:36:53 -0000      1.21
  +++ Emitter.java      4 Mar 2002 14:22:48 -0000       1.22
  @@ -124,7 +124,8 @@
       protected WriterFactory writerFactory = null;
       protected SymbolTable symbolTable = null;
       protected String currentWSDLURI = null;
  -    protected File NStoPkg = new File("NStoPkg.properties");
  +    protected String NStoPkgFilename = "NStoPkg.properties";
  +    protected File NStoPkgFile = null;
   
       /**
        * Default constructor.
  @@ -161,8 +162,9 @@
           if (packageName != null) {
                namespaces.setDefaultPackage(packageName);
           } else {
  -            // First, read the namespace mapping file - NStoPkg.properties - if it
  -            // exists, and load the namespaceMap HashMap with its data.
  +            // First, read the namespace mapping file - configurable, by default
  +            // NStoPkg.properties - if it exists, and load the namespaceMap HashMap
  +            // with its data.
               getNStoPkgFromPropsFile(namespaces);
               
               if (delaySetMap != null) {
  @@ -244,7 +246,14 @@
       {
           try {
               Properties mappings = new Properties();
  -            mappings.load(new FileInputStream(NStoPkg));
  +System.out.println("NStoPkgFile = " + NStoPkgFile);
  +System.out.println("NStoPkgFilename = " + NStoPkgFilename);
  +            if (NStoPkgFile != null) {
  +                mappings.load(new FileInputStream(NStoPkgFile));
  +            }
  +            else {
  +                mappings.load(new FileInputStream(NStoPkgFilename));
  +            }
               Enumeration keys = mappings.propertyNames();
               while (keys.hasMoreElements()) {
                   try {
  @@ -256,6 +265,7 @@
               }
           }
           catch (Throwable t) {
  +t.printStackTrace();
           }
       } // getNStoPkgFromPropsFile
   
  @@ -415,11 +425,20 @@
       } // getScope
   
       /**
  -     * set the package to namespace mappings
  +     * set the package to namespace mappings filename
        */
  -    public void setNStoPkg(File NStoPkg) {
  -        this.NStoPkg = NStoPkg;
  -    } // getScope
  +    public void setNStoPkg(String NStoPkgFilename) {
  +        if (NStoPkgFilename != null) {
  +            this.NStoPkgFilename = NStoPkgFilename;
  +        }
  +    } // setNStoPkg
  +
  +    /**
  +     * set the package to namespace mappings file
  +     */
  +    public void setNStoPkg(File NStoPkgFile) {
  +        this.NStoPkgFile = NStoPkgFile;
  +    } // setNStoPkg
   
       ///////////////////////////////////////////////////
       //
  
  
  


Reply via email to