You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by jo...@apache.org on 2003/11/28 08:39:17 UTC

cvs commit: ws-jaxme/src/xs/org/apache/ws/jaxme/xs/types AbstractBuiltinType.java XSAnyType.java AbstractSimpleType.java

jochen      2003/11/27 23:39:17

  Modified:    src/xs/org/apache/ws/jaxme/xs/xml/impl XsTElementImpl.java
               src/xs/org/apache/ws/jaxme/xs/junit WSDLTest.java
               src/xs/org/apache/ws/jaxme/xs/impl XSSchemaImpl.java
                        XSTypeImpl.java
               src/xs/org/apache/ws/jaxme/xs/types AbstractSimpleType.java
  Added:       src/xs/org/apache/ws/jaxme/xs/types AbstractBuiltinType.java
                        XSAnyType.java
  Log:
  Added the XSAnyType to JaxMeXS.
  
  Revision  Changes    Path
  1.3       +1 -2      ws-jaxme/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTElementImpl.java
  
  Index: XsTElementImpl.java
  ===================================================================
  RCS file: /home/cvs/ws-jaxme/src/xs/org/apache/ws/jaxme/xs/xml/impl/XsTElementImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XsTElementImpl.java	26 Sep 2003 21:31:32 -0000	1.2
  +++ XsTElementImpl.java	28 Nov 2003 07:39:16 -0000	1.3
  @@ -239,8 +239,7 @@
     public void validate() throws SAXException {
       super.validate();
       if (type == null  &&  simpleType == null  &&  complexType == null  &&  getRef() == null) {
  -      throw new LocSAXException("You must set either the 'ref' attribute, the 'type' attribute, the 'simpleType' child element, or the 'complexType' child element.",
  -                                 getLocator());
  +      setType(org.apache.ws.jaxme.xs.types.XSAnyType.getInstance().getName());
       }
       defRef.validate();
       occurs.validate();
  
  
  
  1.8       +3 -3      ws-jaxme/src/xs/org/apache/ws/jaxme/xs/junit/WSDLTest.java
  
  Index: WSDLTest.java
  ===================================================================
  RCS file: /home/cvs/ws-jaxme/src/xs/org/apache/ws/jaxme/xs/junit/WSDLTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- WSDLTest.java	17 Nov 2003 11:54:02 -0000	1.7
  +++ WSDLTest.java	28 Nov 2003 07:39:16 -0000	1.8
  @@ -58,10 +58,10 @@
       private List prefixes = new ArrayList();
       private Locator locator;
       private List schemas = new ArrayList();
  -    private final Document soapDataTypes;
  +    private final Document myDataTypes;
   
       public FilterHandler(Document pSoapDataTypes) {
  -      soapDataTypes = pSoapDataTypes;
  +      myDataTypes = pSoapDataTypes;
       }
   
       public XSSchema[] getSchemas() {
  @@ -141,7 +141,7 @@
         if (xsContentHandler == null) {
           if (XSParser.XML_SCHEMA_URI.equals(pNamespaceURI)  &&  "schema".equals(pLocalName)) {
             XSParser parser = new XSParser();
  -          Element element = soapDataTypes.getDocumentElement();
  +          Element element = myDataTypes.getDocumentElement();
             String namespace = element.getAttributeNS(null, "targetNamespace");
             if (namespace == null  ||  namespace.length() == 0) {
               throw new IllegalStateException("Namespace is not set");
  
  
  
  1.5       +2 -1      ws-jaxme/src/xs/org/apache/ws/jaxme/xs/impl/XSSchemaImpl.java
  
  Index: XSSchemaImpl.java
  ===================================================================
  RCS file: /home/cvs/ws-jaxme/src/xs/org/apache/ws/jaxme/xs/impl/XSSchemaImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XSSchemaImpl.java	26 Oct 2003 04:17:29 -0000	1.4
  +++ XSSchemaImpl.java	28 Nov 2003 07:39:17 -0000	1.5
  @@ -127,7 +127,8 @@
       XSUnsignedByte.getInstance(),
       XSUnsignedInt.getInstance(),
       XSUnsignedLong.getInstance(),
  -    XSUnsignedShort.getInstance()
  +    XSUnsignedShort.getInstance(),
  +    XSAnyType.getInstance()
     };
   
     private final XSContext context;
  
  
  
  1.9       +3 -3      ws-jaxme/src/xs/org/apache/ws/jaxme/xs/impl/XSTypeImpl.java
  
  Index: XSTypeImpl.java
  ===================================================================
  RCS file: /home/cvs/ws-jaxme/src/xs/org/apache/ws/jaxme/xs/impl/XSTypeImpl.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- XSTypeImpl.java	11 Nov 2003 21:13:15 -0000	1.8
  +++ XSTypeImpl.java	28 Nov 2003 07:39:17 -0000	1.9
  @@ -73,15 +73,15 @@
   public class XSTypeImpl extends XSOpenAttrsImpl implements XSType {
     public abstract class XSComplexTypeImpl implements XSComplexType {
       protected final XSType owner;
  -    private final XsTComplexType complexType;
  +    private final XsTComplexType myComplexType;
       protected XSType extendedType, restrictedType;
   
       public XSComplexTypeImpl(XSType pOwner, XsTComplexType pType) {
         owner = pOwner;
  -      complexType = pType;
  +      myComplexType = pType;
       }
   
  -    protected XsTComplexType getXsTComplexType() { return complexType; }
  +    protected XsTComplexType getXsTComplexType() { return myComplexType; }
       protected XSType getOwner() { return owner; }
   
       public XsComplexContentType getComplexContentType() {
  
  
  
  1.3       +2 -26     ws-jaxme/src/xs/org/apache/ws/jaxme/xs/types/AbstractSimpleType.java
  
  Index: AbstractSimpleType.java
  ===================================================================
  RCS file: /home/cvs/ws-jaxme/src/xs/org/apache/ws/jaxme/xs/types/AbstractSimpleType.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractSimpleType.java	26 Oct 2003 04:17:29 -0000	1.2
  +++ AbstractSimpleType.java	28 Nov 2003 07:39:17 -0000	1.3
  @@ -48,51 +48,33 @@
    */
   package org.apache.ws.jaxme.xs.types;
   
  -import org.apache.ws.jaxme.xs.XSAnnotation;
   import org.apache.ws.jaxme.xs.XSAtomicType;
   import org.apache.ws.jaxme.xs.XSEnumeration;
   import org.apache.ws.jaxme.xs.XSComplexType;
   import org.apache.ws.jaxme.xs.XSListType;
   import org.apache.ws.jaxme.xs.XSObject;
   import org.apache.ws.jaxme.xs.XSObjectFactory;
  -import org.apache.ws.jaxme.xs.XSSchema;
   import org.apache.ws.jaxme.xs.XSSimpleType;
  -import org.apache.ws.jaxme.xs.XSType;
   import org.apache.ws.jaxme.xs.XSUnionType;
  -import org.xml.sax.Attributes;
  -import org.xml.sax.Locator;
  -import org.xml.sax.SAXException;
  +
   
   /**
    * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
    */
  -public abstract class AbstractSimpleType implements XSType, XSSimpleType {
  -  public Attributes getOpenAttributes() { return null; }
  +public abstract class AbstractSimpleType extends AbstractBuiltinType implements XSSimpleType {
     public boolean isSimple() { return true; }
  -  public boolean isGlobal() { return true; }
     public boolean isAtomic() { return false; }
     public boolean isList() { return false; }
     public boolean isUnion() { return false; }
     public XSSimpleType getSimpleType() { return this; }
     public String[][] getPattern() { return null; }
     public XSEnumeration[] getEnumerations() { return new XSEnumeration[0]; }
  -  public XSAnnotation[] getAnnotations() { return new XSAnnotation[0]; }
     public XSObject getParentObject() {
       throw new IllegalStateException("The " + getName() +
                                        " type is declared outside of any schema and doesn't have a parent.");
     }
     public boolean isTopLevelObject() { return true; }
   
  -  public void setGlobal(boolean pGlobal) {
  -    if (!pGlobal) {
  -      throw new IllegalStateException("The global type" + getName() + " cannot be made local.");
  -    }
  -  }
  -  
  -  public XSSchema getXSSchema() {
  -    return null;
  -  }
  -
     public XSComplexType getComplexType() {
       throw new IllegalStateException("This is a complex type.");
     }
  @@ -109,13 +91,7 @@
       throw new IllegalStateException("The global type " + getName() + " is no union type.");
     }
   
  -  public Locator getLocator() {
  -    throw new IllegalStateException("The global type " + getName() + " does not have a location.");
  -  }
  -
     public XSObjectFactory getXSObjectFactory() {
       throw new IllegalStateException("The global type " + getName() + " does not have an object factory.");
     }
  -
  -  public void validate() throws SAXException {}
   }
  
  
  
  1.1                  ws-jaxme/src/xs/org/apache/ws/jaxme/xs/types/AbstractBuiltinType.java
  
  Index: AbstractBuiltinType.java
  ===================================================================
  package org.apache.ws.jaxme.xs.types;
  
  import org.apache.ws.jaxme.xs.XSAnnotation;
  import org.apache.ws.jaxme.xs.XSSchema;
  import org.apache.ws.jaxme.xs.XSType;
  import org.xml.sax.Attributes;
  import org.xml.sax.Locator;
  import org.xml.sax.SAXException;
  import org.xml.sax.helpers.AttributesImpl;
  
  /** <p>An abstract type, to be extended by the builtin types.</p>
   *
   * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
   */
  public abstract class AbstractBuiltinType implements XSType {
    private static final Attributes openAttrs = new AttributesImpl();
    private static final XSAnnotation[] annotations = new XSAnnotation[0];
    
    public Attributes getOpenAttributes() { return openAttrs; }
    public XSAnnotation[] getAnnotations() { return annotations; }
    public boolean isGlobal() { return true; }
    public XSSchema getXSSchema() { return null; }
    
    public void setGlobal(boolean pGlobal) {
      if (pGlobal == false) {
        throw new IllegalStateException("A builtin type cannot be local.");
      }
    }
  
    public Locator getLocator() {
      throw new IllegalStateException("The builtin type " + getName() + " does not have a location.");
    }
  
    public void validate() throws SAXException {}
  }
  
  
  
  1.1                  ws-jaxme/src/xs/org/apache/ws/jaxme/xs/types/XSAnyType.java
  
  Index: XSAnyType.java
  ===================================================================
  package org.apache.ws.jaxme.xs.types;
  
  import org.apache.ws.jaxme.xs.XSAttributable;
  import org.apache.ws.jaxme.xs.XSComplexType;
  import org.apache.ws.jaxme.xs.XSObject;
  import org.apache.ws.jaxme.xs.XSParser;
  import org.apache.ws.jaxme.xs.XSParticle;
  import org.apache.ws.jaxme.xs.XSSimpleContentType;
  import org.apache.ws.jaxme.xs.XSSimpleType;
  import org.apache.ws.jaxme.xs.XSType;
  import org.apache.ws.jaxme.xs.xml.XsComplexContentType;
  import org.apache.ws.jaxme.xs.xml.XsQName;
  import org.xml.sax.SAXException;
  
  
  /** <p>The "anyType" is a type with arbitrary content.</p>
   *
   * @author <a href="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
   */
  public class XSAnyType extends AbstractBuiltinType
      implements XSComplexType {
    private static final XsQName qName = new XsQName(XSParser.XML_SCHEMA_URI, "anyType", null);
    private static final XSAttributable[] attributes = new XSAttributable[0];
    private static final XSAnyType theInstance = new XSAnyType();
  
    private XSAnyType() {
    }
  
    public static final XSAnyType getInstance() {
      return theInstance;
    }
  
    public boolean isSimple() { return false; }
    public XSSimpleType getSimpleType() throws SAXException {
      throw new IllegalStateException("The anyType is a complex type.");
    }
    public XSComplexType getComplexType() throws SAXException { return this; }
    public XsQName getName() { return qName; }
    public boolean isTopLevelObject() { return true; }
    public XSObject getParentObject() { return null; }
    public boolean hasSimpleContent() { return false; }
    public boolean isEmpty() { return false; }
    public boolean isElementOnly() { return false; }
    public boolean isMixed() { return true; }
    public XSParticle getParticle() { return null; }
    public XSAttributable[] getAttributes() { return attributes; }
    public boolean isExtension() { return false; }
    public XSType getExtendedType() { return null; }
    public boolean isRestriction() { return false; }
    public XSType getRestrictedType() { return null; }
      
    public XsComplexContentType getComplexContentType() {
      throw new IllegalStateException("The builtin type " + getName() + " does not have an inner instance of XsComplexContentType.");
    }
  
    public XSSimpleContentType getSimpleContent() {
      throw new IllegalStateException("The builtin type " + getName() + " does not have simple content.");
    }
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org