You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlbeans-cvs@xml.apache.org by da...@apache.org on 2004/07/16 02:21:15 UTC

cvs commit: xml-xmlbeans/v2/test/src/compile/scomp/detailed CompilationTests.java

daveremy    2004/07/15 17:21:14

  Modified:    v2       build.xml
               v2/src/typeimpl/org/apache/xmlbeans/impl/schema
                        SchemaAttributeGroupImpl.java
                        SchemaIdentityConstraintImpl.java
                        SchemaLocalAttributeImpl.java
                        SchemaModelGroupImpl.java SchemaParticleImpl.java
                        SchemaTypeImpl.java SchemaTypeSystemImpl.java
                        SoapEncSchemaTypeSystem.java StscTranslator.java
               v2/src/xmlpublic/org/apache/xmlbeans
                        SchemaAttributeGroup.java SchemaField.java
                        SchemaIdentityConstraint.java SchemaModelGroup.java
                        SchemaType.java
               v2/src/xmlstore/org/apache/xmlbeans/impl/store Splay.java
               v2/test/cases/xbean/compile/scomp/j2ee
                        application-client_1_4.xsd application_1_4.xsd
                        connector_1_5.xsd web-app_2_4.xsd
               v2/test/src/compile/scomp/detailed CompilationTests.java
  Added:       v2/src/xmlpublic/org/apache/xmlbeans SchemaBookmark.java
  Log:
  New "schema bookmark" mechanism allowing one to tag user data on Schema Object Model entities + test case.
  Contributed by Radu Preotiuc.
  
  Revision  Changes    Path
  1.75      +1 -1      xml-xmlbeans/v2/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/build.xml,v
  retrieving revision 1.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- build.xml	9 Jul 2004 17:31:12 -0000	1.74
  +++ build.xml	16 Jul 2004 00:21:10 -0000	1.75
  @@ -189,7 +189,7 @@
       <property name="docs.dir" value="build/docs"/>
       <delete dir="${docs.dir}"/>
       <mkdir dir="${docs.dir}"/>
  -    <javadoc packagenames="*" sourcepath="src/xmlpublic" classpath="${javadoc.path}" destdir="${docs.dir}/reference" windowtitle="XMLBeans Documentation" source="${javac.source}" target="${javac.target}" stylesheetfile="docs/stylesheet.css">
  +    <javadoc packagenames="*" sourcepath="src/xmlpublic" classpath="${javadoc.path}" destdir="${docs.dir}/reference" windowtitle="XMLBeans Documentation" source="${javac.source}" stylesheetfile="docs/stylesheet.css">
         <link href="http://e-docs.bea.com/wls/docs81/javadocs/"/>
         <link href="http://java.sun.com/j2se/1.4.2/docs/api/"/>
         <link href="http://java.sun.com/j2ee/1.4/docs/api/"/>
  
  
  
  1.4       +6 -1      xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaAttributeGroupImpl.java
  
  Index: SchemaAttributeGroupImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaAttributeGroupImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SchemaAttributeGroupImpl.java	12 Feb 2004 20:06:21 -0000	1.3
  +++ SchemaAttributeGroupImpl.java	16 Jul 2004 00:21:10 -0000	1.4
  @@ -27,6 +27,7 @@
       private SchemaTypeSystem _typeSystem;
       private QName _name;
       private XmlObject _parseObject;
  +    private Object _userData;
       private String _parseTNS;
       private boolean _chameleon;
       private boolean _redefinition;
  @@ -43,7 +44,7 @@
           _name = name;
       }
   
  -    public void init(QName name, String targetNamespace, boolean chameleon, boolean redefinition, XmlObject x, SchemaAnnotation a)
  +    public void init(QName name, String targetNamespace, boolean chameleon, boolean redefinition, XmlObject x, SchemaAnnotation a, Object userData)
       {
           assert _name == null || name.equals( _name );
   
  @@ -53,6 +54,7 @@
           _redefinition = redefinition;
           _parseObject = x;
           _annotation = a;
  +        _userData = userData;
       }
   
       public SchemaTypeSystem getTypeSystem()
  @@ -88,4 +90,7 @@
   
       public boolean isRedefinition()
           { return _redefinition; }
  +
  +    public Object getUserData()
  +    {   return _userData; }
   }
  
  
  
  1.4       +7 -0      xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaIdentityConstraintImpl.java
  
  Index: SchemaIdentityConstraintImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaIdentityConstraintImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SchemaIdentityConstraintImpl.java	12 Feb 2004 20:06:21 -0000	1.3
  +++ SchemaIdentityConstraintImpl.java	16 Jul 2004 00:21:10 -0000	1.4
  @@ -34,6 +34,7 @@
       private QName _name;
       private int _type;
       private XmlObject _parse;
  +    private Object _userData;
       private SchemaAnnotation _annotation;
       private Map _nsMap = Collections.EMPTY_MAP;
       private String _parseTNS;
  @@ -191,4 +192,10 @@
   
       public SchemaComponent.Ref getComponentRef()
           { return getRef(); }
  +
  +    public Object getUserData()
  +    {   return _userData; }
  +
  +    public void setUserData(Object data)
  +    {   _userData = data; }
   }
  
  
  
  1.4       +8 -1      xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaLocalAttributeImpl.java
  
  Index: SchemaLocalAttributeImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaLocalAttributeImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SchemaLocalAttributeImpl.java	12 Feb 2004 20:06:21 -0000	1.3
  +++ SchemaLocalAttributeImpl.java	16 Jul 2004 00:21:10 -0000	1.4
  @@ -17,8 +17,10 @@
   
   import javax.xml.namespace.QName;
   import org.apache.xmlbeans.SchemaAnnotation;
  +import org.apache.xmlbeans.SchemaBookmark;
   import org.apache.xmlbeans.SchemaType;
   import org.apache.xmlbeans.SchemaLocalAttribute;
  +import org.apache.xmlbeans.XmlCursor;
   import org.apache.xmlbeans.XmlObject;
   import org.apache.xmlbeans.XmlAnySimpleType;
   import org.apache.xmlbeans.XmlQName;
  @@ -34,7 +36,7 @@
       {
       }
   
  -    public void init(QName name, SchemaType.Ref typeref, int use, String deftext, XmlObject parseObject, XmlValueRef defvalue, boolean isFixed, SOAPArrayType wsdlArray, SchemaAnnotation ann)
  +    public void init(QName name, SchemaType.Ref typeref, int use, String deftext, XmlObject parseObject, XmlValueRef defvalue, boolean isFixed, SOAPArrayType wsdlArray, SchemaAnnotation ann, Object userData)
       {
           if (_xmlName != null || _typeref != null)
               throw new IllegalStateException("Already initialized");
  @@ -48,6 +50,7 @@
           _xmlName = name;
           _wsdlArrayType = wsdlArray;
           _annotation = ann;
  +        _userData = userData;
       }
   
       private String _defaultText;
  @@ -60,6 +63,7 @@
       private int _use;
       private SchemaAnnotation _annotation;
       protected XmlObject _parseObject; // for QName resolution
  +    private Object _userData;
   
       public boolean isTypeResolved()
       {
  @@ -137,4 +141,7 @@
   
       public void setDefaultValue(XmlValueRef defaultRef)
           { _defaultValue = defaultRef; }
  +
  +    public Object getUserData()
  +    {   return _userData; }
   }
  
  
  
  1.4       +6 -1      xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaModelGroupImpl.java
  
  Index: SchemaModelGroupImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaModelGroupImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SchemaModelGroupImpl.java	12 Feb 2004 20:06:21 -0000	1.3
  +++ SchemaModelGroupImpl.java	16 Jul 2004 00:21:10 -0000	1.4
  @@ -27,6 +27,7 @@
       private SchemaTypeSystem _typeSystem;
       private QName _name;
       private XmlObject _parseObject;
  +    private Object _userData;
       private String _parseTNS;
       private boolean _chameleon;
       private boolean _redefinition;
  @@ -43,7 +44,7 @@
           _name = name;
       }
   
  -    public void init(QName name, String targetNamespace, boolean chameleon, boolean redefinition, XmlObject x, SchemaAnnotation a)
  +    public void init(QName name, String targetNamespace, boolean chameleon, boolean redefinition, XmlObject x, SchemaAnnotation a, Object userData)
       {
           assert _name == null || name.equals( _name );
           
  @@ -53,6 +54,7 @@
           _redefinition = redefinition;
           _parseObject = x;
           _annotation = a;
  +        _userData = userData;
       }
   
       public SchemaTypeSystem getTypeSystem()
  @@ -88,4 +90,7 @@
   
       public SchemaComponent.Ref getComponentRef()
           { return getRef(); }
  +
  +    public Object getUserData()
  +    {   return _userData; }
   }
  
  
  
  1.3       +11 -0     xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaParticleImpl.java
  
  Index: SchemaParticleImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaParticleImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SchemaParticleImpl.java	12 Feb 2004 20:06:21 -0000	1.2
  +++ SchemaParticleImpl.java	16 Jul 2004 00:21:10 -0000	1.3
  @@ -49,6 +49,7 @@
       private boolean _isNillable;
       private SchemaType.Ref _typeref;
       protected XmlObject _parseObject;
  +    private Object _userData;
       private XmlValueRef _defaultValue;
   
       protected void mutate()
  @@ -236,5 +237,15 @@
       {
           mutate();
           _defaultValue = defaultRef;
  +    }
  +
  +    public Object getUserData()
  +    {
  +        return _userData;
  +    }
  +
  +    public void setUserData(Object data)
  +    {
  +        _userData = data;
       }
   }
  
  
  
  1.12      +9 -0      xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeImpl.java
  
  Index: SchemaTypeImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeImpl.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SchemaTypeImpl.java	5 May 2004 00:45:38 -0000	1.11
  +++ SchemaTypeImpl.java	16 Jul 2004 00:21:10 -0000	1.12
  @@ -98,6 +98,9 @@
       private volatile Constructor _javaImplConstructor2;
       private volatile boolean _implNotAvailable;
   
  +    // user data objects not persisted
  +    private volatile Object _userData;
  +
       private final Object[] _ctrArgs = new Object[] { this };
   
       // reflective support
  @@ -568,6 +571,12 @@
   
       public String getFullJavaImplName() { return _fullJavaImplName;}
       public String getShortJavaImplName() { return _shortJavaImplName;}
  +
  +    public Object getUserData()
  +    {   return _userData; }
  +
  +    public void setUserData(Object data)
  +    {   _userData = data; }
   
       public SchemaTypeSystem getTypeSystem()
           { return _typeSystem; }
  
  
  
  1.10      +3 -3      xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java
  
  Index: SchemaTypeSystemImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/schema/SchemaTypeSystemImpl.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SchemaTypeSystemImpl.java	11 Jun 2004 18:37:53 -0000	1.9
  +++ SchemaTypeSystemImpl.java	16 Jul 2004 00:21:10 -0000	1.10
  @@ -2378,7 +2378,7 @@
           {
               try
               {
  -                result.init(readQName(), readString(), readShort() == 1, atLeast(2, 15, 0) ? readShort() == 1 : false, GroupDocument.Factory.parse( readString() ).getGroup(), readAnnotation());
  +                result.init(readQName(), readString(), readShort() == 1, atLeast(2, 15, 0) ? readShort() == 1 : false, GroupDocument.Factory.parse( readString() ).getGroup(), readAnnotation(), null);
               }
               catch ( XmlException e )
               {
  @@ -2390,7 +2390,7 @@
           {
               try
               {
  -                result.init( readQName(), readString(), readShort() == 1, atLeast(2, 15, 0) ? readShort() == 1 : false, AttributeGroupDocument.Factory.parse( readString() ).getAttributeGroup(), readAnnotation());
  +                result.init( readQName(), readString(), readShort() == 1, atLeast(2, 15, 0) ? readShort() == 1 : false, AttributeGroupDocument.Factory.parse( readString() ).getAttributeGroup(), readAnnotation(), null);
               }
               catch ( XmlException e )
               {
  @@ -2401,7 +2401,7 @@
           void loadAttribute(SchemaLocalAttributeImpl result)
           {
               // name, type, use, deftext, defval, fixed, soaparraytype, annotation
  -            result.init(readQName(), readTypeRef(), readShort(), readString(), null, atLeast(2, 16, 0) ? readXmlValueObject() : null, readShort() == 1, readSOAPArrayType(), readAnnotation());
  +            result.init(readQName(), readTypeRef(), readShort(), readString(), null, atLeast(2, 16, 0) ? readXmlValueObject() : null, readShort() == 1, readSOAPArrayType(), readAnnotation(), null);
           }
   
           void writeAttributeData(SchemaLocalAttribute attr)
  
  
  
  1.2       +5 -5      xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/schema/SoapEncSchemaTypeSystem.java
  
  Index: SoapEncSchemaTypeSystem.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/schema/SoapEncSchemaTypeSystem.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SoapEncSchemaTypeSystem.java	29 Mar 2004 21:09:00 -0000	1.1
  +++ SoapEncSchemaTypeSystem.java	16 Jul 2004 00:21:10 -0000	1.2
  @@ -106,26 +106,26 @@
                   Collections.EMPTY_SET));
           SchemaLocalAttributeImpl attr = new SchemaLocalAttributeImpl();
           attr.init(new QName("", ATTR_ID), BuiltinSchemaTypeSystem.ST_ID.getRef(),
  -            SchemaLocalAttribute.OPTIONAL, null, null, null, false, null, null);
  +            SchemaLocalAttribute.OPTIONAL, null, null, null, false, null, null, null);
           attrModel.addAttribute(attr);
           attr = new SchemaLocalAttributeImpl();
           attr.init(new QName("", ATTR_HREF), BuiltinSchemaTypeSystem.ST_ANY_URI.getRef(),
  -            SchemaLocalAttributeImpl.OPTIONAL, null, null, null, false, null, null);
  +            SchemaLocalAttributeImpl.OPTIONAL, null, null, null, false, null, null, null);
           attrModel.addAttribute(attr);
           attr = new SchemaLocalAttributeImpl();
           attr.init(new QName(SOAPENC, ARRAY_TYPE), BuiltinSchemaTypeSystem.ST_STRING.getRef(),
  -            SchemaLocalAttributeImpl.OPTIONAL, null, null, null, false, null, null);
  +            SchemaLocalAttributeImpl.OPTIONAL, null, null, null, false, null, null, null);
           attrModel.addAttribute(attr);
           attr = new SchemaLocalAttributeImpl();
           attr.init(new QName(SOAPENC, ATTR_OFFSET), BuiltinSchemaTypeSystem.ST_STRING.getRef(),
  -            SchemaLocalAttributeImpl.OPTIONAL, null, null, null, false, null, null);
  +            SchemaLocalAttributeImpl.OPTIONAL, null, null, null, false, null, null, null);
           attrModel.addAttribute(attr);
           soapArray.setContentModel(contentModel, attrModel, Collections.EMPTY_MAP, Collections.EMPTY_MAP, false);
   
           // soapenc:arrayType
           arrayType = new SchemaGlobalAttributeImpl(this);
           arrayType.init(new QName(SOAPENC, ARRAY_TYPE), BuiltinSchemaTypeSystem.ST_STRING.getRef(),
  -            SchemaLocalAttributeImpl.OPTIONAL, null, null, null, false, null, null);
  +            SchemaLocalAttributeImpl.OPTIONAL, null, null, null, false, null, null, null);
           _handlesToObjects.put(soapArrayHandle, soapArray);
           _handlesToObjects.put(ARRAY_TYPE.toLowerCase() + "attribute", arrayType);
       }
  
  
  
  1.8       +21 -4     xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/schema/StscTranslator.java
  
  Index: StscTranslator.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/schema/StscTranslator.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- StscTranslator.java	11 Jun 2004 18:37:53 -0000	1.7
  +++ StscTranslator.java	16 Jul 2004 00:21:10 -0000	1.8
  @@ -39,6 +39,7 @@
   import org.apache.xmlbeans.SchemaParticle;
   import org.apache.xmlbeans.QNameSet;
   import org.apache.xmlbeans.QNameSetBuilder;
  +import org.apache.xmlbeans.SchemaBookmark;
   import org.apache.xmlbeans.SchemaIdentityConstraint;
   import org.apache.xmlbeans.SchemaAttributeModel;
   import org.apache.xmlbeans.SchemaLocalAttribute;
  @@ -424,6 +425,7 @@
           sType.setFilename(findFilename(xsdType));
           sType.setName(QNameHelper.forLNS(localname, targetNamespace));
           sType.setAnnotation(SchemaAnnotationImpl.getAnnotation(state.sts(), xsdType));
  +        sType.setUserData(getUserData(xsdType));
           return sType;
       }
   
  @@ -459,6 +461,7 @@
           sType.setFilename(findFilename(xsdType));
           sType.setName(name);
           sType.setAnnotation(SchemaAnnotationImpl.getAnnotation(state.sts(), xsdType));
  +        sType.setUserData(getUserData(xsdType));
           return sType;
       }
   
  @@ -502,7 +505,7 @@
                   referenced.getParseObject(), referenced._defaultValue,
               referenced.isFixed(),
               referenced.getWSDLArrayType(),
  -            referenced.getAnnotation());
  +            referenced.getAnnotation(), null);
       }
   
       /**
  @@ -607,6 +610,7 @@
               }
               SchemaLocalElementImpl target = new SchemaLocalElementImpl();
               target.setParticleType(SchemaParticle.ELEMENT);
  +            target.setUserData(getUserData(xsdElt));
               copyGlobalElementToLocalElement( referenced, target );
               return target;
           }
  @@ -683,6 +687,7 @@
   
           SchemaAnnotationImpl ann = SchemaAnnotationImpl.getAnnotation(state.sts(), xsdElt);
           impl.setAnnotation(ann);
  +        impl.setUserData(getUserData(xsdElt));
           if (xsdElt.getType() != null)
           {
               sType = state.findGlobalType(xsdElt.getType(), chameleon ? targetNamespace : null );
  @@ -715,6 +720,7 @@
               sTypeImpl.setSimpleType(simpleTypedef);
               sTypeImpl.setParseContext(typedef, targetNamespace, chameleon, false);
               sTypeImpl.setAnnotation(SchemaAnnotationImpl.getAnnotation(state.sts(), typedef));
  +            sTypeImpl.setUserData(getUserData(typedef));
           }
   
           if (sType == null)
  @@ -896,6 +902,7 @@
           ic.setParseContext(parseIC, targetNamespace, chameleon);
           SchemaAnnotationImpl ann = SchemaAnnotationImpl.getAnnotation(state.sts(), parseIC);
           ic.setAnnotation(ann);
  +        ic.setUserData(getUserData(parseIC));
   
           // Set the ns map
           XmlCursor c = parseIC.newCursor();
  @@ -938,7 +945,7 @@
           SchemaTypeSystemImpl sts = StscState.get().sts();
           SchemaModelGroupImpl result = new SchemaModelGroupImpl(sts);
           SchemaAnnotationImpl ann = SchemaAnnotationImpl.getAnnotation(sts, namedGroup);
  -        result.init(QNameHelper.forLNS(name, targetNamespace), targetNamespace, chameleon, redefinition, namedGroup, ann);
  +        result.init(QNameHelper.forLNS(name, targetNamespace), targetNamespace, chameleon, redefinition, namedGroup, ann, getUserData(namedGroup));
           return result;
       }
   
  @@ -953,7 +960,7 @@
           SchemaTypeSystemImpl ts = StscState.get().sts();
           SchemaAttributeGroupImpl result = new SchemaAttributeGroupImpl(ts);
           SchemaAnnotationImpl ann = SchemaAnnotationImpl.getAnnotation(ts, attrGroup);
  -        result.init(QNameHelper.forLNS(name, targetNamespace), targetNamespace, chameleon, redefinition, attrGroup, ann);
  +        result.init(QNameHelper.forLNS(name, targetNamespace), targetNamespace, chameleon, redefinition, attrGroup, ann, getUserData(attrGroup));
           return result;
       }
   
  @@ -1095,6 +1102,7 @@
                   sTypeImpl.setSimpleType(true);
                   sTypeImpl.setParseContext(typedef, targetNamespace, chameleon, false);
                   sTypeImpl.setAnnotation(SchemaAnnotationImpl.getAnnotation(state.sts(), typedef));
  +                sTypeImpl.setUserData(getUserData(typedef));
               }
               
               if (sType == null && baseModel != null && baseModel.getAttribute(qname) != null)
  @@ -1157,7 +1165,7 @@
               sType.getRef(),
               use,
               deftext, xsdAttr, null, isFixed,
  -            wat, ann);
  +            wat, ann, getUserData(xsdAttr));
   
           return sAttr;
       }
  @@ -1210,6 +1218,15 @@
               StscState.get().error("Internal error processing number", XmlErrorContext.MALFORMED_NUMBER, value);
               return null;
           }
  +    }
  +
  +    private static Object getUserData(XmlObject pos)
  +    {
  +        XmlCursor.XmlBookmark b = pos.newCursor().getBookmark(SchemaBookmark.class);
  +        if (b != null && b instanceof SchemaBookmark)
  +            return ((SchemaBookmark) b).getValue();
  +        else
  +            return null;
       }
   
       private static boolean isReservedTypeName(QName name)
  
  
  
  1.4       +6 -0      xml-xmlbeans/v2/src/xmlpublic/org/apache/xmlbeans/SchemaAttributeGroup.java
  
  Index: SchemaAttributeGroup.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/xmlpublic/org/apache/xmlbeans/SchemaAttributeGroup.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SchemaAttributeGroup.java	12 Feb 2004 20:06:27 -0000	1.3
  +++ SchemaAttributeGroup.java	16 Jul 2004 00:21:12 -0000	1.4
  @@ -61,4 +61,10 @@
           public final SchemaAttributeGroup get()
               { return (SchemaAttributeGroup)getComponent(); }
       }
  +
  +    /**
  +     * Returns user-specific information.
  +     * @see SchemaBookmark
  +     */
  +    Object getUserData();
   }
  
  
  
  1.3       +6 -0      xml-xmlbeans/v2/src/xmlpublic/org/apache/xmlbeans/SchemaField.java
  
  Index: SchemaField.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/xmlpublic/org/apache/xmlbeans/SchemaField.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SchemaField.java	12 Feb 2004 20:06:27 -0000	1.2
  +++ SchemaField.java	16 Jul 2004 00:21:12 -0000	1.3
  @@ -80,4 +80,10 @@
        * True if the value is fixed.
        */
       boolean isFixed();
  +
  +    /**
  +     * Returns user-specific information.
  +     * @see SchemaBookmark
  +     */
  +    Object getUserData();
   }
  
  
  
  1.4       +6 -0      xml-xmlbeans/v2/src/xmlpublic/org/apache/xmlbeans/SchemaIdentityConstraint.java
  
  Index: SchemaIdentityConstraint.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/xmlpublic/org/apache/xmlbeans/SchemaIdentityConstraint.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SchemaIdentityConstraint.java	12 Feb 2004 20:06:27 -0000	1.3
  +++ SchemaIdentityConstraint.java	16 Jul 2004 00:21:12 -0000	1.4
  @@ -88,4 +88,10 @@
           public final SchemaIdentityConstraint get()
               { return (SchemaIdentityConstraint)getComponent(); }
       }
  +
  +    /**
  +     * Returns user-specific information.
  +     * @see SchemaBookmark
  +     */
  +    Object getUserData();
   }
  
  
  
  1.4       +6 -0      xml-xmlbeans/v2/src/xmlpublic/org/apache/xmlbeans/SchemaModelGroup.java
  
  Index: SchemaModelGroup.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/xmlpublic/org/apache/xmlbeans/SchemaModelGroup.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SchemaModelGroup.java	12 Feb 2004 20:06:27 -0000	1.3
  +++ SchemaModelGroup.java	16 Jul 2004 00:21:12 -0000	1.4
  @@ -59,4 +59,10 @@
           public final SchemaModelGroup get()
               { return (SchemaModelGroup)getComponent(); }
       }
  +
  +    /**
  +     * Returns user-specific information.
  +     * @see SchemaBookmark
  +     */
  +    Object getUserData();
   }
  
  
  
  1.6       +6 -0      xml-xmlbeans/v2/src/xmlpublic/org/apache/xmlbeans/SchemaType.java
  
  Index: SchemaType.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/xmlpublic/org/apache/xmlbeans/SchemaType.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SchemaType.java	23 Mar 2004 02:42:45 -0000	1.5
  +++ SchemaType.java	16 Jul 2004 00:21:12 -0000	1.6
  @@ -225,6 +225,12 @@
       public abstract Class getEnumJavaClass();
   
       /**
  +     * Returns user-specific information.
  +     * @see SchemaBookmark
  +     */
  +    public Object getUserData();
  +
  +    /**
        * True if the Xsd type is anonymous (i.e., not top-level).
        */
       public abstract boolean isAnonymousType();
  
  
  
  1.1                  xml-xmlbeans/v2/src/xmlpublic/org/apache/xmlbeans/SchemaBookmark.java
  
  Index: SchemaBookmark.java
  ===================================================================
  /*   Copyright 2004 The Apache Software Foundation
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *  limitations under the License.
   */
  
  package org.apache.xmlbeans;
  
  /**
   * Represents a Schema bookmark. The XMLSchema compiler will copy the value
   * returned by {@link #getValue} when this bookmark is found in the XMLStore
   * to the corresponding Schema* objects, and the value will be accessible using
   * the <code>getUserInfo</code> method on these objects.
   *
   * @see SchemaType
   * @see SchemaField
   * @see SchemaAttributeGroup
   * @see SchemaModelGroup
   * @see SchemaIdentityConstraint
   */
  public class SchemaBookmark extends XmlCursor.XmlBookmark
  {
      private Object _value;
  
      public SchemaBookmark(Object value)
      {   _value = value; }
  
      /**
       * Getter. Called during the Schema compilation process.
       */
      public Object getValue()
      {   return _value; }
  }
  
  
  
  1.6       +4 -1      xml-xmlbeans/v2/src/xmlstore/org/apache/xmlbeans/impl/store/Splay.java
  
  Index: Splay.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/xmlstore/org/apache/xmlbeans/impl/store/Splay.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Splay.java	27 May 2004 23:36:20 -0000	1.5
  +++ Splay.java	16 Jul 2004 00:21:13 -0000	1.6
  @@ -2314,7 +2314,10 @@
           if (getXsiNil( r ) == nil)
               return;
   
  -        setAttr( r, _xsiNil, "true" );
  +        if (nil)
  +            setAttr( r, _xsiNil, "true" );
  +        else
  +            removeAttr( r,_xsiNil );
       }
   
       boolean getXsiNil ( Root r )
  
  
  
  1.2       +2 -2      xml-xmlbeans/v2/test/cases/xbean/compile/scomp/j2ee/application-client_1_4.xsd
  
  Index: application-client_1_4.xsd
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/test/cases/xbean/compile/scomp/j2ee/application-client_1_4.xsd,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- application-client_1_4.xsd	8 Jun 2004 19:37:55 -0000	1.1
  +++ application-client_1_4.xsd	16 Jul 2004 00:21:14 -0000	1.2
  @@ -49,7 +49,7 @@
   
   <xsd:annotation>
   <xsd:documentation>
  -
  +<![CDATA[
   This is the XML Schema for the application client 1.4
   deployment descriptor.  All application client deployment
   descriptors must indicate the application client
  @@ -68,7 +68,7 @@
   
       ...
       </application-client>
  -
  +]]>
   The instance documents may indicate the published version of
   the schema using the xsi:schemaLocation attribute for J2EE
   namespace with the following location:
  
  
  
  1.2       +2 -2      xml-xmlbeans/v2/test/cases/xbean/compile/scomp/j2ee/application_1_4.xsd
  
  Index: application_1_4.xsd
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/test/cases/xbean/compile/scomp/j2ee/application_1_4.xsd,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- application_1_4.xsd	8 Jun 2004 19:37:55 -0000	1.1
  +++ application_1_4.xsd	16 Jul 2004 00:21:14 -0000	1.2
  @@ -49,7 +49,7 @@
   
   <xsd:annotation>
   <xsd:documentation>
  -
  +<![CDATA[
   This is the XML Schema for the application 1.4 deployment
   descriptor.  All application deployment descriptors must
   indicate that the schema by using the J2EE namespace
  @@ -73,7 +73,7 @@
   namespace with the following location:
   
   http://java.sun.com/xml/ns/j2ee/application_1_4.xsd
  -
  +]]>
   </xsd:documentation>
   </xsd:annotation>
   
  
  
  
  1.2       +2 -2      xml-xmlbeans/v2/test/cases/xbean/compile/scomp/j2ee/connector_1_5.xsd
  
  Index: connector_1_5.xsd
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/test/cases/xbean/compile/scomp/j2ee/connector_1_5.xsd,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- connector_1_5.xsd	8 Jun 2004 19:37:55 -0000	1.1
  +++ connector_1_5.xsd	16 Jul 2004 00:21:14 -0000	1.2
  @@ -49,7 +49,7 @@
   
   <xsd:annotation>
   <xsd:documentation>
  -
  +<![CDATA[
   This is the XML Schema for the Connector 1.5 deployment
   descriptor.  All Connector deployment descriptors must
   indicate the connector resource adapter schema by using the
  @@ -73,7 +73,7 @@
   namespace with the following location:
   
   http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd
  -
  +]]>
   </xsd:documentation>
   </xsd:annotation>
   
  
  
  
  1.2       +2 -2      xml-xmlbeans/v2/test/cases/xbean/compile/scomp/j2ee/web-app_2_4.xsd
  
  Index: web-app_2_4.xsd
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/test/cases/xbean/compile/scomp/j2ee/web-app_2_4.xsd,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- web-app_2_4.xsd	8 Jun 2004 19:37:55 -0000	1.1
  +++ web-app_2_4.xsd	16 Jul 2004 00:21:14 -0000	1.2
  @@ -49,7 +49,7 @@
   
   <xsd:annotation>
   <xsd:documentation>
  -
  +<![CDATA[
   This is the XML Schema for the Servlet 2.4 deployment
   descriptor.  All Servlet deployment descriptors must
   indicate the web application schema by using the J2EE
  @@ -72,7 +72,7 @@
   namespace with the following location:
   
   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
  -
  +]]>
   </xsd:documentation>
   </xsd:annotation>
   
  
  
  
  1.3       +54 -3     xml-xmlbeans/v2/test/src/compile/scomp/detailed/CompilationTests.java
  
  Index: CompilationTests.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/test/src/compile/scomp/detailed/CompilationTests.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CompilationTests.java	17 Jun 2004 16:29:37 -0000	1.2
  +++ CompilationTests.java	16 Jul 2004 00:21:14 -0000	1.3
  @@ -19,11 +19,17 @@
   import junit.framework.Assert;
   import junit.framework.Test;
   import junit.framework.TestSuite;
  +import org.apache.xmlbeans.impl.common.QNameHelper;
   import org.apache.xmlbeans.impl.tool.SchemaCompiler;
   import org.apache.xmlbeans.impl.tool.CodeGenUtil;
   import org.w3.x2001.xmlSchema.SchemaDocument;
  +import org.w3.x2001.xmlSchema.TopLevelComplexType;
  +import org.apache.xmlbeans.SchemaBookmark;
  +import org.apache.xmlbeans.SchemaType;
  +import org.apache.xmlbeans.SchemaTypeSystem;
   import org.apache.xmlbeans.XmlBeans;
   import org.apache.xmlbeans.XmlObject;
  +import org.apache.xmlbeans.XmlError;
   import org.apache.xmlbeans.XmlException;
   
   import java.io.File;
  @@ -31,6 +37,7 @@
   import java.util.ArrayList;
   import java.util.List;
   import java.util.Arrays;
  +import java.util.Collections;
   
   import tools.util.TestRunUtil;
   
  @@ -62,12 +69,56 @@
           params.setSrcDir(srcdir);
           params.setClassesDir(classesdir);
           params.setOutputJar(outputjar);
  -        Assert.assertTrue("Build failed", SchemaCompiler.compile(params));
  -        Assert.assertTrue("Cannout find " + outputjar, outputjar.exists());
  +        params.setMdefNamespaces(Collections.singleton("http://java.sun.com/xml/ns/j2ee"));
  +        List errors = new ArrayList();
  +        params.setErrorListener(errors);
  +        boolean result = SchemaCompiler.compile(params);
  +        if (!result)
  +        {
  +            // Display the errors
  +            for (int i = 0; i < errors.size(); i++)
  +            {
  +                XmlError error = (XmlError) errors.get(i);
  +                if (error.getSeverity() == XmlError.SEVERITY_ERROR)
  +                    System.out.println(error.toString());
  +            }
  +        }
  +        Assert.assertTrue("Build failed", result);
  +        Assert.assertTrue("Cannot find " + outputjar, outputjar.exists());
       }
   
   
  -   
  +    public void testSchemaBookmarks() throws Throwable
  +    {
  +        File srcSchema = xbeanCase("simple/person.xsd");
  +        // Parse
  +        SchemaDocument.Schema parsed = SchemaDocument.Factory.parse(srcSchema).getSchema();
  +        // Navigate to the type definition
  +        TopLevelComplexType[] cTypes = parsed.getComplexTypeArray();
  +        boolean found = false;
  +        int i;
  +        for (i = 0; i < cTypes.length; i++)
  +            if ("person".equals(cTypes[i].getName()))
  +            {
  +                found = true;
  +                break;
  +            }
  +        Assert.assertTrue("Could not find the \"person\" complex type", found);
  +        // Set the bookmark
  +        SchemaBookmark sb = new SchemaBookmark("MyBookmark");
  +        cTypes[i].newCursor().setBookmark(sb);
  +        // Compile it into STS
  +        SchemaTypeSystem sts = XmlBeans.compileXsd(new XmlObject[]{parsed},
  +            XmlBeans.getBuiltinTypeSystem(), null);
  +        Assert.assertNotNull("Could not compile person.xsd", sts);
  +        SchemaType personType = sts.findType(QNameHelper.forLNS("person", "http://openuri.org/mytest"));
  +        Assert.assertNotNull("Could not find the \"person\" schema type", personType);
  +        // Check that the bookmark made it through
  +        Object val = personType.getUserData();
  +        Assert.assertNotNull("Schema user data not found!", val);
  +        Assert.assertEquals("MyBookmark", val);
  +    }
  +
   
       public void __testSimple() throws Throwable
       {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-cvs-help@xml.apache.org