Example of Annotation Processor that generates a db access class
authorJaroslav Tulach <jtulach@netbeans.org>
Tue, 01 Jun 2010 12:08:47 +0200
changeset 355d1e7424dc988
parent 354 f77d863ac962
child 356 23511f8a9718
Example of Annotation Processor that generates a db access class
samples/livedb/build.xml
samples/livedb/nbproject/build-impl.xml
samples/livedb/nbproject/genfiles.properties
samples/livedb/nbproject/project.properties
samples/livedb/nbproject/project.xml
samples/livedb/src/org/apidesign/livedb/LiveDB.java
samples/livedb/src/org/apidesign/livedb/impl/LiveDBProcessor.java
samples/livedb/test/org/apidesign/livedb/example/LiveDBTest.java
samples/livedb/test/org/apidesign/livedb/example/package-info.java
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/samples/livedb/build.xml	Tue Jun 01 12:08:47 2010 +0200
     1.3 @@ -0,0 +1,74 @@
     1.4 +<?xml version="1.0" encoding="UTF-8"?>
     1.5 +<!-- You may freely edit this file. See commented blocks below for -->
     1.6 +<!-- some examples of how to customize the build. -->
     1.7 +<!-- (If you delete it and reopen the project it will be recreated.) -->
     1.8 +<!-- By default, only the Clean and Build commands use this build script. -->
     1.9 +<!-- Commands such as Run, Debug, and Test only use this build script if -->
    1.10 +<!-- the Compile on Save feature is turned off for the project. -->
    1.11 +<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
    1.12 +<!-- in the project's Project Properties dialog box.-->
    1.13 +<project name="livedb" default="default" basedir=".">
    1.14 +    <description>Builds, tests, and runs the project livedb.</description>
    1.15 +    <import file="nbproject/build-impl.xml"/>
    1.16 +    <!--
    1.17 +
    1.18 +    There exist several targets which are by default empty and which can be 
    1.19 +    used for execution of your tasks. These targets are usually executed 
    1.20 +    before and after some main targets. They are: 
    1.21 +
    1.22 +      -pre-init:                 called before initialization of project properties
    1.23 +      -post-init:                called after initialization of project properties
    1.24 +      -pre-compile:              called before javac compilation
    1.25 +      -post-compile:             called after javac compilation
    1.26 +      -pre-compile-single:       called before javac compilation of single file
    1.27 +      -post-compile-single:      called after javac compilation of single file
    1.28 +      -pre-compile-test:         called before javac compilation of JUnit tests
    1.29 +      -post-compile-test:        called after javac compilation of JUnit tests
    1.30 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
    1.31 +      -post-compile-test-single: called after javac compilation of single JUunit test
    1.32 +      -pre-jar:                  called before JAR building
    1.33 +      -post-jar:                 called after JAR building
    1.34 +      -post-clean:               called after cleaning build products
    1.35 +
    1.36 +    (Targets beginning with '-' are not intended to be called on their own.)
    1.37 +
    1.38 +    Example of inserting an obfuscator after compilation could look like this:
    1.39 +
    1.40 +        <target name="-post-compile">
    1.41 +            <obfuscate>
    1.42 +                <fileset dir="${build.classes.dir}"/>
    1.43 +            </obfuscate>
    1.44 +        </target>
    1.45 +
    1.46 +    For list of available properties check the imported 
    1.47 +    nbproject/build-impl.xml file. 
    1.48 +
    1.49 +
    1.50 +    Another way to customize the build is by overriding existing main targets.
    1.51 +    The targets of interest are: 
    1.52 +
    1.53 +      -init-macrodef-javac:     defines macro for javac compilation
    1.54 +      -init-macrodef-junit:     defines macro for junit execution
    1.55 +      -init-macrodef-debug:     defines macro for class debugging
    1.56 +      -init-macrodef-java:      defines macro for class execution
    1.57 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
    1.58 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
    1.59 +      run:                      execution of project 
    1.60 +      -javadoc-build:           Javadoc generation
    1.61 +      test-report:              JUnit report generation
    1.62 +
    1.63 +    An example of overriding the target for project execution could look like this:
    1.64 +
    1.65 +        <target name="run" depends="livedb-impl.jar">
    1.66 +            <exec dir="bin" executable="launcher.exe">
    1.67 +                <arg file="${dist.jar}"/>
    1.68 +            </exec>
    1.69 +        </target>
    1.70 +
    1.71 +    Notice that the overridden target depends on the jar target and not only on 
    1.72 +    the compile target as the regular run target does. Again, for a list of available 
    1.73 +    properties which you can use, check the target you are overriding in the
    1.74 +    nbproject/build-impl.xml file. 
    1.75 +
    1.76 +    -->
    1.77 +</project>
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/samples/livedb/nbproject/build-impl.xml	Tue Jun 01 12:08:47 2010 +0200
     2.3 @@ -0,0 +1,883 @@
     2.4 +<?xml version="1.0" encoding="UTF-8"?>
     2.5 +<!--
     2.6 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
     2.7 +***         EDIT ../build.xml INSTEAD         ***
     2.8 +
     2.9 +For the purpose of easier reading the script
    2.10 +is divided into following sections:
    2.11 +
    2.12 +  - initialization
    2.13 +  - compilation
    2.14 +  - jar
    2.15 +  - execution
    2.16 +  - debugging
    2.17 +  - javadoc
    2.18 +  - junit compilation
    2.19 +  - junit execution
    2.20 +  - junit debugging
    2.21 +  - applet
    2.22 +  - cleanup
    2.23 +
    2.24 +        -->
    2.25 +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="livedb-impl">
    2.26 +    <fail message="Please build using Ant 1.7.1 or higher.">
    2.27 +        <condition>
    2.28 +            <not>
    2.29 +                <antversion atleast="1.7.1"/>
    2.30 +            </not>
    2.31 +        </condition>
    2.32 +    </fail>
    2.33 +    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
    2.34 +    <!-- 
    2.35 +                ======================
    2.36 +                INITIALIZATION SECTION 
    2.37 +                ======================
    2.38 +            -->
    2.39 +    <target name="-pre-init">
    2.40 +        <!-- Empty placeholder for easier customization. -->
    2.41 +        <!-- You can override this target in the ../build.xml file. -->
    2.42 +    </target>
    2.43 +    <target depends="-pre-init" name="-init-private">
    2.44 +        <property file="nbproject/private/config.properties"/>
    2.45 +        <property file="nbproject/private/configs/${config}.properties"/>
    2.46 +        <property file="nbproject/private/private.properties"/>
    2.47 +    </target>
    2.48 +    <target depends="-pre-init,-init-private" name="-init-user">
    2.49 +        <property file="${user.properties.file}"/>
    2.50 +        <!-- The two properties below are usually overridden -->
    2.51 +        <!-- by the active platform. Just a fallback. -->
    2.52 +        <property name="default.javac.source" value="1.4"/>
    2.53 +        <property name="default.javac.target" value="1.4"/>
    2.54 +    </target>
    2.55 +    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
    2.56 +        <property file="nbproject/configs/${config}.properties"/>
    2.57 +        <property file="nbproject/project.properties"/>
    2.58 +    </target>
    2.59 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
    2.60 +        <available file="${manifest.file}" property="manifest.available"/>
    2.61 +        <available file="${application.splash}" property="splashscreen.available"/>
    2.62 +        <condition property="main.class.available">
    2.63 +            <and>
    2.64 +                <isset property="main.class"/>
    2.65 +                <not>
    2.66 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
    2.67 +                </not>
    2.68 +            </and>
    2.69 +        </condition>
    2.70 +        <condition property="manifest.available+main.class">
    2.71 +            <and>
    2.72 +                <isset property="manifest.available"/>
    2.73 +                <isset property="main.class.available"/>
    2.74 +            </and>
    2.75 +        </condition>
    2.76 +        <condition property="do.mkdist">
    2.77 +            <and>
    2.78 +                <isset property="libs.CopyLibs.classpath"/>
    2.79 +                <not>
    2.80 +                    <istrue value="${mkdist.disabled}"/>
    2.81 +                </not>
    2.82 +            </and>
    2.83 +        </condition>
    2.84 +        <condition property="manifest.available+main.class+mkdist.available">
    2.85 +            <and>
    2.86 +                <istrue value="${manifest.available+main.class}"/>
    2.87 +                <isset property="do.mkdist"/>
    2.88 +            </and>
    2.89 +        </condition>
    2.90 +        <condition property="manifest.available+main.class+mkdist.available+splashscreen.available">
    2.91 +            <and>
    2.92 +                <istrue value="${manifest.available+main.class+mkdist.available}"/>
    2.93 +                <istrue value="${splashscreen.available}"/>
    2.94 +            </and>
    2.95 +        </condition>
    2.96 +        <condition property="do.archive">
    2.97 +            <not>
    2.98 +                <istrue value="${jar.archive.disabled}"/>
    2.99 +            </not>
   2.100 +        </condition>
   2.101 +        <condition property="do.archive+manifest.available">
   2.102 +            <and>
   2.103 +                <isset property="manifest.available"/>
   2.104 +                <istrue value="${do.archive}"/>
   2.105 +            </and>
   2.106 +        </condition>
   2.107 +        <condition property="do.archive+manifest.available+main.class">
   2.108 +            <and>
   2.109 +                <istrue value="${manifest.available+main.class}"/>
   2.110 +                <istrue value="${do.archive}"/>
   2.111 +            </and>
   2.112 +        </condition>
   2.113 +        <condition property="do.archive+manifest.available+main.class+mkdist.available">
   2.114 +            <and>
   2.115 +                <istrue value="${manifest.available+main.class+mkdist.available}"/>
   2.116 +                <istrue value="${do.archive}"/>
   2.117 +            </and>
   2.118 +        </condition>
   2.119 +        <condition property="do.archive+manifest.available+main.class+mkdist.available+splashscreen.available">
   2.120 +            <and>
   2.121 +                <istrue value="${manifest.available+main.class+mkdist.available+splashscreen.available}"/>
   2.122 +                <istrue value="${do.archive}"/>
   2.123 +            </and>
   2.124 +        </condition>
   2.125 +        <condition property="have.tests">
   2.126 +            <or>
   2.127 +                <available file="${test.src.dir}"/>
   2.128 +            </or>
   2.129 +        </condition>
   2.130 +        <condition property="have.sources">
   2.131 +            <or>
   2.132 +                <available file="${src.dir}"/>
   2.133 +            </or>
   2.134 +        </condition>
   2.135 +        <condition property="netbeans.home+have.tests">
   2.136 +            <and>
   2.137 +                <isset property="netbeans.home"/>
   2.138 +                <isset property="have.tests"/>
   2.139 +            </and>
   2.140 +        </condition>
   2.141 +        <condition property="no.javadoc.preview">
   2.142 +            <and>
   2.143 +                <isset property="javadoc.preview"/>
   2.144 +                <isfalse value="${javadoc.preview}"/>
   2.145 +            </and>
   2.146 +        </condition>
   2.147 +        <property name="run.jvmargs" value=""/>
   2.148 +        <property name="javac.compilerargs" value=""/>
   2.149 +        <property name="work.dir" value="${basedir}"/>
   2.150 +        <condition property="no.deps">
   2.151 +            <and>
   2.152 +                <istrue value="${no.dependencies}"/>
   2.153 +            </and>
   2.154 +        </condition>
   2.155 +        <property name="javac.debug" value="true"/>
   2.156 +        <property name="javadoc.preview" value="true"/>
   2.157 +        <property name="application.args" value=""/>
   2.158 +        <property name="source.encoding" value="${file.encoding}"/>
   2.159 +        <property name="runtime.encoding" value="${source.encoding}"/>
   2.160 +        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
   2.161 +            <and>
   2.162 +                <isset property="javadoc.encoding"/>
   2.163 +                <not>
   2.164 +                    <equals arg1="${javadoc.encoding}" arg2=""/>
   2.165 +                </not>
   2.166 +            </and>
   2.167 +        </condition>
   2.168 +        <property name="javadoc.encoding.used" value="${source.encoding}"/>
   2.169 +        <property name="includes" value="**"/>
   2.170 +        <property name="excludes" value=""/>
   2.171 +        <property name="do.depend" value="false"/>
   2.172 +        <condition property="do.depend.true">
   2.173 +            <istrue value="${do.depend}"/>
   2.174 +        </condition>
   2.175 +        <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
   2.176 +        <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
   2.177 +            <length length="0" string="${endorsed.classpath}" when="greater"/>
   2.178 +        </condition>
   2.179 +        <property name="javac.fork" value="false"/>
   2.180 +        <property name="jar.index" value="false"/>
   2.181 +        <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>
   2.182 +    </target>
   2.183 +    <target name="-post-init">
   2.184 +        <!-- Empty placeholder for easier customization. -->
   2.185 +        <!-- You can override this target in the ../build.xml file. -->
   2.186 +    </target>
   2.187 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
   2.188 +        <fail unless="src.dir">Must set src.dir</fail>
   2.189 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
   2.190 +        <fail unless="build.dir">Must set build.dir</fail>
   2.191 +        <fail unless="dist.dir">Must set dist.dir</fail>
   2.192 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
   2.193 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
   2.194 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
   2.195 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
   2.196 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
   2.197 +        <fail unless="dist.jar">Must set dist.jar</fail>
   2.198 +    </target>
   2.199 +    <target name="-init-macrodef-property">
   2.200 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
   2.201 +            <attribute name="name"/>
   2.202 +            <attribute name="value"/>
   2.203 +            <sequential>
   2.204 +                <property name="@{name}" value="${@{value}}"/>
   2.205 +            </sequential>
   2.206 +        </macrodef>
   2.207 +    </target>
   2.208 +    <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
   2.209 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
   2.210 +            <attribute default="${src.dir}" name="srcdir"/>
   2.211 +            <attribute default="${build.classes.dir}" name="destdir"/>
   2.212 +            <attribute default="${javac.classpath}" name="classpath"/>
   2.213 +            <attribute default="${javac.processorpath}" name="processorpath"/>
   2.214 +            <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
   2.215 +            <attribute default="${includes}" name="includes"/>
   2.216 +            <attribute default="${excludes}" name="excludes"/>
   2.217 +            <attribute default="${javac.debug}" name="debug"/>
   2.218 +            <attribute default="${empty.dir}" name="sourcepath"/>
   2.219 +            <attribute default="${empty.dir}" name="gensrcdir"/>
   2.220 +            <element name="customize" optional="true"/>
   2.221 +            <sequential>
   2.222 +                <property location="${build.dir}/empty" name="empty.dir"/>
   2.223 +                <mkdir dir="${empty.dir}"/>
   2.224 +                <mkdir dir="@{apgeneratedsrcdir}"/>
   2.225 +                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
   2.226 +                    <src>
   2.227 +                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
   2.228 +                            <include name="*"/>
   2.229 +                        </dirset>
   2.230 +                    </src>
   2.231 +                    <classpath>
   2.232 +                        <path path="@{classpath}"/>
   2.233 +                    </classpath>
   2.234 +                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
   2.235 +                    <compilerarg line="${javac.compilerargs}"/>
   2.236 +                    <compilerarg value="-processorpath"/>
   2.237 +                    <compilerarg path="@{processorpath}"/>
   2.238 +                    <compilerarg line="${ap.processors.internal}"/>
   2.239 +                    <compilerarg line="${annotation.processing.processor.options}"/>
   2.240 +                    <compilerarg value="-s"/>
   2.241 +                    <compilerarg path="@{apgeneratedsrcdir}"/>
   2.242 +                    <compilerarg line="${ap.proc.none.internal}"/>
   2.243 +                    <customize/>
   2.244 +                </javac>
   2.245 +            </sequential>
   2.246 +        </macrodef>
   2.247 +    </target>
   2.248 +    <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
   2.249 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
   2.250 +            <attribute default="${src.dir}" name="srcdir"/>
   2.251 +            <attribute default="${build.classes.dir}" name="destdir"/>
   2.252 +            <attribute default="${javac.classpath}" name="classpath"/>
   2.253 +            <attribute default="${javac.processorpath}" name="processorpath"/>
   2.254 +            <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
   2.255 +            <attribute default="${includes}" name="includes"/>
   2.256 +            <attribute default="${excludes}" name="excludes"/>
   2.257 +            <attribute default="${javac.debug}" name="debug"/>
   2.258 +            <attribute default="${empty.dir}" name="sourcepath"/>
   2.259 +            <attribute default="${empty.dir}" name="gensrcdir"/>
   2.260 +            <element name="customize" optional="true"/>
   2.261 +            <sequential>
   2.262 +                <property location="${build.dir}/empty" name="empty.dir"/>
   2.263 +                <mkdir dir="${empty.dir}"/>
   2.264 +                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
   2.265 +                    <src>
   2.266 +                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
   2.267 +                            <include name="*"/>
   2.268 +                        </dirset>
   2.269 +                    </src>
   2.270 +                    <classpath>
   2.271 +                        <path path="@{classpath}"/>
   2.272 +                    </classpath>
   2.273 +                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
   2.274 +                    <compilerarg line="${javac.compilerargs}"/>
   2.275 +                    <customize/>
   2.276 +                </javac>
   2.277 +            </sequential>
   2.278 +        </macrodef>
   2.279 +    </target>
   2.280 +    <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
   2.281 +        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
   2.282 +            <attribute default="${src.dir}" name="srcdir"/>
   2.283 +            <attribute default="${build.classes.dir}" name="destdir"/>
   2.284 +            <attribute default="${javac.classpath}" name="classpath"/>
   2.285 +            <sequential>
   2.286 +                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
   2.287 +                    <classpath>
   2.288 +                        <path path="@{classpath}"/>
   2.289 +                    </classpath>
   2.290 +                </depend>
   2.291 +            </sequential>
   2.292 +        </macrodef>
   2.293 +        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
   2.294 +            <attribute default="${build.classes.dir}" name="destdir"/>
   2.295 +            <sequential>
   2.296 +                <fail unless="javac.includes">Must set javac.includes</fail>
   2.297 +                <pathconvert pathsep="," property="javac.includes.binary">
   2.298 +                    <path>
   2.299 +                        <filelist dir="@{destdir}" files="${javac.includes}"/>
   2.300 +                    </path>
   2.301 +                    <globmapper from="*.java" to="*.class"/>
   2.302 +                </pathconvert>
   2.303 +                <delete>
   2.304 +                    <files includes="${javac.includes.binary}"/>
   2.305 +                </delete>
   2.306 +            </sequential>
   2.307 +        </macrodef>
   2.308 +    </target>
   2.309 +    <target name="-init-macrodef-junit">
   2.310 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
   2.311 +            <attribute default="${includes}" name="includes"/>
   2.312 +            <attribute default="${excludes}" name="excludes"/>
   2.313 +            <attribute default="**" name="testincludes"/>
   2.314 +            <sequential>
   2.315 +                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${build.dir}">
   2.316 +                    <batchtest todir="${build.test.results.dir}">
   2.317 +                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
   2.318 +                            <filename name="@{testincludes}"/>
   2.319 +                        </fileset>
   2.320 +                    </batchtest>
   2.321 +                    <classpath>
   2.322 +                        <path path="${run.test.classpath}"/>
   2.323 +                    </classpath>
   2.324 +                    <syspropertyset>
   2.325 +                        <propertyref prefix="test-sys-prop."/>
   2.326 +                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
   2.327 +                    </syspropertyset>
   2.328 +                    <formatter type="brief" usefile="false"/>
   2.329 +                    <formatter type="xml"/>
   2.330 +                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
   2.331 +                    <jvmarg line="${run.jvmargs}"/>
   2.332 +                </junit>
   2.333 +            </sequential>
   2.334 +        </macrodef>
   2.335 +    </target>
   2.336 +    <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
   2.337 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
   2.338 +            <attribute default="${main.class}" name="name"/>
   2.339 +            <attribute default="${debug.classpath}" name="classpath"/>
   2.340 +            <attribute default="" name="stopclassname"/>
   2.341 +            <sequential>
   2.342 +                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
   2.343 +                    <classpath>
   2.344 +                        <path path="@{classpath}"/>
   2.345 +                    </classpath>
   2.346 +                </nbjpdastart>
   2.347 +            </sequential>
   2.348 +        </macrodef>
   2.349 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
   2.350 +            <attribute default="${build.classes.dir}" name="dir"/>
   2.351 +            <sequential>
   2.352 +                <nbjpdareload>
   2.353 +                    <fileset dir="@{dir}" includes="${fix.classes}">
   2.354 +                        <include name="${fix.includes}*.class"/>
   2.355 +                    </fileset>
   2.356 +                </nbjpdareload>
   2.357 +            </sequential>
   2.358 +        </macrodef>
   2.359 +    </target>
   2.360 +    <target name="-init-debug-args">
   2.361 +        <property name="version-output" value="java version &quot;${ant.java.version}"/>
   2.362 +        <condition property="have-jdk-older-than-1.4">
   2.363 +            <or>
   2.364 +                <contains string="${version-output}" substring="java version &quot;1.0"/>
   2.365 +                <contains string="${version-output}" substring="java version &quot;1.1"/>
   2.366 +                <contains string="${version-output}" substring="java version &quot;1.2"/>
   2.367 +                <contains string="${version-output}" substring="java version &quot;1.3"/>
   2.368 +            </or>
   2.369 +        </condition>
   2.370 +        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
   2.371 +            <istrue value="${have-jdk-older-than-1.4}"/>
   2.372 +        </condition>
   2.373 +        <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
   2.374 +            <os family="windows"/>
   2.375 +        </condition>
   2.376 +        <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
   2.377 +            <isset property="debug.transport"/>
   2.378 +        </condition>
   2.379 +    </target>
   2.380 +    <target depends="-init-debug-args" name="-init-macrodef-debug">
   2.381 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
   2.382 +            <attribute default="${main.class}" name="classname"/>
   2.383 +            <attribute default="${debug.classpath}" name="classpath"/>
   2.384 +            <element name="customize" optional="true"/>
   2.385 +            <sequential>
   2.386 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
   2.387 +                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
   2.388 +                    <jvmarg line="${debug-args-line}"/>
   2.389 +                    <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
   2.390 +                    <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
   2.391 +                    <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
   2.392 +                    <jvmarg line="${run.jvmargs}"/>
   2.393 +                    <classpath>
   2.394 +                        <path path="@{classpath}"/>
   2.395 +                    </classpath>
   2.396 +                    <syspropertyset>
   2.397 +                        <propertyref prefix="run-sys-prop."/>
   2.398 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
   2.399 +                    </syspropertyset>
   2.400 +                    <customize/>
   2.401 +                </java>
   2.402 +            </sequential>
   2.403 +        </macrodef>
   2.404 +    </target>
   2.405 +    <target name="-init-macrodef-java">
   2.406 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
   2.407 +            <attribute default="${main.class}" name="classname"/>
   2.408 +            <attribute default="${run.classpath}" name="classpath"/>
   2.409 +            <element name="customize" optional="true"/>
   2.410 +            <sequential>
   2.411 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
   2.412 +                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
   2.413 +                    <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
   2.414 +                    <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
   2.415 +                    <jvmarg line="${run.jvmargs}"/>
   2.416 +                    <classpath>
   2.417 +                        <path path="@{classpath}"/>
   2.418 +                    </classpath>
   2.419 +                    <syspropertyset>
   2.420 +                        <propertyref prefix="run-sys-prop."/>
   2.421 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
   2.422 +                    </syspropertyset>
   2.423 +                    <customize/>
   2.424 +                </java>
   2.425 +            </sequential>
   2.426 +        </macrodef>
   2.427 +    </target>
   2.428 +    <target name="-init-macrodef-copylibs">
   2.429 +        <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3">
   2.430 +            <element name="customize" optional="true"/>
   2.431 +            <sequential>
   2.432 +                <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
   2.433 +                <pathconvert property="run.classpath.without.build.classes.dir">
   2.434 +                    <path path="${run.classpath}"/>
   2.435 +                    <map from="${build.classes.dir.resolved}" to=""/>
   2.436 +                </pathconvert>
   2.437 +                <pathconvert pathsep=" " property="jar.classpath">
   2.438 +                    <path path="${run.classpath.without.build.classes.dir}"/>
   2.439 +                    <chainedmapper>
   2.440 +                        <flattenmapper/>
   2.441 +                        <globmapper from="*" to="lib/*"/>
   2.442 +                    </chainedmapper>
   2.443 +                </pathconvert>
   2.444 +                <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
   2.445 +                <copylibs compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
   2.446 +                    <fileset dir="${build.classes.dir}"/>
   2.447 +                    <manifest>
   2.448 +                        <attribute name="Class-Path" value="${jar.classpath}"/>
   2.449 +                        <customize/>
   2.450 +                    </manifest>
   2.451 +                </copylibs>
   2.452 +            </sequential>
   2.453 +        </macrodef>
   2.454 +    </target>
   2.455 +    <target name="-init-presetdef-jar">
   2.456 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
   2.457 +            <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}">
   2.458 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
   2.459 +            </jar>
   2.460 +        </presetdef>
   2.461 +    </target>
   2.462 +    <target name="-init-ap-cmdline-properties">
   2.463 +        <property name="annotation.processing.enabled" value="true"/>
   2.464 +        <property name="annotation.processing.processors.list" value=""/>
   2.465 +        <property name="annotation.processing.processor.options" value=""/>
   2.466 +        <property name="annotation.processing.run.all.processors" value="true"/>
   2.467 +        <property name="javac.processorpath" value="${javac.classpath}"/>
   2.468 +        <property name="javac.test.processorpath" value="${javac.test.classpath}"/>
   2.469 +        <condition property="ap.supported.internal" value="true">
   2.470 +            <not>
   2.471 +                <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
   2.472 +            </not>
   2.473 +        </condition>
   2.474 +    </target>
   2.475 +    <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
   2.476 +        <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
   2.477 +            <isfalse value="${annotation.processing.run.all.processors}"/>
   2.478 +        </condition>
   2.479 +        <condition else="" property="ap.proc.none.internal" value="-proc:none">
   2.480 +            <isfalse value="${annotation.processing.enabled}"/>
   2.481 +        </condition>
   2.482 +    </target>
   2.483 +    <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
   2.484 +        <property name="ap.cmd.line.internal" value=""/>
   2.485 +    </target>
   2.486 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/>
   2.487 +    <!--
   2.488 +                ===================
   2.489 +                COMPILATION SECTION
   2.490 +                ===================
   2.491 +            -->
   2.492 +    <target name="-deps-jar-init" unless="built-jar.properties">
   2.493 +        <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
   2.494 +        <delete file="${built-jar.properties}" quiet="true"/>
   2.495 +    </target>
   2.496 +    <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
   2.497 +        <echo level="warn" message="Cycle detected: livedb was already built"/>
   2.498 +    </target>
   2.499 +    <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
   2.500 +        <mkdir dir="${build.dir}"/>
   2.501 +        <touch file="${built-jar.properties}" verbose="false"/>
   2.502 +        <property file="${built-jar.properties}" prefix="already.built.jar."/>
   2.503 +        <antcall target="-warn-already-built-jar"/>
   2.504 +        <propertyfile file="${built-jar.properties}">
   2.505 +            <entry key="${basedir}" value=""/>
   2.506 +        </propertyfile>
   2.507 +    </target>
   2.508 +    <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
   2.509 +    <target depends="init" name="-check-automatic-build">
   2.510 +        <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
   2.511 +    </target>
   2.512 +    <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
   2.513 +        <antcall target="clean"/>
   2.514 +    </target>
   2.515 +    <target depends="init,deps-jar" name="-pre-pre-compile">
   2.516 +        <mkdir dir="${build.classes.dir}"/>
   2.517 +    </target>
   2.518 +    <target name="-pre-compile">
   2.519 +        <!-- Empty placeholder for easier customization. -->
   2.520 +        <!-- You can override this target in the ../build.xml file. -->
   2.521 +    </target>
   2.522 +    <target if="do.depend.true" name="-compile-depend">
   2.523 +        <pathconvert property="build.generated.subdirs">
   2.524 +            <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
   2.525 +                <include name="*"/>
   2.526 +            </dirset>
   2.527 +        </pathconvert>
   2.528 +        <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
   2.529 +    </target>
   2.530 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
   2.531 +        <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
   2.532 +        <copy todir="${build.classes.dir}">
   2.533 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
   2.534 +        </copy>
   2.535 +    </target>
   2.536 +    <target if="has.persistence.xml" name="-copy-persistence-xml">
   2.537 +        <mkdir dir="${build.classes.dir}/META-INF"/>
   2.538 +        <copy todir="${build.classes.dir}/META-INF">
   2.539 +            <fileset dir="${meta.inf.dir}" includes="persistence.xml"/>
   2.540 +        </copy>
   2.541 +    </target>
   2.542 +    <target name="-post-compile">
   2.543 +        <!-- Empty placeholder for easier customization. -->
   2.544 +        <!-- You can override this target in the ../build.xml file. -->
   2.545 +    </target>
   2.546 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
   2.547 +    <target name="-pre-compile-single">
   2.548 +        <!-- Empty placeholder for easier customization. -->
   2.549 +        <!-- You can override this target in the ../build.xml file. -->
   2.550 +    </target>
   2.551 +    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
   2.552 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
   2.553 +        <j2seproject3:force-recompile/>
   2.554 +        <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
   2.555 +    </target>
   2.556 +    <target name="-post-compile-single">
   2.557 +        <!-- Empty placeholder for easier customization. -->
   2.558 +        <!-- You can override this target in the ../build.xml file. -->
   2.559 +    </target>
   2.560 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
   2.561 +    <!--
   2.562 +                ====================
   2.563 +                JAR BUILDING SECTION
   2.564 +                ====================
   2.565 +            -->
   2.566 +    <target depends="init" name="-pre-pre-jar">
   2.567 +        <dirname file="${dist.jar}" property="dist.jar.dir"/>
   2.568 +        <mkdir dir="${dist.jar.dir}"/>
   2.569 +    </target>
   2.570 +    <target name="-pre-jar">
   2.571 +        <!-- Empty placeholder for easier customization. -->
   2.572 +        <!-- You can override this target in the ../build.xml file. -->
   2.573 +    </target>
   2.574 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available">
   2.575 +        <j2seproject1:jar/>
   2.576 +    </target>
   2.577 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
   2.578 +        <j2seproject1:jar manifest="${manifest.file}"/>
   2.579 +    </target>
   2.580 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available">
   2.581 +        <j2seproject1:jar manifest="${manifest.file}">
   2.582 +            <j2seproject1:manifest>
   2.583 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
   2.584 +            </j2seproject1:manifest>
   2.585 +        </j2seproject1:jar>
   2.586 +        <echo>To run this application from the command line without Ant, try:</echo>
   2.587 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
   2.588 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
   2.589 +        <pathconvert property="run.classpath.with.dist.jar">
   2.590 +            <path path="${run.classpath}"/>
   2.591 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
   2.592 +        </pathconvert>
   2.593 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
   2.594 +    </target>
   2.595 +    <target depends="init,compile,-pre-pre-jar,-pre-jar,-init-macrodef-copylibs" if="do.archive+manifest.available+main.class+mkdist.available+splashscreen.available" name="-do-jar-with-libraries-and-splashscreen">
   2.596 +        <basename file="${application.splash}" property="splashscreen.basename"/>
   2.597 +        <mkdir dir="${build.classes.dir}/META-INF"/>
   2.598 +        <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/>
   2.599 +        <j2seproject3:copylibs>
   2.600 +            <customize>
   2.601 +                <attribute name="Main-Class" value="${main.class}"/>
   2.602 +                <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
   2.603 +            </customize>
   2.604 +        </j2seproject3:copylibs>
   2.605 +        <echo>To run this application from the command line without Ant, try:</echo>
   2.606 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
   2.607 +        <echo>java -jar "${dist.jar.resolved}"</echo>
   2.608 +    </target>
   2.609 +    <target depends="init,compile,-pre-pre-jar,-pre-jar,-init-macrodef-copylibs" if="do.archive+manifest.available+main.class+mkdist.available" name="-do-jar-with-libraries" unless="splashscreen.available">
   2.610 +        <j2seproject3:copylibs>
   2.611 +            <customize>
   2.612 +                <attribute name="Main-Class" value="${main.class}"/>
   2.613 +            </customize>
   2.614 +        </j2seproject3:copylibs>
   2.615 +        <echo>To run this application from the command line without Ant, try:</echo>
   2.616 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
   2.617 +        <echo>java -jar "${dist.jar.resolved}"</echo>
   2.618 +    </target>
   2.619 +    <target name="-post-jar">
   2.620 +        <!-- Empty placeholder for easier customization. -->
   2.621 +        <!-- You can override this target in the ../build.xml file. -->
   2.622 +    </target>
   2.623 +    <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries-and-splashscreen,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/>
   2.624 +    <!--
   2.625 +                =================
   2.626 +                EXECUTION SECTION
   2.627 +                =================
   2.628 +            -->
   2.629 +    <target depends="init,compile" description="Run a main class." name="run">
   2.630 +        <j2seproject1:java>
   2.631 +            <customize>
   2.632 +                <arg line="${application.args}"/>
   2.633 +            </customize>
   2.634 +        </j2seproject1:java>
   2.635 +    </target>
   2.636 +    <target name="-do-not-recompile">
   2.637 +        <property name="javac.includes.binary" value=""/>
   2.638 +    </target>
   2.639 +    <target depends="init,compile-single" name="run-single">
   2.640 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
   2.641 +        <j2seproject1:java classname="${run.class}"/>
   2.642 +    </target>
   2.643 +    <target depends="init,compile-test-single" name="run-test-with-main">
   2.644 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
   2.645 +        <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
   2.646 +    </target>
   2.647 +    <!--
   2.648 +                =================
   2.649 +                DEBUGGING SECTION
   2.650 +                =================
   2.651 +            -->
   2.652 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
   2.653 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
   2.654 +    </target>
   2.655 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
   2.656 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
   2.657 +    </target>
   2.658 +    <target depends="init,compile" name="-debug-start-debuggee">
   2.659 +        <j2seproject3:debug>
   2.660 +            <customize>
   2.661 +                <arg line="${application.args}"/>
   2.662 +            </customize>
   2.663 +        </j2seproject3:debug>
   2.664 +    </target>
   2.665 +    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
   2.666 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
   2.667 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
   2.668 +    </target>
   2.669 +    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
   2.670 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
   2.671 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
   2.672 +        <j2seproject3:debug classname="${debug.class}"/>
   2.673 +    </target>
   2.674 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
   2.675 +    <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
   2.676 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
   2.677 +        <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
   2.678 +    </target>
   2.679 +    <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
   2.680 +    <target depends="init" name="-pre-debug-fix">
   2.681 +        <fail unless="fix.includes">Must set fix.includes</fail>
   2.682 +        <property name="javac.includes" value="${fix.includes}.java"/>
   2.683 +    </target>
   2.684 +    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
   2.685 +        <j2seproject1:nbjpdareload/>
   2.686 +    </target>
   2.687 +    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
   2.688 +    <!--
   2.689 +                ===============
   2.690 +                JAVADOC SECTION
   2.691 +                ===============
   2.692 +            -->
   2.693 +    <target depends="init" if="have.sources" name="-javadoc-build">
   2.694 +        <mkdir dir="${dist.javadoc.dir}"/>
   2.695 +        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
   2.696 +            <classpath>
   2.697 +                <path path="${javac.classpath}"/>
   2.698 +            </classpath>
   2.699 +            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
   2.700 +                <filename name="**/*.java"/>
   2.701 +            </fileset>
   2.702 +            <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
   2.703 +                <include name="**/*.java"/>
   2.704 +            </fileset>
   2.705 +        </javadoc>
   2.706 +    </target>
   2.707 +    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
   2.708 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
   2.709 +    </target>
   2.710 +    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
   2.711 +    <!--
   2.712 +                =========================
   2.713 +                JUNIT COMPILATION SECTION
   2.714 +                =========================
   2.715 +            -->
   2.716 +    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
   2.717 +        <mkdir dir="${build.test.classes.dir}"/>
   2.718 +    </target>
   2.719 +    <target name="-pre-compile-test">
   2.720 +        <!-- Empty placeholder for easier customization. -->
   2.721 +        <!-- You can override this target in the ../build.xml file. -->
   2.722 +    </target>
   2.723 +    <target if="do.depend.true" name="-compile-test-depend">
   2.724 +        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
   2.725 +    </target>
   2.726 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
   2.727 +        <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.src.dir}"/>
   2.728 +        <copy todir="${build.test.classes.dir}">
   2.729 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
   2.730 +        </copy>
   2.731 +    </target>
   2.732 +    <target name="-post-compile-test">
   2.733 +        <!-- Empty placeholder for easier customization. -->
   2.734 +        <!-- You can override this target in the ../build.xml file. -->
   2.735 +    </target>
   2.736 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
   2.737 +    <target name="-pre-compile-test-single">
   2.738 +        <!-- Empty placeholder for easier customization. -->
   2.739 +        <!-- You can override this target in the ../build.xml file. -->
   2.740 +    </target>
   2.741 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
   2.742 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
   2.743 +        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
   2.744 +        <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
   2.745 +        <copy todir="${build.test.classes.dir}">
   2.746 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
   2.747 +        </copy>
   2.748 +    </target>
   2.749 +    <target name="-post-compile-test-single">
   2.750 +        <!-- Empty placeholder for easier customization. -->
   2.751 +        <!-- You can override this target in the ../build.xml file. -->
   2.752 +    </target>
   2.753 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
   2.754 +    <!--
   2.755 +                =======================
   2.756 +                JUNIT EXECUTION SECTION
   2.757 +                =======================
   2.758 +            -->
   2.759 +    <target depends="init" if="have.tests" name="-pre-test-run">
   2.760 +        <mkdir dir="${build.test.results.dir}"/>
   2.761 +    </target>
   2.762 +    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
   2.763 +        <j2seproject3:junit testincludes="**/*Test.java"/>
   2.764 +    </target>
   2.765 +    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
   2.766 +        <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
   2.767 +    </target>
   2.768 +    <target depends="init" if="have.tests" name="test-report"/>
   2.769 +    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
   2.770 +    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
   2.771 +    <target depends="init" if="have.tests" name="-pre-test-run-single">
   2.772 +        <mkdir dir="${build.test.results.dir}"/>
   2.773 +    </target>
   2.774 +    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
   2.775 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
   2.776 +        <j2seproject3:junit excludes="" includes="${test.includes}"/>
   2.777 +    </target>
   2.778 +    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
   2.779 +        <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
   2.780 +    </target>
   2.781 +    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
   2.782 +    <!--
   2.783 +                =======================
   2.784 +                JUNIT DEBUGGING SECTION
   2.785 +                =======================
   2.786 +            -->
   2.787 +    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
   2.788 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
   2.789 +        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
   2.790 +        <delete file="${test.report.file}"/>
   2.791 +        <mkdir dir="${build.test.results.dir}"/>
   2.792 +        <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
   2.793 +            <customize>
   2.794 +                <syspropertyset>
   2.795 +                    <propertyref prefix="test-sys-prop."/>
   2.796 +                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
   2.797 +                </syspropertyset>
   2.798 +                <arg value="${test.class}"/>
   2.799 +                <arg value="showoutput=true"/>
   2.800 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
   2.801 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
   2.802 +            </customize>
   2.803 +        </j2seproject3:debug>
   2.804 +    </target>
   2.805 +    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
   2.806 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
   2.807 +    </target>
   2.808 +    <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
   2.809 +    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
   2.810 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
   2.811 +    </target>
   2.812 +    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
   2.813 +    <!--
   2.814 +                =========================
   2.815 +                APPLET EXECUTION SECTION
   2.816 +                =========================
   2.817 +            -->
   2.818 +    <target depends="init,compile-single" name="run-applet">
   2.819 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
   2.820 +        <j2seproject1:java classname="sun.applet.AppletViewer">
   2.821 +            <customize>
   2.822 +                <arg value="${applet.url}"/>
   2.823 +            </customize>
   2.824 +        </j2seproject1:java>
   2.825 +    </target>
   2.826 +    <!--
   2.827 +                =========================
   2.828 +                APPLET DEBUGGING  SECTION
   2.829 +                =========================
   2.830 +            -->
   2.831 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
   2.832 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
   2.833 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
   2.834 +            <customize>
   2.835 +                <arg value="${applet.url}"/>
   2.836 +            </customize>
   2.837 +        </j2seproject3:debug>
   2.838 +    </target>
   2.839 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
   2.840 +    <!--
   2.841 +                ===============
   2.842 +                CLEANUP SECTION
   2.843 +                ===============
   2.844 +            -->
   2.845 +    <target name="-deps-clean-init" unless="built-clean.properties">
   2.846 +        <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
   2.847 +        <delete file="${built-clean.properties}" quiet="true"/>
   2.848 +    </target>
   2.849 +    <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
   2.850 +        <echo level="warn" message="Cycle detected: livedb was already built"/>
   2.851 +    </target>
   2.852 +    <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
   2.853 +        <mkdir dir="${build.dir}"/>
   2.854 +        <touch file="${built-clean.properties}" verbose="false"/>
   2.855 +        <property file="${built-clean.properties}" prefix="already.built.clean."/>
   2.856 +        <antcall target="-warn-already-built-clean"/>
   2.857 +        <propertyfile file="${built-clean.properties}">
   2.858 +            <entry key="${basedir}" value=""/>
   2.859 +        </propertyfile>
   2.860 +    </target>
   2.861 +    <target depends="init" name="-do-clean">
   2.862 +        <delete dir="${build.dir}"/>
   2.863 +        <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
   2.864 +    </target>
   2.865 +    <target name="-post-clean">
   2.866 +        <!-- Empty placeholder for easier customization. -->
   2.867 +        <!-- You can override this target in the ../build.xml file. -->
   2.868 +    </target>
   2.869 +    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
   2.870 +    <target name="-check-call-dep">
   2.871 +        <property file="${call.built.properties}" prefix="already.built."/>
   2.872 +        <condition property="should.call.dep">
   2.873 +            <not>
   2.874 +                <isset property="already.built.${call.subproject}"/>
   2.875 +            </not>
   2.876 +        </condition>
   2.877 +    </target>
   2.878 +    <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
   2.879 +        <ant antfile="${call.script}" inheritall="false" target="${call.target}">
   2.880 +            <propertyset>
   2.881 +                <propertyref prefix="transfer."/>
   2.882 +                <mapper from="transfer.*" to="*" type="glob"/>
   2.883 +            </propertyset>
   2.884 +        </ant>
   2.885 +    </target>
   2.886 +</project>
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/samples/livedb/nbproject/genfiles.properties	Tue Jun 01 12:08:47 2010 +0200
     3.3 @@ -0,0 +1,8 @@
     3.4 +build.xml.data.CRC32=acb473e7
     3.5 +build.xml.script.CRC32=61ba5a6a
     3.6 +build.xml.stylesheet.CRC32=958a1d3e@1.38.0.45
     3.7 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
     3.8 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
     3.9 +nbproject/build-impl.xml.data.CRC32=acb473e7
    3.10 +nbproject/build-impl.xml.script.CRC32=c82572ef
    3.11 +nbproject/build-impl.xml.stylesheet.CRC32=c75ce636@1.38.0.45
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/samples/livedb/nbproject/project.properties	Tue Jun 01 12:08:47 2010 +0200
     4.3 @@ -0,0 +1,73 @@
     4.4 +annotation.processing.enabled=true
     4.5 +annotation.processing.enabled.in.editor=true
     4.6 +annotation.processing.run.all.processors=true
     4.7 +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
     4.8 +application.title=livedb
     4.9 +application.vendor=jarda
    4.10 +build.classes.dir=${build.dir}/classes
    4.11 +build.classes.excludes=**/*.java,**/*.form
    4.12 +# This directory is removed when the project is cleaned:
    4.13 +build.dir=build
    4.14 +build.generated.dir=${build.dir}/generated
    4.15 +build.generated.sources.dir=${build.dir}/generated-sources
    4.16 +# Only compile against the classpath explicitly listed here:
    4.17 +build.sysclasspath=ignore
    4.18 +build.test.classes.dir=${build.dir}/test/classes
    4.19 +build.test.results.dir=${build.dir}/test/results
    4.20 +# Uncomment to specify the preferred debugger connection transport:
    4.21 +#debug.transport=dt_socket
    4.22 +debug.classpath=\
    4.23 +    ${run.classpath}
    4.24 +debug.test.classpath=\
    4.25 +    ${run.test.classpath}
    4.26 +# This directory is removed when the project is cleaned:
    4.27 +dist.dir=dist
    4.28 +dist.jar=${dist.dir}/livedb.jar
    4.29 +dist.javadoc.dir=${dist.dir}/javadoc
    4.30 +endorsed.classpath=
    4.31 +excludes=
    4.32 +file.reference.junit-4.4.jar=../libs/dist/junit-4.4.jar
    4.33 +file.reference.org-openide-util-lookup.jar=../libs/dist/org-openide-util-lookup.jar
    4.34 +includes=**
    4.35 +jar.compress=false
    4.36 +javac.classpath=\
    4.37 +    ${file.reference.org-openide-util-lookup.jar}
    4.38 +# Space-separated list of extra javac options
    4.39 +javac.compilerargs=
    4.40 +javac.deprecation=false
    4.41 +javac.processorpath=\
    4.42 +    ${javac.classpath}
    4.43 +javac.source=1.5
    4.44 +javac.target=1.5
    4.45 +javac.test.classpath=\
    4.46 +    ${javac.classpath}:\
    4.47 +    ${build.classes.dir}:\
    4.48 +    ${file.reference.junit-4.4.jar}
    4.49 +javac.test.processorpath=\
    4.50 +    ${javac.test.classpath}
    4.51 +javadoc.additionalparam=
    4.52 +javadoc.author=false
    4.53 +javadoc.encoding=${source.encoding}
    4.54 +javadoc.noindex=false
    4.55 +javadoc.nonavbar=false
    4.56 +javadoc.notree=false
    4.57 +javadoc.private=false
    4.58 +javadoc.splitindex=true
    4.59 +javadoc.use=true
    4.60 +javadoc.version=false
    4.61 +javadoc.windowtitle=
    4.62 +meta.inf.dir=${src.dir}/META-INF
    4.63 +platform.active=default_platform
    4.64 +run.classpath=\
    4.65 +    ${javac.classpath}:\
    4.66 +    ${build.classes.dir}
    4.67 +# Space-separated list of JVM arguments used when running the project
    4.68 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
    4.69 +# or test-sys-prop.name=value to set system properties for unit tests):
    4.70 +run.jvmargs=
    4.71 +run.test.classpath=\
    4.72 +    ${javac.test.classpath}:\
    4.73 +    ${build.test.classes.dir}
    4.74 +source.encoding=UTF-8
    4.75 +src.dir=src
    4.76 +test.src.dir=test
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/samples/livedb/nbproject/project.xml	Tue Jun 01 12:08:47 2010 +0200
     5.3 @@ -0,0 +1,15 @@
     5.4 +<?xml version="1.0" encoding="UTF-8"?>
     5.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
     5.6 +    <type>org.netbeans.modules.java.j2seproject</type>
     5.7 +    <configuration>
     5.8 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
     5.9 +            <name>livedb</name>
    5.10 +            <source-roots>
    5.11 +                <root id="src.dir"/>
    5.12 +            </source-roots>
    5.13 +            <test-roots>
    5.14 +                <root id="test.src.dir"/>
    5.15 +            </test-roots>
    5.16 +        </data>
    5.17 +    </configuration>
    5.18 +</project>
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/samples/livedb/src/org/apidesign/livedb/LiveDB.java	Tue Jun 01 12:08:47 2010 +0200
     6.3 @@ -0,0 +1,17 @@
     6.4 +package org.apidesign.livedb;
     6.5 +
     6.6 +import java.lang.annotation.ElementType;
     6.7 +import java.lang.annotation.Retention;
     6.8 +import java.lang.annotation.RetentionPolicy;
     6.9 +import java.lang.annotation.Target;
    6.10 +
    6.11 +/**
    6.12 + *
    6.13 + * @author Jaroslav Tulach <jtulach@netbeans.org>
    6.14 + */
    6.15 +@Target(ElementType.PACKAGE)
    6.16 +@Retention(RetentionPolicy.SOURCE)
    6.17 +public @interface LiveDB {
    6.18 +    String classname();
    6.19 +    String field();
    6.20 +}
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/samples/livedb/src/org/apidesign/livedb/impl/LiveDBProcessor.java	Tue Jun 01 12:08:47 2010 +0200
     7.3 @@ -0,0 +1,53 @@
     7.4 +/*
     7.5 + * To change this template, choose Tools | Templates
     7.6 + * and open the template in the editor.
     7.7 + */
     7.8 +
     7.9 +package org.apidesign.livedb.impl;
    7.10 +
    7.11 +import java.io.IOException;
    7.12 +import java.io.Writer;
    7.13 +import java.util.Set;
    7.14 +import javax.annotation.processing.AbstractProcessor;
    7.15 +import javax.annotation.processing.Processor;
    7.16 +import javax.annotation.processing.RoundEnvironment;
    7.17 +import javax.annotation.processing.SupportedAnnotationTypes;
    7.18 +import javax.annotation.processing.SupportedSourceVersion;
    7.19 +import javax.lang.model.SourceVersion;
    7.20 +import javax.lang.model.element.Element;
    7.21 +import javax.lang.model.element.PackageElement;
    7.22 +import javax.lang.model.element.TypeElement;
    7.23 +import javax.tools.JavaFileObject;
    7.24 +import org.apidesign.livedb.LiveDB;
    7.25 +import org.openide.util.lookup.ServiceProvider;
    7.26 +
    7.27 +/**
    7.28 + *
    7.29 + * @author Jaroslav Tulach <jtulach@netbeans.org>
    7.30 + */
    7.31 +@SupportedAnnotationTypes("org.apidesign.livedb.LiveDB")
    7.32 +@SupportedSourceVersion(SourceVersion.RELEASE_6)
    7.33 +@ServiceProvider(service=Processor.class)
    7.34 +public class LiveDBProcessor extends AbstractProcessor {
    7.35 +    @Override
    7.36 +    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    7.37 +        for (Element e : roundEnv.getElementsAnnotatedWith(LiveDB.class)) {
    7.38 +            LiveDB db = e.getAnnotation(LiveDB.class);
    7.39 +            PackageElement pe = (PackageElement)e;
    7.40 +            String clsName = pe.getQualifiedName().toString() + "." + db.classname();
    7.41 +            try {
    7.42 +                JavaFileObject src = processingEnv.getFiler().createSourceFile(clsName, pe);
    7.43 +                Writer w = src.openWriter();
    7.44 +                w.append("package " + pe.getQualifiedName() + ";\n");
    7.45 +                w.append("class " + db.classname() + " {\n");
    7.46 +                w.append("  public String " + db.field() + ";\n");
    7.47 +                w.append("}");
    7.48 +                w.close();
    7.49 +            } catch (IOException ex) {
    7.50 +                throw new IllegalStateException(ex);
    7.51 +            }
    7.52 +        }
    7.53 +        return true;
    7.54 +    }
    7.55 +
    7.56 +}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/samples/livedb/test/org/apidesign/livedb/example/LiveDBTest.java	Tue Jun 01 12:08:47 2010 +0200
     8.3 @@ -0,0 +1,26 @@
     8.4 +/*
     8.5 + * To change this template, choose Tools | Templates
     8.6 + * and open the template in the editor.
     8.7 + */
     8.8 +
     8.9 +package org.apidesign.livedb.example;
    8.10 +
    8.11 +import junit.framework.TestCase;
    8.12 +
    8.13 +/**
    8.14 + *
    8.15 + * @author Jaroslav Tulach <jtulach@netbeans.org>
    8.16 + */
    8.17 +public class LiveDBTest extends TestCase {
    8.18 +    
    8.19 +    public LiveDBTest(String testName) {
    8.20 +        super(testName);
    8.21 +    }
    8.22 +
    8.23 +    public void testSomeMethod() {
    8.24 +        DBAccess db = new DBAccess();
    8.25 +        db.jarda = "Ahoj";
    8.26 +        assertEquals("Ahoj", db.jarda);
    8.27 +    }
    8.28 +
    8.29 +}
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/samples/livedb/test/org/apidesign/livedb/example/package-info.java	Tue Jun 01 12:08:47 2010 +0200
     9.3 @@ -0,0 +1,6 @@
     9.4 +
     9.5 +
     9.6 +@LiveDB(classname="DBAccess", field="jarda")
     9.7 +package org.apidesign.livedb.example;
     9.8 +
     9.9 +import org.apidesign.livedb.LiveDB;