6 Replies Latest reply on Feb 1, 2007 7:18 AM by Thomas Diesler

    wstools not generating Java for enum pattern

    Victor Lewis Newbie

      I am using jbossws-1.0.0 in JBoss 4.0.2 CR2 with JDK 1.5.0_6.

      I have a web service that uses a value type implementing the enum pattern:

      
      public class MembershipStatus {
       public static final String _current = "current";
       public static final String _expired = "expired";
       public static final String _unknown = "unknown";
      
       public static final MembershipStatus CURRENT = new MembershipStatus(_current);
       public static final MembershipStatus EXPIRED = new MembershipStatus(_expired);
       public static final MembershipStatus UNKNOWN = new MembershipStatus(_unknown);
      
       private static Map<String, MembershipStatus> statuses;
      
       static {
       statuses = new HashMap<String, MembershipStatus>();
       statuses.put(_current, CURRENT);
       statuses.put(_expired, EXPIRED);
       statuses.put(_unknown, UNKNOWN);
       }
      
       public static MembershipStatus fromValue(String candiateValue) {
       MembershipStatus result = statuses.get(candiateValue);
       if (result == null) {
       throw new IllegalArgumentException(candiateValue);
       }
       return result;
       }
      
      
       private String value;
      
       protected MembershipStatus(String newValue) {
       value = newValue;
       }
      
       public String getValue() {
       return value;
       }
      }
      


      jbossws recognizes this pattern enough to generate the correct WSDL:

      .
      .
      .
       <simpleType name='MembershipStatus'>
       <restriction base='string'>
       <enumeration value='current'/>
       <enumeration value='expired'/>
       <enumeration value='unknown'/>
       </restriction>
       </simpleType>
      .
      .
      .
      


      but when I run wstools using this wstools-confg.xml

      
      <configuration xmlns="http://www.jboss.org/jbossws-tools"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.jboss.org/jbossws-tools http://www.jboss.org/jbossws-tools/schema/jbossws-tool_1_0.xsd">
      
       <wsdl-java file="Generated-src/META-INF/wsdl/FBCMembershipVerification.wsdl">
       <mapping file="META-INF/jaxrpc-mapping.xml" />
       </wsdl-java>
      
      </configuration>
      


      It generates Java code for everything except the MembershipStatus type. It also generates other classes which the type as though it is expected to have been generated.

      I tried supplying my own implementation of MembershipStatus but a call which returns the type fails because it cannot obtain deserializer factory for MembershipStatus.

      Am I doing something wrong or is this a missing feature?

      I know that generating for JDK5 enums is not yet supported from reading bug JBWS-446 but reading JBWS-231 lead me to believe this problem had been fixed.