Attached is a shell script for extracting the lines to be included in the spec from the annotations files.

-- Michelle

Craig L Russell wrote:

Hi Michelle,

Sadly, there is one feature missing that would disallow this to be used for the annotations chapter. I couldn't find a way to skip over the boilerplate [1] at the top of each .java file. So if we used this technique for the annotations chapter, we would either have to write a script to remove the boilerplate or include the boilerplate in every file. And if we write a script we would need to keep the source files up to date if the java files ever changed.

Do you know a way around this problem?

This isn't an issue for the xsd and dtd files because the only boilerplate is the Apache license which is ok for this purpose.

Craig

[1] boilerplate for Column.java
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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 javax.jdo.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Annotation for a column in the database.
 * Corresponds to the xml element "column".
* * @version 2.1
 * @since 2.1
 */

On Jan 4, 2008, at 4:32 PM, Michelle Caisse wrote:


2. Updated spec: in progress. The jdoconfig.xml has been added to Appendix D. Should we also put jdo.xml, orm.xml, and jdoquery.xml to Appendix D? No, probably better to add the dtd version of jdoconfig to Appendix D.

AI Michelle look at how to automatically include the xsd and dtd files into the spec.

From FrameMaker help:


        Importing by reference

------------------------------------------------------------------------

      You can import by reference by using File > Import > File, OLE
      (Windows), Publish and Subscribe (Mac OS), or a graphic inset
      editor (UNIX).

      When you double-click a graphic imported by reference you:

          * (Windows) Open the application
          * (Mac OS) Open the Object Properties dialog

      Importing by reference keeps the imported text or graphics
      linked to the source file. FrameMaker stores the pathname to
      the source file in the document. Each time you open the
      document, FrameMaker locates the file on the disk and
      redisplays it. If the source file was revised, FrameMaker
      updates the document with the latest version. Importing by
      reference can reduce total file size because it lets you use
      the same material in several places without storing the
      contents of imported images or text in the FrameMaker document.
      Text imported by reference is called a text inset.

      For information on how the pathname is stored when importing by
      reference, see Using pathnames when importing by reference.


I did a quick test of importing jdo_2_0.xsd. I applied the code paragraph style and it looked good with no changes. When you import by reference, you cannot edit the text from within Frame. When you select the imported text (clicking anywhere within the import highlights the entire block), Edit/Text Inset Properties brings up a dialog that displays information and offers various actions.

-- Michelle


Craig Russell

Architect, Sun Java Enterprise System http://java.sun.com/products/jdo

408 276-5638 mailto:[EMAIL PROTECTED]

P.S. A good JDO? O, Gasp!



#!/bin/sh
# Read .java files in source directory,
#   copying lines from the first line matching
#   the start pattern to the one line matching the end pattern
#   to a file of the same name in the target directory
USAGE="behead <source dir> <target dir>"
if [ $# -ne 2 ]
    then
        echo $USAGE
        exit -1
fi

SRCDIR=$1
TARGETDIR=$2

STARTPATTERN="^@"
# Must be unique in file
ENDPATTERN="^\}"

for FILE in `ls $SRCDIR/*.java`
do
    ROOT=`basename $FILE`
    OUTFILE=${TARGETDIR}/${ROOT}
    if [ `grep -c "public enum" $FILE` -gt 0 ]
    then
        echo Skipping ${FILE}, an enum
    else
        echo Copy lines from $FILE to $OUTFILE
        STARTINDEX=`grep --max-count=1 -n $STARTPATTERN $FILE | cut -d: -f1 `
        #echo $STARTINDEX
        ENDINDEX=`grep -n $ENDPATTERN $FILE | cut -f1 -d":" `
        #echo $ENDINDEX
        NUMLINES=`expr $ENDINDEX - $STARTINDEX + 1`
        #echo $NUMLINES
        tail --lines ${NUMLINES} $FILE > ${OUTFILE}
    fi
done

Reply via email to