You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by pc...@apache.org on 2004/01/28 22:54:43 UTC

cvs commit: xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/internal BaseJElement.java

pcal        2004/01/28 13:54:43

  Modified:    v2/src/binding/org/apache/xmlbeans/impl/binding/compile
                        Java2Schema.java
               v2/src/jam/org/apache/xmlbeans/impl/jam/internal
                        BaseJElement.java
  Log:
  hack in quick support for external annotations in Java2Schema
  
  Revision  Changes    Path
  1.28      +21 -0     xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/compile/Java2Schema.java
  
  Index: Java2Schema.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/compile/Java2Schema.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- Java2Schema.java	28 Jan 2004 00:57:52 -0000	1.27
  +++ Java2Schema.java	28 Jan 2004 21:54:42 -0000	1.28
  @@ -58,6 +58,7 @@
   import org.apache.xmlbeans.impl.binding.bts.*;
   import org.apache.xmlbeans.impl.binding.tylar.TylarWriter;
   import org.apache.xmlbeans.impl.jam.*;
  +import org.apache.xmlbeans.impl.jam.internal.BaseJElement;
   import org.w3.x2001.xmlSchema.*;
   import javax.xml.namespace.QName;
   import java.util.ArrayList;
  @@ -105,6 +106,7 @@
     private SchemaDocument mSchemaDocument; // schema doc we're generating
     private SchemaDocument.Schema mSchema;
     private JClass[] mClasses; // the input classes
  +  private JAnnotationLoader mAnnotationLoader = null;
   
     // =========================================================================
     // Constructors
  @@ -114,6 +116,25 @@
         throw new IllegalArgumentException("null classes");
       }
       mClasses = classesToBind;
  +  }
  +
  +  // ========================================================================
  +  // Public methods
  +
  +  /**
  +   * Sets the JAnnotionLoader to be used to 'overlay' external annotations
  +   * onto the input JClass set.
  +   */
  +  public void setAnnotationLoader(JAnnotationLoader jal) {
  +    if (mAnnotationLoader == null) throw new IllegalArgumentException("null jal");
  +    mAnnotationLoader = jal;
  +    //FIXME this is a gross quick hack to get the external annotations
  +    //working.  long term, we need to extend jam to allow a jam facade to be
  +    //created that imposes the annotations without actually modifying the
  +    //input JClasses like we do here.
  +    for(int i=0; i<mClasses.length; i++) {
  +      ((BaseJElement)mClasses[i]).setAnnotationLoader(mAnnotationLoader);
  +    }
     }
   
     // ========================================================================
  
  
  
  1.5       +15 -1     xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/internal/BaseJElement.java
  
  Index: BaseJElement.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/internal/BaseJElement.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- BaseJElement.java	21 Jan 2004 01:27:36 -0000	1.4
  +++ BaseJElement.java	28 Jan 2004 21:54:42 -0000	1.5
  @@ -93,6 +93,10 @@
     private JComment[] mComments = null;
     private List mTempList = null;
   
  +  //FIXME this is a really gross quick hack to get this stuff working.
  +  //we should be getting this from our classloader.
  +  private JAnnotationLoader mExternalAnnotations = null;
  +
     // ========================================================================
     // Constructors
   
  @@ -111,6 +115,13 @@
       */
     }
   
  +  /**
  +   * @deprecated this is a quick hack, please remove
  +   */
  +  public void setAnnotationLoader(JAnnotationLoader l) {
  +    mExternalAnnotations = l;
  +  }
  +
     // ========================================================================
     // JAnnotation implementation
   
  @@ -124,8 +135,11 @@
      * @return
      */
     public /*final*/ JAnnotation[] getAnnotations() {
  -    if (mAnns == null) {
  +    if (true || mAnns == null) { //FIXME always do this until we fixing JAnnotationLoader thing
         List list = getTempList();
  +      if (mExternalAnnotations != null) {
  +        mExternalAnnotations.getAnnotations(this,list);
  +      }
         getLocalAnnotations(list);
         if (list.size() == 0) {
           mAnns = NO_ANNOTATION;
  
  
  

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