xml-xmlbeans-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject cvs commit: xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/compile Java2Schema.java
Date Wed, 17 Mar 2004 02:25:54 GMT
pcal        2004/03/16 18:25:54

  Modified:    v2/jam   build.xml
               v2/jam/src/org/apache/xmlbeans/impl/jam JAnnotation.java
                        JamServiceFactory.java JamServiceParams.java
               v2/jam/src/org/apache/xmlbeans/impl/jam/internal
                        DirectoryScanner.java JamServiceContextImpl.java
               v2/jam/src/org/apache/xmlbeans/impl/jam/internal/elements
                        AnnotatedElementImpl.java AnnotationImpl.java
                        ClassImpl.java
               v2/jam/src/org/apache/xmlbeans/impl/jam/internal/javadoc
                        JavadocClassBuilder.java
               v2/jam/src/org/apache/xmlbeans/impl/jam/mutable
                        MAnnotation.java
               v2/jam/src/org/apache/xmlbeans/impl/jam/provider
                        JamLogger.java JamServiceFactoryImpl.java
               v2/jam/test/tests/org/apache/xmlbeans/test/jam
                        ClassesJamTest.java ParserJamTest.java
                        SourcesJamTest.java
               v2/src/binding/org/apache/xmlbeans/impl/binding/compile
                        Java2Schema.java
  Log:
  new jam updates, some j2s work for issetters
  
  Revision  Changes    Path
  1.14      +7 -2      xml-xmlbeans/v2/jam/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/build.xml,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- build.xml	16 Mar 2004 06:40:44 -0000	1.13
  +++ build.xml	17 Mar 2004 02:25:53 -0000	1.14
  @@ -52,7 +52,7 @@
       -->
     </target>
   
  -  <target name='compile' depends='parser'>
  +  <target name='compile' depends='parser,unpack_java15jar'>
   
       <mkdir dir='${classes_dir}'/>
   
  @@ -68,7 +68,6 @@
         </classpath>
       </javac>
   
  -    <unjar src='${java15_jar}' dest='${classes_dir}'/>
   
     </target>
   
  @@ -129,6 +128,11 @@
       <jar jarfile='${java15_jar}' basedir='${java15_builddir}' update='false'/>
     </target>
   
  +  <target name='unpack_java15jar' unless='skip_java15jar'>
  +    <mkdir dir='${classes_dir}'/>
  +    <unjar src='${java15_jar}' dest='${classes_dir}'/>
  +  </target>
  +
   
     <target name='repackage' depends='clean,repackage_check,repackage_do'/>
   
  @@ -165,6 +169,7 @@
   
       <ant dir='.' target='website' inheritAll='false' >
         <property name='src_dir' value='${repackaged_src}'/>
  +      <property name='skip_java15jar' value='true'/>
       </ant>
     </target>
     
  
  
  
  1.5       +17 -7     xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/JAnnotation.java
  
  Index: JAnnotation.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/JAnnotation.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JAnnotation.java	10 Mar 2004 11:42:07 -0000	1.4
  +++ JAnnotation.java	17 Mar 2004 02:25:53 -0000	1.5
  @@ -73,15 +73,25 @@
     //public String getJavadocTagText();
   
     /**
  -   * <p>Use of this method is *strongly* discouraged.</p>
  -   *
      * <p>If this JAnnotation corresponds to metadata that is stored in
  -   * an instance of java.lang.annotation.Annotation, that object is returned.
  -   * This is done on a strictly best-effort basis.  Null is returned if
  -   * no such annotation exists or if the JAM implementation is unable
  -   * to support the request.</p>
  +   * a JSR175 annotation (i.e. an instance of java.lang.annotation.Annotation),
  +   * returns that annotation object.  Returns null if the annotation does
  +   * not exist or is otherwise unavailable.</p>
  +   *
  +   * <p>Note that this is done only on a best-effort basis - the annotation
  +   * object not be availble under pre-1.5 JREs and will generally only be
  +   * available if the underlying annotation was read from a class file.  Note
  +   * that the retention policy of the annotation type usually must also be
  +   * RUNTIME.  Unless you are sure of all of these things, you are better
  +   * off using an AnnotationProxy or the untyped value accessors
  +   * (e.g. getValues()).</p>
  +   *
  +   * <p>If this method does return something other than null, it is guaranteed
  +   * to be an instance of <code>java.lang.annotation.Annotation</code>.  It
  +   * is typed as <code>Object</code> simply to preserve API compatibility
  +   * with Java 1.4.</p.
      */
  -  //public Object getAnnotationInstance();
  +  public Object getAnnotationInstance();
   
   
   }
  
  
  
  1.4       +1 -1      xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/JamServiceFactory.java
  
  Index: JamServiceFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/JamServiceFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JamServiceFactory.java	16 Mar 2004 21:55:31 -0000	1.3
  +++ JamServiceFactory.java	17 Mar 2004 02:25:53 -0000	1.4
  @@ -92,7 +92,7 @@
       try {
         JamServiceParams sp = getInstance().createServiceParams();
         for(int i=0; i<args.length; i++) {
  -        sp.includeSourceFiles(new File[] {new File(".")},args[i]);
  +        sp.includeSourcePattern(new File[] {new File(".")},args[i]);
         }
         JamService service = getInstance().createService(sp);
         JamPrinter jp = JamPrinter.newInstance();
  
  
  
  1.5       +13 -5     xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/JamServiceParams.java
  
  Index: JamServiceParams.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/JamServiceParams.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JamServiceParams.java	16 Mar 2004 21:55:31 -0000	1.4
  +++ JamServiceParams.java	17 Mar 2004 02:25:53 -0000	1.5
  @@ -32,6 +32,14 @@
     // Public methods
   
     /**
  +   * <p>Include a single java source file to be viewed.  Note that if your
  +   * code is able to understand the file/package structure in which the
  +   * source exists, you may get better performance by using the various
  +   * include... methods which take a sourcepath parameter.</p>
  +   */
  +  public void includeSourceFile(File file);
  +
  +  /**
      * Specifies a set of java source files to be included in the JamService.
      *
      * <p>Note that calling this method implicitly includes the 'root' in
  @@ -42,7 +50,7 @@
      * 'Include and Exclude Patterns').
      * @throws IllegalArgumentException if either argument is null.
      */
  -  public void includeSourceFiles(File[] sourcepath, String pattern);
  +  public void includeSourcePattern(File[] sourcepath, String pattern);
   
     /**
      * Specifies a set of java source files to be excluded in the JamService.
  @@ -54,7 +62,7 @@
      * 'Include and Exclude Patterns').
      * @throws IllegalArgumentException if either argument is null.
      */
  -  public void excludeSourceFiles(File[] sourcepath, String pattern);
  +  public void excludeSourcePattern(File[] sourcepath, String pattern);
   
     /**
      * Specifies a set of java class files to be excluded in the JamService.
  @@ -66,7 +74,7 @@
      * 'Include and Exclude Patterns').
      * @throws IllegalArgumentException if either argument is null.
      */
  -  public void includeClassFiles(File[] classpath, String pattern);
  +  public void includeClassPattern(File[] classpath, String pattern);
   
     /**
      * Specifies a set of java class files to be excluded from the JamService.
  @@ -78,7 +86,7 @@
      * 'Include and Exclude Patterns').
      * @throws IllegalArgumentException if either argument is null.
      */
  -  public void excludeClassFiles(File[] classpath, String pattern);
  +  public void excludeClassPattern(File[] classpath, String pattern);
   
     /**
      * <p>Includes a single source File in the JamService.  The sourcepath parameter
  @@ -182,7 +190,7 @@
      * @param out a PrintWriter to write to
      * @throws IllegalArgumentException if the argument is null
      */
  -  public void setLogger(PrintWriter out);
  +//  public void setLogger(PrintWriter out);
   
     /**
      * Sets whether the JamService should send verbose output to the logger.
  
  
  
  1.5       +5 -2      xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/DirectoryScanner.java
  
  Index: DirectoryScanner.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/DirectoryScanner.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DirectoryScanner.java	16 Mar 2004 21:55:31 -0000	1.4
  +++ DirectoryScanner.java	17 Mar 2004 02:25:53 -0000	1.5
  @@ -264,6 +264,9 @@
         if (file.isDirectory()) {
           if (isIncluded(name) && !isExcluded(name)) {
             mDirsIncluded.addElement(name);
  +          if (mLogger.isVerbose()) {
  +            mLogger.verbose("[DirectoryScanner] ...including dir "+name);
  +          }
             scandir(file, name + File.separator, fast);
           } else {
             if (couldHoldIncluded(name)) {
  @@ -275,11 +278,11 @@
             if (!isExcluded(name)) {
               mFilesIncluded.addElement(name);
               if (mLogger.isVerbose()) {
  -              mLogger.verbose("[DirectoryScanner] including "+name+" under '"+dir);
  +              mLogger.verbose("[DirectoryScanner] ...including "+name+" under '"+dir);
               }
             } else {
               if (mLogger.isVerbose()) {
  -              mLogger.verbose("[DirectoryScanner] EXCLUDING "+name+" under '"+dir);
  +              mLogger.verbose("[DirectoryScanner] ...EXCLUDING "+name+" under '"+dir);
               }
             }
           }
  
  
  
  1.7       +83 -21    xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/JamServiceContextImpl.java
  
  Index: JamServiceContextImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/JamServiceContextImpl.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JamServiceContextImpl.java	16 Mar 2004 21:55:31 -0000	1.6
  +++ JamServiceContextImpl.java	17 Mar 2004 02:25:53 -0000	1.7
  @@ -60,12 +60,13 @@
     private List mIncludeClasses = null;
     private List mExcludeClasses = null;
   
  -  private PrintWriter mOut = new PrintWriter(System.out);
  +  private PrintWriter mOut = new PrintWriter(System.out,true);
     private boolean mUseSystemClasspath = true;
     private boolean mVerbose = false;
     private MVisitor mCommentInitializer = null;
     private MVisitor mPropertyInitializer = null;
     private List mOtherInitializers = null;
  +  private List mUnstructuredSourceFiles = null;
   
     private JamClassLoader mLoader = null;
   
  @@ -121,20 +122,39 @@
     }*/
   
     public File[] getSourceFiles() throws IOException {
  -    if (mSourceRoot2Scanner == null) return new File[0];
  +
       Set set = new HashSet();
  -    for(Iterator i = mSourceRoot2Scanner.values().iterator(); i.hasNext(); ) {
  -      DirectoryScanner ds = (DirectoryScanner)i.next();
  -      String[] files = ds.getIncludedFiles();
  -      for(int j=0; j<files.length; j++) {
  -        set.add(new File(ds.getRoot(),files[j]));
  +    if (mSourceRoot2Scanner != null) {
  +      for(Iterator i = mSourceRoot2Scanner.values().iterator(); i.hasNext(); ) {
  +        DirectoryScanner ds = (DirectoryScanner)i.next();
  +        if (mVerbose) verbose(PREFIX+ " checking scanner for dir"+ds.getRoot());
  +        String[] files = ds.getIncludedFiles();
  +        for(int j=0; j<files.length; j++) {
  +          if (mVerbose) verbose(PREFIX+ " ...including a source file "+files[j]);
  +          set.add(new File(ds.getRoot(),files[j]));
  +        }
         }
       }
  +    // also dump unstructured files in there as well.  javadoc doesn't
  +    // know the difference, but eventually we're going to care
  +    // when we introduce lazy parsing
  +    if (mUnstructuredSourceFiles != null) {
  +      if (mVerbose) verbose(PREFIX+ "adding "+mUnstructuredSourceFiles.size()+
  +                            " other source files");
  +      set.addAll(mUnstructuredSourceFiles);
  +    }
       File[] out = new File[set.size()];
       set.toArray(out);
       return out;
     }
   
  +  public File[] getUnstructuredSourceFiles() {
  +    if (mUnstructuredSourceFiles == null) return null;
  +    File[] out = new File[mUnstructuredSourceFiles.size()];
  +    mUnstructuredSourceFiles.toArray(out);
  +    return out;
  +  }
  +
   
     public ResourcePath getInputClasspath() {
       return createJPath(mClasspath);
  @@ -213,7 +233,6 @@
     // JamServiceParams implementation
   
   
  -
     //DOCME
     public void setCommentInitializer(MVisitor initializer) {
       mCommentInitializer = initializer;
  @@ -231,41 +250,62 @@
     }
   
   
  -  public void includeSourceFiles(File[] sourcepath, String pattern) {
  +  public void includeSourceFile(File file) {
  +    if (file == null) throw new IllegalArgumentException("null file");
  +    if (mVerbose) verbose(PREFIX+ "adding source "+file.getAbsoluteFile());
  +    if (mUnstructuredSourceFiles == null) {
  +      mUnstructuredSourceFiles = new ArrayList();
  +    }
  +    mUnstructuredSourceFiles.add(file.getAbsoluteFile());
  +  }
  +
  +  public void includeSourcePattern(File[] sourcepath, String pattern) {
       if (sourcepath == null) throw new IllegalArgumentException("null sourcepath");
       if (sourcepath.length == 0) throw new IllegalArgumentException("empty sourcepath");
       if (pattern == null) throw new IllegalArgumentException("null pattern");
  +    pattern = pattern.trim();
  +    if (pattern.length() == 0) throw new IllegalArgumentException("empty pattern");
       for(int i=0; i<sourcepath.length; i++) {
  +      if (mVerbose) verbose(PREFIX+ "including '"+pattern+"' under "+sourcepath[i]);
         addSourcepath(sourcepath[i]);
         getSourceScanner(sourcepath[i]).include(pattern);
       }
     }
   
  -  public void includeClassFiles(File classpath[], String pattern) {
  +  public void includeClassPattern(File classpath[], String pattern) {
       if (classpath == null) throw new IllegalArgumentException("null classpath");
       if (classpath.length == 0) throw new IllegalArgumentException("empty classpath");
       if (pattern == null) throw new IllegalArgumentException("null pattern");
  +    pattern = pattern.trim();
  +    if (pattern.length() == 0) throw new IllegalArgumentException("empty pattern");
       for(int i=0; i<classpath.length; i++) {
  +      if (mVerbose) verbose(PREFIX+ "including '"+pattern+"' under "+classpath[i]);
         addClasspath(classpath[i]);
         getClassScanner(classpath[i]).include(pattern);
       }
     }
   
  -  public void excludeSourceFiles(File[] sourcepath, String pattern) {
  +  public void excludeSourcePattern(File[] sourcepath, String pattern) {
       if (sourcepath == null) throw new IllegalArgumentException("null sourcepath");
       if (sourcepath.length == 0) throw new IllegalArgumentException("empty sourcepath");
       if (pattern == null) throw new IllegalArgumentException("null pattern");
  +    pattern = pattern.trim();
  +    if (pattern.length() == 0) throw new IllegalArgumentException("empty pattern");
       for(int i=0; i<sourcepath.length; i++) {
  +      if (mVerbose) verbose(PREFIX+ "EXCLUDING '"+pattern+"' under "+sourcepath[i]);
         addSourcepath(sourcepath[i]);
         getSourceScanner(sourcepath[i]).exclude(pattern);
       }
     }
   
  -  public void excludeClassFiles(File[] classpath, String pattern) {
  +  public void excludeClassPattern(File[] classpath, String pattern) {
       if (classpath == null) throw new IllegalArgumentException("null classpath");
       if (classpath.length == 0) throw new IllegalArgumentException("empty classpath");
       if (pattern == null) throw new IllegalArgumentException("null pattern");
  +    pattern = pattern.trim();
  +    if (pattern.length() == 0) throw new IllegalArgumentException("empty pattern");
       for(int i=0; i<classpath.length; i++) {
  +      if (mVerbose) verbose(PREFIX+ "EXCLUDING '"+pattern+"' under "+classpath[i]);
         addClasspath(classpath[i]);
         getClassScanner(classpath[i]).exclude(pattern);
       }
  @@ -273,22 +313,22 @@
   
     public void includeSourceFile(File[] sourcepath, File sourceFile) {
       File root = getPathRootForFile(sourcepath,sourceFile);
  -    includeSourceFiles(new File[] {root}, source2pattern(root,sourceFile));
  +    includeSourcePattern(new File[] {root}, source2pattern(root,sourceFile));
     }
   
     public void excludeSourceFile(File[] sourcepath, File sourceFile) {
       File root = getPathRootForFile(sourcepath,sourceFile);
  -    excludeSourceFiles(new File[] {root}, source2pattern(root,sourceFile));
  +    excludeSourcePattern(new File[] {root}, source2pattern(root,sourceFile));
     }
   
     public void includeClassFile(File[] classpath, File classFile) {
       File root = getPathRootForFile(classpath,classFile);
  -    includeClassFiles(new File[] {root}, source2pattern(root,classFile));
  +    includeClassPattern(new File[] {root}, source2pattern(root,classFile));
     }
   
     public void excludeClassFile(File[] classpath, File classFile) {
       File root = getPathRootForFile(classpath,classFile);
  -    excludeClassFiles(new File[] {root}, source2pattern(root,classFile));
  +    excludeClassPattern(new File[] {root}, source2pattern(root,classFile));
     }
   
     public void includeClass(String qualifiedClassname) {
  @@ -333,7 +373,7 @@
       mProperties.setProperty(name,value);
     }
   
  -  public void setLogger(PrintWriter out) { mOut = out; }
  +  //public void setLogger(PrintWriter out) { mOut = out; }
   
     public void setVerbose(boolean v) {
       mVerbose = v;
  @@ -448,19 +488,37 @@
     // ========================================================================
     // Private methods
   
  +  private static final String PREFIX = "[JamServiceContextImpl] ";
  +
     private File getPathRootForFile(File[] sourcepath, File sourceFile) {
       if (sourcepath == null) throw new IllegalArgumentException("null sourcepath");
       if (sourcepath.length == 0) throw new IllegalArgumentException("empty sourcepath");
       if (sourceFile == null) throw new IllegalArgumentException("null sourceFile");
  -    String f = sourceFile.getAbsolutePath();
  +    sourceFile = sourceFile.getAbsoluteFile();
  +    if (mVerbose) verbose(PREFIX+"Getting root for "+sourceFile+"...");
       for(int i=0; i<sourcepath.length; i++) {
  -      if (f.startsWith(sourcepath[i].getAbsolutePath())) {//cheesy?
  -        return sourcepath[i];
  +      if (mVerbose) verbose(PREFIX+"...looking in "+sourcepath[i]);
  +      if (isContainingDir(sourcepath[i],sourceFile)) {
  +        if (mVerbose) verbose(PREFIX+"...found it!");
  +        return sourcepath[i].getAbsoluteFile();
         }
       }
       throw new IllegalArgumentException(sourceFile+" is not in the given path.");
     }
   
  +  /**
  +   * Returns true if the given dir contains the given file.
  +   */
  +  private boolean isContainingDir(File dir, File file) {
  +    if (mVerbose) verbose(PREFIX+ "... ...isContainingDir "+dir+"  "+file);
  +    if (file == null) return false;
  +    if (dir.equals(file)) {
  +      if (mVerbose) verbose(PREFIX+ "... ...yes!");
  +      return true;
  +    }
  +    return isContainingDir(dir,file.getParentFile());
  +  }
  +
   
     private AnnotationProxy createProxy(Class clazz) {
       if (clazz == null) clazz = mDefaultAnnotationProxyClass;
  @@ -490,10 +548,14 @@
      * given root.
      */
     private String source2pattern(File root, File sourceFile) {
  +    if (mVerbose) verbose(PREFIX+ "source2pattern "+root+"  "+sourceFile);
       //REVIEW this is a bit cheesy
       String r = root.getAbsolutePath();
       String s = sourceFile.getAbsolutePath();
  -    return s.substring(r.length());
  +    if (mVerbose) {
  +      verbose(PREFIX+ "source2pattern returning "+s.substring(r.length()+1));
  +    }
  +    return s.substring(r.length()+1);
     }
   
     /**
  
  
  
  1.7       +4 -1      xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/elements/AnnotatedElementImpl.java
  
  Index: AnnotatedElementImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/elements/AnnotatedElementImpl.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AnnotatedElementImpl.java	16 Mar 2004 05:34:49 -0000	1.6
  +++ AnnotatedElementImpl.java	17 Mar 2004 02:25:53 -0000	1.7
  @@ -55,7 +55,8 @@
       if (mName2Annotation == null) return null;
       int delim = valueName.indexOf('@');
       if (delim == -1) {
  -      throw new IllegalArgumentException("invalid value identifier '"+valueName);
  +      throw new IllegalArgumentException("value identifiers must include an '@'"+
  +                                         valueName);
       }
       JAnnotation out = getAnnotation(valueName.substring(0,delim));
       return out.getValue(valueName.substring(delim+1));
  @@ -134,6 +135,7 @@
       String typename = getAnnotationTypeFor(jsr175annotationInstance);
       MAnnotation ann = getMutableAnnotation(typename);
       if (ann != null) {
  +      ann.setAnnotationInstance(jsr175annotationInstance);
         ann.getMutableProxy().initFromAnnotationInstance(jsr175annotationInstance);
         //REVIEW this is a weird case where they add another instance
         // of the same annotation type.  We'll just go with it for now,
  @@ -143,6 +145,7 @@
           (getAnnotationTypeFor(jsr175annotationInstance));
         proxy.initFromAnnotationInstance(jsr175annotationInstance);
         ann = new AnnotationImpl(getContext(),proxy,typename);
  +      ann.setAnnotationInstance(jsr175annotationInstance);
         setArtifact(jsr175annotationInstance);
         getName2Annotation().put(typename,ann);
       }
  
  
  
  1.6       +12 -0     xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/elements/AnnotationImpl.java
  
  Index: AnnotationImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/elements/AnnotationImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AnnotationImpl.java	11 Mar 2004 23:01:41 -0000	1.5
  +++ AnnotationImpl.java	17 Mar 2004 02:25:53 -0000	1.6
  @@ -31,6 +31,7 @@
     // Variables
   
     private AnnotationProxy mProxy;
  +  private Object mAnnotationInstance = null;
   
     // ========================================================================
     // Constructors
  @@ -56,6 +57,17 @@
   
     public JAnnotationValue getValue(String name) {
       return mProxy.getValue(name);
  +  }
  +
  +  public Object getAnnotationInstance() {
  +    return mAnnotationInstance;
  +  }
  +
  +  // ========================================================================
  +  // MAnnotation implementation
  +
  +  public void setAnnotationInstance(Object o) {
  +    mAnnotationInstance = o;
     }
   
     // ========================================================================
  
  
  
  1.7       +1 -1      xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/elements/ClassImpl.java
  
  Index: ClassImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/elements/ClassImpl.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ClassImpl.java	11 Mar 2004 23:01:41 -0000	1.6
  +++ ClassImpl.java	17 Mar 2004 02:25:53 -0000	1.7
  @@ -317,7 +317,7 @@
     public JProperty addNewProperty(String name, MMethod getter, MMethod setter) {
       if (mProperties == null) mProperties = new ArrayList();
       JProperty out = new PropertyImpl(name,getter,setter,
  -                                     getter.getReturnType().getQualifiedName());
  +                                     getter.getReturnType().getFieldDescriptor());
       mProperties.add(out);
       return out;
     }
  
  
  
  1.10      +50 -6     xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/javadoc/JavadocClassBuilder.java
  
  Index: JavadocClassBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/internal/javadoc/JavadocClassBuilder.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- JavadocClassBuilder.java	16 Mar 2004 21:55:31 -0000	1.9
  +++ JavadocClassBuilder.java	17 Mar 2004 02:25:53 -0000	1.10
  @@ -34,12 +34,15 @@
     // Constants
   
     public static final String ARGS_PROPERTY = "javadoc.args";
  +  public static final String PARSETAGS_PROPERTY = "javadoc.parsetags";
   
     private static boolean VERBOSE = false;
   
     private static final String JAVA15_EXTRACTOR =
       "org.apache.xmlbeans.impl.jam.internal.java15.Javadoc15AnnotationExtractor";
   
  +  private static final String PREFIX = "[JavadocClassBuilder] ";
  +
     // ========================================================================
     // Variables
   
  @@ -47,6 +50,8 @@
     private JamServiceContext mServiceContext;
     private JavadocAnnotationExtractor mExtractor = null;
   
  +  private boolean mParseTags = false;//FIXME
  +
     // ========================================================================
     // Constructors
   
  @@ -62,15 +67,22 @@
         mServiceContext.verbose(e);
       } catch (InstantiationException e) {
         mServiceContext.verbose(e);
  +      //if this fails, we'll assume it's because we're not under 1.5
  +      ctx.verbose(e);
  +    }
  +    String pct = ctx.getProperty(PARSETAGS_PROPERTY);
  +    if (pct != null) {
  +      mParseTags = Boolean.parseBoolean(pct);
  +      ctx.verbose(PREFIX+ "mParseTags="+mParseTags);
       }
     }
   
     // ========================================================================
     // JamClassBuilder implementation
   
  -
     public void init(ElementContext ctx) {
       super.init(ctx);
  +    if (mServiceContext.isVerbose()) mServiceContext.verbose(PREFIX+ " init()");
       File[] files;
       try {
         files = mServiceContext.getSourceFiles();
  @@ -85,10 +97,17 @@
         mServiceContext.getInputSourcepath().toString();
       String classPath = (mServiceContext.getInputClasspath() == null) ? null :
         mServiceContext.getInputClasspath().toString();
  +    if (mServiceContext.isVerbose()) {
  +      mServiceContext.verbose(PREFIX+ "sourcePath="+sourcePath);
  +      mServiceContext.verbose(PREFIX+ "classPath ="+classPath);
  +      for(int i=0; i<files.length; i++) {
  +        mServiceContext.verbose(PREFIX+ "including '"+files[i]+"'");
  +      }
  +    }
       JavadocRunner jdr = new JavadocRunner();
       try {
         PrintWriter out = null;
  -      if (((JamServiceContextImpl)mServiceContext).isVerbose()) {
  +      if (mServiceContext.isVerbose()) {
           out = new PrintWriter(System.out);
         }
         mRootDoc = jdr.run(files,
  @@ -97,7 +116,23 @@
                            classPath,
                            getJavadocArgs(mServiceContext));
         if (mRootDoc == null) {
  -        ctx.verbose("Javadoc returned a null root");//FIXME error
  +        mServiceContext.error("Javadoc returned a null root");//FIXME error
  +      } else {
  +        if (mServiceContext.isVerbose()) {
  +          mServiceContext.verbose(PREFIX+ " received "+mRootDoc.classes().length+
  +                                  " ClassDocs from javadoc: ");
  +        }
  +        ClassDoc[] classes = mRootDoc.classes();
  +        // go through and explicitly add all of the class names.  we need to
  +        // do this in case they passed any 'unstructured' classes.  to the
  +        // params.  this could use a little TLC.
  +        for(int i=0; i<classes.length; i++) {
  +          if (mServiceContext.isVerbose()) {
  +            mServiceContext.verbose(PREFIX+ "..."+classes[i].qualifiedName());
  +          }
  +          ((JamServiceContextImpl)mServiceContext).
  +            includeClass(classes[i].qualifiedName());
  +        }
         }
       } catch (FileNotFoundException e) {
         ctx.error(e);
  @@ -211,6 +246,8 @@
       if (t == null) throw new IllegalArgumentException("null type");
       String dim = t.dimension();
       if (dim == null || dim.length() == 0) {
  +      ClassDoc cd = t.asClassDoc();
  +      if (cd != null) return cd.qualifiedName();
         return t.qualifiedTypeName();
       } else {
         StringWriter out = new StringWriter();
  @@ -221,7 +258,7 @@
           out.write(primFd);
         } else {
           out.write("L");
  -        out.write(t.qualifiedTypeName());
  +        out.write(t.asClassDoc().qualifiedName());
           out.write(";");
         }
         return out.toString();
  @@ -241,8 +278,15 @@
   
   
     private void addAnnotations(MAnnotatedElement dest, ProgramElementDoc src) {
  -    String comments = src.getRawCommentText();
  -    if (comments != null) dest.createComment().setText(comments);
  +    if (mParseTags) {
  +      String comments = src.commentText();
  +      if (comments != null) dest.createComment().setText(comments);
  +      Tag[] t = src.tags();
  +      //FIXME!!!
  +    } else {
  +      String comments = src.getRawCommentText();
  +      if (comments != null) dest.createComment().setText(comments);
  +    }
       if (mExtractor != null) mExtractor.extractAnnotations(dest,src);
     }
   }
  
  
  
  1.3       +5 -0      xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/mutable/MAnnotation.java
  
  Index: MAnnotation.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/mutable/MAnnotation.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MAnnotation.java	11 Mar 2004 23:01:42 -0000	1.2
  +++ MAnnotation.java	17 Mar 2004 02:25:54 -0000	1.3
  @@ -25,6 +25,11 @@
    */
   public interface MAnnotation extends JAnnotation, MElement {
   
  +  // ========================================================================
  +  // MAnnotation implementation
  +
  +  public void setAnnotationInstance(Object o);
  +
     public AnnotationProxy getMutableProxy();
   
   }
  
  
  
  1.3       +5 -0      xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/provider/JamLogger.java
  
  Index: JamLogger.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/provider/JamLogger.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JamLogger.java	16 Mar 2004 21:55:31 -0000	1.2
  +++ JamLogger.java	17 Mar 2004 02:25:54 -0000	1.3
  @@ -46,4 +46,9 @@
      */
     public void error(Throwable t);
   
  +  /**
  +   * <p>Outputs an error as appropriate.</p>
  +   */
  +  public void error(String msg);
  +
   }
  
  
  
  1.5       +9 -1      xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/provider/JamServiceFactoryImpl.java
  
  Index: JamServiceFactoryImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/src/org/apache/xmlbeans/impl/jam/provider/JamServiceFactoryImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JamServiceFactoryImpl.java	16 Mar 2004 21:55:31 -0000	1.4
  +++ JamServiceFactoryImpl.java	17 Mar 2004 02:25:54 -0000	1.5
  @@ -52,6 +52,8 @@
     public static final String USE_NEW_PARSER =
       "JamServiceFactoryImpl.use-new-parser";
   
  +  private static final String PREFIX = "[JamServiceFactoryImpl]";
  +  
     // ========================================================================
     // Constructors
   
  @@ -145,7 +147,13 @@
       throws IOException
     {
       File[] sources = ctx.getSourceFiles();
  -    if (sources == null || sources.length == 0) return null;
  +    if (sources == null || sources.length == 0) {
  +      if (ctx.isVerbose()) {
  +        ctx.verbose(PREFIX+ "no source files present, "+
  +                    "skipping source ClassBuilder");
  +      }
  +      return null;
  +    }
       if(ctx.getProperty(USE_NEW_PARSER) == null) {
         return new JavadocClassBuilder(ctx);
       } else {
  
  
  
  1.8       +1 -1      xml-xmlbeans/v2/jam/test/tests/org/apache/xmlbeans/test/jam/ClassesJamTest.java
  
  Index: ClassesJamTest.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/test/tests/org/apache/xmlbeans/test/jam/ClassesJamTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ClassesJamTest.java	16 Mar 2004 21:55:31 -0000	1.7
  +++ ClassesJamTest.java	17 Mar 2004 02:25:54 -0000	1.8
  @@ -82,7 +82,7 @@
       JamServiceFactory jsf = JamServiceFactory.getInstance();
       JamServiceParams params = jsf.createServiceParams();
   //include
  -    params.includeClassFiles(getDummyclassesClassPath(),"**/*.class");
  +    params.includeClassPattern(getDummyclassesClassPath(),"**/*.class");
       params.setVerbose(true);
       return jsf.createService(params);
     }
  
  
  
  1.5       +1 -1      xml-xmlbeans/v2/jam/test/tests/org/apache/xmlbeans/test/jam/ParserJamTest.java
  
  Index: ParserJamTest.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/test/tests/org/apache/xmlbeans/test/jam/ParserJamTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ParserJamTest.java	16 Mar 2004 21:55:31 -0000	1.4
  +++ ParserJamTest.java	17 Mar 2004 02:25:54 -0000	1.5
  @@ -41,7 +41,7 @@
       JamServiceFactory jsf = JamServiceFactory.getInstance();
       JamServiceParams params = jsf.createServiceParams();
       params.setProperty(JamServiceFactoryImpl.USE_NEW_PARSER,"true");
  -    params.includeSourceFiles(getDummyclassesSourcepath(),"**/*.java");
  +    params.includeSourcePattern(getDummyclassesSourcepath(),"**/*.java");
       return jsf.createService(params);
     }
   
  
  
  
  1.6       +1 -1      xml-xmlbeans/v2/jam/test/tests/org/apache/xmlbeans/test/jam/SourcesJamTest.java
  
  Index: SourcesJamTest.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/jam/test/tests/org/apache/xmlbeans/test/jam/SourcesJamTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SourcesJamTest.java	16 Mar 2004 21:55:31 -0000	1.5
  +++ SourcesJamTest.java	17 Mar 2004 02:25:54 -0000	1.6
  @@ -83,7 +83,7 @@
       JamServiceFactory jsf = JamServiceFactory.getInstance();
       JamServiceParams params = jsf.createServiceParams();
       params.setVerbose(true);
  -    params.includeSourceFiles(getDummyclassesSourcepath(),"**/*.java");
  +    params.includeSourcePattern(getDummyclassesSourcepath(),"**/*.java");
       params.setProperty(JavadocClassBuilder.ARGS_PROPERTY,"-source 1.5");
       return jsf.createService(params);
     }
  
  
  
  1.43      +9 -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.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- Java2Schema.java	12 Mar 2004 21:24:31 -0000	1.42
  +++ Java2Schema.java	17 Mar 2004 02:25:54 -0000	1.43
  @@ -59,9 +59,11 @@
     public static final String TAG_EL_NILLABLE      = TAG_EL+".nillable";
     public static final String TAG_EL_EXCLUDE       = TAG_EL+".exclude";
     public static final String TAG_EL_ASTYPE        = TAG_EL+".astype";
  +  public static final String TAG_EL_CHECKER       = TAG_EL+".isSetMethod";
   
     public static final String TAG_AT               = "xsdgen:attribute";
     public static final String TAG_AT_NAME          = TAG_AT+".name";
  +  public static final String TAG_AT_CHECKER       = TAG_AT+".isSetMethod";
   
     // this is the character that replaces invalid characters when creating new
     // xml names.
  @@ -518,6 +520,13 @@
        */
       public void setSetter(JMethod s) {
         mBtsProp.setSetterName(MethodName.create(s));
  +    }
  +
  +    /**
  +     * Sets the name of the java setter for this property.
  +     */
  +    public void setIssetter(JMethod s) {
  +      mBtsProp.setIssetterName(MethodName.create(s));
       }
   
       /**
  
  
  

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


Mime
View raw message