hotswap.patch
author Thomas W?rthinger <wuerthinger@ssw.jku.at>
Fri Dec 17 18:29:06 2010 +0100 (2 years ago)
changeset 274 c4bf8cbde070
parent 1864f9420785686
permissions -rw-r--r--
new version of the enhanced hotswapping code
        1 diff -r f5603a6e5042 .hgignore
        2 --- a/.hgignore	Wed Nov 17 22:42:08 2010 -0800
        3 +++ b/.hgignore	Fri Dec 17 13:23:04 2010 +0100
        4 @@ -1,7 +1,27 @@
        5 -^build/
        6 -^dist/
        7 -/nbproject/private/
        8 -^src/share/tools/hsdis/build/
        9 -^src/share/tools/IdealGraphVisualizer/[a-zA-Z0-9]*/build/
       10 -^src/share/tools/IdealGraphVisualizer/build/
       11 -^src/share/tools/IdealGraphVisualizer/dist/
       12 +^build/
       13 +^work/
       14 +^work64/
       15 +^java/
       16 +^java64/
       17 +^dist/
       18 +^make/
       19 +build/
       20 +/nbproject/private/
       21 +^src/share/tools/hsdis/build/
       22 +private/
       23 +dist/
       24 +.toc$
       25 +.ps$
       26 +.dvi$
       27 +.aux$
       28 +.swp$
       29 +.dll$
       30 +.dylib$
       31 +.so$
       32 +.bak$
       33 +.orig$
       34 +~$
       35 +hotspot.log$
       36 +^src/share/tools/IdealGraphVisualizer/[a-zA-Z0-9]*/build/
       37 +^src/share/tools/IdealGraphVisualizer/build/
       38 +^src/share/tools/IdealGraphVisualizer/dist/
       39 diff -r f5603a6e5042 .hgtags
       40 --- a/.hgtags	Wed Nov 17 22:42:08 2010 -0800
       41 +++ b/.hgtags	Fri Dec 17 13:23:04 2010 +0100
       42 @@ -131,3 +131,7 @@
       43  806d0c037e6bbb88dac0699673f4ba55ee8c02da jdk7-b117
       44  698b7b727e12de44139d8cca6ab9a494ead13253 jdk7-b118
       45  3ef7426b4deac5dcfd4afb35cabe9ab3d666df91 hs20-b02
       46 +946201493cab53f518c55272b6f27517a0ba4e0e build 0.1-b01
       47 +4425fe0d7f0ec7f8583ae687f7eb1b4a3e94ea09 build 0.1-b02
       48 +0c5e4a085baa8aaa9aed55b20810de4bdc2d6548 build 0.2-b01
       49 +34520cf6c532e28f529340f66f71855aadf83d95 build 0.2-b02
       50 diff -r f5603a6e5042 build.cmd
       51 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
       52 +++ b/build.cmd	Fri Dec 17 13:23:04 2010 +0100
       53 @@ -0,0 +1,12 @@
       54 +set HotSpotMksHome=C:\Cygwin\bin
       55 +set path=%JAVA_HOME%;C:\Cygwin\bin
       56 +call "%VS_VCVARS%\vsvars32.bat"
       57 +
       58 +set OrigPath=%cd%
       59 +cd make\windows
       60 +
       61 +call build.bat product compiler1 %OrigPath% %JAVA_HOME%
       62 +call build.bat fastdebug compiler1 %OrigPath% %JAVA_HOME%
       63 +
       64 +cd %OrigPath%
       65 +pause
       66 diff -r f5603a6e5042 create.cmd
       67 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
       68 +++ b/create.cmd	Fri Dec 17 13:23:04 2010 +0100
       69 @@ -0,0 +1,12 @@
       70 +set HotSpotMksHome=C:\Cygwin\bin
       71 +set path=%JAVA_HOME%\bin;C:\Cygwin\bin
       72 +call "%VS_VCVARS%\vsvars32.bat"
       73 +
       74 +set OrigPath=%cd%
       75 +cd make\windows
       76 +
       77 +mkdir %OrigPath%\work
       78 +call create.bat %OrigPath% %OrigPath%\work %OrigPath%\java
       79 +
       80 +cd %OrigPath%
       81 +pause
       82 diff -r f5603a6e5042 create64.cmd
       83 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
       84 +++ b/create64.cmd	Fri Dec 17 13:23:04 2010 +0100
       85 @@ -0,0 +1,14 @@
       86 +set HotSpotMksHome=C:\cygwin\bin
       87 +set JAVA_HOME=%cd%\java64
       88 +set ORIG_PATH=%PATH%
       89 +set path=%JAVA_HOME%\bin;%path%;C:\cygwin\bin
       90 +
       91 +set OrigPath=%cd%
       92 +cd make\windows
       93 +
       94 +mkdir %OrigPath%\work64
       95 +call create.bat %OrigPath% %OrigPath%\work64 %OrigPath%\java64
       96 +
       97 +set PATH=%ORIG_PATH%
       98 +cd %OrigPath%
       99 +pause
      100 diff -r f5603a6e5042 create_installers.cmd
      101 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
      102 +++ b/create_installers.cmd	Fri Dec 17 13:23:04 2010 +0100
      103 @@ -0,0 +1,11 @@
      104 +copy hotswapinstaller\Installer\dist\Installer.jar dcevm-mac.jar
      105 +jar uvf dcevm-mac.jar -C hotswapbinaries\mac\ .
      106 +jar uvf dcevm-mac.jar -C hotswapinstaller\Installer\dist data\dcevm.jar
      107 +
      108 +copy hotswapinstaller\Installer\dist\Installer.jar dcevm-win.jar
      109 +jar uvf dcevm-win.jar -C hotswapbinaries\win\ .
      110 +jar uvf dcevm-win.jar -C hotswapinstaller\Installer\dist data\dcevm.jar
      111 +
      112 +copy hotswapinstaller\Installer\dist\Installer.jar dcevm-linux.jar
      113 +jar uvf dcevm-linux.jar -C hotswapbinaries\linux\ .
      114 +jar uvf dcevm-linux.jar -C hotswapinstaller\Installer\dist data\dcevm.jar
      115 \ No newline at end of file
      116 diff -r f5603a6e5042 create_installers.sh
      117 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
      118 +++ b/create_installers.sh	Fri Dec 17 13:23:04 2010 +0100
      119 @@ -0,0 +1,11 @@
      120 +cp hotswapinstaller/Installer/dist/Installer.jar dcevm-mac.jar
      121 +jar uvf dcevm-mac.jar -C hotswapbinaries/mac/ .
      122 +jar uvf dcevm-mac.jar -C hotswapinstaller/Installer/dist data/dcevm.jar
      123 +
      124 +cp hotswapinstaller/Installer/dist/Installer.jar dcevm-win.jar
      125 +jar uvf dcevm-win.jar -C hotswapbinaries/win/ .
      126 +jar uvf dcevm-win.jar -C hotswapinstaller/Installer/dist data/dcevm.jar
      127 +
      128 +cp hotswapinstaller/Installer/dist/Installer.jar dcevm-linux.jar
      129 +jar uvf dcevm-linux.jar -C hotswapbinaries/linux/ .
      130 +jar uvf dcevm-linux.jar -C hotswapinstaller/Installer/dist data/dcevm.jar
      131 diff -r f5603a6e5042 create_patch_vm_only.cmd
      132 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
      133 +++ b/create_patch_vm_only.cmd	Fri Dec 17 13:23:04 2010 +0100
      134 @@ -0,0 +1,1 @@
      135 +hg diff -r 2039 -X hotswapdoc -X hotswaptest -X hotswapinstaller -X create_patch.cmd -X create_patch_vm_only.cmd >hotswapping_patch_vm_only
      136 \ No newline at end of file
      137 diff -r f5603a6e5042 hotswapbinaries/README
      138 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
      139 +++ b/hotswapbinaries/README	Fri Dec 17 13:23:04 2010 +0100
      140 @@ -0,0 +1,18 @@
      141 +The binary files are not stored in the mercurial repository, because they would bloat the repository size. The expected files in this subdirectory are:
      142 +
      143 +==========================================
      144 +Windows
      145 +win/data/64/bin/server/jvm.dll
      146 +win/data/bin/client/jvm.dll
      147 +win/data/bin/server/jvm.dll
      148 +
      149 +==========================================
      150 +Mac
      151 +mac/data/lib/i386/client/libjvm.dylib
      152 +mac/data/lib/i386/server/libjvm.dylib
      153 +
      154 +==========================================
      155 +Linux
      156 +linux/data/64/lib/amd64/server/libjvm.so
      157 +linux/data/lib/i386/client/libjvm.so
      158 +linux/data/lib/i386/server/libjvm.so
      159 diff -r f5603a6e5042 hotswapinstaller/Installer/build.xml
      160 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
      161 +++ b/hotswapinstaller/Installer/build.xml	Fri Dec 17 13:23:04 2010 +0100
      162 @@ -0,0 +1,96 @@
      163 +<?xml version="1.0" encoding="UTF-8"?>
      164 +<!-- You may freely edit this file. See commented blocks below for -->
      165 +<!-- some examples of how to customize the build. -->
      166 +<!-- (If you delete it and reopen the project it will be recreated.) -->
      167 +<!-- By default, only the Clean and Build commands use this build script. -->
      168 +<!-- Commands such as Run, Debug, and Test only use this build script if -->
      169 +<!-- the Compile on Save feature is turned off for the project. -->
      170 +<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
      171 +<!-- in the project's Project Properties dialog box.-->
      172 +<project name="Installer" default="default" basedir=".">
      173 +    <description>Builds, tests, and runs the project Installer.</description>
      174 +    <import file="nbproject/build-impl.xml"/>
      175 +    <target name="-post-compile">
      176 +        <property name="hotswapvm.dir" value="${build.classes.dir}/../../../.."/>
      177 +          <!--
      178 +          <copy file="${hotswapvm.dir}/hotswapbinaries/win/data/bin/client/jvm.dll" tofile="${build.classes.dir}/data/bin/client/jvm.dll"/>
      179 +          <copy file="${hotswapvm.dir}/hotswapbinaries/win/data/bin/server/jvm.dll" tofile="${build.classes.dir}/data/bin/server/jvm.dll"/>
      180 +          <copy file="${hotswapvm.dir}/hotswapbinaries/win/data/64/bin/server/jvm.dll" tofile="${build.classes.dir}/data/64/bin/server/jvm.dll"/>
      181 +          <copy file="${hotswapvm.dir}/hotswapbinaries/mac/data/lib/i386/client/libjvm.dylib" tofile="${build.classes.dir}/data/lib/i386/client/libjvm.dylib"/>
      182 +          <copy file="${hotswapvm.dir}/hotswapbinaries/mac/data/lib/i386/server/libjvm.dylib" tofile="${build.classes.dir}/data/lib/i386/server/libjvm.dylib"/>     
      183 +-->
      184 +
      185 +
      186 +        <jar destfile="dist/data/dcevm.jar">
      187 +            <manifest>
      188 +                <attribute name="Premain-Class" value="at.ssw.mixin.MixinAgent"/>
      189 +                <attribute name="Can-Retransform-Classes" value="true"/>
      190 +            </manifest>
      191 +            <zipfileset src="${hotswapvm.dir}/hotswaptest/HotSwapTool/dist/HotSwapTool.jar" />
      192 +            <zipfileset src="${hotswapvm.dir}/../Mixin/Mixin/dist/Mixin.jar" />
      193 +            <zipfileset src="${hotswapvm.dir}/../Mixin/Mixin/dist/lib/asm-all-3.3.jar" />
      194 +        </jar>
      195 +
      196 +    </target>
      197 +    <!--
      198 +
      199 +    There exist several targets which are by default empty and which can be 
      200 +    used for execution of your tasks. These targets are usually executed 
      201 +    before and after some main targets. They are: 
      202 +
      203 +      -pre-init:                 called before initialization of project properties
      204 +      -post-init:                called after initialization of project properties
      205 +      -pre-compile:              called before javac compilation
      206 +      -post-compile:             called after javac compilation
      207 +      -pre-compile-single:       called before javac compilation of single file
      208 +      -post-compile-single:      called after javac compilation of single file
      209 +      -pre-compile-test:         called before javac compilation of JUnit tests
      210 +      -post-compile-test:        called after javac compilation of JUnit tests
      211 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
      212 +      -post-compile-test-single: called after javac compilation of single JUunit test
      213 +      -pre-jar:                  called before JAR building
      214 +      -post-jar:                 called after JAR building
      215 +      -post-clean:               called after cleaning build products
      216 +
      217 +    (Targets beginning with '-' are not intended to be called on their own.)
      218 +
      219 +    Example of inserting an obfuscator after compilation could look like this:
      220 +
      221 +        <target name="-post-compile">
      222 +            <obfuscate>
      223 +                <fileset dir="${build.classes.dir}"/>
      224 +            </obfuscate>
      225 +        </target>
      226 +
      227 +    For list of available properties check the imported 
      228 +    nbproject/build-impl.xml file. 
      229 +
      230 +
      231 +    Another way to customize the build is by overriding existing main targets.
      232 +    The targets of interest are: 
      233 +
      234 +      -init-macrodef-javac:     defines macro for javac compilation
      235 +      -init-macrodef-junit:     defines macro for junit execution
      236 +      -init-macrodef-debug:     defines macro for class debugging
      237 +      -init-macrodef-java:      defines macro for class execution
      238 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
      239 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
      240 +      run:                      execution of project 
      241 +      -javadoc-build:           Javadoc generation
      242 +      test-report:              JUnit report generation
      243 +
      244 +    An example of overriding the target for project execution could look like this:
      245 +
      246 +        <target name="run" depends="Installer-impl.jar">
      247 +            <exec dir="bin" executable="launcher.exe">
      248 +                <arg file="${dist.jar}"/>
      249 +            </exec>
      250 +        </target>
      251 +
      252 +    Notice that the overridden target depends on the jar target and not only on 
      253 +    the compile target as the regular run target does. Again, for a list of available 
      254 +    properties which you can use, check the target you are overriding in the
      255 +    nbproject/build-impl.xml file. 
      256 +
      257 +    -->
      258 +</project>
      259 diff -r f5603a6e5042 hotswapinstaller/Installer/manifest.mf
      260 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
      261 +++ b/hotswapinstaller/Installer/manifest.mf	Fri Dec 17 13:23:04 2010 +0100
      262 @@ -0,0 +1,3 @@
      263 +Manifest-Version: 1.0
      264 +X-COMMENT: Main-Class will be added automatically by build
      265 +
      266 diff -r f5603a6e5042 hotswapinstaller/Installer/nbproject/build-impl.xml
      267 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
      268 +++ b/hotswapinstaller/Installer/nbproject/build-impl.xml	Fri Dec 17 13:23:04 2010 +0100
      269 @@ -0,0 +1,883 @@
      270 +<?xml version="1.0" encoding="UTF-8"?>
      271 +<!--
      272 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
      273 +***         EDIT ../build.xml INSTEAD         ***
      274 +
      275 +For the purpose of easier reading the script
      276 +is divided into following sections:
      277 +
      278 +  - initialization
      279 +  - compilation
      280 +  - jar
      281 +  - execution
      282 +  - debugging
      283 +  - javadoc
      284 +  - junit compilation
      285 +  - junit execution
      286 +  - junit debugging
      287 +  - applet
      288 +  - cleanup
      289 +
      290 +        -->
      291 +<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="Installer-impl">
      292 +    <fail message="Please build using Ant 1.7.1 or higher.">
      293 +        <condition>
      294 +            <not>
      295 +                <antversion atleast="1.7.1"/>
      296 +            </not>
      297 +        </condition>
      298 +    </fail>
      299 +    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
      300 +    <!-- 
      301 +                ======================
      302 +                INITIALIZATION SECTION 
      303 +                ======================
      304 +            -->
      305 +    <target name="-pre-init">
      306 +        <!-- Empty placeholder for easier customization. -->
      307 +        <!-- You can override this target in the ../build.xml file. -->
      308 +    </target>
      309 +    <target depends="-pre-init" name="-init-private">
      310 +        <property file="nbproject/private/config.properties"/>
      311 +        <property file="nbproject/private/configs/${config}.properties"/>
      312 +        <property file="nbproject/private/private.properties"/>
      313 +    </target>
      314 +    <target depends="-pre-init,-init-private" name="-init-user">
      315 +        <property file="${user.properties.file}"/>
      316 +        <!-- The two properties below are usually overridden -->
      317 +        <!-- by the active platform. Just a fallback. -->
      318 +        <property name="default.javac.source" value="1.4"/>
      319 +        <property name="default.javac.target" value="1.4"/>
      320 +    </target>
      321 +    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
      322 +        <property file="nbproject/configs/${config}.properties"/>
      323 +        <property file="nbproject/project.properties"/>
      324 +    </target>
      325 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
      326 +        <available file="${manifest.file}" property="manifest.available"/>
      327 +        <available file="${application.splash}" property="splashscreen.available"/>
      328 +        <condition property="main.class.available">
      329 +            <and>
      330 +                <isset property="main.class"/>
      331 +                <not>
      332 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
      333 +                </not>
      334 +            </and>
      335 +        </condition>
      336 +        <condition property="manifest.available+main.class">
      337 +            <and>
      338 +                <isset property="manifest.available"/>
      339 +                <isset property="main.class.available"/>
      340 +            </and>
      341 +        </condition>
      342 +        <condition property="do.mkdist">
      343 +            <and>
      344 +                <isset property="libs.CopyLibs.classpath"/>
      345 +                <not>
      346 +                    <istrue value="${mkdist.disabled}"/>
      347 +                </not>
      348 +            </and>
      349 +        </condition>
      350 +        <condition property="manifest.available+main.class+mkdist.available">
      351 +            <and>
      352 +                <istrue value="${manifest.available+main.class}"/>
      353 +                <isset property="do.mkdist"/>
      354 +            </and>
      355 +        </condition>
      356 +        <condition property="manifest.available+main.class+mkdist.available+splashscreen.available">
      357 +            <and>
      358 +                <istrue value="${manifest.available+main.class+mkdist.available}"/>
      359 +                <istrue value="${splashscreen.available}"/>
      360 +            </and>
      361 +        </condition>
      362 +        <condition property="do.archive">
      363 +            <not>
      364 +                <istrue value="${jar.archive.disabled}"/>
      365 +            </not>
      366 +        </condition>
      367 +        <condition property="do.archive+manifest.available">
      368 +            <and>
      369 +                <isset property="manifest.available"/>
      370 +                <istrue value="${do.archive}"/>
      371 +            </and>
      372 +        </condition>
      373 +        <condition property="do.archive+manifest.available+main.class">
      374 +            <and>
      375 +                <istrue value="${manifest.available+main.class}"/>
      376 +                <istrue value="${do.archive}"/>
      377 +            </and>
      378 +        </condition>
      379 +        <condition property="do.archive+manifest.available+main.class+mkdist.available">
      380 +            <and>
      381 +                <istrue value="${manifest.available+main.class+mkdist.available}"/>
      382 +                <istrue value="${do.archive}"/>
      383 +            </and>
      384 +        </condition>
      385 +        <condition property="do.archive+manifest.available+main.class+mkdist.available+splashscreen.available">
      386 +            <and>
      387 +                <istrue value="${manifest.available+main.class+mkdist.available+splashscreen.available}"/>
      388 +                <istrue value="${do.archive}"/>
      389 +            </and>
      390 +        </condition>
      391 +        <condition property="have.tests">
      392 +            <or>
      393 +                <available file="${test.src.dir}"/>
      394 +            </or>
      395 +        </condition>
      396 +        <condition property="have.sources">
      397 +            <or>
      398 +                <available file="${src.dir}"/>
      399 +            </or>
      400 +        </condition>
      401 +        <condition property="netbeans.home+have.tests">
      402 +            <and>
      403 +                <isset property="netbeans.home"/>
      404 +                <isset property="have.tests"/>
      405 +            </and>
      406 +        </condition>
      407 +        <condition property="no.javadoc.preview">
      408 +            <and>
      409 +                <isset property="javadoc.preview"/>
      410 +                <isfalse value="${javadoc.preview}"/>
      411 +            </and>
      412 +        </condition>
      413 +        <property name="run.jvmargs" value=""/>
      414 +        <property name="javac.compilerargs" value=""/>
      415 +        <property name="work.dir" value="${basedir}"/>
      416 +        <condition property="no.deps">
      417 +            <and>
      418 +                <istrue value="${no.dependencies}"/>
      419 +            </and>
      420 +        </condition>
      421 +        <property name="javac.debug" value="true"/>
      422 +        <property name="javadoc.preview" value="true"/>
      423 +        <property name="application.args" value=""/>
      424 +        <property name="source.encoding" value="${file.encoding}"/>
      425 +        <property name="runtime.encoding" value="${source.encoding}"/>
      426 +        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
      427 +            <and>
      428 +                <isset property="javadoc.encoding"/>
      429 +                <not>
      430 +                    <equals arg1="${javadoc.encoding}" arg2=""/>
      431 +                </not>
      432 +            </and>
      433 +        </condition>
      434 +        <property name="javadoc.encoding.used" value="${source.encoding}"/>
      435 +        <property name="includes" value="**"/>
      436 +        <property name="excludes" value=""/>
      437 +        <property name="do.depend" value="false"/>
      438 +        <condition property="do.depend.true">
      439 +            <istrue value="${do.depend}"/>
      440 +        </condition>
      441 +        <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
      442 +        <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
      443 +            <length length="0" string="${endorsed.classpath}" when="greater"/>
      444 +        </condition>
      445 +        <property name="javac.fork" value="false"/>
      446 +        <property name="jar.index" value="false"/>
      447 +        <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>
      448 +    </target>
      449 +    <target name="-post-init">
      450 +        <!-- Empty placeholder for easier customization. -->
      451 +        <!-- You can override this target in the ../build.xml file. -->
      452 +    </target>
      453 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
      454 +        <fail unless="src.dir">Must set src.dir</fail>
      455 +        <fail unless="test.src.dir">Must set test.src.dir</fail>
      456 +        <fail unless="build.dir">Must set build.dir</fail>
      457 +        <fail unless="dist.dir">Must set dist.dir</fail>
      458 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
      459 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
      460 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
      461 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
      462 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
      463 +        <fail unless="dist.jar">Must set dist.jar</fail>
      464 +    </target>
      465 +    <target name="-init-macrodef-property">
      466 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
      467 +            <attribute name="name"/>
      468 +            <attribute name="value"/>
      469 +            <sequential>
      470 +                <property name="@{name}" value="${@{value}}"/>
      471 +            </sequential>
      472 +        </macrodef>
      473 +    </target>
      474 +    <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
      475 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
      476 +            <attribute default="${src.dir}" name="srcdir"/>
      477 +            <attribute default="${build.classes.dir}" name="destdir"/>
      478 +            <attribute default="${javac.classpath}" name="classpath"/>
      479 +            <attribute default="${javac.processorpath}" name="processorpath"/>
      480 +            <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
      481 +            <attribute default="${includes}" name="includes"/>
      482 +            <attribute default="${excludes}" name="excludes"/>
      483 +            <attribute default="${javac.debug}" name="debug"/>
      484 +            <attribute default="${empty.dir}" name="sourcepath"/>
      485 +            <attribute default="${empty.dir}" name="gensrcdir"/>
      486 +            <element name="customize" optional="true"/>
      487 +            <sequential>
      488 +                <property location="${build.dir}/empty" name="empty.dir"/>
      489 +                <mkdir dir="${empty.dir}"/>
      490 +                <mkdir dir="@{apgeneratedsrcdir}"/>
      491 +                <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}">
      492 +                    <src>
      493 +                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
      494 +                            <include name="*"/>
      495 +                        </dirset>
      496 +                    </src>
      497 +                    <classpath>
      498 +                        <path path="@{classpath}"/>
      499 +                    </classpath>
      500 +                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
      501 +                    <compilerarg line="${javac.compilerargs}"/>
      502 +                    <compilerarg value="-processorpath"/>
      503 +                    <compilerarg path="@{processorpath}:${empty.dir}"/>
      504 +                    <compilerarg line="${ap.processors.internal}"/>
      505 +                    <compilerarg line="${annotation.processing.processor.options}"/>
      506 +                    <compilerarg value="-s"/>
      507 +                    <compilerarg path="@{apgeneratedsrcdir}"/>
      508 +                    <compilerarg line="${ap.proc.none.internal}"/>
      509 +                    <customize/>
      510 +                </javac>
      511 +            </sequential>
      512 +        </macrodef>
      513 +    </target>
      514 +    <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
      515 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
      516 +            <attribute default="${src.dir}" name="srcdir"/>
      517 +            <attribute default="${build.classes.dir}" name="destdir"/>
      518 +            <attribute default="${javac.classpath}" name="classpath"/>
      519 +            <attribute default="${javac.processorpath}" name="processorpath"/>
      520 +            <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
      521 +            <attribute default="${includes}" name="includes"/>
      522 +            <attribute default="${excludes}" name="excludes"/>
      523 +            <attribute default="${javac.debug}" name="debug"/>
      524 +            <attribute default="${empty.dir}" name="sourcepath"/>
      525 +            <attribute default="${empty.dir}" name="gensrcdir"/>
      526 +            <element name="customize" optional="true"/>
      527 +            <sequential>
      528 +                <property location="${build.dir}/empty" name="empty.dir"/>
      529 +                <mkdir dir="${empty.dir}"/>
      530 +                <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}">
      531 +                    <src>
      532 +                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
      533 +                            <include name="*"/>
      534 +                        </dirset>
      535 +                    </src>
      536 +                    <classpath>
      537 +                        <path path="@{classpath}"/>
      538 +                    </classpath>
      539 +                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
      540 +                    <compilerarg line="${javac.compilerargs}"/>
      541 +                    <customize/>
      542 +                </javac>
      543 +            </sequential>
      544 +        </macrodef>
      545 +    </target>
      546 +    <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
      547 +        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
      548 +            <attribute default="${src.dir}" name="srcdir"/>
      549 +            <attribute default="${build.classes.dir}" name="destdir"/>
      550 +            <attribute default="${javac.classpath}" name="classpath"/>
      551 +            <sequential>
      552 +                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
      553 +                    <classpath>
      554 +                        <path path="@{classpath}"/>
      555 +                    </classpath>
      556 +                </depend>
      557 +            </sequential>
      558 +        </macrodef>
      559 +        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
      560 +            <attribute default="${build.classes.dir}" name="destdir"/>
      561 +            <sequential>
      562 +                <fail unless="javac.includes">Must set javac.includes</fail>
      563 +                <pathconvert pathsep="," property="javac.includes.binary">
      564 +                    <path>
      565 +                        <filelist dir="@{destdir}" files="${javac.includes}"/>
      566 +                    </path>
      567 +                    <globmapper from="*.java" to="*.class"/>
      568 +                </pathconvert>
      569 +                <delete>
      570 +                    <files includes="${javac.includes.binary}"/>
      571 +                </delete>
      572 +            </sequential>
      573 +        </macrodef>
      574 +    </target>
      575 +    <target name="-init-macrodef-junit">
      576 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
      577 +            <attribute default="${includes}" name="includes"/>
      578 +            <attribute default="${excludes}" name="excludes"/>
      579 +            <attribute default="**" name="testincludes"/>
      580 +            <sequential>
      581 +                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${build.dir}">
      582 +                    <batchtest todir="${build.test.results.dir}">
      583 +                        <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
      584 +                            <filename name="@{testincludes}"/>
      585 +                        </fileset>
      586 +                    </batchtest>
      587 +                    <classpath>
      588 +                        <path path="${run.test.classpath}"/>
      589 +                    </classpath>
      590 +                    <syspropertyset>
      591 +                        <propertyref prefix="test-sys-prop."/>
      592 +                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
      593 +                    </syspropertyset>
      594 +                    <formatter type="brief" usefile="false"/>
      595 +                    <formatter type="xml"/>
      596 +                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
      597 +                    <jvmarg line="${run.jvmargs}"/>
      598 +                </junit>
      599 +            </sequential>
      600 +        </macrodef>
      601 +    </target>
      602 +    <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
      603 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
      604 +            <attribute default="${main.class}" name="name"/>
      605 +            <attribute default="${debug.classpath}" name="classpath"/>
      606 +            <attribute default="" name="stopclassname"/>
      607 +            <sequential>
      608 +                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
      609 +                    <classpath>
      610 +                        <path path="@{classpath}"/>
      611 +                    </classpath>
      612 +                </nbjpdastart>
      613 +            </sequential>
      614 +        </macrodef>
      615 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
      616 +            <attribute default="${build.classes.dir}" name="dir"/>
      617 +            <sequential>
      618 +                <nbjpdareload>
      619 +                    <fileset dir="@{dir}" includes="${fix.classes}">
      620 +                        <include name="${fix.includes}*.class"/>
      621 +                    </fileset>
      622 +                </nbjpdareload>
      623 +            </sequential>
      624 +        </macrodef>
      625 +    </target>
      626 +    <target name="-init-debug-args">
      627 +        <property name="version-output" value="java version &quot;${ant.java.version}"/>
      628 +        <condition property="have-jdk-older-than-1.4">
      629 +            <or>
      630 +                <contains string="${version-output}" substring="java version &quot;1.0"/>
      631 +                <contains string="${version-output}" substring="java version &quot;1.1"/>
      632 +                <contains string="${version-output}" substring="java version &quot;1.2"/>
      633 +                <contains string="${version-output}" substring="java version &quot;1.3"/>
      634 +            </or>
      635 +        </condition>
      636 +        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
      637 +            <istrue value="${have-jdk-older-than-1.4}"/>
      638 +        </condition>
      639 +        <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
      640 +            <os family="windows"/>
      641 +        </condition>
      642 +        <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
      643 +            <isset property="debug.transport"/>
      644 +        </condition>
      645 +    </target>
      646 +    <target depends="-init-debug-args" name="-init-macrodef-debug">
      647 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
      648 +            <attribute default="${main.class}" name="classname"/>
      649 +            <attribute default="${debug.classpath}" name="classpath"/>
      650 +            <element name="customize" optional="true"/>
      651 +            <sequential>
      652 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
      653 +                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
      654 +                    <jvmarg line="${debug-args-line}"/>
      655 +                    <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
      656 +                    <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
      657 +                    <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
      658 +                    <jvmarg line="${run.jvmargs}"/>
      659 +                    <classpath>
      660 +                        <path path="@{classpath}"/>
      661 +                    </classpath>
      662 +                    <syspropertyset>
      663 +                        <propertyref prefix="run-sys-prop."/>
      664 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
      665 +                    </syspropertyset>
      666 +                    <customize/>
      667 +                </java>
      668 +            </sequential>
      669 +        </macrodef>
      670 +    </target>
      671 +    <target name="-init-macrodef-java">
      672 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
      673 +            <attribute default="${main.class}" name="classname"/>
      674 +            <attribute default="${run.classpath}" name="classpath"/>
      675 +            <element name="customize" optional="true"/>
      676 +            <sequential>
      677 +                <java classname="@{classname}" dir="${work.dir}" fork="true">
      678 +                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
      679 +                    <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
      680 +                    <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
      681 +                    <jvmarg line="${run.jvmargs}"/>
      682 +                    <classpath>
      683 +                        <path path="@{classpath}"/>
      684 +                    </classpath>
      685 +                    <syspropertyset>
      686 +                        <propertyref prefix="run-sys-prop."/>
      687 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
      688 +                    </syspropertyset>
      689 +                    <customize/>
      690 +                </java>
      691 +            </sequential>
      692 +        </macrodef>
      693 +    </target>
      694 +    <target name="-init-macrodef-copylibs">
      695 +        <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3">
      696 +            <element name="customize" optional="true"/>
      697 +            <sequential>
      698 +                <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
      699 +                <pathconvert property="run.classpath.without.build.classes.dir">
      700 +                    <path path="${run.classpath}"/>
      701 +                    <map from="${build.classes.dir.resolved}" to=""/>
      702 +                </pathconvert>
      703 +                <pathconvert pathsep=" " property="jar.classpath">
      704 +                    <path path="${run.classpath.without.build.classes.dir}"/>
      705 +                    <chainedmapper>
      706 +                        <flattenmapper/>
      707 +                        <globmapper from="*" to="lib/*"/>
      708 +                    </chainedmapper>
      709 +                </pathconvert>
      710 +                <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
      711 +                <copylibs compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
      712 +                    <fileset dir="${build.classes.dir}"/>
      713 +                    <manifest>
      714 +                        <attribute name="Class-Path" value="${jar.classpath}"/>
      715 +                        <customize/>
      716 +                    </manifest>
      717 +                </copylibs>
      718 +            </sequential>
      719 +        </macrodef>
      720 +    </target>
      721 +    <target name="-init-presetdef-jar">
      722 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
      723 +            <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}">
      724 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
      725 +            </jar>
      726 +        </presetdef>
      727 +    </target>
      728 +    <target name="-init-ap-cmdline-properties">
      729 +        <property name="annotation.processing.enabled" value="true"/>
      730 +        <property name="annotation.processing.processors.list" value=""/>
      731 +        <property name="annotation.processing.processor.options" value=""/>
      732 +        <property name="annotation.processing.run.all.processors" value="true"/>
      733 +        <property name="javac.processorpath" value="${javac.classpath}"/>
      734 +        <property name="javac.test.processorpath" value="${javac.test.classpath}"/>
      735 +        <condition property="ap.supported.internal" value="true">
      736 +            <not>
      737 +                <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
      738 +            </not>
      739 +        </condition>
      740 +    </target>
      741 +    <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
      742 +        <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
      743 +            <isfalse value="${annotation.processing.run.all.processors}"/>
      744 +        </condition>
      745 +        <condition else="" property="ap.proc.none.internal" value="-proc:none">
      746 +            <isfalse value="${annotation.processing.enabled}"/>
      747 +        </condition>
      748 +    </target>
      749 +    <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
      750 +        <property name="ap.cmd.line.internal" value=""/>
      751 +    </target>
      752 +    <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"/>
      753 +    <!--
      754 +                ===================
      755 +                COMPILATION SECTION
      756 +                ===================
      757 +            -->
      758 +    <target name="-deps-jar-init" unless="built-jar.properties">
      759 +        <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
      760 +        <delete file="${built-jar.properties}" quiet="true"/>
      761 +    </target>
      762 +    <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
      763 +        <echo level="warn" message="Cycle detected: Installer was already built"/>
      764 +    </target>
      765 +    <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
      766 +        <mkdir dir="${build.dir}"/>
      767 +        <touch file="${built-jar.properties}" verbose="false"/>
      768 +        <property file="${built-jar.properties}" prefix="already.built.jar."/>
      769 +        <antcall target="-warn-already-built-jar"/>
      770 +        <propertyfile file="${built-jar.properties}">
      771 +            <entry key="${basedir}" value=""/>
      772 +        </propertyfile>
      773 +    </target>
      774 +    <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
      775 +    <target depends="init" name="-check-automatic-build">
      776 +        <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
      777 +    </target>
      778 +    <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
      779 +        <antcall target="clean"/>
      780 +    </target>
      781 +    <target depends="init,deps-jar" name="-pre-pre-compile">
      782 +        <mkdir dir="${build.classes.dir}"/>
      783 +    </target>
      784 +    <target name="-pre-compile">
      785 +        <!-- Empty placeholder for easier customization. -->
      786 +        <!-- You can override this target in the ../build.xml file. -->
      787 +    </target>
      788 +    <target if="do.depend.true" name="-compile-depend">
      789 +        <pathconvert property="build.generated.subdirs">
      790 +            <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
      791 +                <include name="*"/>
      792 +            </dirset>
      793 +        </pathconvert>
      794 +        <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
      795 +    </target>
      796 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
      797 +        <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
      798 +        <copy todir="${build.classes.dir}">
      799 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
      800 +        </copy>
      801 +    </target>
      802 +    <target if="has.persistence.xml" name="-copy-persistence-xml">
      803 +        <mkdir dir="${build.classes.dir}/META-INF"/>
      804 +        <copy todir="${build.classes.dir}/META-INF">
      805 +            <fileset dir="${meta.inf.dir}" includes="persistence.xml"/>
      806 +        </copy>
      807 +    </target>
      808 +    <target name="-post-compile">
      809 +        <!-- Empty placeholder for easier customization. -->
      810 +        <!-- You can override this target in the ../build.xml file. -->
      811 +    </target>
      812 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
      813 +    <target name="-pre-compile-single">
      814 +        <!-- Empty placeholder for easier customization. -->
      815 +        <!-- You can override this target in the ../build.xml file. -->
      816 +    </target>
      817 +    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
      818 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
      819 +        <j2seproject3:force-recompile/>
      820 +        <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
      821 +    </target>
      822 +    <target name="-post-compile-single">
      823 +        <!-- Empty placeholder for easier customization. -->
      824 +        <!-- You can override this target in the ../build.xml file. -->
      825 +    </target>
      826 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
      827 +    <!--
      828 +                ====================
      829 +                JAR BUILDING SECTION
      830 +                ====================
      831 +            -->
      832 +    <target depends="init" name="-pre-pre-jar">
      833 +        <dirname file="${dist.jar}" property="dist.jar.dir"/>
      834 +        <mkdir dir="${dist.jar.dir}"/>
      835 +    </target>
      836 +    <target name="-pre-jar">
      837 +        <!-- Empty placeholder for easier customization. -->
      838 +        <!-- You can override this target in the ../build.xml file. -->
      839 +    </target>
      840 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available">
      841 +        <j2seproject1:jar/>
      842 +    </target>
      843 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
      844 +        <j2seproject1:jar manifest="${manifest.file}"/>
      845 +    </target>
      846 +    <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">
      847 +        <j2seproject1:jar manifest="${manifest.file}">
      848 +            <j2seproject1:manifest>
      849 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
      850 +            </j2seproject1:manifest>
      851 +        </j2seproject1:jar>
      852 +        <echo>To run this application from the command line without Ant, try:</echo>
      853 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
      854 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
      855 +        <pathconvert property="run.classpath.with.dist.jar">
      856 +            <path path="${run.classpath}"/>
      857 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
      858 +        </pathconvert>
      859 +        <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
      860 +    </target>
      861 +    <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">
      862 +        <basename file="${application.splash}" property="splashscreen.basename"/>
      863 +        <mkdir dir="${build.classes.dir}/META-INF"/>
      864 +        <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/>
      865 +        <j2seproject3:copylibs>
      866 +            <customize>
      867 +                <attribute name="Main-Class" value="${main.class}"/>
      868 +                <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
      869 +            </customize>
      870 +        </j2seproject3:copylibs>
      871 +        <echo>To run this application from the command line without Ant, try:</echo>
      872 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
      873 +        <echo>java -jar "${dist.jar.resolved}"</echo>
      874 +    </target>
      875 +    <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">
      876 +        <j2seproject3:copylibs>
      877 +            <customize>
      878 +                <attribute name="Main-Class" value="${main.class}"/>
      879 +            </customize>
      880 +        </j2seproject3:copylibs>
      881 +        <echo>To run this application from the command line without Ant, try:</echo>
      882 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
      883 +        <echo>java -jar "${dist.jar.resolved}"</echo>
      884 +    </target>
      885 +    <target name="-post-jar">
      886 +        <!-- Empty placeholder for easier customization. -->
      887 +        <!-- You can override this target in the ../build.xml file. -->
      888 +    </target>
      889 +    <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"/>
      890 +    <!--
      891 +                =================
      892 +                EXECUTION SECTION
      893 +                =================
      894 +            -->
      895 +    <target depends="init,compile" description="Run a main class." name="run">
      896 +        <j2seproject1:java>
      897 +            <customize>
      898 +                <arg line="${application.args}"/>
      899 +            </customize>
      900 +        </j2seproject1:java>
      901 +    </target>
      902 +    <target name="-do-not-recompile">
      903 +        <property name="javac.includes.binary" value=""/>
      904 +    </target>
      905 +    <target depends="init,compile-single" name="run-single">
      906 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
      907 +        <j2seproject1:java classname="${run.class}"/>
      908 +    </target>
      909 +    <target depends="init,compile-test-single" name="run-test-with-main">
      910 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
      911 +        <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
      912 +    </target>
      913 +    <!--
      914 +                =================
      915 +                DEBUGGING SECTION
      916 +                =================
      917 +            -->
      918 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
      919 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
      920 +    </target>
      921 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
      922 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
      923 +    </target>
      924 +    <target depends="init,compile" name="-debug-start-debuggee">
      925 +        <j2seproject3:debug>
      926 +            <customize>
      927 +                <arg line="${application.args}"/>
      928 +            </customize>
      929 +        </j2seproject3:debug>
      930 +    </target>
      931 +    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
      932 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
      933 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
      934 +    </target>
      935 +    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
      936 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
      937 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
      938 +        <j2seproject3:debug classname="${debug.class}"/>
      939 +    </target>
      940 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
      941 +    <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
      942 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
      943 +        <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
      944 +    </target>
      945 +    <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
      946 +    <target depends="init" name="-pre-debug-fix">
      947 +        <fail unless="fix.includes">Must set fix.includes</fail>
      948 +        <property name="javac.includes" value="${fix.includes}.java"/>
      949 +    </target>
      950 +    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
      951 +        <j2seproject1:nbjpdareload/>
      952 +    </target>
      953 +    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
      954 +    <!--
      955 +                ===============
      956 +                JAVADOC SECTION
      957 +                ===============
      958 +            -->
      959 +    <target depends="init" if="have.sources" name="-javadoc-build">
      960 +        <mkdir dir="${dist.javadoc.dir}"/>
      961 +        <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}">
      962 +            <classpath>
      963 +                <path path="${javac.classpath}"/>
      964 +            </classpath>
      965 +            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
      966 +                <filename name="**/*.java"/>
      967 +            </fileset>
      968 +            <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
      969 +                <include name="**/*.java"/>
      970 +            </fileset>
      971 +        </javadoc>
      972 +    </target>
      973 +    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
      974 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
      975 +    </target>
      976 +    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
      977 +    <!--
      978 +                =========================
      979 +                JUNIT COMPILATION SECTION
      980 +                =========================
      981 +            -->
      982 +    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
      983 +        <mkdir dir="${build.test.classes.dir}"/>
      984 +    </target>
      985 +    <target name="-pre-compile-test">
      986 +        <!-- Empty placeholder for easier customization. -->
      987 +        <!-- You can override this target in the ../build.xml file. -->
      988 +    </target>
      989 +    <target if="do.depend.true" name="-compile-test-depend">
      990 +        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
      991 +    </target>
      992 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
      993 +        <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}"/>
      994 +        <copy todir="${build.test.classes.dir}">
      995 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
      996 +        </copy>
      997 +    </target>
      998 +    <target name="-post-compile-test">
      999 +        <!-- Empty placeholder for easier customization. -->
     1000 +        <!-- You can override this target in the ../build.xml file. -->
     1001 +    </target>
     1002 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
     1003 +    <target name="-pre-compile-test-single">
     1004 +        <!-- Empty placeholder for easier customization. -->
     1005 +        <!-- You can override this target in the ../build.xml file. -->
     1006 +    </target>
     1007 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
     1008 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
     1009 +        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
     1010 +        <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}"/>
     1011 +        <copy todir="${build.test.classes.dir}">
     1012 +            <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
     1013 +        </copy>
     1014 +    </target>
     1015 +    <target name="-post-compile-test-single">
     1016 +        <!-- Empty placeholder for easier customization. -->
     1017 +        <!-- You can override this target in the ../build.xml file. -->
     1018 +    </target>
     1019 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
     1020 +    <!--
     1021 +                =======================
     1022 +                JUNIT EXECUTION SECTION
     1023 +                =======================
     1024 +            -->
     1025 +    <target depends="init" if="have.tests" name="-pre-test-run">
     1026 +        <mkdir dir="${build.test.results.dir}"/>
     1027 +    </target>
     1028 +    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
     1029 +        <j2seproject3:junit testincludes="**/*Test.java"/>
     1030 +    </target>
     1031 +    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
     1032 +        <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
     1033 +    </target>
     1034 +    <target depends="init" if="have.tests" name="test-report"/>
     1035 +    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
     1036 +    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
     1037 +    <target depends="init" if="have.tests" name="-pre-test-run-single">
     1038 +        <mkdir dir="${build.test.results.dir}"/>
     1039 +    </target>
     1040 +    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
     1041 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
     1042 +        <j2seproject3:junit excludes="" includes="${test.includes}"/>
     1043 +    </target>
     1044 +    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
     1045 +        <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
     1046 +    </target>
     1047 +    <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"/>
     1048 +    <!--
     1049 +                =======================
     1050 +                JUNIT DEBUGGING SECTION
     1051 +                =======================
     1052 +            -->
     1053 +    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
     1054 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
     1055 +        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
     1056 +        <delete file="${test.report.file}"/>
     1057 +        <mkdir dir="${build.test.results.dir}"/>
     1058 +        <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}">
     1059 +            <customize>
     1060 +                <syspropertyset>
     1061 +                    <propertyref prefix="test-sys-prop."/>
     1062 +                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
     1063 +                </syspropertyset>
     1064 +                <arg value="${test.class}"/>
     1065 +                <arg value="showoutput=true"/>
     1066 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
     1067 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
     1068 +            </customize>
     1069 +        </j2seproject3:debug>
     1070 +    </target>
     1071 +    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
     1072 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
     1073 +    </target>
     1074 +    <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
     1075 +    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
     1076 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
     1077 +    </target>
     1078 +    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
     1079 +    <!--
     1080 +                =========================
     1081 +                APPLET EXECUTION SECTION
     1082 +                =========================
     1083 +            -->
     1084 +    <target depends="init,compile-single" name="run-applet">
     1085 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
     1086 +        <j2seproject1:java classname="sun.applet.AppletViewer">
     1087 +            <customize>
     1088 +                <arg value="${applet.url}"/>
     1089 +            </customize>
     1090 +        </j2seproject1:java>
     1091 +    </target>
     1092 +    <!--
     1093 +                =========================
     1094 +                APPLET DEBUGGING  SECTION
     1095 +                =========================
     1096 +            -->
     1097 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
     1098 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
     1099 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
     1100 +            <customize>
     1101 +                <arg value="${applet.url}"/>
     1102 +            </customize>
     1103 +        </j2seproject3:debug>
     1104 +    </target>
     1105 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
     1106 +    <!--
     1107 +                ===============
     1108 +                CLEANUP SECTION
     1109 +                ===============
     1110 +            -->
     1111 +    <target name="-deps-clean-init" unless="built-clean.properties">
     1112 +        <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
     1113 +        <delete file="${built-clean.properties}" quiet="true"/>
     1114 +    </target>
     1115 +    <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
     1116 +        <echo level="warn" message="Cycle detected: Installer was already built"/>
     1117 +    </target>
     1118 +    <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
     1119 +        <mkdir dir="${build.dir}"/>
     1120 +        <touch file="${built-clean.properties}" verbose="false"/>
     1121 +        <property file="${built-clean.properties}" prefix="already.built.clean."/>
     1122 +        <antcall target="-warn-already-built-clean"/>
     1123 +        <propertyfile file="${built-clean.properties}">
     1124 +            <entry key="${basedir}" value=""/>
     1125 +        </propertyfile>
     1126 +    </target>
     1127 +    <target depends="init" name="-do-clean">
     1128 +        <delete dir="${build.dir}"/>
     1129 +        <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
     1130 +    </target>
     1131 +    <target name="-post-clean">
     1132 +        <!-- Empty placeholder for easier customization. -->
     1133 +        <!-- You can override this target in the ../build.xml file. -->
     1134 +    </target>
     1135 +    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
     1136 +    <target name="-check-call-dep">
     1137 +        <property file="${call.built.properties}" prefix="already.built."/>
     1138 +        <condition property="should.call.dep">
     1139 +            <not>
     1140 +                <isset property="already.built.${call.subproject}"/>
     1141 +            </not>
     1142 +        </condition>
     1143 +    </target>
     1144 +    <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
     1145 +        <ant antfile="${call.script}" inheritall="false" target="${call.target}">
     1146 +            <propertyset>
     1147 +                <propertyref prefix="transfer."/>
     1148 +                <mapper from="transfer.*" to="*" type="glob"/>
     1149 +            </propertyset>
     1150 +        </ant>
     1151 +    </target>
     1152 +</project>
     1153 diff -r f5603a6e5042 hotswapinstaller/Installer/nbproject/project.properties
     1154 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1155 +++ b/hotswapinstaller/Installer/nbproject/project.properties	Fri Dec 17 13:23:04 2010 +0100
     1156 @@ -0,0 +1,63 @@
     1157 +build.classes.dir=${build.dir}/classes
     1158 +build.classes.excludes=**/*.java,**/*.form
     1159 +# This directory is removed when the project is cleaned:
     1160 +build.dir=build
     1161 +build.generated.dir=${build.dir}/generated
     1162 +build.generated.sources.dir=${build.dir}/generated-sources
     1163 +# Only compile against the classpath explicitly listed here:
     1164 +build.sysclasspath=ignore
     1165 +build.test.classes.dir=${build.dir}/test/classes
     1166 +build.test.results.dir=${build.dir}/test/results
     1167 +# Uncomment to specify the preferred debugger connection transport:
     1168 +#debug.transport=dt_socket
     1169 +debug.classpath=\
     1170 +    ${run.classpath}
     1171 +debug.test.classpath=\
     1172 +    ${run.test.classpath}
     1173 +# This directory is removed when the project is cleaned:
     1174 +dist.dir=dist
     1175 +dist.jar=${dist.dir}/Installer.jar
     1176 +dist.javadoc.dir=${dist.dir}/javadoc
     1177 +excludes=
     1178 +includes=**
     1179 +jar.compress=false
     1180 +javac.classpath=
     1181 +# Space-separated list of extra javac options
     1182 +javac.compilerargs=
     1183 +javac.deprecation=false
     1184 +javac.source=1.5
     1185 +javac.target=1.5
     1186 +javac.test.classpath=\
     1187 +    ${javac.classpath}:\
     1188 +    ${build.classes.dir}:\
     1189 +    ${libs.junit.classpath}:\
     1190 +    ${libs.junit_4.classpath}
     1191 +javadoc.additionalparam=
     1192 +javadoc.author=false
     1193 +javadoc.encoding=${source.encoding}
     1194 +javadoc.noindex=false
     1195 +javadoc.nonavbar=false
     1196 +javadoc.notree=false
     1197 +javadoc.private=false
     1198 +javadoc.splitindex=true
     1199 +javadoc.use=true
     1200 +javadoc.version=false
     1201 +javadoc.windowtitle=
     1202 +jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api"
     1203 +main.class=at.ssw.hotswap.installer.Main
     1204 +manifest.file=manifest.mf
     1205 +meta.inf.dir=${src.dir}/META-INF
     1206 +platform.active=default_platform
     1207 +run.classpath=\
     1208 +    ${javac.classpath}:\
     1209 +    ${build.classes.dir}
     1210 +# Space-separated list of JVM arguments used when running the project
     1211 +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
     1212 +# or test-sys-prop.name=value to set system properties for unit tests):
     1213 +run.jvmargs=
     1214 +run.test.classpath=\
     1215 +    ${javac.test.classpath}:\
     1216 +    ${build.test.classes.dir}
     1217 +source.encoding=UTF-8
     1218 +src.dir=src
     1219 +test.src.dir=test
     1220 diff -r f5603a6e5042 hotswapinstaller/Installer/nbproject/project.xml
     1221 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1222 +++ b/hotswapinstaller/Installer/nbproject/project.xml	Fri Dec 17 13:23:04 2010 +0100
     1223 @@ -0,0 +1,15 @@
     1224 +<?xml version="1.0" encoding="UTF-8"?>
     1225 +<project xmlns="http://www.netbeans.org/ns/project/1">
     1226 +    <type>org.netbeans.modules.java.j2seproject</type>
     1227 +    <configuration>
     1228 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
     1229 +            <name>Installer</name>
     1230 +            <source-roots>
     1231 +                <root id="src.dir"/>
     1232 +            </source-roots>
     1233 +            <test-roots>
     1234 +                <root id="test.src.dir"/>
     1235 +            </test-roots>
     1236 +        </data>
     1237 +    </configuration>
     1238 +</project>
     1239 diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/Installation.java
     1240 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1241 +++ b/hotswapinstaller/Installer/src/at/ssw/hotswap/installer/Installation.java	Fri Dec 17 13:23:04 2010 +0100
     1242 @@ -0,0 +1,137 @@
     1243 +/*
     1244 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     1245 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1246 + *
     1247 + * This code is free software; you can redistribute it and/or modify it
     1248 + * under the terms of the GNU General Public License version 2 only, as
     1249 + * published by the Free Software Foundation.
     1250 + *
     1251 + * This code is distributed in the hope that it will be useful, but WITHOUT
     1252 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     1253 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     1254 + * version 2 for more details (a copy is included in the LICENSE file that
     1255 + * accompanied this code).
     1256 + *
     1257 + * You should have received a copy of the GNU General Public License version
     1258 + * 2 along with this work; if not, write to the Free Software Foundation,
     1259 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     1260 + *
     1261 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     1262 + * or visit www.oracle.com if you need additional information or have any
     1263 + * questions.
     1264 + *
     1265 + */
     1266 +package at.ssw.hotswap.installer;
     1267 +
     1268 +import java.io.File;
     1269 +import java.io.IOException;
     1270 +import java.util.Observable;
     1271 +
     1272 +/**
     1273 + * @author Kerstin Breiteneder
     1274 + * @author Christoph Wimberger
     1275 + */
     1276 +public class Installation extends Observable {
     1277 +
     1278 +    private final File file;
     1279 +    private final boolean isJDK;
     1280 +    private final Installer installer;
     1281 +    private boolean installed;
     1282 +    private String version;
     1283 +    private String dceVersion;
     1284 +    private boolean is64Bit;
     1285 +
     1286 +    public Installation(File f, Installer i) throws InstallerException {
     1287 +        installer = i;
     1288 +        try {
     1289 +            file = f.getCanonicalFile();
     1290 +        } catch (IOException ex) {
     1291 +            throw new InstallerException(f.getAbsolutePath() + " is no JRE or JDK-directory.");
     1292 +        }
     1293 +        isJDK = installer.isJDK(file);
     1294 +        if (!isJDK && !installer.isJRE(file)) {
     1295 +            throw new InstallerException(f.getAbsolutePath() + " is no JRE or JDK-directory.");
     1296 +        }
     1297 +
     1298 +        version = installer.getJavaVersion(file);
     1299 +        update();
     1300 +    }
     1301 +
     1302 +    final public void update() throws InstallerException {
     1303 +        installed = installer.isDCEInstalled(file);
     1304 +        if (installed) {
     1305 +            dceVersion = installer.getDCEVersion(file);
     1306 +        }
     1307 +        is64Bit = installer.is64Bit(file);
     1308 +    }
     1309 +
     1310 +    public File getPath() {
     1311 +        return file;
     1312 +    }
     1313 +
     1314 +    public String getVersion() {
     1315 +        return version;
     1316 +    }
     1317 +
     1318 +    public String getDCEVersion() {
     1319 +        return dceVersion;
     1320 +    }
     1321 +
     1322 +    public boolean isJDK() {
     1323 +        return isJDK;
     1324 +    }
     1325 +
     1326 +    public boolean is64Bit() {
     1327 +        return is64Bit;
     1328 +    }
     1329 +
     1330 +    public void installDCE() throws InstallerException {
     1331 +        try {
     1332 +            installer.install(file, is64Bit);
     1333 +        } catch (InstallerException ex) {
     1334 +            throw new InstallerException("Could not install DCE to " + file.getAbsolutePath() + ".", ex);
     1335 +        }
     1336 +        installed = true;
     1337 +        update();
     1338 +        setChanged();
     1339 +        notifyObservers();
     1340 +    }
     1341 +
     1342 +    public void uninstallDCE() throws InstallerException {
     1343 +        try {
     1344 +            installer.uninstall(file, is64Bit);
     1345 +        } catch (InstallerException ex) {
     1346 +            throw new InstallerException("Could not uninstall DCE to " + file.getAbsolutePath() + ".", ex);
     1347 +        }
     1348 +        installed = false;
     1349 +        update();
     1350 +        setChanged();
     1351 +        notifyObservers();
     1352 +    }
     1353 +
     1354 +    public boolean isDCEInstalled() {
     1355 +        return installed;
     1356 +    }
     1357 +
     1358 +    @Override
     1359 +    public boolean equals(Object obj) {
     1360 +        if (obj == null) {
     1361 +            return false;
     1362 +        }
     1363 +        if (getClass() != obj.getClass()) {
     1364 +            return false;
     1365 +        }
     1366 +        final Installation other = (Installation) obj;
     1367 +        if (this.file != other.file && (this.file == null || !this.file.equals(other.file))) {
     1368 +            return false;
     1369 +        }
     1370 +        return true;
     1371 +    }
     1372 +
     1373 +    @Override
     1374 +    public int hashCode() {
     1375 +        int hash = 5;
     1376 +        hash = 97 * hash + (this.file != null ? this.file.hashCode() : 0);
     1377 +        return hash;
     1378 +    }
     1379 +}
     1380 diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/Installer.java
     1381 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1382 +++ b/hotswapinstaller/Installer/src/at/ssw/hotswap/installer/Installer.java	Fri Dec 17 13:23:04 2010 +0100
     1383 @@ -0,0 +1,359 @@
     1384 +/*
     1385 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     1386 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1387 + *
     1388 + * This code is free software; you can redistribute it and/or modify it
     1389 + * under the terms of the GNU General Public License version 2 only, as
     1390 + * published by the Free Software Foundation.
     1391 + *
     1392 + * This code is distributed in the hope that it will be useful, but WITHOUT
     1393 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     1394 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     1395 + * version 2 for more details (a copy is included in the LICENSE file that
     1396 + * accompanied this code).
     1397 + *
     1398 + * You should have received a copy of the GNU General Public License version
     1399 + * 2 along with this work; if not, write to the Free Software Foundation,
     1400 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     1401 + *
     1402 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     1403 + * or visit www.oracle.com if you need additional information or have any
     1404 + * questions.
     1405 + *
     1406 + */
     1407 +package at.ssw.hotswap.installer;
     1408 +
     1409 +import java.io.BufferedReader;
     1410 +import java.io.File;
     1411 +import java.io.FileOutputStream;
     1412 +import java.io.IOException;
     1413 +import java.io.InputStream;
     1414 +import java.io.InputStreamReader;
     1415 +import java.util.ArrayList;
     1416 +import java.util.Arrays;
     1417 +import java.util.List;
     1418 +import java.util.logging.Level;
     1419 +import java.util.logging.Logger;
     1420 +import java.util.regex.Matcher;
     1421 +import java.util.regex.Pattern;
     1422 +
     1423 +/**
     1424 + * @author Kerstin Breiteneder
     1425 + * @author Christoph Wimberger
     1426 + */
     1427 +public abstract class Installer {
     1428 +
     1429 +    public String getJREDirectory() {
     1430 +        return "jre";
     1431 +    }
     1432 +
     1433 +    public String getBackupLibraryName() {
     1434 +        return getLibraryName() + ".backup";
     1435 +    }
     1436 +
     1437 +    public String getTemporaryLibraryName() {
     1438 +        return getLibraryName() + ".temp";
     1439 +    }
     1440 +
     1441 +    public abstract String getClientDirectory();
     1442 +
     1443 +    public abstract String getServerDirectory(boolean is64bit);
     1444 +
     1445 +    public abstract String getLibraryName();
     1446 +
     1447 +    public abstract String getJavaExecutable();
     1448 +
     1449 +    public abstract List<Installation> listAllInstallations();
     1450 +
     1451 +    public static Installer create() throws InstallerException {
     1452 +
     1453 +        String os = System.getProperty("os.name").toLowerCase();
     1454 +
     1455 +        if (os.contains("windows")) {
     1456 +            return new WindowsInstaller();
     1457 +        } else if (os.contains("mac") || os.contains("darwin")) {
     1458 +            return new MacInstaller();
     1459 +        } else if (os.contains("unix") || os.contains("linux")) {
     1460 +            return new LinuxInstaller();
     1461 +        }
     1462 +        throw new InstallerException("Unknown OS is unsupported.");
     1463 +    }
     1464 +
     1465 +    final protected void extractFile(String jarpath, String dest) throws InstallerException {
     1466 +        boolean fileCreated = false;
     1467 +        FileOutputStream output = null;
     1468 +        InputStream in = Main.class.getClassLoader().getResourceAsStream(jarpath);
     1469 +        if (in == null) {
     1470 +            throw new InstallerException("Could not find " + jarpath + " in jar-file.");
     1471 +        }
     1472 +
     1473 +        boolean failure = false;
     1474 +        try {
     1475 +            output = new FileOutputStream(dest);
     1476 +            fileCreated = true;
     1477 +            int len = 0;
     1478 +            byte[] cur = new byte[102400];
     1479 +            while ((len = in.read(cur)) != -1) {
     1480 +                output.write(cur, 0, len);
     1481 +            }
     1482 +        } catch (Exception ex) {
     1483 +            failure = true;
     1484 +            throw new InstallerException("Could not extract file " + dest + ".", ex);
     1485 +        } finally {
     1486 +            if (output != null) {
     1487 +                try {
     1488 +                    output.close();
     1489 +                } catch (Exception e) {
     1490 +                }
     1491 +            }
     1492 +            if (failure && fileCreated) {
     1493 +                deleteFile(dest);
     1494 +            }
     1495 +        }
     1496 +    }
     1497 +
     1498 +    public void install(File dir, boolean bit64) throws InstallerException {
     1499 +        if (isJDK(dir)) {
     1500 +            dir = new File(dir, getJREDirectory());
     1501 +        }
     1502 +
     1503 +        String dcevm_jar = new File(dir, "lib" + File.separator + "ext" + File.separator + "dcevm.jar").getPath();
     1504 +        extractFile("data/dcevm.jar", dcevm_jar);
     1505 +
     1506 +        if (new File(dir, getServerDirectory(bit64)).exists()) {
     1507 +            installClientServer(dir, getServerDirectory(bit64), bit64);
     1508 +        }
     1509 +
     1510 +        if (new File(dir, getClientDirectory()).exists() && !bit64) {
     1511 +            try {
     1512 +                installClientServer(dir, getClientDirectory(), false);
     1513 +            } catch (InstallerException e) {
     1514 +                uninstallClientServer(dir, getServerDirectory(bit64));
     1515 +                throw e;
     1516 +            }
     1517 +        }
     1518 +    }
     1519 +
     1520 +    public void uninstall(File dir, boolean bit64) throws InstallerException {
     1521 +        if (isJDK(dir)) {
     1522 +            dir = new File(dir, getJREDirectory());
     1523 +        }
     1524 +
     1525 +        if (new File(dir, getServerDirectory(bit64)).exists()) {
     1526 +            uninstallClientServer(dir, getServerDirectory(bit64));
     1527 +        }
     1528 +
     1529 +        if (new File(dir, getClientDirectory()).exists() && !bit64) {
     1530 +            try {
     1531 +                uninstallClientServer(dir, getClientDirectory());
     1532 +            } catch (InstallerException e) {
     1533 +                if (new File(dir, getServerDirectory(bit64)).exists()) {
     1534 +                    installClientServer(dir, getServerDirectory(bit64), bit64);
     1535 +                }
     1536 +                throw e;
     1537 +            }
     1538 +        }
     1539 +
     1540 +        String dcevm_jar = new File(dir, "lib" + File.separator + "ext" + File.separator + "dcevm.jar").getPath();
     1541 +        try {
     1542 +            deleteFile(dcevm_jar);
     1543 +        } catch (InstallerException e) {
     1544 +            install(dir, bit64);
     1545 +            throw e;
     1546 +        }
     1547 +    }
     1548 +
     1549 +    private void installClientServer(File jreDir, String directory, boolean bit64) throws InstallerException {
     1550 +        String jarpath = "data/" + (bit64 ? "64/" : "") + directory.replace(File.separatorChar, '/') + "/" + getLibraryName();
     1551 +        File clientOrServerDir = new File(jreDir, directory);
     1552 +        String jvm_dll = new File(clientOrServerDir, getLibraryName()).getPath();
     1553 +        String jvm_dll_backup = new File(clientOrServerDir, getBackupLibraryName()).getPath();
     1554 +
     1555 +        renameFile(jvm_dll, jvm_dll_backup);
     1556 +
     1557 +        try {
     1558 +            extractFile(jarpath, jvm_dll);
     1559 +        } catch (InstallerException e) {
     1560 +            renameFile(jvm_dll_backup, jvm_dll);
     1561 +            throw e;
     1562 +        }
     1563 +    }
     1564 +
     1565 +    private void uninstallClientServer(File jreDir, String directory) throws InstallerException {
     1566 +        File clientOrServerDir = new File(jreDir, directory);
     1567 +        String jvm_dll = new File(clientOrServerDir, getLibraryName()).getPath();
     1568 +        String jvm_dll_backup = new File(clientOrServerDir, getBackupLibraryName()).getPath();
     1569 +        String jvm_dll_backup_temp = createTempFilename(clientOrServerDir, getBackupLibraryName() + "_", ".temp");
     1570 +
     1571 +        renameFile(jvm_dll_backup, jvm_dll_backup_temp);
     1572 +
     1573 +        try {
     1574 +            deleteFile(jvm_dll);
     1575 +        } catch (InstallerException e) {
     1576 +            renameFile(jvm_dll_backup_temp, jvm_dll_backup);
     1577 +            throw e;
     1578 +        }
     1579 +
     1580 +        try {
     1581 +            renameFile(jvm_dll_backup_temp, jvm_dll);
     1582 +        } catch (InstallerException e) {
     1583 +            throw new InstallerException("Warning: JVM directory is in an inconistent state.", e);
     1584 +        }
     1585 +    }
     1586 +
     1587 +    private String createTempFilename(File dir, String prefix, String suffix){
     1588 +        String filename;
     1589 +        int i=0;
     1590 +        
     1591 +        do
     1592 +        {
     1593 +            i++;
     1594 +            filename = prefix + i + suffix;
     1595 +        } while(new File(dir, filename).exists() && i<1000);
     1596 +
     1597 +        return new File(dir, filename).getPath();
     1598 +    }
     1599 +
     1600 +    private void deleteFile(String file) throws InstallerException {
     1601 +        File f = new File(file);
     1602 +
     1603 +        boolean succ = false;
     1604 +        try {
     1605 +            succ = f.delete();
     1606 +        } catch (Exception e) {
     1607 +            throw new InstallerException("Could not delete " + file + ".", e);
     1608 +        }
     1609 +
     1610 +        if (!succ) {
     1611 +            throw new InstallerException("Could not delete " + file + ".");
     1612 +        }
     1613 +    }
     1614 +
     1615 +    private void renameFile(String from, String to) throws InstallerException {
     1616 +        File ffr = new File(from);
     1617 +        File fto = new File(to);
     1618 +        if(!fto.isAbsolute()) fto = new File(ffr, to);
     1619 +
     1620 +        if (!ffr.exists()) {
     1621 +            throw new InstallerException("The file " + from + " does not exist.");
     1622 +        }
     1623 +
     1624 +        boolean succ = false;
     1625 +        try {
     1626 +            succ = ffr.renameTo(fto);
     1627 +        } catch (Exception e) {
     1628 +            throw new InstallerException("Could not rename " + from + " to " + to + ".", e);
     1629 +        }
     1630 +
     1631 +        if (!succ) {
     1632 +            throw new InstallerException("Could not rename " + from + " to " + to + ".");
     1633 +        }
     1634 +    }
     1635 +
     1636 +    public boolean isJRE(File directory) {
     1637 +        if (directory.isDirectory() && directory.getName().startsWith("jre")) {
     1638 +
     1639 +            String[] files = {getJavaExecutable()};
     1640 +            for (int i = 0; i < files.length; i++) {
     1641 +                if (!new File(directory, files[i]).exists()) {
     1642 +                    return false;
     1643 +                }
     1644 +            }
     1645 +
     1646 +            if (new File(directory, getClientDirectory()).exists()) {
     1647 +                if (!new File(directory, getClientDirectory() + File.separator + getLibraryName()).exists()) {
     1648 +                    return new File(directory, getClientDirectory() + File.separator + getBackupLibraryName()).exists();
     1649 +                }
     1650 +            }
     1651 +
     1652 +            if (new File(directory, getServerDirectory(true)).exists()) {
     1653 +                if (!new File(directory, getServerDirectory(true) + File.separator + getLibraryName()).exists()) {
     1654 +                    return new File(directory, getServerDirectory(true) + File.separator + getBackupLibraryName()).exists();
     1655 +                }
     1656 +            }
     1657 +            return true;
     1658 +        }
     1659 +        return false;
     1660 +    }
     1661 +
     1662 +    public boolean isJDK(File directory) {
     1663 +        if (directory.isDirectory()) {
     1664 +            File jreDir = new File(directory, getJREDirectory());
     1665 +            return isJRE(jreDir);
     1666 +        }
     1667 +        return false;
     1668 +    }
     1669 +
     1670 +    final public String executeJava(File jreDir, String... params) throws InstallerException {
     1671 +        File command = new File(jreDir, getJavaExecutable());
     1672 +        try {
     1673 +            StringBuilder result = new StringBuilder();
     1674 +            String line;
     1675 +            ArrayList<String> pp = new ArrayList<String>();
     1676 +            pp.add(command.getAbsolutePath());
     1677 +            pp.addAll(Arrays.asList(params));
     1678 +            Process p = Runtime.getRuntime().exec(pp.toArray(new String[0]));
     1679 +            BufferedReader input =
     1680 +                    new BufferedReader(new InputStreamReader(p.getErrorStream()));
     1681 +            while ((line = input.readLine()) != null) {
     1682 +                result.append(line);
     1683 +                result.append('\n');
     1684 +            }
     1685 +            input.close();
     1686 +            return result.toString();
     1687 +        } catch (Exception err) {
     1688 +            throw new InstallerException("Could not execute " + command + ".", err);
     1689 +        }
     1690 +    }
     1691 +
     1692 +    public boolean isDCEInstalled(File dir) throws InstallerException {
     1693 +        File jreDir;
     1694 +        if (isJDK(dir)) {
     1695 +            jreDir = new File(dir, "jre");
     1696 +        } else {
     1697 +            jreDir = dir;
     1698 +        }
     1699 +        File jvmDCEClientFile = new File(jreDir, getClientDirectory() + File.separator + getBackupLibraryName());
     1700 +        String serverDir = getServerDirectory(false);
     1701 +        if (!new File(jreDir, serverDir).exists()) {
     1702 +            serverDir = getServerDirectory(true);
     1703 +        }
     1704 +        File jvmDCEServerFile = new File(jreDir, serverDir + File.separator + getBackupLibraryName());
     1705 +
     1706 +        if (new File(jreDir, getClientDirectory()).exists() && new File(jreDir, serverDir).exists()) {
     1707 +            if (jvmDCEServerFile.exists() != jvmDCEClientFile.exists()) {
     1708 +                throw new InstallerException(jreDir.getAbsolutePath() + " has invalid state.");
     1709 +            }
     1710 +        }
     1711 +        return jvmDCEClientFile.exists() || jvmDCEServerFile.exists();
     1712 +    }
     1713 +
     1714 +    final public String getVersionString(File jreDir) throws InstallerException {
     1715 +        return executeJava(jreDir, "-version");
     1716 +    }
     1717 +
     1718 +    final public boolean is64Bit(File jreDir) throws InstallerException {
     1719 +        return getVersionString(jreDir).contains("64-Bit");
     1720 +    }
     1721 +
     1722 +    final public String getJavaVersion(File jreDir) throws InstallerException {
     1723 +        return getVersionHelper(jreDir, ".*java version.*\"(.*)\".*", true);
     1724 +    }
     1725 +
     1726 +    final public String getDCEVersion(File jreDir) throws InstallerException {
     1727 +        return getVersionHelper(jreDir, ".*Dynamic Code Evolution.*build ([^,]+),.*", false);
     1728 +    }
     1729 +
     1730 +    private String getVersionHelper(File jreDir, String regex, boolean javaVersion) throws InstallerException {
     1731 +        String version = getVersionString(jreDir);
     1732 +        version = version.replaceAll("\n", "");
     1733 +        Matcher matcher = Pattern.compile(regex).matcher(version);
     1734 +
     1735 +        if (!matcher.matches()) {
     1736 +            throw new InstallerException("Could not get " + (javaVersion ? "java" : "dce") + "version of " + jreDir.getAbsolutePath() + ".");
     1737 +        }
     1738 +
     1739 +        version = matcher.replaceFirst("$1");
     1740 +        return version;
     1741 +    }
     1742 +}
     1743 diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/InstallerException.java
     1744 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1745 +++ b/hotswapinstaller/Installer/src/at/ssw/hotswap/installer/InstallerException.java	Fri Dec 17 13:23:04 2010 +0100
     1746 @@ -0,0 +1,39 @@
     1747 +/*
     1748 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     1749 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1750 + *
     1751 + * This code is free software; you can redistribute it and/or modify it
     1752 + * under the terms of the GNU General Public License version 2 only, as
     1753 + * published by the Free Software Foundation.
     1754 + *
     1755 + * This code is distributed in the hope that it will be useful, but WITHOUT
     1756 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     1757 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     1758 + * version 2 for more details (a copy is included in the LICENSE file that
     1759 + * accompanied this code).
     1760 + *
     1761 + * You should have received a copy of the GNU General Public License version
     1762 + * 2 along with this work; if not, write to the Free Software Foundation,
     1763 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     1764 + *
     1765 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     1766 + * or visit www.oracle.com if you need additional information or have any
     1767 + * questions.
     1768 + *
     1769 + */
     1770 +package at.ssw.hotswap.installer;
     1771 +
     1772 +/**
     1773 + * @author Kerstin Breiteneder
     1774 + * @author Christoph Wimberger
     1775 + */
     1776 +public class InstallerException extends Exception {
     1777 +
     1778 +    InstallerException(String e) {
     1779 +        super(e);
     1780 +    }
     1781 +
     1782 +    InstallerException(String e, Throwable t) {
     1783 +        super(e, t);
     1784 +    }
     1785 +}
     1786 diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/LinuxInstaller.java
     1787 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1788 +++ b/hotswapinstaller/Installer/src/at/ssw/hotswap/installer/LinuxInstaller.java	Fri Dec 17 13:23:04 2010 +0100
     1789 @@ -0,0 +1,78 @@
     1790 +/*
     1791 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     1792 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1793 + *
     1794 + * This code is free software; you can redistribute it and/or modify it
     1795 + * under the terms of the GNU General Public License version 2 only, as
     1796 + * published by the Free Software Foundation.
     1797 + *
     1798 + * This code is distributed in the hope that it will be useful, but WITHOUT
     1799 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     1800 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     1801 + * version 2 for more details (a copy is included in the LICENSE file that
     1802 + * accompanied this code).
     1803 + *
     1804 + * You should have received a copy of the GNU General Public License version
     1805 + * 2 along with this work; if not, write to the Free Software Foundation,
     1806 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     1807 + *
     1808 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     1809 + * or visit www.oracle.com if you need additional information or have any
     1810 + * questions.
     1811 + *
     1812 + */
     1813 +package at.ssw.hotswap.installer;
     1814 +
     1815 +import java.io.File;
     1816 +import java.io.IOException;
     1817 +import java.util.ArrayList;
     1818 +import java.util.List;
     1819 +
     1820 +/**
     1821 + * @author Kerstin Breiteneder
     1822 + * @author Christoph Wimberger
     1823 + */
     1824 +public class LinuxInstaller extends Installer {
     1825 +
     1826 +    public String getClientDirectory() {
     1827 +        return "lib/i386/client";
     1828 +    }
     1829 +
     1830 +    public String getServerDirectory(boolean is64Bit) {
     1831 +        if (is64Bit) {
     1832 +            return "lib/amd64/server";
     1833 +        } else {
     1834 +            return "lib/i386/server";
     1835 +        }
     1836 +    }
     1837 +
     1838 +    public String getLibraryName() {
     1839 +        return "libjvm.so";
     1840 +    }
     1841 +
     1842 +    public String getJavaExecutable() {
     1843 +        return "bin/java";
     1844 +    }
     1845 +
     1846 +    @Override
     1847 +    public List<Installation> listAllInstallations() {
     1848 +        File dir = new File("/usr/java");
     1849 +
     1850 +        List<Installation> dirs = new ArrayList<Installation>();
     1851 +
     1852 +        if (dir.exists()) {
     1853 +            for (File f : dir.listFiles()) {
     1854 +                try {
     1855 +                    Installation i = new Installation(f.getCanonicalFile(), this);
     1856 +                    if (!dirs.contains(i)) {
     1857 +                        dirs.add(i);
     1858 +                    }
     1859 +                } catch (IOException ex) {
     1860 +                } catch (InstallerException ex) {
     1861 +                }
     1862 +            }
     1863 +        }
     1864 +
     1865 +        return dirs;
     1866 +    }
     1867 +}
     1868 diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/MacInstaller.java
     1869 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1870 +++ b/hotswapinstaller/Installer/src/at/ssw/hotswap/installer/MacInstaller.java	Fri Dec 17 13:23:04 2010 +0100
     1871 @@ -0,0 +1,66 @@
     1872 +/*
     1873 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     1874 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1875 + *
     1876 + * This code is free software; you can redistribute it and/or modify it
     1877 + * under the terms of the GNU General Public License version 2 only, as
     1878 + * published by the Free Software Foundation.
     1879 + *
     1880 + * This code is distributed in the hope that it will be useful, but WITHOUT
     1881 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     1882 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     1883 + * version 2 for more details (a copy is included in the LICENSE file that
     1884 + * accompanied this code).
     1885 + *
     1886 + * You should have received a copy of the GNU General Public License version
     1887 + * 2 along with this work; if not, write to the Free Software Foundation,
     1888 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     1889 + *
     1890 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     1891 + * or visit www.oracle.com if you need additional information or have any
     1892 + * questions.
     1893 + *
     1894 + */
     1895 +package at.ssw.hotswap.installer;
     1896 +
     1897 +import java.io.File;
     1898 +import java.util.ArrayList;
     1899 +import java.util.List;
     1900 +
     1901 +/**
     1902 + * @author Kerstin Breiteneder
     1903 + * @author Christoph Wimberger
     1904 + */
     1905 +public class MacInstaller extends Installer {
     1906 +
     1907 +    @Override
     1908 +    public void install(File dir, boolean bit64) throws InstallerException {
     1909 +        if(bit64) throw new InstallerException("64 Bit Soylatte is not supported in this installer version.");
     1910 +        super.install(dir, bit64);
     1911 +    }
     1912 +
     1913 +    public String getClientDirectory() {
     1914 +        return "lib/i386/client";
     1915 +    }
     1916 +
     1917 +    public String getServerDirectory(boolean is64Bit) {
     1918 +        if (is64Bit) {
     1919 +            return "lib/amd64/server";
     1920 +        } else {
     1921 +            return "lib/i386/server";
     1922 +        }
     1923 +    }
     1924 +
     1925 +    public String getLibraryName() {
     1926 +        return "libjvm.dylib";
     1927 +    }
     1928 +
     1929 +    public String getJavaExecutable() {
     1930 +        return "bin/java";
     1931 +    }
     1932 +
     1933 +    @Override
     1934 +    public List<Installation> listAllInstallations() {
     1935 +        return new ArrayList<Installation>();
     1936 +    }
     1937 +}
     1938 diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/Main.java
     1939 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1940 +++ b/hotswapinstaller/Installer/src/at/ssw/hotswap/installer/Main.java	Fri Dec 17 13:23:04 2010 +0100
     1941 @@ -0,0 +1,57 @@
     1942 +/*
     1943 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     1944 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1945 + *
     1946 + * This code is free software; you can redistribute it and/or modify it
     1947 + * under the terms of the GNU General Public License version 2 only, as
     1948 + * published by the Free Software Foundation.
     1949 + *
     1950 + * This code is distributed in the hope that it will be useful, but WITHOUT
     1951 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     1952 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     1953 + * version 2 for more details (a copy is included in the LICENSE file that
     1954 + * accompanied this code).
     1955 + *
     1956 + * You should have received a copy of the GNU General Public License version
     1957 + * 2 along with this work; if not, write to the Free Software Foundation,
     1958 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     1959 + *
     1960 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     1961 + * or visit www.oracle.com if you need additional information or have any
     1962 + * questions.
     1963 + *
     1964 + */
     1965 +package at.ssw.hotswap.installer;
     1966 +
     1967 +import javax.swing.JOptionPane;
     1968 +import javax.swing.UIManager;
     1969 +import javax.swing.UnsupportedLookAndFeelException;
     1970 +
     1971 +/**
     1972 + * @author Kerstin Breiteneder
     1973 + * @author Christoph Wimberger
     1974 + * @author Thomas Wuerthinger
     1975 + */
     1976 +public class Main {
     1977 +
     1978 +    public static void main(String[] args) {
     1979 +        try {
     1980 +            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
     1981 +        } catch (UnsupportedLookAndFeelException e) {
     1982 +        } catch (ClassNotFoundException e) {
     1983 +        } catch (InstantiationException e) {
     1984 +        } catch (IllegalAccessException e) {
     1985 +        }
     1986 +
     1987 +        MainWindow w;
     1988 +        try {
     1989 +            Installer i = Installer.create();
     1990 +            w = new MainWindow(i);
     1991 +            w.setLocationRelativeTo(null);
     1992 +            w.setVisible(true);
     1993 +        } catch (InstallerException ex) {
     1994 +            JOptionPane.showMessageDialog(null, ex.getMessage(), ex.getMessage(), JOptionPane.ERROR_MESSAGE);
     1995 +        }
     1996 +
     1997 +    }
     1998 +}
     1999 diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/MainWindow.java
     2000 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2001 +++ b/hotswapinstaller/Installer/src/at/ssw/hotswap/installer/MainWindow.java	Fri Dec 17 13:23:04 2010 +0100
     2002 @@ -0,0 +1,430 @@
     2003 +/*
     2004 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     2005 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2006 + *
     2007 + * This code is free software; you can redistribute it and/or modify it
     2008 + * under the terms of the GNU General Public License version 2 only, as
     2009 + * published by the Free Software Foundation.
     2010 + *
     2011 + * This code is distributed in the hope that it will be useful, but WITHOUT
     2012 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     2013 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     2014 + * version 2 for more details (a copy is included in the LICENSE file that
     2015 + * accompanied this code).
     2016 + *
     2017 + * You should have received a copy of the GNU General Public License version
     2018 + * 2 along with this work; if not, write to the Free Software Foundation,
     2019 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     2020 + *
     2021 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     2022 + * or visit www.oracle.com if you need additional information or have any
     2023 + * questions.
     2024 + *
     2025 + */
     2026 +package at.ssw.hotswap.installer;
     2027 +
     2028 +import java.awt.BorderLayout;
     2029 +import java.awt.Color;
     2030 +import java.awt.Component;
     2031 +import java.awt.Dimension;
     2032 +import java.awt.FlowLayout;
     2033 +import java.awt.event.ActionEvent;
     2034 +import java.awt.image.BufferedImage;
     2035 +import java.io.File;
     2036 +import java.io.IOException;
     2037 +import java.util.ArrayList;
     2038 +import java.util.Observable;
     2039 +import java.util.Observer;
     2040 +import java.util.prefs.Preferences;
     2041 +import javax.imageio.ImageIO;
     2042 +import javax.swing.AbstractAction;
     2043 +import javax.swing.BorderFactory;
     2044 +import javax.swing.ImageIcon;
     2045 +import javax.swing.JButton;
     2046 +import javax.swing.JComponent;
     2047 +import javax.swing.JFileChooser;
     2048 +import javax.swing.JFrame;
     2049 +import javax.swing.JLabel;
     2050 +import javax.swing.JOptionPane;
     2051 +import javax.swing.JPanel;
     2052 +import javax.swing.JScrollPane;
     2053 +import javax.swing.JTable;
     2054 +import javax.swing.JTextArea;
     2055 +import javax.swing.ListSelectionModel;
     2056 +import javax.swing.event.ListSelectionEvent;
     2057 +import javax.swing.event.ListSelectionListener;
     2058 +import javax.swing.table.AbstractTableModel;
     2059 +import javax.swing.table.DefaultTableCellRenderer;
     2060 +
     2061 +/**
     2062 + * @author Kerstin Breiteneder
     2063 + * @author Christoph Wimberger
     2064 + */
     2065 +public class MainWindow extends JFrame {
     2066 +
     2067 +    private final InstallationsTableModel installations;
     2068 +    private final Installer installer;
     2069 +    private JTable table;
     2070 +
     2071 +    public MainWindow(Installer inst) {
     2072 +        super("Dynamic Code Evolution VM Installer");
     2073 +        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     2074 +
     2075 +        installer = inst;
     2076 +        installations = new InstallationsTableModel();
     2077 +        for (Installation i : installer.listAllInstallations()) {
     2078 +            installations.add(i);
     2079 +        }
     2080 +        add(getBanner(), BorderLayout.NORTH);
     2081 +        add(getCenterPanel(), BorderLayout.CENTER);
     2082 +        add(getBottomPanel(), BorderLayout.SOUTH);
     2083 +
     2084 +        if (table.getRowCount() > 0) {
     2085 +            table.setRowSelectionInterval(0, 0);
     2086 +        }
     2087 +
     2088 +        pack();
     2089 +        setMinimumSize(getSize());
     2090 +    }
     2091 +
     2092 +    static void showInstallerException(InstallerException ex, Component parent) {
     2093 +        Throwable e = ex;
     2094 +        String error = e.getMessage();
     2095 +        e = e.getCause();
     2096 +
     2097 +        while (e != null) {
     2098 +            error += "\n" + e.getMessage();
     2099 +            e = e.getCause();
     2100 +        }
     2101 +
     2102 +        ex.printStackTrace();
     2103 +
     2104 +        error += "\nPlease ensure that no other Java applications are running and you have sufficient permissions.";
     2105 +        JOptionPane.showMessageDialog(parent, error, ex.getMessage(), JOptionPane.ERROR_MESSAGE);
     2106 +    }
     2107 +
     2108 +    private JComponent getBanner() {
     2109 +        try {
     2110 +            BufferedImage img = ImageIO.read(getClass().getResource("splash.png"));
     2111 +            JLabel title = new JLabel(new ImageIcon(img));
     2112 +            title.setPreferredSize(new Dimension(img.getWidth() + 10, img.getHeight()));
     2113 +            title.setOpaque(true);
     2114 +            title.setBackground(new Color(238, 238, 255));
     2115 +            return title;
     2116 +        } catch (IOException ex) {
     2117 +        }
     2118 +        return new JLabel();
     2119 +    }
     2120 +
     2121 +    private JComponent getCenterPanel() {
     2122 +        JPanel center = new JPanel(new BorderLayout());
     2123 +        center.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
     2124 +        center.setBackground(Color.WHITE);
     2125 +        JTextArea license = new javax.swing.JTextArea();
     2126 +        license.setLineWrap(true);
     2127 +        license.setWrapStyleWord(true);
     2128 +        license.setEditable(false);
     2129 +        license.setFont(license.getFont().deriveFont(11.0f));
     2130 +        StringBuilder licenseText = new StringBuilder();
     2131 +        licenseText.append("This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 only, as published by the Free Software Foundation.\n\nThis code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License version 2 for more details (a copy is included in the LICENSE file that accompanied this code).\n\nYou should have received a copy of the GNU General Public License version 2 along with this work; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.");
     2132 +        licenseText.append("\n\n\nASM LICENSE TEXT:\nCopyright (c) 2000-2005 INRIA, France Telecom\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n\n3. Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.");
     2133 +        license.setText(licenseText.toString());
     2134 +        JScrollPane licenses = new JScrollPane(license, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
     2135 +        licenses.setPreferredSize(new Dimension(150, 150));
     2136 +        center.add(licenses, BorderLayout.NORTH);
     2137 +        center.add(getChooserPanel(), BorderLayout.CENTER);
     2138 +        return center;
     2139 +    }
     2140 +
     2141 +    private JComponent getChooserPanel() {
     2142 +        JPanel p = new JPanel(new BorderLayout());
     2143 +        p.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
     2144 +        p.setOpaque(false);
     2145 +
     2146 +        JLabel l = new JLabel("Please choose installation directory:");
     2147 +        l.setVerticalAlignment(JLabel.NORTH);
     2148 +        l.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
     2149 +        p.add(l, BorderLayout.WEST);
     2150 +
     2151 +        table = new JTable(installations);
     2152 +        table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
     2153 +        table.setColumnSelectionAllowed(false);
     2154 +        table.setDefaultRenderer(Object.class, new InstallationTableCellRenderer());
     2155 +        table.getColumnModel().getColumn(0).setHeaderValue("Directory");
     2156 +        table.getColumnModel().getColumn(0).setPreferredWidth(300);
     2157 +        table.getColumnModel().getColumn(1).setHeaderValue("Java Version");
     2158 +        table.getColumnModel().getColumn(2).setHeaderValue("Type");
     2159 +        table.getColumnModel().getColumn(3).setHeaderValue("DCE");
     2160 +        JScrollPane lists = new JScrollPane(table);
     2161 +        lists.setPreferredSize(new Dimension(200, 200));
     2162 +        p.add(lists, BorderLayout.CENTER);
     2163 +
     2164 +        return p;
     2165 +    }
     2166 +
     2167 +    private JComponent getBottomPanel() {
     2168 +
     2169 +        JPanel left = new JPanel(new FlowLayout());
     2170 +        left.add(new JButton(new AddDirectoryAction(this, installations, installer)));
     2171 +
     2172 +        JPanel right = new JPanel(new FlowLayout());
     2173 +        right.add(new JButton(new TestAction(table, installer)));
     2174 +        right.add(new JButton(new InstallUninstallAction(false, table)));
     2175 +        right.add(new JButton(new InstallUninstallAction(true, table)));
     2176 +
     2177 +        JPanel bottom = new JPanel(new BorderLayout());
     2178 +        bottom.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
     2179 +        bottom.add(left, BorderLayout.WEST);
     2180 +        bottom.add(right, BorderLayout.EAST);
     2181 +
     2182 +        return bottom;
     2183 +    }
     2184 +}
     2185 +
     2186 +class AddDirectoryAction extends AbstractAction {
     2187 +
     2188 +    private final Component parent;
     2189 +    private final InstallationsTableModel installations;
     2190 +    private final Installer installer;
     2191 +
     2192 +    public AddDirectoryAction(Component parent, InstallationsTableModel inst, Installer installer) {
     2193 +        super("Add installation directory...");
     2194 +        this.parent = parent;
     2195 +        installations = inst;
     2196 +        this.installer = installer;
     2197 +    }
     2198 +
     2199 +    public void actionPerformed(ActionEvent e) {
     2200 +        JFileChooser fc = new JFileChooser();
     2201 +        fc.setDialogTitle("Select a Java installation directory...");
     2202 +        fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
     2203 +        fc.setAcceptAllFileFilterUsed(false);
     2204 +        Preferences p = Preferences.userNodeForPackage(Installer.class);
     2205 +        final String prefID = "defaultDirectory";
     2206 +        fc.setCurrentDirectory(new File(p.get(prefID, ".")));
     2207 +
     2208 +        if (fc.showOpenDialog(parent) == JFileChooser.APPROVE_OPTION) {
     2209 +
     2210 +            File dir = fc.getSelectedFile();
     2211 +            p.put(prefID, dir.getParent());
     2212 +            try {
     2213 +                installations.add(new Installation(dir, installer));
     2214 +            } catch (InstallerException ex) {
     2215 +                MainWindow.showInstallerException(ex, parent);
     2216 +            }
     2217 +        }
     2218 +    }
     2219 +}
     2220 +
     2221 +class InstallUninstallAction extends AbstractAction implements ListSelectionListener, Observer {
     2222 +
     2223 +    private final JTable table;
     2224 +    private final boolean install;
     2225 +    private Installation installation;
     2226 +
     2227 +    public InstallUninstallAction(boolean install, JTable t) {
     2228 +        super(install ? "Install" : "Uninstall");
     2229 +        this.install = install;
     2230 +        setEnabled(false);
     2231 +        table = t;
     2232 +        t.getSelectionModel().addListSelectionListener(this);
     2233 +    }
     2234 +
     2235 +    private Installation getSelectedInstallation() {
     2236 +        InstallationsTableModel itm = (InstallationsTableModel) table.getModel();
     2237 +        int sel = table.getSelectedRow();
     2238 +        if (sel < 0) {
     2239 +            return null;
     2240 +        } else {
     2241 +            return itm.getInstallationAt(sel);
     2242 +        }
     2243 +    }
     2244 +
     2245 +    public void actionPerformed(ActionEvent e) {
     2246 +        try {
     2247 +            if (install) {
     2248 +                getSelectedInstallation().installDCE();
     2249 +            } else {
     2250 +                getSelectedInstallation().uninstallDCE();
     2251 +            }
     2252 +        } catch (InstallerException ex) {
     2253 +            MainWindow.showInstallerException(ex, table);
     2254 +        }
     2255 +    }
     2256 +
     2257 +    private void setCurrentInstallation(Installation i) {
     2258 +        if (installation != null) {
     2259 +            installation.deleteObserver(this);
     2260 +        }
     2261 +        installation = i;
     2262 +        if (installation != null) {
     2263 +            installation.addObserver(this);
     2264 +        }
     2265 +        update();
     2266 +    }
     2267 +
     2268 +    public void valueChanged(ListSelectionEvent e) {
     2269 +        Installation i = getSelectedInstallation();
     2270 +        setCurrentInstallation(i);
     2271 +    }
     2272 +
     2273 +    private void update() {
     2274 +        if (install) {
     2275 +            setEnabled(installation != null && !installation.isDCEInstalled());
     2276 +        } else {
     2277 +            setEnabled(installation != null && installation.isDCEInstalled());
     2278 +        }
     2279 +    }
     2280 +
     2281 +    public void update(Observable o, Object arg) {
     2282 +        update();
     2283 +    }
     2284 +}
     2285 +
     2286 +class TestAction extends AbstractAction implements ListSelectionListener, Observer {
     2287 +
     2288 +    private final JTable table;
     2289 +    private Installation installation;
     2290 +    private final Installer installer;
     2291 +
     2292 +    public TestAction(JTable t, Installer i) {
     2293 +        super("Test Installation");
     2294 +        setEnabled(false);
     2295 +        table = t;
     2296 +        installer = i;
     2297 +        t.getSelectionModel().addListSelectionListener(this);
     2298 +    }
     2299 +
     2300 +    private Installation getSelectedInstallation() {
     2301 +        InstallationsTableModel itm = (InstallationsTableModel) table.getModel();
     2302 +        int sel = table.getSelectedRow();
     2303 +        if (sel < 0) {
     2304 +            return null;
     2305 +        } else {
     2306 +            return itm.getInstallationAt(sel);
     2307 +        }
     2308 +    }
     2309 +
     2310 +    public void actionPerformed(ActionEvent e) {
     2311 +        File p = installation.getPath();
     2312 +        if(installation.isJDK()) p = new File(p, "jre");
     2313 +
     2314 +        String result = "";
     2315 +        try {
     2316 +            String agentparam = "-javaagent:" + p.getAbsolutePath() + "/lib/ext/dcevm.jar";
     2317 +            result = installer.executeJava(p, agentparam, "at.ssw.mixin.fasttest.FastTest");
     2318 +        } catch (InstallerException ex) {
     2319 +            MainWindow.showInstallerException(ex, table);
     2320 +        }
     2321 +
     2322 +        if(result.length()>0) {
     2323 +            String msg = "Tests failed:\n" + result;
     2324 +            JOptionPane.showMessageDialog(table.getTopLevelAncestor(), msg, "Error", JOptionPane.ERROR_MESSAGE);
     2325 +        } else {
     2326 +            JOptionPane.showMessageDialog(table.getTopLevelAncestor(), "All tests succeeded.", "Information", JOptionPane.INFORMATION_MESSAGE);
     2327 +        }
     2328 +    }
     2329 +
     2330 +    private void setCurrentInstallation(Installation i) {
     2331 +        if (installation != null) {
     2332 +            installation.deleteObserver(this);
     2333 +        }
     2334 +        installation = i;
     2335 +        if (installation != null) {
     2336 +            installation.addObserver(this);
     2337 +        }
     2338 +        update();
     2339 +    }
     2340 +
     2341 +    public void valueChanged(ListSelectionEvent e) {
     2342 +        Installation i = getSelectedInstallation();
     2343 +        setCurrentInstallation(i);
     2344 +    }
     2345 +
     2346 +    private void update() {
     2347 +        setEnabled(installation != null && installation.isDCEInstalled());
     2348 +    }
     2349 +
     2350 +    public void update(Observable o, Object arg) {
     2351 +        update();
     2352 +    }
     2353 +}
     2354 +
     2355 +class InstallationsTableModel extends AbstractTableModel implements Observer {
     2356 +
     2357 +    private final ArrayList<Installation> installations;
     2358 +
     2359 +    public InstallationsTableModel() {
     2360 +        installations = new ArrayList<Installation>();
     2361 +    }
     2362 +
     2363 +    public int getRowCount() {
     2364 +        return installations.size();
     2365 +    }
     2366 +
     2367 +    public int getColumnCount() {
     2368 +        return 4;
     2369 +    }
     2370 +
     2371 +    public Object getValueAt(int rowIndex, int columnIndex) {
     2372 +        return installations.get(rowIndex);
     2373 +    }
     2374 +
     2375 +    public Installation getInstallationAt(int row) {
     2376 +        return installations.get(row);
     2377 +    }
     2378 +
     2379 +    public void add(Installation i) {
     2380 +        installations.add(i);
     2381 +        i.addObserver(this);
     2382 +        fireTableDataChanged();
     2383 +    }
     2384 +
     2385 +    public void update(Observable o, Object arg) {
     2386 +        int row = installations.indexOf(o);
     2387 +        fireTableRowsUpdated(row, row);
     2388 +    }
     2389 +}
     2390 +
     2391 +class InstallationTableCellRenderer extends DefaultTableCellRenderer {
     2392 +
     2393 +    @Override
     2394 +    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
     2395 +        Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
     2396 +
     2397 +        if (c instanceof JLabel && value instanceof Installation) {
     2398 +            JLabel l = (JLabel) c;
     2399 +            Installation i = (Installation) value;
     2400 +
     2401 +            switch (column) {
     2402 +                case 0:
     2403 +                    l.setText(i.getPath().getAbsolutePath());
     2404 +                    break;
     2405 +                case 1:
     2406 +                    l.setText(i.getVersion());
     2407 +                    break;
     2408 +                case 2:
     2409 +                    l.setText(i.isJDK() ? "JDK" : "JRE");
     2410 +                    if (i.is64Bit()) {
     2411 +                        l.setText(l.getText() + " (64 Bit)");
     2412 +                    }
     2413 +                    break;
     2414 +                case 3:
     2415 +                    if (i.isDCEInstalled()) {
     2416 +                        l.setText("Yes (" + i.getDCEVersion() + ")");
     2417 +                    } else {
     2418 +                        l.setText("No");
     2419 +                    }
     2420 +                    break;
     2421 +            }
     2422 +        }
     2423 +
     2424 +        return c;
     2425 +    }
     2426 +
     2427 +    @Override
     2428 +    public void setText(String text) {
     2429 +        super.setText(text);
     2430 +        setToolTipText(text);
     2431 +    }
     2432 +}
     2433 diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/WindowsInstaller.java
     2434 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2435 +++ b/hotswapinstaller/Installer/src/at/ssw/hotswap/installer/WindowsInstaller.java	Fri Dec 17 13:23:04 2010 +0100
     2436 @@ -0,0 +1,88 @@
     2437 +/*
     2438 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     2439 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2440 + *
     2441 + * This code is free software; you can redistribute it and/or modify it
     2442 + * under the terms of the GNU General Public License version 2 only, as
     2443 + * published by the Free Software Foundation.
     2444 + *
     2445 + * This code is distributed in the hope that it will be useful, but WITHOUT
     2446 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     2447 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     2448 + * version 2 for more details (a copy is included in the LICENSE file that
     2449 + * accompanied this code).
     2450 + *
     2451 + * You should have received a copy of the GNU General Public License version
     2452 + * 2 along with this work; if not, write to the Free Software Foundation,
     2453 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     2454 + *
     2455 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     2456 + * or visit www.oracle.com if you need additional information or have any
     2457 + * questions.
     2458 + *
     2459 + */
     2460 +package at.ssw.hotswap.installer;
     2461 +
     2462 +import java.io.File;
     2463 +import java.util.ArrayList;
     2464 +import java.util.List;
     2465 +
     2466 +/**
     2467 + * @author Kerstin Breiteneder
     2468 + * @author Christoph Wimberger
     2469 + */
     2470 +public class WindowsInstaller extends Installer {
     2471 +
     2472 +    public String getClientDirectory() {
     2473 +        return "bin\\client";
     2474 +    }
     2475 +
     2476 +    public String getServerDirectory(boolean is64bit) {
     2477 +        return "bin\\server";
     2478 +    }
     2479 +
     2480 +    public String getJavaExecutable() {
     2481 +        return "bin\\java.exe";
     2482 +    }
     2483 +
     2484 +    public String getLibraryName() {
     2485 +        return "jvm.dll";
     2486 +    }
     2487 +
     2488 +    public List<Installation> listAllInstallations() {
     2489 +        List<Installation> installations = new ArrayList<Installation>();
     2490 +        String[] searchForJavaString = new String[]{
     2491 +            System.getenv("JAVA_HOME") + "\\..",
     2492 +            System.getenv("PROGRAMW6432") + "\\JAVA",
     2493 +            System.getenv("PROGRAMFILES") + "\\JAVA",
     2494 +            System.getenv("SYSTEMDRIVE") + "\\JAVA"};
     2495 +
     2496 +        for (String fileString : searchForJavaString) {
     2497 +            File javaDir = new File(fileString);
     2498 +
     2499 +            if (javaDir.exists() && javaDir.isDirectory()) {
     2500 +                for (File f : javaDir.listFiles()) {
     2501 +                    if (f.getName().startsWith("jdk") || f.getName().startsWith("jre")) {
     2502 +                        try {
     2503 +                            Installation i = new Installation(f, this);
     2504 +                            if (!installations.contains(i)) {
     2505 +                                installations.add(i);
     2506 +                            }
     2507 +                        } catch (InstallerException ex) {
     2508 +                        }
     2509 +                    }
     2510 +                }
     2511 +            }
     2512 +        }
     2513 +        return installations;
     2514 +    }
     2515 +
     2516 +    @Override
     2517 +    public boolean isJDK(File directory) {
     2518 +        if (directory.isDirectory() && directory.getName().startsWith("jdk")) {
     2519 +            File jreDir = new File(directory, "jre");
     2520 +            return isJRE(jreDir);
     2521 +        }
     2522 +        return false;
     2523 +    }
     2524 +}
     2525 diff -r f5603a6e5042 hotswapinstaller/Installer/src/at/ssw/hotswap/installer/splash.png
     2526 Binary file hotswapinstaller/Installer/src/at/ssw/hotswap/installer/splash.png has changed
     2527 diff -r f5603a6e5042 hotswaptest/HotSwapTests/build.xml
     2528 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2529 +++ b/hotswaptest/HotSwapTests/build.xml	Fri Dec 17 13:23:04 2010 +0100
     2530 @@ -0,0 +1,74 @@
     2531 +<?xml version="1.0" encoding="UTF-8"?>
     2532 +<!-- You may freely edit this file. See commented blocks below for -->
     2533 +<!-- some examples of how to customize the build. -->
     2534 +<!-- (If you delete it and reopen the project it will be recreated.) -->
     2535 +<!-- By default, only the Clean and Build commands use this build script. -->
     2536 +<!-- Commands such as Run, Debug, and Test only use this build script if -->
     2537 +<!-- the Compile on Save feature is turned off for the project. -->
     2538 +<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
     2539 +<!-- in the project's Project Properties dialog box.-->
     2540 +<project name="HotSwapTests" default="default" basedir=".">
     2541 +    <description>Builds, tests, and runs the project HotSwapTests.</description>
     2542 +    <import file="nbproject/build-impl.xml"/>
     2543 +    <!--
     2544 +
     2545 +    There exist several targets which are by default empty and which can be
     2546 +    used for execution of your tasks. These targets are usually executed
     2547 +    before and after some main targets. They are:
     2548 +
     2549 +      -pre-init:                 called before initialization of project properties
     2550 +      -post-init:                called after initialization of project properties
     2551 +      -pre-compile:              called before javac compilation
     2552 +      -post-compile:             called after javac compilation
     2553 +      -pre-compile-single:       called before javac compilation of single file
     2554 +      -post-compile-single:      called after javac compilation of single file
     2555 +      -pre-compile-test:         called before javac compilation of JUnit tests
     2556 +      -post-compile-test:        called after javac compilation of JUnit tests
     2557 +      -pre-compile-test-single:  called before javac compilation of single JUnit test
     2558 +      -post-compile-test-single: called after javac compilation of single JUunit test
     2559 +      -pre-jar:                  called before JAR building
     2560 +      -post-jar:                 called after JAR building
     2561 +      -post-clean:               called after cleaning build products
     2562 +
     2563 +    (Targets beginning with '-' are not intended to be called on their own.)
     2564 +
     2565 +    Example of inserting an obfuscator after compilation could look like this:
     2566 +
     2567 +        <target name="-post-compile">
     2568 +            <obfuscate>
     2569 +                <fileset dir="${build.classes.dir}"/>
     2570 +            </obfuscate>
     2571 +        </target>
     2572 +
     2573 +    For list of available properties check the imported
     2574 +    nbproject/build-impl.xml file.
     2575 +
     2576 +
     2577 +    Another way to customize the build is by overriding existing main targets.
     2578 +    The targets of interest are:
     2579 +
     2580 +      -init-macrodef-javac:     defines macro for javac compilation
     2581 +      -init-macrodef-junit:     defines macro for junit execution
     2582 +      -init-macrodef-debug:     defines macro for class debugging
     2583 +      -init-macrodef-java:      defines macro for class execution
     2584 +      -do-jar-with-manifest:    JAR building (if you are using a manifest)
     2585 +      -do-jar-without-manifest: JAR building (if you are not using a manifest)
     2586 +      run:                      execution of project
     2587 +      -javadoc-build:           Javadoc generation
     2588 +      test-report:              JUnit report generation
     2589 +
     2590 +    An example of overriding the target for project execution could look like this:
     2591 +
     2592 +        <target name="run" depends="HotSwapTests-impl.jar">
     2593 +            <exec dir="bin" executable="launcher.exe">
     2594 +                <arg file="${dist.jar}"/>
     2595 +            </exec>
     2596 +        </target>
     2597 +
     2598 +    Notice that the overridden target depends on the jar target and not only on
     2599 +    the compile target as the regular run target does. Again, for a list of available
     2600 +    properties which you can use, check the target you are overriding in the
     2601 +    nbproject/build-impl.xml file.
     2602 +
     2603 +    -->
     2604 +</project>
     2605 diff -r f5603a6e5042 hotswaptest/HotSwapTests/manifest.mf
     2606 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2607 +++ b/hotswaptest/HotSwapTests/manifest.mf	Fri Dec 17 13:23:04 2010 +0100
     2608 @@ -0,0 +1,3 @@
     2609 +Manifest-Version: 1.0
     2610 +X-COMMENT: Main-Class will be added automatically by build
     2611 +
     2612 diff -r f5603a6e5042 hotswaptest/HotSwapTests/nbproject/build-impl.xml
     2613 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2614 +++ b/hotswaptest/HotSwapTests/nbproject/build-impl.xml	Fri Dec 17 13:23:04 2010 +0100
     2615 @@ -0,0 +1,1056 @@
     2616 +<?xml version="1.0" encoding="UTF-8"?>
     2617 +<!--
     2618 +*** GENERATED FROM project.xml - DO NOT EDIT  ***
     2619 +***         EDIT ../build.xml INSTEAD         ***
     2620 +
     2621 +For the purpose of easier reading the script
     2622 +is divided into following sections:
     2623 +
     2624 +  - initialization
     2625 +  - compilation
     2626 +  - jar
     2627 +  - execution
     2628 +  - debugging
     2629 +  - javadoc
     2630 +  - junit compilation
     2631 +  - junit execution
     2632 +  - junit debugging
     2633 +  - applet
     2634 +  - cleanup
     2635 +
     2636 +        -->
     2637 +<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="HotSwapTests-impl">
     2638 +    <fail message="Please build using Ant 1.7.1 or higher.">
     2639 +        <condition>
     2640 +            <not>
     2641 +                <antversion atleast="1.7.1"/>
     2642 +            </not>
     2643 +        </condition>
     2644 +    </fail>
     2645 +    <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/>
     2646 +    <!-- 
     2647 +                ======================
     2648 +                INITIALIZATION SECTION 
     2649 +                ======================
     2650 +            -->
     2651 +    <target name="-pre-init">
     2652 +        <!-- Empty placeholder for easier customization. -->
     2653 +        <!-- You can override this target in the ../build.xml file. -->
     2654 +    </target>
     2655 +    <target depends="-pre-init" name="-init-private">
     2656 +        <property file="nbproject/private/config.properties"/>
     2657 +        <property file="nbproject/private/configs/${config}.properties"/>
     2658 +        <property file="nbproject/private/private.properties"/>
     2659 +    </target>
     2660 +    <target depends="-pre-init,-init-private" name="-init-user">
     2661 +        <property file="${user.properties.file}"/>
     2662 +        <!-- The two properties below are usually overridden -->
     2663 +        <!-- by the active platform. Just a fallback. -->
     2664 +        <property name="default.javac.source" value="1.4"/>
     2665 +        <property name="default.javac.target" value="1.4"/>
     2666 +    </target>
     2667 +    <target depends="-pre-init,-init-private,-init-user" name="-init-project">
     2668 +        <property file="nbproject/configs/${config}.properties"/>
     2669 +        <property file="nbproject/project.properties"/>
     2670 +    </target>
     2671 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
     2672 +        <j2seproject1:property name="platform.home" value="platforms.${platform.active}.home"/>
     2673 +        <j2seproject1:property name="platform.bootcp" value="platforms.${platform.active}.bootclasspath"/>
     2674 +        <j2seproject1:property name="platform.compiler" value="platforms.${platform.active}.compile"/>
     2675 +        <j2seproject1:property name="platform.javac.tmp" value="platforms.${platform.active}.javac"/>
     2676 +        <condition property="platform.javac" value="${platform.home}/bin/javac">
     2677 +            <equals arg1="${platform.javac.tmp}" arg2="$${platforms.${platform.active}.javac}"/>
     2678 +        </condition>
     2679 +        <property name="platform.javac" value="${platform.javac.tmp}"/>
     2680 +        <j2seproject1:property name="platform.java.tmp" value="platforms.${platform.active}.java"/>
     2681 +        <condition property="platform.java" value="${platform.home}/bin/java">
     2682 +            <equals arg1="${platform.java.tmp}" arg2="$${platforms.${platform.active}.java}"/>
     2683 +        </condition>
     2684 +        <property name="platform.java" value="${platform.java.tmp}"/>
     2685 +        <j2seproject1:property name="platform.javadoc.tmp" value="platforms.${platform.active}.javadoc"/>
     2686 +        <condition property="platform.javadoc" value="${platform.home}/bin/javadoc">
     2687 +            <equals arg1="${platform.javadoc.tmp}" arg2="$${platforms.${platform.active}.javadoc}"/>
     2688 +        </condition>
     2689 +        <property name="platform.javadoc" value="${platform.javadoc.tmp}"/>
     2690 +        <condition property="platform.invalid" value="true">
     2691 +            <or>
     2692 +                <contains string="${platform.javac}" substring="$${platforms."/>
     2693 +                <contains string="${platform.java}" substring="$${platforms."/>
     2694 +                <contains string="${platform.javadoc}" substring="$${platforms."/>
     2695 +            </or>
     2696 +        </condition>
     2697 +        <fail unless="platform.home">Must set platform.home</fail>
     2698 +        <fail unless="platform.bootcp">Must set platform.bootcp</fail>
     2699 +        <fail unless="platform.java">Must set platform.java</fail>
     2700 +        <fail unless="platform.javac">Must set platform.javac</fail>
     2701 +        <fail if="platform.invalid">
     2702 + The J2SE Platform is not correctly set up.
     2703 + Your active platform is: ${platform.active}, but the corresponding property "platforms.${platform.active}.home" is not found in the project's properties files. 
     2704 + Either open the project in the IDE and setup the Platform with the same name or add it manually.
     2705 + For example like this:
     2706 +     ant -Duser.properties.file=&lt;path_to_property_file&gt; jar (where you put the property "platforms.${platform.active}.home" in a .properties file)
     2707 +  or ant -Dplatforms.${platform.active}.home=&lt;path_to_JDK_home&gt; jar (where no properties file is used) 
     2708 +  </fail>
     2709 +        <available file="${manifest.file}" property="manifest.available"/>
     2710 +        <condition property="splashscreen.available">
     2711 +            <and>
     2712 +                <not>
     2713 +                    <equals arg1="${application.splash}" arg2="" trim="true"/>
     2714 +                </not>
     2715 +                <available file="${application.splash}"/>
     2716 +            </and>
     2717 +        </condition>
     2718 +        <condition property="main.class.available">
     2719 +            <and>
     2720 +                <isset property="main.class"/>
     2721 +                <not>
     2722 +                    <equals arg1="${main.class}" arg2="" trim="true"/>
     2723 +                </not>
     2724 +            </and>
     2725 +        </condition>
     2726 +        <condition property="manifest.available+main.class">
     2727 +            <and>
     2728 +                <isset property="manifest.available"/>
     2729 +                <isset property="main.class.available"/>
     2730 +            </and>
     2731 +        </condition>
     2732 +        <condition property="do.mkdist">
     2733 +            <and>
     2734 +                <isset property="libs.CopyLibs.classpath"/>
     2735 +                <not>
     2736 +                    <istrue value="${mkdist.disabled}"/>
     2737 +                </not>
     2738 +            </and>
     2739 +        </condition>
     2740 +        <condition property="manifest.available+main.class+mkdist.available">
     2741 +            <and>
     2742 +                <istrue value="${manifest.available+main.class}"/>
     2743 +                <isset property="do.mkdist"/>
     2744 +            </and>
     2745 +        </condition>
     2746 +        <condition property="manifest.available+main.class+mkdist.available+splashscreen.available">
     2747 +            <and>
     2748 +                <istrue value="${manifest.available+main.class+mkdist.available}"/>
     2749 +                <istrue value="${splashscreen.available}"/>
     2750 +            </and>
     2751 +        </condition>
     2752 +        <condition property="do.archive">
     2753 +            <not>
     2754 +                <istrue value="${jar.archive.disabled}"/>
     2755 +            </not>
     2756 +        </condition>
     2757 +        <condition property="do.archive+manifest.available">
     2758 +            <and>
     2759 +                <isset property="manifest.available"/>
     2760 +                <istrue value="${do.archive}"/>
     2761 +            </and>
     2762 +        </condition>
     2763 +        <condition property="do.archive+manifest.available+main.class">
     2764 +            <and>
     2765 +                <istrue value="${manifest.available+main.class}"/>
     2766 +                <istrue value="${do.archive}"/>
     2767 +            </and>
     2768 +        </condition>
     2769 +        <condition property="do.archive+manifest.available+main.class+mkdist.available">
     2770 +            <and>
     2771 +                <istrue value="${manifest.available+main.class+mkdist.available}"/>
     2772 +                <istrue value="${do.archive}"/>
     2773 +            </and>
     2774 +        </condition>
     2775 +        <condition property="do.archive+manifest.available+main.class+mkdist.available+splashscreen.available">
     2776 +            <and>
     2777 +                <istrue value="${manifest.available+main.class+mkdist.available+splashscreen.available}"/>
     2778 +                <istrue value="${do.archive}"/>
     2779 +            </and>
     2780 +        </condition>
     2781 +        <condition property="have.tests">
     2782 +            <or/>
     2783 +        </condition>
     2784 +        <condition property="have.sources">
     2785 +            <or>
     2786 +                <available file="${src.dir}"/>
     2787 +            </or>
     2788 +        </condition>
     2789 +        <condition property="netbeans.home+have.tests">
     2790 +            <and>
     2791 +                <isset property="netbeans.home"/>
     2792 +                <isset property="have.tests"/>
     2793 +            </and>
     2794 +        </condition>
     2795 +        <condition property="no.javadoc.preview">
     2796 +            <and>
     2797 +                <isset property="javadoc.preview"/>
     2798 +                <isfalse value="${javadoc.preview}"/>
     2799 +            </and>
     2800 +        </condition>
     2801 +        <property name="run.jvmargs" value=""/>
     2802 +        <property name="javac.compilerargs" value=""/>
     2803 +        <property name="work.dir" value="${basedir}"/>
     2804 +        <condition property="no.deps">
     2805 +            <and>
     2806 +                <istrue value="${no.dependencies}"/>
     2807 +            </and>
     2808 +        </condition>
     2809 +        <property name="javac.debug" value="true"/>
     2810 +        <property name="javadoc.preview" value="true"/>
     2811 +        <property name="application.args" value=""/>
     2812 +        <property name="source.encoding" value="${file.encoding}"/>
     2813 +        <property name="runtime.encoding" value="${source.encoding}"/>
     2814 +        <condition property="javadoc.encoding.used" value="${javadoc.encoding}">
     2815 +            <and>
     2816 +                <isset property="javadoc.encoding"/>
     2817 +                <not>
     2818 +                    <equals arg1="${javadoc.encoding}" arg2=""/>
     2819 +                </not>
     2820 +            </and>
     2821 +        </condition>
     2822 +        <property name="javadoc.encoding.used" value="${source.encoding}"/>
     2823 +        <property name="includes" value="**"/>
     2824 +        <property name="excludes" value=""/>
     2825 +        <property name="do.depend" value="false"/>
     2826 +        <condition property="do.depend.true">
     2827 +            <istrue value="${do.depend}"/>
     2828 +        </condition>
     2829 +        <path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
     2830 +        <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
     2831 +            <length length="0" string="${endorsed.classpath}" when="greater"/>
     2832 +        </condition>
     2833 +        <property name="jar.index" value="false"/>
     2834 +        <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/>
     2835 +    </target>
     2836 +    <target name="-post-init">
     2837 +        <!-- Empty placeholder for easier customization. -->
     2838 +        <!-- You can override this target in the ../build.xml file. -->
     2839 +    </target>
     2840 +    <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
     2841 +        <fail unless="src.dir">Must set src.dir</fail>
     2842 +        <fail unless="build.dir">Must set build.dir</fail>
     2843 +        <fail unless="dist.dir">Must set dist.dir</fail>
     2844 +        <fail unless="build.classes.dir">Must set build.classes.dir</fail>
     2845 +        <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
     2846 +        <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
     2847 +        <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
     2848 +        <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
     2849 +        <fail unless="dist.jar">Must set dist.jar</fail>
     2850 +    </target>
     2851 +    <target name="-init-macrodef-property">
     2852 +        <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
     2853 +            <attribute name="name"/>
     2854 +            <attribute name="value"/>
     2855 +            <sequential>
     2856 +                <property name="@{name}" value="${@{value}}"/>
     2857 +            </sequential>
     2858 +        </macrodef>
     2859 +    </target>
     2860 +    <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
     2861 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
     2862 +            <attribute default="${src.dir}" name="srcdir"/>
     2863 +            <attribute default="${build.classes.dir}" name="destdir"/>
     2864 +            <attribute default="${javac.classpath}" name="classpath"/>
     2865 +            <attribute default="${javac.processorpath}" name="processorpath"/>
     2866 +            <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
     2867 +            <attribute default="${includes}" name="includes"/>
     2868 +            <attribute default="${excludes}" name="excludes"/>
     2869 +            <attribute default="${javac.debug}" name="debug"/>
     2870 +            <attribute default="${empty.dir}" name="sourcepath"/>
     2871 +            <attribute default="${empty.dir}" name="gensrcdir"/>
     2872 +            <element name="customize" optional="true"/>
     2873 +            <sequential>
     2874 +                <property location="${build.dir}/empty" name="empty.dir"/>
     2875 +                <mkdir dir="${empty.dir}"/>
     2876 +                <mkdir dir="@{apgeneratedsrcdir}"/>
     2877 +                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" executable="${platform.javac}" fork="yes" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
     2878 +                    <src>
     2879 +                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
     2880 +                            <include name="*"/>
     2881 +                        </dirset>
     2882 +                    </src>
     2883 +                    <classpath>
     2884 +                        <path path="@{classpath}"/>
     2885 +                    </classpath>
     2886 +                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
     2887 +                    <compilerarg line="${javac.compilerargs}"/>
     2888 +                    <compilerarg value="-processorpath"/>
     2889 +                    <compilerarg path="@{processorpath}:${empty.dir}"/>
     2890 +                    <compilerarg line="${ap.processors.internal}"/>
     2891 +                    <compilerarg line="${annotation.processing.processor.options}"/>
     2892 +                    <compilerarg value="-s"/>
     2893 +                    <compilerarg path="@{apgeneratedsrcdir}"/>
     2894 +                    <compilerarg line="${ap.proc.none.internal}"/>
     2895 +                    <customize/>
     2896 +                </javac>
     2897 +            </sequential>
     2898 +        </macrodef>
     2899 +    </target>
     2900 +    <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
     2901 +        <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
     2902 +            <attribute default="${src.dir}" name="srcdir"/>
     2903 +            <attribute default="${build.classes.dir}" name="destdir"/>
     2904 +            <attribute default="${javac.classpath}" name="classpath"/>
     2905 +            <attribute default="${javac.processorpath}" name="processorpath"/>
     2906 +            <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
     2907 +            <attribute default="${includes}" name="includes"/>
     2908 +            <attribute default="${excludes}" name="excludes"/>
     2909 +            <attribute default="${javac.debug}" name="debug"/>
     2910 +            <attribute default="${empty.dir}" name="sourcepath"/>
     2911 +            <attribute default="${empty.dir}" name="gensrcdir"/>
     2912 +            <element name="customize" optional="true"/>
     2913 +            <sequential>
     2914 +                <property location="${build.dir}/empty" name="empty.dir"/>
     2915 +                <mkdir dir="${empty.dir}"/>
     2916 +                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" executable="${platform.javac}" fork="yes" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
     2917 +                    <src>
     2918 +                        <dirset dir="@{gensrcdir}" erroronmissingdir="false">
     2919 +                            <include name="*"/>
     2920 +                        </dirset>
     2921 +                    </src>
     2922 +                    <classpath>
     2923 +                        <path path="@{classpath}"/>
     2924 +                    </classpath>
     2925 +                    <compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
     2926 +                    <compilerarg line="${javac.compilerargs}"/>
     2927 +                    <customize/>
     2928 +                </javac>
     2929 +            </sequential>
     2930 +        </macrodef>
     2931 +    </target>
     2932 +    <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
     2933 +        <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
     2934 +            <attribute default="${src.dir}" name="srcdir"/>
     2935 +            <attribute default="${build.classes.dir}" name="destdir"/>
     2936 +            <attribute default="${javac.classpath}" name="classpath"/>
     2937 +            <sequential>
     2938 +                <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
     2939 +                    <classpath>
     2940 +                        <path path="@{classpath}"/>
     2941 +                    </classpath>
     2942 +                </depend>
     2943 +            </sequential>
     2944 +        </macrodef>
     2945 +        <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3">
     2946 +            <attribute default="${build.classes.dir}" name="destdir"/>
     2947 +            <sequential>
     2948 +                <fail unless="javac.includes">Must set javac.includes</fail>
     2949 +                <pathconvert pathsep="${line.separator}" property="javac.includes.binary">
     2950 +                    <path>
     2951 +                        <filelist dir="@{destdir}" files="${javac.includes}"/>
     2952 +                    </path>
     2953 +                    <globmapper from="*.java" to="*.class"/>
     2954 +                </pathconvert>
     2955 +                <tempfile deleteonexit="true" property="javac.includesfile.binary"/>
     2956 +                <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/>
     2957 +                <delete>
     2958 +                    <files includesfile="${javac.includesfile.binary}"/>
     2959 +                </delete>
     2960 +                <delete file="${javac.includesfile.binary}"/>
     2961 +            </sequential>
     2962 +        </macrodef>
     2963 +    </target>
     2964 +    <target name="-init-macrodef-junit">
     2965 +        <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
     2966 +            <attribute default="${includes}" name="includes"/>
     2967 +            <attribute default="${excludes}" name="excludes"/>
     2968 +            <attribute default="**" name="testincludes"/>
     2969 +            <sequential>
     2970 +                <property name="junit.forkmode" value="perTest"/>
     2971 +                <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" jvm="${platform.java}" showoutput="true" tempdir="${build.dir}">
     2972 +                    <batchtest todir="${build.test.results.dir}"/>
     2973 +                    <classpath>
     2974 +                        <path path="${run.test.classpath}"/>
     2975 +                    </classpath>
     2976 +                    <syspropertyset>
     2977 +                        <propertyref prefix="test-sys-prop."/>
     2978 +                        <mapper from="test-sys-prop.*" to="*" type="glob"/>
     2979 +                    </syspropertyset>
     2980 +                    <formatter type="brief" usefile="false"/>
     2981 +                    <formatter type="xml"/>
     2982 +                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
     2983 +                    <jvmarg line="${run.jvmargs}"/>
     2984 +                </junit>
     2985 +            </sequential>
     2986 +        </macrodef>
     2987 +    </target>
     2988 +    <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" name="profile-init"/>
     2989 +    <target name="-profile-pre-init">
     2990 +        <!-- Empty placeholder for easier customization. -->
     2991 +        <!-- You can override this target in the ../build.xml file. -->
     2992 +    </target>
     2993 +    <target name="-profile-post-init">
     2994 +        <!-- Empty placeholder for easier customization. -->
     2995 +        <!-- You can override this target in the ../build.xml file. -->
     2996 +    </target>
     2997 +    <target name="-profile-init-macrodef-profile">
     2998 +        <macrodef name="resolve">
     2999 +            <attribute name="name"/>
     3000 +            <attribute name="value"/>
     3001 +            <sequential>
     3002 +                <property name="@{name}" value="${env.@{value}}"/>
     3003 +            </sequential>
     3004 +        </macrodef>
     3005 +        <macrodef name="profile">
     3006 +            <attribute default="${main.class}" name="classname"/>
     3007 +            <element name="customize" optional="true"/>
     3008 +            <sequential>
     3009 +                <property environment="env"/>
     3010 +                <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/>
     3011 +                <java classname="@{classname}" dir="${profiler.info.dir}" fork="true" jvm="${profiler.info.jvm}">
     3012 +                    <jvmarg value="${profiler.info.jvmargs.agent}"/>
     3013 +                    <jvmarg line="${profiler.info.jvmargs}"/>
     3014 +                    <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
     3015 +                    <arg line="${application.args}"/>
     3016 +                    <classpath>
     3017 +                        <path path="${run.classpath}"/>
     3018 +                    </classpath>
     3019 +                    <syspropertyset>
     3020 +                        <propertyref prefix="run-sys-prop."/>
     3021 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
     3022 +                    </syspropertyset>
     3023 +                    <customize/>
     3024 +                </java>
     3025 +            </sequential>
     3026 +        </macrodef>
     3027 +    </target>
     3028 +    <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" name="-profile-init-check">
     3029 +        <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail>
     3030 +        <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail>
     3031 +    </target>
     3032 +    <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
     3033 +        <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
     3034 +            <attribute default="${main.class}" name="name"/>
     3035 +            <attribute default="${debug.classpath}" name="classpath"/>
     3036 +            <attribute default="" name="stopclassname"/>
     3037 +            <sequential>
     3038 +                <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
     3039 +                    <classpath>
     3040 +                        <path path="@{classpath}"/>
     3041 +                    </classpath>
     3042 +                    <bootclasspath>
     3043 +                        <path path="${platform.bootcp}"/>
     3044 +                    </bootclasspath>
     3045 +                </nbjpdastart>
     3046 +            </sequential>
     3047 +        </macrodef>
     3048 +        <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
     3049 +            <attribute default="${build.classes.dir}" name="dir"/>
     3050 +            <sequential>
     3051 +                <nbjpdareload>
     3052 +                    <fileset dir="@{dir}" includes="${fix.classes}">
     3053 +                        <include name="${fix.includes}*.class"/>
     3054 +                    </fileset>
     3055 +                </nbjpdareload>
     3056 +            </sequential>
     3057 +        </macrodef>
     3058 +    </target>
     3059 +    <target name="-init-debug-args">
     3060 +        <exec executable="${platform.java}" outputproperty="version-output">
     3061 +            <arg value="-version"/>
     3062 +        </exec>
     3063 +        <condition property="have-jdk-older-than-1.4">
     3064 +            <or>
     3065 +                <contains string="${version-output}" substring="java version &quot;1.0"/>
     3066 +                <contains string="${version-output}" substring="java version &quot;1.1"/>
     3067 +                <contains string="${version-output}" substring="java version &quot;1.2"/>
     3068 +                <contains string="${version-output}" substring="java version &quot;1.3"/>
     3069 +            </or>
     3070 +        </condition>
     3071 +        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
     3072 +            <istrue value="${have-jdk-older-than-1.4}"/>
     3073 +        </condition>
     3074 +        <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
     3075 +            <os family="windows"/>
     3076 +        </condition>
     3077 +        <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
     3078 +            <isset property="debug.transport"/>
     3079 +        </condition>
     3080 +    </target>
     3081 +    <target depends="-init-debug-args" name="-init-macrodef-debug">
     3082 +        <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
     3083 +            <attribute default="${main.class}" name="classname"/>
     3084 +            <attribute default="${debug.classpath}" name="classpath"/>
     3085 +            <element name="customize" optional="true"/>
     3086 +            <sequential>
     3087 +                <java classname="@{classname}" dir="${work.dir}" fork="true" jvm="${platform.java}">
     3088 +                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
     3089 +                    <jvmarg line="${debug-args-line}"/>
     3090 +                    <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
     3091 +                    <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
     3092 +                    <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
     3093 +                    <jvmarg line="${run.jvmargs}"/>
     3094 +                    <classpath>
     3095 +                        <path path="@{classpath}"/>
     3096 +                    </classpath>
     3097 +                    <syspropertyset>
     3098 +                        <propertyref prefix="run-sys-prop."/>
     3099 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
     3100 +                    </syspropertyset>
     3101 +                    <customize/>
     3102 +                </java>
     3103 +            </sequential>
     3104 +        </macrodef>
     3105 +    </target>
     3106 +    <target name="-init-macrodef-java">
     3107 +        <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
     3108 +            <attribute default="${main.class}" name="classname"/>
     3109 +            <attribute default="${run.classpath}" name="classpath"/>
     3110 +            <element name="customize" optional="true"/>
     3111 +            <sequential>
     3112 +                <java classname="@{classname}" dir="${work.dir}" fork="true" jvm="${platform.java}">
     3113 +                    <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
     3114 +                    <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
     3115 +                    <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
     3116 +                    <jvmarg line="${run.jvmargs}"/>
     3117 +                    <classpath>
     3118 +                        <path path="@{classpath}"/>
     3119 +                    </classpath>
     3120 +                    <syspropertyset>
     3121 +                        <propertyref prefix="run-sys-prop."/>
     3122 +                        <mapper from="run-sys-prop.*" to="*" type="glob"/>
     3123 +                    </syspropertyset>
     3124 +                    <customize/>
     3125 +                </java>
     3126 +            </sequential>
     3127 +        </macrodef>
     3128 +    </target>
     3129 +    <target name="-init-macrodef-copylibs">
     3130 +        <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3">
     3131 +            <element name="customize" optional="true"/>
     3132 +            <sequential>
     3133 +                <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
     3134 +                <pathconvert property="run.classpath.without.build.classes.dir">
     3135 +                    <path path="${run.classpath}"/>
     3136 +                    <map from="${build.classes.dir.resolved}" to=""/>
     3137 +                </pathconvert>
     3138 +                <pathconvert pathsep=" " property="jar.classpath">
     3139 +                    <path path="${run.classpath.without.build.classes.dir}"/>
     3140 +                    <chainedmapper>
     3141 +                        <flattenmapper/>
     3142 +                        <globmapper from="*" to="lib/*"/>
     3143 +                    </chainedmapper>
     3144 +                </pathconvert>
     3145 +                <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>
     3146 +                <copylibs compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">
     3147 +                    <fileset dir="${build.classes.dir}"/>
     3148 +                    <manifest>
     3149 +                        <attribute name="Class-Path" value="${jar.classpath}"/>
     3150 +                        <customize/>
     3151 +                    </manifest>
     3152 +                </copylibs>
     3153 +            </sequential>
     3154 +        </macrodef>
     3155 +    </target>
     3156 +    <target name="-init-presetdef-jar">
     3157 +        <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
     3158 +            <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}">
     3159 +                <j2seproject1:fileset dir="${build.classes.dir}"/>
     3160 +            </jar>
     3161 +        </presetdef>
     3162 +    </target>
     3163 +    <target name="-init-ap-cmdline-properties">
     3164 +        <property name="annotation.processing.enabled" value="true"/>
     3165 +        <property name="annotation.processing.processors.list" value=""/>
     3166 +        <property name="annotation.processing.processor.options" value=""/>
     3167 +        <property name="annotation.processing.run.all.processors" value="true"/>
     3168 +        <property name="javac.processorpath" value="${javac.classpath}"/>
     3169 +        <property name="javac.test.processorpath" value="${javac.test.classpath}"/>
     3170 +        <condition property="ap.supported.internal" value="true">
     3171 +            <not>
     3172 +                <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
     3173 +            </not>
     3174 +        </condition>
     3175 +    </target>
     3176 +    <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
     3177 +        <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
     3178 +            <isfalse value="${annotation.processing.run.all.processors}"/>
     3179 +        </condition>
     3180 +        <condition else="" property="ap.proc.none.internal" value="-proc:none">
     3181 +            <isfalse value="${annotation.processing.enabled}"/>
     3182 +        </condition>
     3183 +    </target>
     3184 +    <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
     3185 +        <property name="ap.cmd.line.internal" value=""/>
     3186 +    </target>
     3187 +    <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"/>
     3188 +    <!--
     3189 +                ===================
     3190 +                COMPILATION SECTION
     3191 +                ===================
     3192 +            -->
     3193 +    <target name="-deps-jar-init" unless="built-jar.properties">
     3194 +        <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/>
     3195 +        <delete file="${built-jar.properties}" quiet="true"/>
     3196 +    </target>
     3197 +    <target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
     3198 +        <echo level="warn" message="Cycle detected: HotSwapTests was already built"/>
     3199 +    </target>
     3200 +    <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
     3201 +        <mkdir dir="${build.dir}"/>
     3202 +        <touch file="${built-jar.properties}" verbose="false"/>
     3203 +        <property file="${built-jar.properties}" prefix="already.built.jar."/>
     3204 +        <antcall target="-warn-already-built-jar"/>
     3205 +        <propertyfile file="${built-jar.properties}">
     3206 +            <entry key="${basedir}" value=""/>
     3207 +        </propertyfile>
     3208 +        <antcall target="-maybe-call-dep">
     3209 +            <param name="call.built.properties" value="${built-jar.properties}"/>
     3210 +            <param location="${project.HotSwapTool}" name="call.subproject"/>
     3211 +            <param location="${project.HotSwapTool}/build.xml" name="call.script"/>
     3212 +            <param name="call.target" value="jar"/>
     3213 +            <param name="transfer.built-jar.properties" value="${built-jar.properties}"/>
     3214 +        </antcall>
     3215 +    </target>
     3216 +    <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/>
     3217 +    <target depends="init" name="-check-automatic-build">
     3218 +        <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
     3219 +    </target>
     3220 +    <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
     3221 +        <antcall target="clean"/>
     3222 +    </target>
     3223 +    <target depends="init,deps-jar" name="-pre-pre-compile">
     3224 +        <mkdir dir="${build.classes.dir}"/>
     3225 +    </target>
     3226 +    <target name="-pre-compile">
     3227 +        <!-- Empty placeholder for easier customization. -->
     3228 +        <!-- You can override this target in the ../build.xml file. -->
     3229 +    </target>
     3230 +    <target if="do.depend.true" name="-compile-depend">
     3231 +        <pathconvert property="build.generated.subdirs">
     3232 +            <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false">
     3233 +                <include name="*"/>
     3234 +            </dirset>
     3235 +        </pathconvert>
     3236 +        <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/>
     3237 +    </target>
     3238 +    <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
     3239 +        <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
     3240 +        <copy todir="${build.classes.dir}">
     3241 +            <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
     3242 +        </copy>
     3243 +    </target>
     3244 +    <target if="has.persistence.xml" name="-copy-persistence-xml">
     3245 +        <mkdir dir="${build.classes.dir}/META-INF"/>
     3246 +        <copy todir="${build.classes.dir}/META-INF">
     3247 +            <fileset dir="${meta.inf.dir}" includes="persistence.xml"/>
     3248 +        </copy>
     3249 +    </target>
     3250 +    <target name="-post-compile">
     3251 +        <!-- Empty placeholder for easier customization. -->
     3252 +        <!-- You can override this target in the ../build.xml file. -->
     3253 +    </target>
     3254 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
     3255 +    <target name="-pre-compile-single">
     3256 +        <!-- Empty placeholder for easier customization. -->
     3257 +        <!-- You can override this target in the ../build.xml file. -->
     3258 +    </target>
     3259 +    <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
     3260 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
     3261 +        <j2seproject3:force-recompile/>
     3262 +        <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
     3263 +    </target>
     3264 +    <target name="-post-compile-single">
     3265 +        <!-- Empty placeholder for easier customization. -->
     3266 +        <!-- You can override this target in the ../build.xml file. -->
     3267 +    </target>
     3268 +    <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
     3269 +    <!--
     3270 +                ====================
     3271 +                JAR BUILDING SECTION
     3272 +                ====================
     3273 +            -->
     3274 +    <target depends="init" name="-pre-pre-jar">
     3275 +        <dirname file="${dist.jar}" property="dist.jar.dir"/>
     3276 +        <mkdir dir="${dist.jar.dir}"/>
     3277 +    </target>
     3278 +    <target name="-pre-jar">
     3279 +        <!-- Empty placeholder for easier customization. -->
     3280 +        <!-- You can override this target in the ../build.xml file. -->
     3281 +    </target>
     3282 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available">
     3283 +        <j2seproject1:jar/>
     3284 +    </target>
     3285 +    <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class">
     3286 +        <j2seproject1:jar manifest="${manifest.file}"/>
     3287 +    </target>
     3288 +    <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">
     3289 +        <j2seproject1:jar manifest="${manifest.file}">
     3290 +            <j2seproject1:manifest>
     3291 +                <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
     3292 +            </j2seproject1:manifest>
     3293 +        </j2seproject1:jar>
     3294 +        <echo>To run this application from the command line without Ant, try:</echo>
     3295 +        <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
     3296 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
     3297 +        <pathconvert property="run.classpath.with.dist.jar">
     3298 +            <path path="${run.classpath}"/>
     3299 +            <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
     3300 +        </pathconvert>
     3301 +        <echo>${platform.java} -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
     3302 +    </target>
     3303 +    <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">
     3304 +        <basename file="${application.splash}" property="splashscreen.basename"/>
     3305 +        <mkdir dir="${build.classes.dir}/META-INF"/>
     3306 +        <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/>
     3307 +        <j2seproject3:copylibs>
     3308 +            <customize>
     3309 +                <attribute name="Main-Class" value="${main.class}"/>
     3310 +                <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/>
     3311 +            </customize>
     3312 +        </j2seproject3:copylibs>
     3313 +        <echo>To run this application from the command line without Ant, try:</echo>
     3314 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
     3315 +        <echo>${platform.java} -jar "${dist.jar.resolved}"</echo>
     3316 +    </target>
     3317 +    <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">
     3318 +        <j2seproject3:copylibs>
     3319 +            <customize>
     3320 +                <attribute name="Main-Class" value="${main.class}"/>
     3321 +            </customize>
     3322 +        </j2seproject3:copylibs>
     3323 +        <echo>To run this application from the command line without Ant, try:</echo>
     3324 +        <property location="${dist.jar}" name="dist.jar.resolved"/>
     3325 +        <echo>${platform.java} -jar "${dist.jar.resolved}"</echo>
     3326 +    </target>
     3327 +    <target name="-post-jar">
     3328 +        <!-- Empty placeholder for easier customization. -->
     3329 +        <!-- You can override this target in the ../build.xml file. -->
     3330 +    </target>
     3331 +    <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"/>
     3332 +    <!--
     3333 +                =================
     3334 +                EXECUTION SECTION
     3335 +                =================
     3336 +            -->
     3337 +    <target depends="init,compile" description="Run a main class." name="run">
     3338 +        <j2seproject1:java>
     3339 +            <customize>
     3340 +                <arg line="${application.args}"/>
     3341 +            </customize>
     3342 +        </j2seproject1:java>
     3343 +    </target>
     3344 +    <target name="-do-not-recompile">
     3345 +        <property name="javac.includes.binary" value=""/>
     3346 +    </target>
     3347 +    <target depends="init,compile-single" name="run-single">
     3348 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
     3349 +        <j2seproject1:java classname="${run.class}"/>
     3350 +    </target>
     3351 +    <target depends="init,compile-test-single" name="run-test-with-main">
     3352 +        <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
     3353 +        <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>
     3354 +    </target>
     3355 +    <!--
     3356 +                =================
     3357 +                DEBUGGING SECTION
     3358 +                =================
     3359 +            -->
     3360 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger">
     3361 +        <j2seproject1:nbjpdastart name="${debug.class}"/>
     3362 +    </target>
     3363 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">
     3364 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>
     3365 +    </target>
     3366 +    <target depends="init,compile" name="-debug-start-debuggee">
     3367 +        <j2seproject3:debug>
     3368 +            <customize>
     3369 +                <arg line="${application.args}"/>
     3370 +            </customize>
     3371 +        </j2seproject3:debug>
     3372 +    </target>
     3373 +    <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
     3374 +    <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
     3375 +        <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
     3376 +    </target>
     3377 +    <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
     3378 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
     3379 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
     3380 +        <j2seproject3:debug classname="${debug.class}"/>
     3381 +    </target>
     3382 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
     3383 +    <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test">
     3384 +        <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
     3385 +        <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/>
     3386 +    </target>
     3387 +    <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/>
     3388 +    <target depends="init" name="-pre-debug-fix">
     3389 +        <fail unless="fix.includes">Must set fix.includes</fail>
     3390 +        <property name="javac.includes" value="${fix.includes}.java"/>
     3391 +    </target>
     3392 +    <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
     3393 +        <j2seproject1:nbjpdareload/>
     3394 +    </target>
     3395 +    <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
     3396 +    <!--
     3397 +                =================
     3398 +                PROFILING SECTION
     3399 +                =================
     3400 +            -->
     3401 +    <target depends="profile-init,compile" description="Profile a project in the IDE." if="netbeans.home" name="profile">
     3402 +        <nbprofiledirect>
     3403 +            <classpath>
     3404 +                <path path="${run.classpath}"/>
     3405 +            </classpath>
     3406 +        </nbprofiledirect>
     3407 +        <profile/>
     3408 +    </target>
     3409 +    <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="netbeans.home" name="profile-single">
     3410 +        <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail>
     3411 +        <nbprofiledirect>
     3412 +            <classpath>
     3413 +                <path path="${run.classpath}"/>
     3414 +            </classpath>
     3415 +        </nbprofiledirect>
     3416 +        <profile classname="${profile.class}"/>
     3417 +    </target>
     3418 +    <!--
     3419 +                =========================
     3420 +                APPLET PROFILING  SECTION
     3421 +                =========================
     3422 +            -->
     3423 +    <target depends="profile-init,compile-single" if="netbeans.home" name="profile-applet">
     3424 +        <nbprofiledirect>
     3425 +            <classpath>
     3426 +                <path path="${run.classpath}"/>
     3427 +            </classpath>
     3428 +        </nbprofiledirect>
     3429 +        <profile classname="sun.applet.AppletViewer">
     3430 +            <customize>
     3431 +                <arg value="${applet.url}"/>
     3432 +            </customize>
     3433 +        </profile>
     3434 +    </target>
     3435 +    <!--
     3436 +                =========================
     3437 +                TESTS PROFILING  SECTION
     3438 +                =========================
     3439 +            -->
     3440 +    <target depends="profile-init,compile-test-single" if="netbeans.home" name="profile-test-single">
     3441 +        <nbprofiledirect>
     3442 +            <classpath>
     3443 +                <path path="${run.test.classpath}"/>
     3444 +            </classpath>
     3445 +        </nbprofiledirect>
     3446 +        <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true">
     3447 +            <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
     3448 +            <jvmarg value="${profiler.info.jvmargs.agent}"/>
     3449 +            <jvmarg line="${profiler.info.jvmargs}"/>
     3450 +            <test name="${profile.class}"/>
     3451 +            <classpath>
     3452 +                <path path="${run.test.classpath}"/>
     3453 +            </classpath>
     3454 +            <syspropertyset>
     3455 +                <propertyref prefix="test-sys-prop."/>
     3456 +                <mapper from="test-sys-prop.*" to="*" type="glob"/>
     3457 +            </syspropertyset>
     3458 +            <formatter type="brief" usefile="false"/>
     3459 +            <formatter type="xml"/>
     3460 +        </junit>
     3461 +    </target>
     3462 +    <!--
     3463 +                ===============
     3464 +                JAVADOC SECTION
     3465 +                ===============
     3466 +            -->
     3467 +    <target depends="init" if="have.sources" name="-javadoc-build">
     3468 +        <mkdir dir="${dist.javadoc.dir}"/>
     3469 +        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" executable="${platform.javadoc}" 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}">
     3470 +            <classpath>
     3471 +                <path path="${javac.classpath}"/>
     3472 +            </classpath>
     3473 +            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
     3474 +                <filename name="**/*.java"/>
     3475 +            </fileset>
     3476 +            <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
     3477 +                <include name="**/*.java"/>
     3478 +            </fileset>
     3479 +        </javadoc>
     3480 +        <copy todir="${dist.javadoc.dir}">
     3481 +            <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
     3482 +                <filename name="**/doc-files/**"/>
     3483 +            </fileset>
     3484 +            <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
     3485 +                <include name="**/doc-files/**"/>
     3486 +            </fileset>
     3487 +        </copy>
     3488 +    </target>
     3489 +    <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
     3490 +        <nbbrowse file="${dist.javadoc.dir}/index.html"/>
     3491 +    </target>
     3492 +    <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
     3493 +    <!--
     3494 +                =========================
     3495 +                JUNIT COMPILATION SECTION
     3496 +                =========================
     3497 +            -->
     3498 +    <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
     3499 +        <mkdir dir="${build.test.classes.dir}"/>
     3500 +    </target>
     3501 +    <target name="-pre-compile-test">
     3502 +        <!-- Empty placeholder for easier customization. -->
     3503 +        <!-- You can override this target in the ../build.xml file. -->
     3504 +    </target>
     3505 +    <target if="do.depend.true" name="-compile-test-depend">
     3506 +        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir=""/>
     3507 +    </target>
     3508 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
     3509 +        <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir=""/>
     3510 +        <copy todir="${build.test.classes.dir}"/>
     3511 +    </target>
     3512 +    <target name="-post-compile-test">
     3513 +        <!-- Empty placeholder for easier customization. -->
     3514 +        <!-- You can override this target in the ../build.xml file. -->
     3515 +    </target>
     3516 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
     3517 +    <target name="-pre-compile-test-single">
     3518 +        <!-- Empty placeholder for easier customization. -->
     3519 +        <!-- You can override this target in the ../build.xml file. -->
     3520 +    </target>
     3521 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
     3522 +        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
     3523 +        <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
     3524 +        <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="" srcdir=""/>
     3525 +        <copy todir="${build.test.classes.dir}"/>
     3526 +    </target>
     3527 +    <target name="-post-compile-test-single">
     3528 +        <!-- Empty placeholder for easier customization. -->
     3529 +        <!-- You can override this target in the ../build.xml file. -->
     3530 +    </target>
     3531 +    <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
     3532 +    <!--
     3533 +                =======================
     3534 +                JUNIT EXECUTION SECTION
     3535 +                =======================
     3536 +            -->
     3537 +    <target depends="init" if="have.tests" name="-pre-test-run">
     3538 +        <mkdir dir="${build.test.results.dir}"/>
     3539 +    </target>
     3540 +    <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
     3541 +        <j2seproject3:junit testincludes="**/*Test.java"/>
     3542 +    </target>
     3543 +    <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
     3544 +        <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
     3545 +    </target>
     3546 +    <target depends="init" if="have.tests" name="test-report"/>
     3547 +    <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
     3548 +    <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
     3549 +    <target depends="init" if="have.tests" name="-pre-test-run-single">
     3550 +        <mkdir dir="${build.test.results.dir}"/>
     3551 +    </target>
     3552 +    <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
     3553 +        <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
     3554 +        <j2seproject3:junit excludes="" includes="${test.includes}"/>
     3555 +    </target>
     3556 +    <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
     3557 +        <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
     3558 +    </target>
     3559 +    <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"/>
     3560 +    <!--
     3561 +                =======================
     3562 +                JUNIT DEBUGGING SECTION
     3563 +                =======================
     3564 +            -->
     3565 +    <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
     3566 +        <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
     3567 +        <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
     3568 +        <delete file="${test.report.file}"/>
     3569 +        <mkdir dir="${build.test.results.dir}"/>
     3570 +        <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}">
     3571 +            <customize>
     3572 +                <syspropertyset>
     3573 +                    <propertyref prefix="test-sys-prop."/>
     3574 +                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
     3575 +                </syspropertyset>
     3576 +                <arg value="${test.class}"/>
     3577 +                <arg value="showoutput=true"/>
     3578 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
     3579 +                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
     3580 +            </customize>
     3581 +        </j2seproject3:debug>
     3582 +    </target>
     3583 +    <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
     3584 +        <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
     3585 +    </target>
     3586 +    <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
     3587 +    <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
     3588 +        <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
     3589 +    </target>
     3590 +    <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
     3591 +    <!--
     3592 +                =========================
     3593 +                APPLET EXECUTION SECTION
     3594 +                =========================
     3595 +            -->
     3596 +    <target depends="init,compile-single" name="run-applet">
     3597 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
     3598 +        <j2seproject1:java classname="sun.applet.AppletViewer">
     3599 +            <customize>
     3600 +                <arg value="${applet.url}"/>
     3601 +            </customize>
     3602 +        </j2seproject1:java>
     3603 +    </target>
     3604 +    <!--
     3605 +                =========================
     3606 +                APPLET DEBUGGING  SECTION
     3607 +                =========================
     3608 +            -->
     3609 +    <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
     3610 +        <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
     3611 +        <j2seproject3:debug classname="sun.applet.AppletViewer">
     3612 +            <customize>
     3613 +                <arg value="${applet.url}"/>
     3614 +            </customize>
     3615 +        </j2seproject3:debug>
     3616 +    </target>
     3617 +    <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
     3618 +    <!--
     3619 +                ===============
     3620 +                CLEANUP SECTION
     3621 +                ===============
     3622 +            -->
     3623 +    <target name="-deps-clean-init" unless="built-clean.properties">
     3624 +        <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/>
     3625 +        <delete file="${built-clean.properties}" quiet="true"/>
     3626 +    </target>
     3627 +    <target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
     3628 +        <echo level="warn" message="Cycle detected: HotSwapTests was already built"/>
     3629 +    </target>
     3630 +    <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
     3631 +        <mkdir dir="${build.dir}"/>
     3632 +        <touch file="${built-clean.properties}" verbose="false"/>
     3633 +        <property file="${built-clean.properties}" prefix="already.built.clean."/>
     3634 +        <antcall target="-warn-already-built-clean"/>
     3635 +        <propertyfile file="${built-clean.properties}">
     3636 +            <entry key="${basedir}" value=""/>
     3637 +        </propertyfile>
     3638 +        <antcall target="-maybe-call-dep">
     3639 +            <param name="call.built.properties" value="${built-clean.properties}"/>
     3640 +            <param location="${project.HotSwapTool}" name="call.subproject"/>
     3641 +            <param location="${project.HotSwapTool}/build.xml" name="call.script"/>
     3642 +            <param name="call.target" value="clean"/>
     3643 +            <param name="transfer.built-clean.properties" value="${built-clean.properties}"/>
     3644 +        </antcall>
     3645 +    </target>
     3646 +    <target depends="init" name="-do-clean">
     3647 +        <delete dir="${build.dir}"/>
     3648 +        <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
     3649 +    </target>
     3650 +    <target name="-post-clean">
     3651 +        <!-- Empty placeholder for easier customization. -->
     3652 +        <!-- You can override this target in the ../build.xml file. -->
     3653 +    </target>
     3654 +    <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
     3655 +    <target name="-check-call-dep">
     3656 +        <property file="${call.built.properties}" prefix="already.built."/>
     3657 +        <condition property="should.call.dep">
     3658 +            <not>
     3659 +                <isset property="already.built.${call.subproject}"/>
     3660 +            </not>
     3661 +        </condition>
     3662 +    </target>
     3663 +    <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">
     3664 +        <ant antfile="${call.script}" inheritall="false" target="${call.target}">
     3665 +            <propertyset>
     3666 +                <propertyref prefix="transfer."/>
     3667 +                <mapper from="transfer.*" to="*" type="glob"/>
     3668 +            </propertyset>
     3669 +        </ant>
     3670 +    </target>
     3671 +</project>
     3672 diff -r f5603a6e5042 hotswaptest/HotSwapTests/nbproject/configs/Run_All_Tests.properties
     3673 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3674 +++ b/hotswaptest/HotSwapTests/nbproject/configs/Run_All_Tests.properties	Fri Dec 17 13:23:04 2010 +0100
     3675 @@ -0,0 +1,2 @@
     3676 +$label=Run All Tests
     3677 +run.jvmargs=\ -Xdebug -XX:TraceRedefineClasses=4 -Xrunjdwp:transport=dt_socket,server=y,address=4000,suspend=n
     3678 diff -r f5603a6e5042 hotswaptest/HotSwapTests/nbproject/configs/Run_Natives_Tests.properties
     3679 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3680 +++ b/hotswaptest/HotSwapTests/nbproject/configs/Run_Natives_Tests.properties	Fri Dec 17 13:23:04 2010 +0100
     3681 @@ -0,0 +1,2 @@
     3682 +$label=Run Natives Tests
     3683 +run.jvmargs=\ -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=4000,suspend=n
     3684 diff -r f5603a6e5042 hotswaptest/HotSwapTests/nbproject/genfiles.properties
     3685 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3686 +++ b/hotswaptest/HotSwapTests/nbproject/genfiles.properties	Fri Dec 17 13:23:04 2010 +0100
     3687 @@ -0,0 +1,8 @@
     3688 +nbbuild.xml.data.CRC32=c8ab650e
     3689 +nbbuild.xml.script.CRC32=2ea92a55
     3690 +nbbuild.xml.stylesheet.CRC32=958a1d3e@1.26.2.45
     3691 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
     3692 +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
     3693 +nbproject/build-impl.xml.data.CRC32=c46425e2
     3694 +nbproject/build-impl.xml.script.CRC32=2aba14d0
     3695 +nbproject/build-impl.xml.stylesheet.CRC32=fce8b508@1.40.0.45
     3696 diff -r f5603a6e5042 hotswaptest/HotSwapTests/nbproject/project.properties
     3697 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3698 +++ b/hotswaptest/HotSwapTests/nbproject/project.properties	Fri Dec 17 13:23:04 2010 +0100
     3699 @@ -0,0 +1,76 @@
     3700 +application.title=HotSwapTests
     3701 +application.vendor=Thomas
     3702 +build.classes.dir=${build.dir}/classes
     3703 +build.classes.excludes=**/*.java,**/*.form
     3704 +# This directory is removed when the project is cleaned:
     3705 +build.dir=build
     3706 +build.generated.dir=${build.dir}/generated
     3707 +build.generated.sources.dir=${build.dir}/generated-sources
     3708 +# Only compile against the classpath explicitly listed here:
     3709 +build.sysclasspath=ignore
     3710 +build.test.classes.dir=${build.dir}/test/classes
     3711 +build.test.results.dir=${build.dir}/test/results
     3712 +buildfile=build.xml
     3713 +# Uncomment to specify the preferred debugger connection transport:
     3714 +#debug.transport=dt_socket
     3715 +debug.classpath=\
     3716 +    ${run.classpath}
     3717 +debug.test.classpath=\
     3718 +    ${run.test.classpath}
     3719 +# This directory is removed when the project is cleaned:
     3720 +dist.dir=dist
     3721 +dist.jar=${dist.dir}/HotSwapTests.jar
     3722 +dist.javadoc.dir=${dist.dir}/javadoc
     3723 +endorsed.classpath=
     3724 +excludes=
     3725 +file.reference.asm-all-3.2.jar=../lib/asm-all-3.2.jar
     3726 +file.reference.HotSwapTests-src=src
     3727 +file.reference.tools.jar=../lib/tools.jar
     3728 +includes=**
     3729 +jar.compress=false
     3730 +javac.classpath=\
     3731 +    ${libs.junit_4.classpath}:\
     3732 +    ${reference.HotSwapTool.jar}:\
     3733 +    ${file.reference.asm-all-3.2.jar}:\
     3734 +    ${file.reference.tools.jar}
     3735 +# Space-separated list of extra javac options
     3736 +javac.compilerargs=
     3737 +javac.deprecation=false
     3738 +javac.source=1.6
     3739 +javac.target=1.6
     3740 +javac.test.classpath=\
     3741 +    ${javac.classpath}:\
     3742 +    ${build.classes.dir}:\
     3743 +    ${libs.junit.classpath}:\
     3744 +    ${libs.junit_4.classpath}
     3745 +javadoc.additionalparam=
     3746 +javadoc.author=false
     3747 +javadoc.encoding=${source.encoding}
     3748 +javadoc.noindex=false
     3749 +javadoc.nonavbar=false
     3750 +javadoc.notree=false
     3751 +javadoc.private=false
     3752 +javadoc.splitindex=true
     3753 +javadoc.use=true
     3754 +javadoc.version=false
     3755 +javadoc.windowtitle=
     3756 +jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api"
     3757 +jnlp.codebase.type=local
     3758 +jnlp.descriptor=application
     3759 +jnlp.enabled=false
     3760 +jnlp.offline-allowed=false
     3761 +jnlp.signed=false
     3762 +main.class=at.ssw.hotswap.test.Main
     3763 +manifest.file=manifest.mf
     3764 +meta.inf.dir=${src.dir}/META-INF
     3765 +platform.active=JDK_1.7_HotSwap
     3766 +project.HotSwapTool=../HotSwapTool
     3767 +reference.HotSwapTool.jar=${project.HotSwapTool}/dist/HotSwapTool.jar
     3768 +run.classpath=\
     3769 +    ${javac.classpath}:\
     3770 +    ${build.classes.dir}
     3771 +run.test.classpath=\
     3772 +    ${javac.test.classpath}:\
     3773 +    ${build.test.classes.dir}
     3774 +source.encoding=UTF-8
     3775 +src.dir=${file.reference.HotSwapTests-src}
     3776 diff -r f5603a6e5042 hotswaptest/HotSwapTests/nbproject/project.xml
     3777 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3778 +++ b/hotswaptest/HotSwapTests/nbproject/project.xml	Fri Dec 17 13:23:04 2010 +0100
     3779 @@ -0,0 +1,25 @@
     3780 +<?xml version="1.0" encoding="UTF-8"?>
     3781 +<project xmlns="http://www.netbeans.org/ns/project/1">
     3782 +    <type>org.netbeans.modules.java.j2seproject</type>
     3783 +    <configuration>
     3784 +        <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
     3785 +            <name>HotSwapTests</name>
     3786 +            <minimum-ant-version>1.6.5</minimum-ant-version>
     3787 +            <explicit-platform explicit-source-supported="true"/>
     3788 +            <source-roots>
     3789 +                <root id="src.dir"/>
     3790 +            </source-roots>
     3791 +            <test-roots/>
     3792 +        </data>
     3793 +        <references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
     3794 +            <reference>
     3795 +                <foreign-project>HotSwapTool</foreign-project>
     3796 +                <artifact-type>jar</artifact-type>
     3797 +                <script>build.xml</script>
     3798 +                <target>jar</target>
     3799 +                <clean-target>clean</clean-target>
     3800 +                <id>jar</id>
     3801 +            </reference>
     3802 +        </references>
     3803 +    </configuration>
     3804 +</project>
     3805 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/CompleteTestSuite.java
     3806 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3807 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/CompleteTestSuite.java	Fri Dec 17 13:23:04 2010 +0100
     3808 @@ -0,0 +1,56 @@
     3809 +/*
     3810 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     3811 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3812 + *
     3813 + * This code is free software; you can redistribute it and/or modify it
     3814 + * under the terms of the GNU General Public License version 2 only, as
     3815 + * published by the Free Software Foundation.
     3816 + *
     3817 + * This code is distributed in the hope that it will be useful, but WITHOUT
     3818 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     3819 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     3820 + * version 2 for more details (a copy is included in the LICENSE file that
     3821 + * accompanied this code).
     3822 + *
     3823 + * You should have received a copy of the GNU General Public License version
     3824 + * 2 along with this work; if not, write to the Free Software Foundation,
     3825 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     3826 + *
     3827 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     3828 + * or visit www.oracle.com if you need additional information or have any
     3829 + * questions.
     3830 + *
     3831 + */
     3832 +
     3833 +package at.ssw.hotswap.test;
     3834 +
     3835 +import at.ssw.hotswap.test.accesstests.AccessTestSuite;
     3836 +import org.junit.runner.RunWith;
     3837 +import org.junit.runners.Suite;
     3838 +
     3839 +import at.ssw.hotswap.test.body.BodyTestSuite;
     3840 +import at.ssw.hotswap.test.eval.EvalTestSuite;
     3841 +import at.ssw.hotswap.test.fields.FieldsTestSuite;
     3842 +import at.ssw.hotswap.test.methods.MethodsTestSuite;
     3843 +import at.ssw.hotswap.test.natives.NativesTestSuite;
     3844 +import at.ssw.hotswap.test.transformer.TransformerTestSuite;
     3845 +import at.ssw.hotswap.test.structural.StructuralTestSuite;
     3846 +
     3847 +/**
     3848 + * Summarizes all available test suites.
     3849 + * 
     3850 + * @author Thomas Wuerthinger
     3851 + */
     3852 +@RunWith(Suite.class)
     3853 +@Suite.SuiteClasses({
     3854 +    BodyTestSuite.class,
     3855 +    EvalTestSuite.class,
     3856 +    MethodsTestSuite.class,
     3857 +    FieldsTestSuite.class,
     3858 +    StructuralTestSuite.class,
     3859 +    TransformerTestSuite.class,
     3860 +    NativesTestSuite.class,
     3861 +    AccessTestSuite.class
     3862 +})
     3863 +public class CompleteTestSuite {
     3864 +}
     3865 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/Main.java
     3866 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3867 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/Main.java	Fri Dec 17 13:23:04 2010 +0100
     3868 @@ -0,0 +1,156 @@
     3869 +/*
     3870 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     3871 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3872 + *
     3873 + * This code is free software; you can redistribute it and/or modify it
     3874 + * under the terms of the GNU General Public License version 2 only, as
     3875 + * published by the Free Software Foundation.
     3876 + *
     3877 + * This code is distributed in the hope that it will be useful, but WITHOUT
     3878 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     3879 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     3880 + * version 2 for more details (a copy is included in the LICENSE file that
     3881 + * accompanied this code).
     3882 + *
     3883 + * You should have received a copy of the GNU General Public License version
     3884 + * 2 along with this work; if not, write to the Free Software Foundation,
     3885 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     3886 + *
     3887 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     3888 + * or visit www.oracle.com if you need additional information or have any
     3889 + * questions.
     3890 + *
     3891 + */
     3892 +
     3893 +package at.ssw.hotswap.test;
     3894 +
     3895 +import at.ssw.hotswap.HotSwapTool;
     3896 +import java.io.File;
     3897 +import java.util.HashSet;
     3898 +import java.util.Set;
     3899 +import org.junit.runner.Description;
     3900 +import org.junit.runner.JUnitCore;
     3901 +import org.junit.runner.Request;
     3902 +import org.junit.runner.manipulation.Filter;
     3903 +import org.junit.runner.notification.Failure;
     3904 +import org.junit.runner.notification.RunListener;
     3905 +
     3906 +/**
     3907 + * Main class for running class redefinition tests. Make sure that the execution directory is set such that this class file
     3908 + * can be reached via "at/ssw/hotswap/test/Main.class".
     3909 + * 
     3910 + * There are different levels of redefinition:
     3911 + * Swap method bodies < add/remove methods < add/remove fields < add/remove super type
     3912 + * 
     3913 + * Make sure that the application is started with a Java debug agent on port 4000. If you specify an argument, only tests
     3914 + * containing the specified string are executed.
     3915 + * 
     3916 + * Example usage:
     3917 + * <pre>java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=4000,suspend=n at.ssw.hotswap.test.Main SimpleTest</pre>
     3918 + * 
     3919 + * @author Thomas Wuerthinger
     3920 + *
     3921 + * Usage:
     3922 + * If a first parameter is given, then only tests with a name containing this parameter are executed.
     3923 + *
     3924 + * Default values of system properties that can be overwritten:
     3925 + * -Dhotswap.trace=0
     3926 + *
     3927 + */
     3928 +public class Main {
     3929 +
     3930 +    private static int failedCount;
     3931 +    private static int finishedCount;
     3932 +    private static String failureString = "";
     3933 +
     3934 +    public static void main(final String[] args) {
     3935 +
     3936 +        boolean runNativeTests = true;
     3937 +        String nativeLibraryName = new File("../../../HotSwapTestsNatives/dist/" + System.mapLibraryName("libHotSwapTestsNatives")).getAbsolutePath();
     3938 +        try {
     3939 +            System.out.println("Load native library: ");
     3940 +            System.load(nativeLibraryName);
     3941 +        } catch(UnsatisfiedLinkError e) {
     3942 +            System.out.println("WARNING: Could not load native library from path " + nativeLibraryName);
     3943 +            System.out.println("Disabling native tests");
     3944 +            runNativeTests = false;
     3945 +        }
     3946 +
     3947 +        System.out.println("Running JUnit tests: ");
     3948 +
     3949 +        JUnitCore core = new JUnitCore();
     3950 +        core.addListener(runListener);
     3951 +        Request request = Request.classes(CompleteTestSuite.class);
     3952 +        HotSwapTool.setTraceLevel(Integer.parseInt(System.getProperty("hotswap.trace", "0")));
     3953 +
     3954 +        // Filter the request?
     3955 +        if (args.length > 0) {
     3956 +
     3957 +            System.out.println("Only run tests containing \"" + args[0] + "\"");
     3958 +
     3959 +            request = request.filterWith(new Filter() {
     3960 +
     3961 +                @Override
     3962 +                public String describe() {
     3963 +                    return "Filter";
     3964 +                }
     3965 +
     3966 +                private Set<Description> childrenToRun = new HashSet<Description>();
     3967 +
     3968 +                @Override
     3969 +                public boolean shouldRun(Description d) {
     3970 +                    System.out.println(d.getDisplayName());
     3971 +
     3972 +                    if (d.getDisplayName().contains(args[0]) || childrenToRun.contains(d)) {
     3973 +                        childrenToRun.addAll(d.getChildren());
     3974 +                        return true;
     3975 +                    }
     3976 +
     3977 +                    // explicitly check if any children want to run
     3978 +                    for (Description each : d.getChildren()) {
     3979 +                        if (shouldRun(each)) {
     3980 +                            return true;
     3981 +                        }
     3982 +                    }
     3983 +
     3984 +                    return false;
     3985 +                }
     3986 +            });
     3987 +        }
     3988 +
     3989 +        long startTime = System.currentTimeMillis();
     3990 +        core.run(request);
     3991 +        long time = System.currentTimeMillis() - startTime;
     3992 +
     3993 +        System.out.println("" + (finishedCount - failedCount) + " of " + finishedCount + " tests are OK!");
     3994 +        System.out.println("Time: " + ((double) time) / 1000);
     3995 +        if (failedCount == 0) {
     3996 +            System.out.println("ALL OK");
     3997 +        } else {
     3998 +            System.out.println(failedCount + " FAILURES: " + failureString);
     3999 +        }
     4000 +    }
     4001 +
     4002 +    private static RunListener runListener = new RunListener() {
     4003 +
     4004 +        @Override
     4005 +        public void testStarted(Description description) throws Exception {
     4006 +            System.out.println("============================================================");
     4007 +            System.out.println("Test started: " + description.getDisplayName());
     4008 +        }
     4009 +
     4010 +        @Override
     4011 +        public void testFailure(Failure failure) throws Exception {
     4012 +            System.out.println("Test failure: " + failure.getMessage());
     4013 +            failure.getException().printStackTrace();
     4014 +            failedCount++;
     4015 +            failureString += failure.getDescription().getDisplayName() + " ";
     4016 +        }
     4017 +
     4018 +        @Override
     4019 +        public void testFinished(Description description) throws Exception {
     4020 +            System.out.println("Test finished: " + description.getDisplayName());
     4021 +            finishedCount++;
     4022 +        }
     4023 +    };
     4024 +}
     4025 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/TestUtil.java
     4026 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4027 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/TestUtil.java	Fri Dec 17 13:23:04 2010 +0100
     4028 @@ -0,0 +1,51 @@
     4029 +/*
     4030 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     4031 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4032 + *
     4033 + * This code is free software; you can redistribute it and/or modify it
     4034 + * under the terms of the GNU General Public License version 2 only, as
     4035 + * published by the Free Software Foundation.
     4036 + *
     4037 + * This code is distributed in the hope that it will be useful, but WITHOUT
     4038 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     4039 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     4040 + * version 2 for more details (a copy is included in the LICENSE file that
     4041 + * accompanied this code).
     4042 + *
     4043 + * You should have received a copy of the GNU General Public License version
     4044 + * 2 along with this work; if not, write to the Free Software Foundation,
     4045 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     4046 + *
     4047 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     4048 + * or visit www.oracle.com if you need additional information or have any
     4049 + * questions.
     4050 + *
     4051 + */
     4052 +
     4053 +package at.ssw.hotswap.test;
     4054 +
     4055 +import junit.framework.Assert;
     4056 +
     4057 +/**
     4058 + *
     4059 + * Utility methods for unit testing.
     4060 + *
     4061 + * @author Thomas Wuerthinger
     4062 + */
     4063 +public class TestUtil {
     4064 +
     4065 +    public static int assertException(Class exceptionClass, Runnable run) {
     4066 +
     4067 +        try {
     4068 +            run.run();
     4069 +        } catch(Throwable t) {
     4070 +            if (t.getClass().equals(exceptionClass)) {
     4071 +                return t.getStackTrace()[0].getLineNumber();
     4072 +            }
     4073 +            Assert.assertTrue("An exception of type " + t.getClass().getSimpleName() + " instead of " + exceptionClass.getSimpleName() + " has been thrown!", false);
     4074 +        }
     4075 +
     4076 +        Assert.assertTrue("No exception has been thrown!", false);
     4077 +        return -1;
     4078 +    }
     4079 +}
     4080 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/ClassAccess.java
     4081 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4082 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/ClassAccess.java	Fri Dec 17 13:23:04 2010 +0100
     4083 @@ -0,0 +1,39 @@
     4084 +/*
     4085 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     4086 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4087 + *
     4088 + * This code is free software; you can redistribute it and/or modify it
     4089 + * under the terms of the GNU General Public License version 2 only, as
     4090 + * published by the Free Software Foundation.
     4091 + *
     4092 + * This code is distributed in the hope that it will be useful, but WITHOUT
     4093 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     4094 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     4095 + * version 2 for more details (a copy is included in the LICENSE file that
     4096 + * accompanied this code).
     4097 + *
     4098 + * You should have received a copy of the GNU General Public License version
     4099 + * 2 along with this work; if not, write to the Free Software Foundation,
     4100 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     4101 + *
     4102 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     4103 + * or visit www.oracle.com if you need additional information or have any
     4104 + * questions.
     4105 + *
     4106 + */
     4107 +package at.ssw.hotswap.test.access;
     4108 +
     4109 +import java.util.List;
     4110 +
     4111 +/**
     4112 + * @author Kerstin Breiteneder
     4113 + * @author Christoph Wimberger
     4114 + */
     4115 +public interface ClassAccess {
     4116 +
     4117 +    public String getName();
     4118 +
     4119 +    public MethodAccess findMethod(String method);
     4120 +
     4121 +    public List<MethodAccess> getMethods();
     4122 +}
     4123 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/MethodAccess.java
     4124 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4125 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/MethodAccess.java	Fri Dec 17 13:23:04 2010 +0100
     4126 @@ -0,0 +1,43 @@
     4127 +/*
     4128 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     4129 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4130 + *
     4131 + * This code is free software; you can redistribute it and/or modify it
     4132 + * under the terms of the GNU General Public License version 2 only, as
     4133 + * published by the Free Software Foundation.
     4134 + *
     4135 + * This code is distributed in the hope that it will be useful, but WITHOUT
     4136 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     4137 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     4138 + * version 2 for more details (a copy is included in the LICENSE file that
     4139 + * accompanied this code).
     4140 + *
     4141 + * You should have received a copy of the GNU General Public License version
     4142 + * 2 along with this work; if not, write to the Free Software Foundation,
     4143 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     4144 + *
     4145 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     4146 + * or visit www.oracle.com if you need additional information or have any
     4147 + * questions.
     4148 + *
     4149 + */
     4150 +package at.ssw.hotswap.test.access;
     4151 +
     4152 +import java.util.List;
     4153 +
     4154 +/**
     4155 + * @author Kerstin Breiteneder
     4156 + * @author Christoph Wimberger
     4157 + */
     4158 +public interface MethodAccess {
     4159 +
     4160 +    public String getName();
     4161 +
     4162 +    public String getSignature();
     4163 +
     4164 +    public boolean canCheckObsoletness();
     4165 +
     4166 +    public boolean isObsolete();
     4167 +
     4168 +    public Object invoke(Object[] o, Object instance);
     4169 +}
     4170 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/StackFrameAccess.java
     4171 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4172 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/StackFrameAccess.java	Fri Dec 17 13:23:04 2010 +0100
     4173 @@ -0,0 +1,35 @@
     4174 +/*
     4175 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     4176 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4177 + *
     4178 + * This code is free software; you can redistribute it and/or modify it
     4179 + * under the terms of the GNU General Public License version 2 only, as
     4180 + * published by the Free Software Foundation.
     4181 + *
     4182 + * This code is distributed in the hope that it will be useful, but WITHOUT
     4183 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     4184 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     4185 + * version 2 for more details (a copy is included in the LICENSE file that
     4186 + * accompanied this code).
     4187 + *
     4188 + * You should have received a copy of the GNU General Public License version
     4189 + * 2 along with this work; if not, write to the Free Software Foundation,
     4190 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     4191 + *
     4192 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     4193 + * or visit www.oracle.com if you need additional information or have any
     4194 + * questions.
     4195 + *
     4196 + */
     4197 +package at.ssw.hotswap.test.access;
     4198 +
     4199 +/**
     4200 + * @author Kerstin Breiteneder
     4201 + * @author Christoph Wimberger
     4202 + */
     4203 +public interface StackFrameAccess {
     4204 +
     4205 +    public MethodAccess getMethod() throws ClassNotFoundException;
     4206 +
     4207 +    public ClassAccess getClazz();
     4208 +}
     4209 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/VMAccess.java
     4210 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4211 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/VMAccess.java	Fri Dec 17 13:23:04 2010 +0100
     4212 @@ -0,0 +1,41 @@
     4213 +/*
     4214 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     4215 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4216 + *
     4217 + * This code is free software; you can redistribute it and/or modify it
     4218 + * under the terms of the GNU General Public License version 2 only, as
     4219 + * published by the Free Software Foundation.
     4220 + *
     4221 + * This code is distributed in the hope that it will be useful, but WITHOUT
     4222 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     4223 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     4224 + * version 2 for more details (a copy is included in the LICENSE file that
     4225 + * accompanied this code).
     4226 + *
     4227 + * You should have received a copy of the GNU General Public License version
     4228 + * 2 along with this work; if not, write to the Free Software Foundation,
     4229 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     4230 + *
     4231 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     4232 + * or visit www.oracle.com if you need additional information or have any
     4233 + * questions.
     4234 + *
     4235 + */
     4236 +package at.ssw.hotswap.test.access;
     4237 +
     4238 +import java.util.List;
     4239 +
     4240 +/**
     4241 + * @author Kerstin Breiteneder
     4242 + * @author Christoph Wimberger
     4243 + */
     4244 +public interface VMAccess {
     4245 +
     4246 +    public boolean canGetFrames();
     4247 +    
     4248 +    public List<StackFrameAccess> getFrames(final String threadName);
     4249 +
     4250 +    public List<String> getThreadNames();
     4251 +
     4252 +    public ClassAccess findClass(String clazz);
     4253 +}
     4254 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jdi/JDIClassAccess.java
     4255 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4256 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jdi/JDIClassAccess.java	Fri Dec 17 13:23:04 2010 +0100
     4257 @@ -0,0 +1,78 @@
     4258 +/*
     4259 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     4260 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4261 + *
     4262 + * This code is free software; you can redistribute it and/or modify it
     4263 + * under the terms of the GNU General Public License version 2 only, as
     4264 + * published by the Free Software Foundation.
     4265 + *
     4266 + * This code is distributed in the hope that it will be useful, but WITHOUT
     4267 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     4268 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     4269 + * version 2 for more details (a copy is included in the LICENSE file that
     4270 + * accompanied this code).
     4271 + *
     4272 + * You should have received a copy of the GNU General Public License version
     4273 + * 2 along with this work; if not, write to the Free Software Foundation,
     4274 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     4275 + *
     4276 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     4277 + * or visit www.oracle.com if you need additional information or have any
     4278 + * questions.
     4279 + *
     4280 + */
     4281 +package at.ssw.hotswap.test.access.jdi;
     4282 +
     4283 +import at.ssw.hotswap.test.access.ClassAccess;
     4284 +import at.ssw.hotswap.test.access.MethodAccess;
     4285 +import com.sun.jdi.Method;
     4286 +import com.sun.jdi.ReferenceType;
     4287 +import java.util.ArrayList;
     4288 +import java.util.List;
     4289 +
     4290 +/**
     4291 + * @author Kerstin Breiteneder
     4292 + * @author Christoph Wimberger
     4293 + */
     4294 +public class JDIClassAccess implements ClassAccess {
     4295 +
     4296 +    private ReferenceType clazz;
     4297 +
     4298 +    public JDIClassAccess(ReferenceType clazz) {
     4299 +        this.clazz = clazz;
     4300 +    }
     4301 +
     4302 +    @Override
     4303 +    public String getName() {
     4304 +        return clazz.name();
     4305 +    }
     4306 +
     4307 +    @Override
     4308 +    public MethodAccess findMethod(String method) {
     4309 +        List<Method> methods = clazz.methodsByName(method);
     4310 +        List<Method> newMethods = new ArrayList<Method>();
     4311 +        for (Method m : methods) {
     4312 +            if (!m.isObsolete()) {
     4313 +                newMethods.add(m);
     4314 +            }
     4315 +        }
     4316 +        if (newMethods.size() > 1) {
     4317 +            throw new RuntimeException("ambiguous methods: " + newMethods.get(0) + ", " + newMethods.get(1));
     4318 +        }
     4319 +        if (newMethods.isEmpty()) {
     4320 +            return null;
     4321 +        }
     4322 +        return new JDIMethodAccess(newMethods.get(0), clazz);
     4323 +    }
     4324 +
     4325 +    @Override
     4326 +    public List<MethodAccess> getMethods() {
     4327 +        List<MethodAccess> methodAccesses = new ArrayList<MethodAccess>();
     4328 +        for (Method m : clazz.methods()) {
     4329 +            if (!m.name().equals("<init>")) {
     4330 +                methodAccesses.add(new JDIMethodAccess(m, clazz));
     4331 +            }
     4332 +        }
     4333 +        return methodAccesses;
     4334 +    }
     4335 +}
     4336 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jdi/JDIMethodAccess.java
     4337 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4338 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jdi/JDIMethodAccess.java	Fri Dec 17 13:23:04 2010 +0100
     4339 @@ -0,0 +1,133 @@
     4340 +/*
     4341 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     4342 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4343 + *
     4344 + * This code is free software; you can redistribute it and/or modify it
     4345 + * under the terms of the GNU General Public License version 2 only, as
     4346 + * published by the Free Software Foundation.
     4347 + *
     4348 + * This code is distributed in the hope that it will be useful, but WITHOUT
     4349 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     4350 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     4351 + * version 2 for more details (a copy is included in the LICENSE file that
     4352 + * accompanied this code).
     4353 + *
     4354 + * You should have received a copy of the GNU General Public License version
     4355 + * 2 along with this work; if not, write to the Free Software Foundation,
     4356 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     4357 + *
     4358 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     4359 + * or visit www.oracle.com if you need additional information or have any
     4360 + * questions.
     4361 + *
     4362 + */
     4363 +package at.ssw.hotswap.test.access.jdi;
     4364 +
     4365 +import at.ssw.hotswap.JDIProxy;
     4366 +import at.ssw.hotswap.test.access.MethodAccess;
     4367 +import com.sun.jdi.ClassNotLoadedException;
     4368 +import com.sun.jdi.ClassType;
     4369 +import com.sun.jdi.IncompatibleThreadStateException;
     4370 +import com.sun.jdi.InvalidTypeException;
     4371 +import com.sun.jdi.InvocationException;
     4372 +import com.sun.jdi.Method;
     4373 +import com.sun.jdi.ReferenceType;
     4374 +import com.sun.jdi.ThreadReference;
     4375 +import com.sun.jdi.Type;
     4376 +import java.lang.reflect.Modifier;
     4377 +import java.util.ArrayList;
     4378 +import java.util.logging.Level;
     4379 +import java.util.logging.Logger;
     4380 +
     4381 +/**
     4382 + * @author Kerstin Breiteneder
     4383 + * @author Christoph Wimberger
     4384 + */
     4385 +public class JDIMethodAccess implements MethodAccess {
     4386 +
     4387 +    private Method method;
     4388 +
     4389 +    public JDIMethodAccess(Method m, ReferenceType clazz) {
     4390 +        method = m;
     4391 +    }
     4392 +
     4393 +    @Override
     4394 +    public String toString() {
     4395 +        return method.toString();
     4396 +    }
     4397 +
     4398 +    @Override
     4399 +    public String getName() {
     4400 +        return method.name();
     4401 +    }
     4402 +
     4403 +    @Override
     4404 +    public String getSignature() {
     4405 +        String methodString = Modifier.toString(method.modifiers()) + " " + method.returnTypeName() + " " + method.name() + "(";
     4406 +        boolean paramFound = false;
     4407 +        try {
     4408 +            for (Type type : method.argumentTypes()) {
     4409 +                if (paramFound) {
     4410 +                    methodString += ", ";
     4411 +                }
     4412 +                paramFound = true;
     4413 +                methodString += type.name();
     4414 +            }
     4415 +        } catch (ClassNotLoadedException ex) {
     4416 +            throw new RuntimeException(ex);
     4417 +        }
     4418 +        return methodString + ")";
     4419 +    }
     4420 +
     4421 +    @Override
     4422 +    public boolean canCheckObsoletness() {
     4423 +        return true;
     4424 +    }
     4425 +
     4426 +    @Override
     4427 +    public boolean isObsolete() {
     4428 +        return method.isObsolete();
     4429 +    }
     4430 +
     4431 +    @Override
     4432 +    public Object invoke(Object[] o, Object instance) {
     4433 +        Thread tempthread = new Thread("invokeThread") {
     4434 +
     4435 +            @Override
     4436 +            public void run() {
     4437 +                try {
     4438 +                    sleep(2000);
     4439 +                } catch (InterruptedException ex) {
     4440 +                    Logger.getLogger(JDIMethodAccess.class.getName()).log(Level.SEVERE, null, ex);
     4441 +                }
     4442 +            }
     4443 +        };
     4444 +        tempthread.start();
     4445 +
     4446 +        // get Main-Thread
     4447 +        final JDIProxy jdi = JDIProxy.getJDI();
     4448 +        ThreadReference reference = null;
     4449 +        for (ThreadReference t : jdi.getVM().allThreads()) {
     4450 +            if (t.name().equals("invokeThread")) {
     4451 +                reference = t;
     4452 +                break;
     4453 +            }
     4454 +        }
     4455 +        //  reference.suspend();
     4456 +
     4457 +        Object obj = null;
     4458 +        try {
     4459 +            obj = ((ClassType) method.declaringType()).invokeMethod(reference, method, new ArrayList(), ClassType.INVOKE_SINGLE_THREADED);
     4460 +        } catch (InvalidTypeException ex) {
     4461 +            Logger.getLogger(JDIMethodAccess.class.getName()).log(Level.SEVERE, null, ex);
     4462 +        } catch (ClassNotLoadedException ex) {
     4463 +            Logger.getLogger(JDIMethodAccess.class.getName()).log(Level.SEVERE, null, ex);
     4464 +        } catch (IncompatibleThreadStateException ex) {
     4465 +            Logger.getLogger(JDIMethodAccess.class.getName()).log(Level.SEVERE, null, ex);
     4466 +        } catch (InvocationException ex) {
     4467 +            Logger.getLogger(JDIMethodAccess.class.getName()).log(Level.SEVERE, null, ex);
     4468 +        }
     4469 +        // reference.resume();
     4470 +        return obj;
     4471 +    }
     4472 +}
     4473 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jdi/JDIStackFrameAccess.java
     4474 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4475 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jdi/JDIStackFrameAccess.java	Fri Dec 17 13:23:04 2010 +0100
     4476 @@ -0,0 +1,69 @@
     4477 +/*
     4478 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     4479 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4480 + *
     4481 + * This code is free software; you can redistribute it and/or modify it
     4482 + * under the terms of the GNU General Public License version 2 only, as
     4483 + * published by the Free Software Foundation.
     4484 + *
     4485 + * This code is distributed in the hope that it will be useful, but WITHOUT
     4486 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     4487 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     4488 + * version 2 for more details (a copy is included in the LICENSE file that
     4489 + * accompanied this code).
     4490 + *
     4491 + * You should have received a copy of the GNU General Public License version
     4492 + * 2 along with this work; if not, write to the Free Software Foundation,
     4493 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     4494 + *
     4495 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     4496 + * or visit www.oracle.com if you need additional information or have any
     4497 + * questions.
     4498 + *
     4499 + */
     4500 +package at.ssw.hotswap.test.access.jdi;
     4501 +
     4502 +import at.ssw.hotswap.test.access.ClassAccess;
     4503 +import at.ssw.hotswap.test.access.MethodAccess;
     4504 +import at.ssw.hotswap.test.access.StackFrameAccess;
     4505 +import com.sun.jdi.Method;
     4506 +import com.sun.jdi.ReferenceType;
     4507 +import com.sun.jdi.StackFrame;
     4508 +
     4509 +/**
     4510 + * @author Kerstin Breiteneder
     4511 + * @author Christoph Wimberger
     4512 + */
     4513 +public class JDIStackFrameAccess implements StackFrameAccess {
     4514 +
     4515 +    private ReferenceType clazz;
     4516 +    private Method method;
     4517 +    private MethodAccess methodAccess;
     4518 +    private ClassAccess classAccess;
     4519 +
     4520 +    JDIStackFrameAccess(StackFrame s) {
     4521 +        method = s.location().method();
     4522 +        clazz = s.location().method().declaringType();
     4523 +    }
     4524 +
     4525 +    @Override
     4526 +    public MethodAccess getMethod() {
     4527 +        if (methodAccess == null) {
     4528 +            methodAccess = new JDIMethodAccess(method, clazz);
     4529 +        }
     4530 +        return methodAccess;
     4531 +    }
     4532 +
     4533 +    @Override
     4534 +    public ClassAccess getClazz() {
     4535 +        if (classAccess == null) {
     4536 +            classAccess = new JDIClassAccess(clazz);
     4537 +        }
     4538 +        return classAccess;
     4539 +    }
     4540 +
     4541 +    @Override
     4542 +    public String toString() {
     4543 +        return method.toString();
     4544 +    }
     4545 +}
     4546 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jdi/JDIVMAccess.java
     4547 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4548 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jdi/JDIVMAccess.java	Fri Dec 17 13:23:04 2010 +0100
     4549 @@ -0,0 +1,121 @@
     4550 +/*
     4551 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     4552 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4553 + *
     4554 + * This code is free software; you can redistribute it and/or modify it
     4555 + * under the terms of the GNU General Public License version 2 only, as
     4556 + * published by the Free Software Foundation.
     4557 + *
     4558 + * This code is distributed in the hope that it will be useful, but WITHOUT
     4559 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     4560 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     4561 + * version 2 for more details (a copy is included in the LICENSE file that
     4562 + * accompanied this code).
     4563 + *
     4564 + * You should have received a copy of the GNU General Public License version
     4565 + * 2 along with this work; if not, write to the Free Software Foundation,
     4566 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     4567 + *
     4568 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     4569 + * or visit www.oracle.com if you need additional information or have any
     4570 + * questions.
     4571 + *
     4572 + */
     4573 +package at.ssw.hotswap.test.access.jdi;
     4574 +
     4575 +import at.ssw.hotswap.JDIProxy;
     4576 +import at.ssw.hotswap.test.access.ClassAccess;
     4577 +import at.ssw.hotswap.test.access.StackFrameAccess;
     4578 +import at.ssw.hotswap.test.access.VMAccess;
     4579 +import com.sun.jdi.IncompatibleThreadStateException;
     4580 +import com.sun.jdi.ReferenceType;
     4581 +import com.sun.jdi.StackFrame;
     4582 +import com.sun.jdi.ThreadReference;
     4583 +import java.util.ArrayList;
     4584 +import java.util.List;
     4585 +import java.util.logging.Level;
     4586 +import java.util.logging.Logger;
     4587 +
     4588 +/**
     4589 + * @author Kerstin Breiteneder
     4590 + * @author Christoph Wimberger
     4591 + */
     4592 +public class JDIVMAccess implements VMAccess {
     4593 +
     4594 +    private List<ThreadReference> getThreads() {
     4595 +        final JDIProxy jdi = JDIProxy.getJDI();
     4596 +        return jdi.getVM().allThreads();
     4597 +    }
     4598 +
     4599 +    @Override
     4600 +    public boolean canGetFrames() {
     4601 +        return true;
     4602 +    }
     4603 +
     4604 +    @Override
     4605 +    public List<StackFrameAccess> getFrames(final String threadName) {
     4606 +        final JDIProxy jdi = JDIProxy.getJDI();
     4607 +        final Exception[] exception = new Exception[1];
     4608 +        final Object[] object = new Object[1];
     4609 +        object[0] = null;
     4610 +        exception[0] = null;
     4611 +
     4612 +        Runnable r = new Runnable() {
     4613 +
     4614 +            public void run() {
     4615 +                List<StackFrameAccess> stackAccesses = new ArrayList<StackFrameAccess>();
     4616 +                for (ThreadReference t : getThreads()) {
     4617 +                    if (t.name().equals(threadName)) {
     4618 +                        try {
     4619 +                            for (StackFrame stack : t.frames()) {
     4620 +                                StackFrameAccess stackAccess = new JDIStackFrameAccess(stack);
     4621 +                                stackAccesses.add(stackAccess);
     4622 +                            }
     4623 +                        } catch (IncompatibleThreadStateException ex) {
     4624 +                            exception[0] = ex;
     4625 +                        }
     4626 +                        object[0] = stackAccesses;
     4627 +                        return;
     4628 +                    }
     4629 +                }
     4630 +            }
     4631 +        };
     4632 +
     4633 +        jdi.executeSuspended(r);
     4634 +
     4635 +        if (exception[0] != null) {
     4636 +            throw new RuntimeException(exception[0]);
     4637 +        }
     4638 +        return (List<StackFrameAccess>) object[0];
     4639 +    }
     4640 +
     4641 +    @Override
     4642 +    public List<String> getThreadNames() {
     4643 +        List<String> threadNames = new ArrayList<String>();
     4644 +
     4645 +        for (ThreadReference t : getThreads()) {
     4646 +            threadNames.add(t.name());
     4647 +        }
     4648 +        return threadNames;
     4649 +    }
     4650 +
     4651 +    @Override
     4652 +    public ClassAccess findClass(String clazz) {
     4653 +        final JDIProxy jdi = JDIProxy.getJDI();
     4654 +        ReferenceType found = null;
     4655 +        // ensures, that all classes are retrieved
     4656 +        jdi.refreshAllClasses();
     4657 +        for (ReferenceType referenceType : jdi.getVM().allClasses()) {
     4658 +            if (referenceType.name().equals(clazz)) {
     4659 +                if (found != null) {
     4660 +                    throw new RuntimeException("ambiguous class name");
     4661 +                }
     4662 +                found = referenceType;
     4663 +            }
     4664 +        }
     4665 +        if (found == null) {
     4666 +            return null;
     4667 +        }
     4668 +        return new JDIClassAccess(found);
     4669 +    }
     4670 +}
     4671 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jni/JNIClassAccess.java
     4672 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4673 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jni/JNIClassAccess.java	Fri Dec 17 13:23:04 2010 +0100
     4674 @@ -0,0 +1,73 @@
     4675 +/*
     4676 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     4677 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4678 + *
     4679 + * This code is free software; you can redistribute it and/or modify it
     4680 + * under the terms of the GNU General Public License version 2 only, as
     4681 + * published by the Free Software Foundation.
     4682 + *
     4683 + * This code is distributed in the hope that it will be useful, but WITHOUT
     4684 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     4685 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     4686 + * version 2 for more details (a copy is included in the LICENSE file that
     4687 + * accompanied this code).
     4688 + *
     4689 + * You should have received a copy of the GNU General Public License version
     4690 + * 2 along with this work; if not, write to the Free Software Foundation,
     4691 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     4692 + *
     4693 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     4694 + * or visit www.oracle.com if you need additional information or have any
     4695 + * questions.
     4696 + *
     4697 + */
     4698 +package at.ssw.hotswap.test.access.jni;
     4699 +
     4700 +import at.ssw.hotswap.test.access.ClassAccess;
     4701 +import at.ssw.hotswap.test.access.MethodAccess;
     4702 +import java.lang.reflect.Method;
     4703 +import java.util.ArrayList;
     4704 +import java.util.List;
     4705 +
     4706 +/**
     4707 + * @author Kerstin Breiteneder
     4708 + * @author Christoph Wimberger
     4709 + */
     4710 +public class JNIClassAccess implements ClassAccess {
     4711 +
     4712 +    Class clazz;
     4713 +
     4714 +    public JNIClassAccess(Class clazz) {
     4715 +        this.clazz = clazz;
     4716 +    }
     4717 +
     4718 +    @Override
     4719 +    public String getName() {
     4720 +        return clazz.getName();
     4721 +    }
     4722 +
     4723 +    public static native Method findMethodNative(Class clazz, String methodName);
     4724 +
     4725 +    @Override
     4726 +    public MethodAccess findMethod(String methodName) {
     4727 +        Method m;
     4728 +        try {
     4729 +            m = findMethodNative(clazz, methodName);
     4730 +        } catch (NoSuchMethodError ex) {
     4731 +            return null;
     4732 +        }
     4733 +        return new JNIMethodAccess(m);
     4734 +    }
     4735 +
     4736 +    public static native Method[] getMethodsNative(Class clazz);
     4737 +
     4738 +    @Override
     4739 +    public List<MethodAccess> getMethods() {
     4740 +        Method[] array = getMethodsNative(clazz);
     4741 +        List<MethodAccess> mAccesses = new ArrayList<MethodAccess>();
     4742 +        for (int i = 0; i < array.length; i++) {
     4743 +            mAccesses.add(new JNIMethodAccess(array[i]));
     4744 +        }
     4745 +        return mAccesses;
     4746 +    }
     4747 +}
     4748 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jni/JNIMethodAccess.java
     4749 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4750 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jni/JNIMethodAccess.java	Fri Dec 17 13:23:04 2010 +0100
     4751 @@ -0,0 +1,82 @@
     4752 +/*
     4753 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     4754 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4755 + *
     4756 + * This code is free software; you can redistribute it and/or modify it
     4757 + * under the terms of the GNU General Public License version 2 only, as
     4758 + * published by the Free Software Foundation.
     4759 + *
     4760 + * This code is distributed in the hope that it will be useful, but WITHOUT
     4761 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     4762 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     4763 + * version 2 for more details (a copy is included in the LICENSE file that
     4764 + * accompanied this code).
     4765 + *
     4766 + * You should have received a copy of the GNU General Public License version
     4767 + * 2 along with this work; if not, write to the Free Software Foundation,
     4768 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     4769 + *
     4770 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     4771 + * or visit www.oracle.com if you need additional information or have any
     4772 + * questions.
     4773 + *
     4774 + */
     4775 +package at.ssw.hotswap.test.access.jni;
     4776 +
     4777 +import at.ssw.hotswap.test.access.MethodAccess;
     4778 +import java.lang.reflect.Method;
     4779 +import java.lang.reflect.Modifier;
     4780 +import org.objectweb.asm.Type;
     4781 +
     4782 +/**
     4783 + * @author Kerstin Breiteneder
     4784 + * @author Christoph Wimberger
     4785 + */
     4786 +public class JNIMethodAccess implements MethodAccess {
     4787 +
     4788 +    Method method;
     4789 +
     4790 +    public JNIMethodAccess(Method m) {
     4791 +        method = m;
     4792 +    }
     4793 +
     4794 +    @Override
     4795 +    public String getName() {
     4796 +        return method.getName();
     4797 +    }
     4798 +
     4799 +    @Override
     4800 +    public String getSignature() {
     4801 +        String methodString = Modifier.toString(method.getModifiers()) + " " + method.getReturnType().getName() + " " + method.getName() + "(";
     4802 +        boolean paramFound = false;
     4803 +        for (Class c : method.getParameterTypes()) {
     4804 +            if (paramFound) {
     4805 +                methodString += ", ";
     4806 +            }
     4807 +            paramFound = true;
     4808 +            methodString += c.getName();
     4809 +        }
     4810 +        return methodString + ")";
     4811 +    }
     4812 +
     4813 +    @Override
     4814 +    public boolean canCheckObsoletness() {
     4815 +        throw new UnsupportedOperationException("Not supported yet.");
     4816 +    }
     4817 +
     4818 +    @Override
     4819 +    public boolean isObsolete() {
     4820 +        throw new UnsupportedOperationException("Not supported yet.");
     4821 +    }
     4822 +
     4823 +    public static native Object invokeMethodNative(Class clazz, Object obj, String methodName, String retValue, boolean staticValue, String descriptor, Object[] params);
     4824 +
     4825 +    @Override
     4826 +    public Object invoke(Object[] o, Object instance) {
     4827 +        boolean staticValue = java.lang.reflect.Modifier.isStatic(method.getModifiers());
     4828 +        String retValue = method.getReturnType().getName();
     4829 +        String descriptor = new org.objectweb.asm.commons.Method(method.getName(), Type.getReturnType(method), Type.getArgumentTypes(method)).getDescriptor();
     4830 +
     4831 +        return invokeMethodNative(method.getDeclaringClass(), instance, method.getName(), retValue, staticValue, descriptor, o);
     4832 +    }
     4833 +}
     4834 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jni/JNIStackFrameAccess.java
     4835 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4836 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jni/JNIStackFrameAccess.java	Fri Dec 17 13:23:04 2010 +0100
     4837 @@ -0,0 +1,45 @@
     4838 +/*
     4839 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     4840 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4841 + *
     4842 + * This code is free software; you can redistribute it and/or modify it
     4843 + * under the terms of the GNU General Public License version 2 only, as
     4844 + * published by the Free Software Foundation.
     4845 + *
     4846 + * This code is distributed in the hope that it will be useful, but WITHOUT
     4847 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     4848 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     4849 + * version 2 for more details (a copy is included in the LICENSE file that
     4850 + * accompanied this code).
     4851 + *
     4852 + * You should have received a copy of the GNU General Public License version
     4853 + * 2 along with this work; if not, write to the Free Software Foundation,
     4854 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     4855 + *
     4856 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     4857 + * or visit www.oracle.com if you need additional information or have any
     4858 + * questions.
     4859 + *
     4860 + */
     4861 +package at.ssw.hotswap.test.access.jni;
     4862 +
     4863 +import at.ssw.hotswap.test.access.ClassAccess;
     4864 +import at.ssw.hotswap.test.access.MethodAccess;
     4865 +import at.ssw.hotswap.test.access.StackFrameAccess;
     4866 +
     4867 +/**
     4868 + * @author Kerstin Breiteneder
     4869 + * @author Christoph Wimberger
     4870 + */
     4871 +public class JNIStackFrameAccess implements StackFrameAccess {
     4872 +
     4873 +    @Override
     4874 +    public MethodAccess getMethod() throws ClassNotFoundException {
     4875 +        throw new UnsupportedOperationException("Not supported yet.");
     4876 +    }
     4877 +
     4878 +    @Override
     4879 +    public ClassAccess getClazz() {
     4880 +        throw new UnsupportedOperationException("Not supported yet.");
     4881 +    }
     4882 +}
     4883 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jni/JNIVMAccess.java
     4884 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4885 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/jni/JNIVMAccess.java	Fri Dec 17 13:23:04 2010 +0100
     4886 @@ -0,0 +1,65 @@
     4887 +/*
     4888 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     4889 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4890 + *
     4891 + * This code is free software; you can redistribute it and/or modify it
     4892 + * under the terms of the GNU General Public License version 2 only, as
     4893 + * published by the Free Software Foundation.
     4894 + *
     4895 + * This code is distributed in the hope that it will be useful, but WITHOUT
     4896 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     4897 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     4898 + * version 2 for more details (a copy is included in the LICENSE file that
     4899 + * accompanied this code).
     4900 + *
     4901 + * You should have received a copy of the GNU General Public License version
     4902 + * 2 along with this work; if not, write to the Free Software Foundation,
     4903 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     4904 + *
     4905 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     4906 + * or visit www.oracle.com if you need additional information or have any
     4907 + * questions.
     4908 + *
     4909 + */
     4910 +package at.ssw.hotswap.test.access.jni;
     4911 +
     4912 +import at.ssw.hotswap.test.access.ClassAccess;
     4913 +import at.ssw.hotswap.test.access.StackFrameAccess;
     4914 +import at.ssw.hotswap.test.access.VMAccess;
     4915 +import java.io.File;
     4916 +import java.util.List;
     4917 +
     4918 +/**
     4919 + * @author Kerstin Breiteneder
     4920 + * @author Christoph Wimberger
     4921 + */
     4922 +public class JNIVMAccess implements VMAccess {
     4923 +
     4924 +    @Override
     4925 +    public boolean canGetFrames() {
     4926 +        return false;
     4927 +    }
     4928 +
     4929 +    @Override
     4930 +    public List<StackFrameAccess> getFrames(String threadName) {
     4931 +        throw new UnsupportedOperationException("Not supported yet.");
     4932 +    }
     4933 +
     4934 +    @Override
     4935 +    public List<String> getThreadNames() {
     4936 +        throw new UnsupportedOperationException("Not supported yet.");
     4937 +    }
     4938 +
     4939 +    public static native Class findClassNative(String clazz) throws ClassNotFoundException, NoClassDefFoundError;
     4940 +
     4941 +    @Override
     4942 +    public ClassAccess findClass(String clazz) {
     4943 +        try {
     4944 +            return new JNIClassAccess(findClassNative(clazz.replace('.', '/')));
     4945 +        } catch (ClassNotFoundException ex) {
     4946 +            return null;
     4947 +        } catch (NoClassDefFoundError ex) {
     4948 +            return null;
     4949 +        }
     4950 +    }
     4951 +}
     4952 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/reflection/ReflectionClassAccess.java
     4953 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4954 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/reflection/ReflectionClassAccess.java	Fri Dec 17 13:23:04 2010 +0100
     4955 @@ -0,0 +1,70 @@
     4956 +/*
     4957 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     4958 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4959 + *
     4960 + * This code is free software; you can redistribute it and/or modify it
     4961 + * under the terms of the GNU General Public License version 2 only, as
     4962 + * published by the Free Software Foundation.
     4963 + *
     4964 + * This code is distributed in the hope that it will be useful, but WITHOUT
     4965 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     4966 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     4967 + * version 2 for more details (a copy is included in the LICENSE file that
     4968 + * accompanied this code).
     4969 + *
     4970 + * You should have received a copy of the GNU General Public License version
     4971 + * 2 along with this work; if not, write to the Free Software Foundation,
     4972 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     4973 + *
     4974 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     4975 + * or visit www.oracle.com if you need additional information or have any
     4976 + * questions.
     4977 + *
     4978 + */
     4979 +package at.ssw.hotswap.test.access.reflection;
     4980 +
     4981 +import at.ssw.hotswap.test.access.ClassAccess;
     4982 +import at.ssw.hotswap.test.access.MethodAccess;
     4983 +import java.lang.reflect.Method;
     4984 +import java.util.ArrayList;
     4985 +import java.util.List;
     4986 +
     4987 +/**
     4988 + * @author Kerstin Breiteneder
     4989 + * @author Christoph Wimberger
     4990 + */
     4991 +public class ReflectionClassAccess implements ClassAccess {
     4992 +
     4993 +    private Class clazz;
     4994 +   
     4995 +    public ReflectionClassAccess() {
     4996 +    }
     4997 +    public ReflectionClassAccess(String name) throws ClassNotFoundException {
     4998 +        clazz = Class.forName(name);
     4999 +    }
     5000 +
     5001 +    @Override
     5002 +    public String getName() {
     5003 +        return clazz.getName();
     5004 +    }
     5005 +
     5006 +    @Override
     5007 +    public MethodAccess findMethod(String method) {
     5008 +        try {
     5009 +            return new ReflectionMethodAccess(method, clazz.getName());
     5010 +        } catch (ClassNotFoundException ex) {
     5011 +            return null;
     5012 +        } catch (NoSuchMethodError ex) {
     5013 +            return null;
     5014 +        }
     5015 +    }
     5016 +
     5017 +    @Override
     5018 +    public List<MethodAccess> getMethods() {
     5019 +        List<MethodAccess> methodAccesses = new ArrayList<MethodAccess>();
     5020 +        for (Method m : clazz.getDeclaredMethods()) {
     5021 +            methodAccesses.add(new ReflectionMethodAccess(m, clazz));
     5022 +        }
     5023 +        return methodAccesses;
     5024 +    }
     5025 +}
     5026 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/reflection/ReflectionMethodAccess.java
     5027 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5028 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/reflection/ReflectionMethodAccess.java	Fri Dec 17 13:23:04 2010 +0100
     5029 @@ -0,0 +1,107 @@
     5030 +/*
     5031 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     5032 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5033 + *
     5034 + * This code is free software; you can redistribute it and/or modify it
     5035 + * under the terms of the GNU General Public License version 2 only, as
     5036 + * published by the Free Software Foundation.
     5037 + *
     5038 + * This code is distributed in the hope that it will be useful, but WITHOUT
     5039 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     5040 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     5041 + * version 2 for more details (a copy is included in the LICENSE file that
     5042 + * accompanied this code).
     5043 + *
     5044 + * You should have received a copy of the GNU General Public License version
     5045 + * 2 along with this work; if not, write to the Free Software Foundation,
     5046 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     5047 + *
     5048 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     5049 + * or visit www.oracle.com if you need additional information or have any
     5050 + * questions.
     5051 + *
     5052 + */
     5053 +package at.ssw.hotswap.test.access.reflection;
     5054 +
     5055 +import at.ssw.hotswap.test.access.MethodAccess;
     5056 +import java.lang.reflect.InvocationTargetException;
     5057 +import java.lang.reflect.Method;
     5058 +import java.lang.reflect.Modifier;
     5059 +
     5060 +/**
     5061 + * @author Kerstin Breiteneder
     5062 + * @author Christoph Wimberger
     5063 + */
     5064 +public class ReflectionMethodAccess implements MethodAccess {
     5065 +
     5066 +    private Method method;
     5067 +
     5068 +    public ReflectionMethodAccess(String methodName, String className) throws ClassNotFoundException, NoSuchMethodError {
     5069 +
     5070 +        Class clazz = Class.forName(className);
     5071 +
     5072 +        Method found = null;
     5073 +        for (Method m : clazz.getDeclaredMethods()) {
     5074 +            if (m.getName().equals(methodName)) {
     5075 +                if (found != null) {
     5076 +                    throw new RuntimeException("ambiguous method name");
     5077 +                }
     5078 +                found = m;
     5079 +            }
     5080 +        }
     5081 +        if (found == null) {
     5082 +            throw new NoSuchMethodError(methodName);
     5083 +        }
     5084 +        this.method = found;
     5085 +    }
     5086 +
     5087 +    public ReflectionMethodAccess(Method m, Class clazz) {
     5088 +        this.method = m;
     5089 +    }
     5090 +
     5091 +    @Override
     5092 +    public String getSignature() {
     5093 +        String methodString = Modifier.toString(method.getModifiers()) + " " + method.getReturnType().getName() + " " + method.getName() + "(";
     5094 +        boolean paramFound = false;
     5095 +        for (Class c : method.getParameterTypes()) {
     5096 +            if (paramFound) {
     5097 +                methodString += ", ";
     5098 +            }
     5099 +            paramFound = true;
     5100 +            methodString += c.getName();
     5101 +        }
     5102 +        return methodString + ")";
     5103 +    }
     5104 +
     5105 +    @Override
     5106 +    public String getName() {
     5107 +        return method.getName();
     5108 +    }
     5109 +
     5110 +    @Override
     5111 +    public boolean canCheckObsoletness() {
     5112 +        return false;
     5113 +    }
     5114 +
     5115 +    @Override
     5116 +    public boolean isObsolete() {
     5117 +        throw new UnsupportedOperationException("Not supported yet.");
     5118 +    }
     5119 +
     5120 +    @Override
     5121 +    public Object invoke(Object[] o, Object instance) {
     5122 +        try {
     5123 +            boolean acc = method.isAccessible();
     5124 +            method.setAccessible(true);
     5125 +            Object obj = method.invoke(instance, o);
     5126 +            method.setAccessible(acc);
     5127 +            return obj;
     5128 +        } catch (IllegalAccessException ex) {
     5129 +            throw new RuntimeException(ex);
     5130 +        } catch (IllegalArgumentException ex) {
     5131 +            throw new RuntimeException(ex);
     5132 +        } catch (InvocationTargetException ex) {
     5133 +            throw new RuntimeException(ex);
     5134 +        }
     5135 +    }
     5136 +}
     5137 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/reflection/ReflectionStackFrameAccess.java
     5138 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5139 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/reflection/ReflectionStackFrameAccess.java	Fri Dec 17 13:23:04 2010 +0100
     5140 @@ -0,0 +1,70 @@
     5141 +/*
     5142 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     5143 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5144 + *
     5145 + * This code is free software; you can redistribute it and/or modify it
     5146 + * under the terms of the GNU General Public License version 2 only, as
     5147 + * published by the Free Software Foundation.
     5148 + *
     5149 + * This code is distributed in the hope that it will be useful, but WITHOUT
     5150 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     5151 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     5152 + * version 2 for more details (a copy is included in the LICENSE file that
     5153 + * accompanied this code).
     5154 + *
     5155 + * You should have received a copy of the GNU General Public License version
     5156 + * 2 along with this work; if not, write to the Free Software Foundation,
     5157 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     5158 + *
     5159 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     5160 + * or visit www.oracle.com if you need additional information or have any
     5161 + * questions.
     5162 + *
     5163 + */
     5164 +package at.ssw.hotswap.test.access.reflection;
     5165 +
     5166 +import at.ssw.hotswap.test.access.ClassAccess;
     5167 +import at.ssw.hotswap.test.access.MethodAccess;
     5168 +import at.ssw.hotswap.test.access.StackFrameAccess;
     5169 +
     5170 +/**
     5171 + * @author Kerstin Breiteneder
     5172 + * @author Christoph Wimberger
     5173 + */
     5174 +public class ReflectionStackFrameAccess implements StackFrameAccess {
     5175 +
     5176 +    private String methodName;
     5177 +    private String className;
     5178 +    private MethodAccess methodAccess;
     5179 +    private ClassAccess classAccess;
     5180 +
     5181 +    ReflectionStackFrameAccess(StackTraceElement element) {
     5182 +        methodName = element.getMethodName();
     5183 +        className = element.getClassName();
     5184 +    }
     5185 +
     5186 +    @Override
     5187 +    public MethodAccess getMethod() throws ClassNotFoundException {
     5188 +        if (methodAccess == null) {
     5189 +            methodAccess = new ReflectionMethodAccess(methodName, className);
     5190 +        }
     5191 +        return methodAccess;
     5192 +    }
     5193 +
     5194 +    @Override
     5195 +    public ClassAccess getClazz() {
     5196 +        if (classAccess == null) {
     5197 +            try {
     5198 +                classAccess = new ReflectionClassAccess(className);
     5199 +            } catch (ClassNotFoundException ex) {
     5200 +                return null;
     5201 +            }
     5202 +        }
     5203 +        return classAccess;
     5204 +    }
     5205 +
     5206 +    @Override
     5207 +    public String toString() {
     5208 +        return methodName;
     5209 +    }
     5210 +}
     5211 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/reflection/ReflectionVMAccess.java
     5212 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5213 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/access/reflection/ReflectionVMAccess.java	Fri Dec 17 13:23:04 2010 +0100
     5214 @@ -0,0 +1,101 @@
     5215 +/*
     5216 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     5217 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5218 + *
     5219 + * This code is free software; you can redistribute it and/or modify it
     5220 + * under the terms of the GNU General Public License version 2 only, as
     5221 + * published by the Free Software Foundation.
     5222 + *
     5223 + * This code is distributed in the hope that it will be useful, but WITHOUT
     5224 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     5225 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     5226 + * version 2 for more details (a copy is included in the LICENSE file that
     5227 + * accompanied this code).
     5228 + *
     5229 + * You should have received a copy of the GNU General Public License version
     5230 + * 2 along with this work; if not, write to the Free Software Foundation,
     5231 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     5232 + *
     5233 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     5234 + * or visit www.oracle.com if you need additional information or have any
     5235 + * questions.
     5236 + *
     5237 + */
     5238 +package at.ssw.hotswap.test.access.reflection;
     5239 +
     5240 +import at.ssw.hotswap.test.access.ClassAccess;
     5241 +import at.ssw.hotswap.test.access.VMAccess;
     5242 +import at.ssw.hotswap.test.access.StackFrameAccess;
     5243 +import java.util.ArrayList;
     5244 +import java.util.List;
     5245 +
     5246 +/**
     5247 + * @author Kerstin Breiteneder
     5248 + * @author Christoph Wimberger
     5249 + */
     5250 +public class ReflectionVMAccess implements VMAccess {
     5251 +
     5252 +    private List<Thread> getThreads() {
     5253 +        ThreadGroup root = Thread.currentThread().getThreadGroup();
     5254 +        while (root.getParent() != null) {
     5255 +            root = root.getParent();
     5256 +        }
     5257 +
     5258 +        Thread[] threads;
     5259 +        int cnt;
     5260 +        int estsize = root.activeCount();
     5261 +
     5262 +        do {
     5263 +            estsize *= 2;
     5264 +            threads = new Thread[estsize];
     5265 +
     5266 +            cnt = root.enumerate(threads, true);
     5267 +        } while (cnt == estsize);
     5268 +
     5269 +        List<Thread> ret = new ArrayList<Thread>();
     5270 +        for (int i = 0; i < cnt; i++) {
     5271 +            ret.add(threads[i]);
     5272 +        }
     5273 +        return ret;
     5274 +    }
     5275 +
     5276 +    @Override
     5277 +    public List<String> getThreadNames() {
     5278 +        List<String> threadNames = new ArrayList<String>();
     5279 +        List<Thread> threads = getThreads();
     5280 +        for (Thread t : threads) {
     5281 +            threadNames.add(t.getName());
     5282 +        }
     5283 +        return threadNames;
     5284 +    }
     5285 +
     5286 +    @Override
     5287 +    public boolean canGetFrames() {
     5288 +        return true;
     5289 +    }
     5290 +
     5291 +    @Override
     5292 +    public List<StackFrameAccess> getFrames(String threadName) {
     5293 +
     5294 +        List<Thread> threads = getThreads();
     5295 +        List<StackFrameAccess> stackAccesses = new ArrayList<StackFrameAccess>();
     5296 +        for (Thread t : threads) {
     5297 +            if (t.getName().equals(threadName)) {
     5298 +                for (StackTraceElement stackElement : t.getStackTrace()) {
     5299 +                    StackFrameAccess stackAccess = new ReflectionStackFrameAccess(stackElement);
     5300 +                    stackAccesses.add(stackAccess);
     5301 +                }
     5302 +            }
     5303 +        }
     5304 +        return stackAccesses;
     5305 +    }
     5306 +
     5307 +    @Override
     5308 +    public ClassAccess findClass(String clazz) {
     5309 +        try {
     5310 +            return new ReflectionClassAccess(clazz);
     5311 +        } catch (ClassNotFoundException ex) {
     5312 +            return null;
     5313 +        }
     5314 +    }
     5315 +}
     5316 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/accesstests/AccessTest.java
     5317 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5318 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/accesstests/AccessTest.java	Fri Dec 17 13:23:04 2010 +0100
     5319 @@ -0,0 +1,325 @@
     5320 +/*
     5321 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     5322 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5323 + *
     5324 + * This code is free software; you can redistribute it and/or modify it
     5325 + * under the terms of the GNU General Public License version 2 only, as
     5326 + * published by the Free Software Foundation.
     5327 + *
     5328 + * This code is distributed in the hope that it will be useful, but WITHOUT
     5329 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     5330 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     5331 + * version 2 for more details (a copy is included in the LICENSE file that
     5332 + * accompanied this code).
     5333 + *
     5334 + * You should have received a copy of the GNU General Public License version
     5335 + * 2 along with this work; if not, write to the Free Software Foundation,
     5336 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     5337 + *
     5338 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     5339 + * or visit www.oracle.com if you need additional information or have any
     5340 + * questions.
     5341 + *
     5342 + */
     5343 +package at.ssw.hotswap.test.accesstests;
     5344 +
     5345 +import static org.junit.Assert.*;
     5346 +import org.junit.Before;
     5347 +import org.junit.Test;
     5348 +import at.ssw.hotswap.HotSwapTool;
     5349 +import at.ssw.hotswap.test.access.ClassAccess;
     5350 +import at.ssw.hotswap.test.access.MethodAccess;
     5351 +import at.ssw.hotswap.test.access.StackFrameAccess;
     5352 +import at.ssw.hotswap.test.access.VMAccess;
     5353 +import at.ssw.hotswap.test.access.jdi.JDIVMAccess;
     5354 +import at.ssw.hotswap.test.access.jni.JNIVMAccess;
     5355 +import at.ssw.hotswap.test.access.reflection.ReflectionVMAccess;
     5356 +import java.util.Arrays;
     5357 +import java.util.Collection;
     5358 +import java.util.Comparator;
     5359 +import java.util.List;
     5360 +import org.junit.runner.RunWith;
     5361 +import org.junit.runners.Parameterized;
     5362 +import org.junit.runners.Parameterized.Parameters;
     5363 +
     5364 +/**
     5365 + * @author Kerstin Breiteneder
     5366 + * @author Christoph Wimberger
     5367 + */
     5368 +@RunWith(Parameterized.class)
     5369 +public class AccessTest {
     5370 +
     5371 +    private static VMAccess vma;
     5372 +
     5373 +    public AccessTest(VMAccess vma) {
     5374 +        this.vma = vma;
     5375 +    }
     5376 +
     5377 +    // Version 0
     5378 +    public static class A {
     5379 +
     5380 +        //needed for StackTraceTest
     5381 +        public static String stackTraceHelper() {
     5382 +            return getParentMethodSignature();
     5383 +        }
     5384 +
     5385 +        //needed for FindMethodTest
     5386 +        public static String method_Version0() {
     5387 +            return "Version0";
     5388 +        }
     5389 +
     5390 +        //needed for SignatureTest
     5391 +        public static String signatureHelper(String y, int x) {
     5392 +            return "Version0";
     5393 +        }
     5394 +
     5395 +        //needed for invokeMethodIntTest()
     5396 +        private int testIntRetValue() {
     5397 +            return 2;
     5398 +        }
     5399 +
     5400 +        //needed for invokeMethodObjectTest
     5401 +        private Object testObjectRetValue() {
     5402 +            return new Integer(2);
     5403 +        }
     5404 +
     5405 +        //needed for invokeMethodVoidTest
     5406 +        private static void testVoidRetValue() {
     5407 +            System.out.println("Version 0");
     5408 +        }
     5409 +
     5410 +        //needed for invokeMethodParameterTest()
     5411 +        private static int testMethodParameter(Integer x) {
     5412 +            return x;
     5413 +        }
     5414 +    }
     5415 +
     5416 +    // Version 1
     5417 +    public static class A___1 {
     5418 +
     5419 +        //needed for StackTraceTest
     5420 +        protected static String stackTraceHelper() {
     5421 +            return getParentMethodSignature();
     5422 +        }
     5423 +
     5424 +        //needed for FindMethodTest, SignatureTest
     5425 +        public static String method_Version1() {
     5426 +            return "Version1";
     5427 +        }
     5428 +
     5429 +        //needed for SignatureTest
     5430 +        private static String signatureHelper(int y, int x) {
     5431 +            return "Version1";
     5432 +        }
     5433 +
     5434 +        //needed for invokeMethodIntTest
     5435 +        private int testIntRetValue() {
     5436 +            return 3;
     5437 +        }
     5438 +
     5439 +        //needed for invokeMethodObjectTest
     5440 +        private Object testObjectRetValue() {
     5441 +            return new Integer(3);
     5442 +        }
     5443 +
     5444 +        //needed for invokeMethodVoidTest
     5445 +        private static void testVoidRetValue() {
     5446 +            System.out.println("Version 1");
     5447 +        }
     5448 +
     5449 +        //needed for invokeMethodParameterTest()
     5450 +        private static int testMethodParameter(Integer x) {
     5451 +            return x + 1;
     5452 +        }
     5453 +    }
     5454 +
     5455 +    //needed for StackTraceTest
     5456 +    private static String getParentMethodSignature() {
     5457 +
     5458 +        try {
     5459 +            int i = 0;
     5460 +            for (StackFrameAccess stack : vma.getFrames("main")) {
     5461 +                if (stack.getMethod().getName().equals("access$000")) {
     5462 +                    break;
     5463 +                } else {
     5464 +                    i++;
     5465 +                }
     5466 +            }
     5467 +            return vma.getFrames("main").get(++i).getMethod().getSignature();
     5468 +        } catch (ClassNotFoundException ex) {
     5469 +            return null;
     5470 +        }
     5471 +    }
     5472 +
     5473 +    @Parameters
     5474 +    public static Collection accessValues() {
     5475 +        return Arrays.asList(new Object[][]{{new JDIVMAccess()}, {new JNIVMAccess()}, {new ReflectionVMAccess()}});
     5476 +        //return Arrays.asList(new Object[][]{{new JDIVMAccess()}});
     5477 +    }
     5478 +
     5479 +    @Before
     5480 +    public void setUp() throws Exception {
     5481 +        HotSwapTool.toVersion(AccessTest.class, 0);
     5482 +    }
     5483 +
     5484 +    @Test
     5485 +    public void FindClassTest() {
     5486 +
     5487 +
     5488 +        ClassAccess classAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$XYZ");
     5489 +        assertNull(classAccess);
     5490 +
     5491 +        classAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A");
     5492 +        assertNotNull(classAccess);
     5493 +
     5494 +        HotSwapTool.toVersion(AccessTest.class, 1);
     5495 +
     5496 +        classAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A");
     5497 +        assertNotNull(classAccess);
     5498 +    }
     5499 +
     5500 +    @Test
     5501 +    public void FindMethodTest() {
     5502 +
     5503 +        ClassAccess classAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A");
     5504 +        assertNotNull(classAccess);
     5505 +
     5506 +        assertNotNull(classAccess.findMethod("method_Version0"));
     5507 +        assertNull(classAccess.findMethod("method_Version1"));
     5508 +
     5509 +        HotSwapTool.toVersion(AccessTest.class, 1);
     5510 +
     5511 +        assertNull(classAccess.findMethod("method_Version0"));
     5512 +        assertNotNull(classAccess.findMethod("method_Version1"));
     5513 +    }
     5514 +
     5515 +    @Test
     5516 +    public void StackTraceTest() {
     5517 +        if (vma.canGetFrames()) {
     5518 +            assertEquals("public static java.lang.String stackTraceHelper()", A.stackTraceHelper());
     5519 +
     5520 +            HotSwapTool.toVersion(AccessTest.class, 1);
     5521 +
     5522 +            assertEquals("protected static java.lang.String stackTraceHelper()", A.stackTraceHelper());
     5523 +        }
     5524 +    }
     5525 +
     5526 +    @Test
     5527 +    public void SignatureTest() {
     5528 +        MethodAccess mAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A").findMethod("signatureHelper");
     5529 +        assertEquals("public static java.lang.String signatureHelper(java.lang.String, int)", mAccess.getSignature());
     5530 +
     5531 +        HotSwapTool.toVersion(AccessTest.class, 1);
     5532 +
     5533 +        mAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A").findMethod("signatureHelper");
     5534 +        assertEquals("private static java.lang.String signatureHelper(int, int)", mAccess.getSignature());
     5535 +    }
     5536 +
     5537 +    @Test
     5538 +    public void invokeMethodIntTest() {
     5539 +        if (vma.getClass().getName().equals("at.ssw.hotswap.test.access.jdi.JDIVMAccess")) {
     5540 +            return;
     5541 +        }
     5542 +
     5543 +        ClassAccess classAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A");
     5544 +        assertEquals(2, classAccess.findMethod("testIntRetValue").invoke(new Object[0], new A()));
     5545 +
     5546 +        HotSwapTool.toVersion(AccessTest.class, 1);
     5547 +
     5548 +        assertEquals(3, classAccess.findMethod("testIntRetValue").invoke(new Object[0], new A()));
     5549 +    }
     5550 +
     5551 +    @Test
     5552 +    public void invokeMethodObjectTest() {
     5553 +        if (vma.getClass().getName().equals("at.ssw.hotswap.test.access.jdi.JDIVMAccess")) {
     5554 +            return;
     5555 +        }
     5556 +
     5557 +        ClassAccess classAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A");
     5558 +        assertEquals(2, classAccess.findMethod("testObjectRetValue").invoke(new Object[0], new A()));
     5559 +
     5560 +        HotSwapTool.toVersion(AccessTest.class, 1);
     5561 +
     5562 +        assertEquals(3, classAccess.findMethod("testObjectRetValue").invoke(new Object[0], new A()));
     5563 +    }
     5564 +
     5565 +    @Test
     5566 +    public void invokeMethodVoidTest() {
     5567 +        if (vma.getClass().getName().equals("at.ssw.hotswap.test.access.jdi.JDIVMAccess")) {
     5568 +            return;
     5569 +        }
     5570 +
     5571 +        ClassAccess classAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A");
     5572 +        assertNull(classAccess.findMethod("testVoidRetValue").invoke(new Object[0], new A()));
     5573 +
     5574 +        HotSwapTool.toVersion(AccessTest.class, 1);
     5575 +
     5576 +        assertNull(classAccess.findMethod("testVoidRetValue").invoke(new Object[0], new A()));
     5577 +    }
     5578 +
     5579 +    @Test
     5580 +    public void invokeMethodParameterTest() {
     5581 +        if (vma.getClass().getName().equals("at.ssw.hotswap.test.access.jdi.JDIVMAccess")) {
     5582 +            return;
     5583 +        }
     5584 +
     5585 +        ClassAccess classAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A");
     5586 +        assertEquals(6, classAccess.findMethod("testMethodParameter").invoke(new Object[]{6}, new A()));
     5587 +
     5588 +        HotSwapTool.toVersion(AccessTest.class, 1);
     5589 +
     5590 +        assertEquals(7, classAccess.findMethod("testMethodParameter").invoke(new Object[]{6}, new A()));
     5591 +
     5592 +    }
     5593 +
     5594 +    @Test
     5595 +    public void getMethodsTest() {
     5596 +
     5597 +        ClassAccess cAccess = vma.findClass("at.ssw.hotswap.test.accesstests.AccessTest$A");
     5598 +        List<MethodAccess> list = cAccess.getMethods();
     5599 +
     5600 +        assertEquals(7, list.size());
     5601 +
     5602 +        Object[] mAccesses = list.toArray();
     5603 +
     5604 +        Arrays.sort(mAccesses, new Comparator() {
     5605 +
     5606 +            @Override
     5607 +            public int compare(Object o1, Object o2) {
     5608 +                return ((MethodAccess) o1).getName().compareTo(((MethodAccess) o2).getName());
     5609 +            }
     5610 +        });
     5611 +
     5612 +        assertEquals("method_Version0", ((MethodAccess) mAccesses[0]).getName());
     5613 +        assertEquals("signatureHelper", ((MethodAccess) mAccesses[1]).getName());
     5614 +        assertEquals("stackTraceHelper", ((MethodAccess) mAccesses[2]).getName());
     5615 +        assertEquals("testIntRetValue", ((MethodAccess) mAccesses[3]).getName());
     5616 +        assertEquals("testMethodParameter", ((MethodAccess) mAccesses[4]).getName());
     5617 +        assertEquals("testObjectRetValue", ((MethodAccess) mAccesses[5]).getName());
     5618 +        assertEquals("testVoidRetValue", ((MethodAccess) mAccesses[6]).getName());
     5619 +
     5620 +        HotSwapTool.toVersion(AccessTest.class, 1);
     5621 +
     5622 +        list = cAccess.getMethods();
     5623 +
     5624 +        assertEquals(7, list.size());
     5625 +
     5626 +        mAccesses = list.toArray();
     5627 +        Arrays.sort(mAccesses, new Comparator() {
     5628 +
     5629 +            @Override
     5630 +            public int compare(Object o1, Object o2) {
     5631 +                return ((MethodAccess) o1).getName().compareTo(((MethodAccess) o2).getName());
     5632 +            }
     5633 +        });
     5634 +
     5635 +        assertEquals("method_Version1", ((MethodAccess) mAccesses[0]).getName());
     5636 +        assertEquals("signatureHelper", ((MethodAccess) mAccesses[1]).getName());
     5637 +        assertEquals("stackTraceHelper", ((MethodAccess) mAccesses[2]).getName());
     5638 +        assertEquals("testIntRetValue", ((MethodAccess) mAccesses[3]).getName());
     5639 +        assertEquals("testMethodParameter", ((MethodAccess) mAccesses[4]).getName());
     5640 +        assertEquals("testObjectRetValue", ((MethodAccess) mAccesses[5]).getName());
     5641 +        assertEquals("testVoidRetValue", ((MethodAccess) mAccesses[6]).getName());
     5642 +
     5643 +    }
     5644 +}
     5645 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/accesstests/AccessTestSuite.java
     5646 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5647 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/accesstests/AccessTestSuite.java	Fri Dec 17 13:23:04 2010 +0100
     5648 @@ -0,0 +1,38 @@
     5649 +/*
     5650 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     5651 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5652 + *
     5653 + * This code is free software; you can redistribute it and/or modify it
     5654 + * under the terms of the GNU General Public License version 2 only, as
     5655 + * published by the Free Software Foundation.
     5656 + *
     5657 + * This code is distributed in the hope that it will be useful, but WITHOUT
     5658 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     5659 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     5660 + * version 2 for more details (a copy is included in the LICENSE file that
     5661 + * accompanied this code).
     5662 + *
     5663 + * You should have received a copy of the GNU General Public License version
     5664 + * 2 along with this work; if not, write to the Free Software Foundation,
     5665 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     5666 + *
     5667 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     5668 + * or visit www.oracle.com if you need additional information or have any
     5669 + * questions.
     5670 + *
     5671 + */
     5672 +package at.ssw.hotswap.test.accesstests;
     5673 +
     5674 +import org.junit.runner.RunWith;
     5675 +import org.junit.runners.Suite;
     5676 +
     5677 +/**
     5678 + * @author Kerstin Breiteneder
     5679 + * @author Christoph Wimberger
     5680 + */
     5681 +@RunWith(Suite.class)
     5682 +@Suite.SuiteClasses({
     5683 +    AccessTest.class
     5684 +})
     5685 +public class AccessTestSuite {
     5686 +}
     5687 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/BodyTestSuite.java
     5688 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5689 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/BodyTestSuite.java	Fri Dec 17 13:23:04 2010 +0100
     5690 @@ -0,0 +1,54 @@
     5691 +/*
     5692 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     5693 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5694 + *
     5695 + * This code is free software; you can redistribute it and/or modify it
     5696 + * under the terms of the GNU General Public License version 2 only, as
     5697 + * published by the Free Software Foundation.
     5698 + *
     5699 + * This code is distributed in the hope that it will be useful, but WITHOUT
     5700 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     5701 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     5702 + * version 2 for more details (a copy is included in the LICENSE file that
     5703 + * accompanied this code).
     5704 + *
     5705 + * You should have received a copy of the GNU General Public License version
     5706 + * 2 along with this work; if not, write to the Free Software Foundation,
     5707 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     5708 + *
     5709 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     5710 + * or visit www.oracle.com if you need additional information or have any
     5711 + * questions.
     5712 + *
     5713 + */
     5714 +
     5715 +package at.ssw.hotswap.test.body;
     5716 +
     5717 +import org.junit.runner.RunWith;
     5718 +import org.junit.runners.Suite;
     5719 +
     5720 +/**
     5721 + * 
     5722 + * Class redefinition tests that swap only method bodies and change nothing else. This test cases should also
     5723 + * run with the current version of HotSpot.
     5724 + * 
     5725 + * @author Thomas Wuerthinger
     5726 + *
     5727 + */
     5728 +@RunWith(Suite.class)
     5729 +@Suite.SuiteClasses(
     5730 +{
     5731 +    StaticTest.class,
     5732 +    SimpleStaticTest.class,
     5733 +    MultipleThreadsTest.class,
     5734 +    OldActivationTest.class,
     5735 +    RefactorActiveMethodTest.class,
     5736 +    StressTest.class,
     5737 +    FacTest.class,
     5738 +    FibTest.class,
     5739 +    RedefinePrivateMethodTest.class,
     5740 +    ClassRenamingTestCase.class,
     5741 +    EMCPTest.class
     5742 +})
     5743 +public class BodyTestSuite {
     5744 +}
     5745 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/ClassRenamingTestCase.java
     5746 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5747 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/ClassRenamingTestCase.java	Fri Dec 17 13:23:04 2010 +0100
     5748 @@ -0,0 +1,69 @@
     5749 +/*
     5750 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     5751 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5752 + *
     5753 + * This code is free software; you can redistribute it and/or modify it
     5754 + * under the terms of the GNU General Public License version 2 only, as
     5755 + * published by the Free Software Foundation.
     5756 + *
     5757 + * This code is distributed in the hope that it will be useful, but WITHOUT
     5758 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     5759 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     5760 + * version 2 for more details (a copy is included in the LICENSE file that
     5761 + * accompanied this code).
     5762 + *
     5763 + * You should have received a copy of the GNU General Public License version
     5764 + * 2 along with this work; if not, write to the Free Software Foundation,
     5765 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     5766 + *
     5767 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     5768 + * or visit www.oracle.com if you need additional information or have any
     5769 + * questions.
     5770 + *
     5771 + */
     5772 +package at.ssw.hotswap.test.body;
     5773 +
     5774 +import at.ssw.hotswap.ClassRedefinitionPolicy;
     5775 +import at.ssw.hotswap.HotSwapTool;
     5776 +import static org.junit.Assert.*;
     5777 +import org.junit.Test;
     5778 +
     5779 +/**
     5780 + *
     5781 + * @author Kerstin Breiteneder
     5782 + * @author Christoph Wimberger
     5783 + *
     5784 + */
     5785 +public class ClassRenamingTestCase {
     5786 +
     5787 +    public static class B {
     5788 +
     5789 +        public int a() {
     5790 +            return 1;
     5791 +        }
     5792 +    }
     5793 +
     5794 +    @ClassRedefinitionPolicy(alias = B.class)
     5795 +    public static class A___1 {
     5796 +
     5797 +        public int a() {
     5798 +            return 2;
     5799 +        }
     5800 +    }
     5801 +
     5802 +    @Test
     5803 +    public void testRenaming() {
     5804 +        HotSwapTool.toVersion(ClassRenamingTestCase.class, 0);
     5805 +
     5806 +        B b = new B();
     5807 +        assertEquals(1, b.a());
     5808 +
     5809 +        HotSwapTool.toVersion(ClassRenamingTestCase.class, 1);
     5810 +
     5811 +        assertEquals(2, b.a());
     5812 +
     5813 +        HotSwapTool.toVersion(ClassRenamingTestCase.class, 0);
     5814 +
     5815 +        assertEquals(1, b.a());
     5816 +    }
     5817 +}
     5818 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/EMCPTest.java
     5819 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5820 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/EMCPTest.java	Fri Dec 17 13:23:04 2010 +0100
     5821 @@ -0,0 +1,219 @@
     5822 +/*
     5823 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     5824 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5825 + *
     5826 + * This code is free software; you can redistribute it and/or modify it
     5827 + * under the terms of the GNU General Public License version 2 only, as
     5828 + * published by the Free Software Foundation.
     5829 + *
     5830 + * This code is distributed in the hope that it will be useful, but WITHOUT
     5831 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     5832 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     5833 + * version 2 for more details (a copy is included in the LICENSE file that
     5834 + * accompanied this code).
     5835 + *
     5836 + * You should have received a copy of the GNU General Public License version
     5837 + * 2 along with this work; if not, write to the Free Software Foundation,
     5838 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     5839 + *
     5840 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     5841 + * or visit www.oracle.com if you need additional information or have any
     5842 + * questions.
     5843 + *
     5844 + */
     5845 +package at.ssw.hotswap.test.body;
     5846 +
     5847 +import at.ssw.hotswap.HotSwapTool;
     5848 +import at.ssw.hotswap.test.TestUtil;
     5849 +import java.io.PrintStream;
     5850 +import static org.junit.Assert.*;
     5851 +import org.junit.Test;
     5852 +
     5853 +/**
     5854 + *
     5855 + * EMCP (Equivalent modulo Constant Pool) tests.
     5856 + *
     5857 + * @author Thomas Wuerthinger
     5858 + *
     5859 + */
     5860 +public class EMCPTest {
     5861 +
     5862 +    public static class A {
     5863 +
     5864 +        public static int EMCPReturn() {
     5865 +            change();
     5866 +            PrintStream s = System.out;
     5867 +            return 1;
     5868 +        }
     5869 +    }
     5870 +
     5871 +    public static class B {
     5872 +
     5873 +        public static int b() {
     5874 +            change();
     5875 +            throw new RuntimeException();
     5876 +        }
     5877 +    }
     5878 +
     5879 +    public static class C {
     5880 +
     5881 +        public static int c() {
     5882 +            changeAndThrow();
     5883 +            return 0;
     5884 +        }
     5885 +    }
     5886 +
     5887 +    public static class D {
     5888 +
     5889 +        private static int value = 1;
     5890 +
     5891 +        public static int EMCPReturn() {
     5892 +            change3();
     5893 +            return value;
     5894 +        }
     5895 +    }
     5896 +
     5897 +    public static class A___1 {
     5898 +
     5899 +        public static int EMCPReturn() {
     5900 +            change();
     5901 +            PrintStream s = System.out;
     5902 +            return 1;
     5903 +        }
     5904 +    }
     5905 +
     5906 +    public static class B___1 {
     5907 +
     5908 +        public static int b() {
     5909 +            change();
     5910 +            throw new RuntimeException();
     5911 +        }
     5912 +    }
     5913 +
     5914 +    public static class C___1 {
     5915 +
     5916 +        public static int c() {
     5917 +            changeAndThrow();
     5918 +            return 0;
     5919 +        }
     5920 +    }
     5921 +    
     5922 +    public static class D___1 {
     5923 +        private static int value = 1;
     5924 +
     5925 +        public static int EMCPReturn() {
     5926 +            change3();
     5927 +            return value;
     5928 +        }
     5929 +    }
     5930 +
     5931 +    public static class D___2 {
     5932 +        private static int value = 1;
     5933 +
     5934 +        public static int EMCPReturn() {
     5935 +            change3();
     5936 +            return value;
     5937 +        }
     5938 +    }
     5939 +
     5940 +    public static class D___3 {
     5941 +        private static int value = 1;
     5942 +
     5943 +        public static int EMCPReturn() {
     5944 +            change3();
     5945 +            return value;
     5946 +        }
     5947 +    }
     5948 +
     5949 +    public static void change() {
     5950 +
     5951 +        HotSwapTool.toVersion(EMCPTest.class, 1);
     5952 +    }
     5953 +
     5954 +    public static void change3() {
     5955 +
     5956 +        HotSwapTool.toVersion(EMCPTest.class, 1);
     5957 +        HotSwapTool.toVersion(EMCPTest.class, 2);
     5958 +        HotSwapTool.toVersion(EMCPTest.class, 3);
     5959 +    }
     5960 +
     5961 +    public static void changeAndThrow() {
     5962 +
     5963 +        HotSwapTool.toVersion(EMCPTest.class, 1);
     5964 +
     5965 +        throw new RuntimeException();
     5966 +    }
     5967 +
     5968 +
     5969 +    @Test
     5970 +    public void testEMCPReturn() {
     5971 +        HotSwapTool.toVersion(EMCPTest.class, 0);
     5972 +
     5973 +        assertEquals(1, A.EMCPReturn());
     5974 +
     5975 +        HotSwapTool.toVersion(EMCPTest.class, 0);
     5976 +
     5977 +        assertEquals(1, A.EMCPReturn());
     5978 +        
     5979 +        HotSwapTool.toVersion(EMCPTest.class, 0);
     5980 +    }
     5981 +    
     5982 +    @Test
     5983 +    public void testEMCPMultiChangeReturn() {
     5984 +        HotSwapTool.toVersion(EMCPTest.class, 0);
     5985 +
     5986 +        assertEquals(1, D.EMCPReturn());
     5987 +
     5988 +        HotSwapTool.toVersion(EMCPTest.class, 0);
     5989 +
     5990 +        assertEquals(1, D.EMCPReturn());
     5991 +
     5992 +        HotSwapTool.toVersion(EMCPTest.class, 0);
     5993 +    }
     5994 +
     5995 +    @Test
     5996 +    public void testEMCPException() {
     5997 +        HotSwapTool.toVersion(EMCPTest.class, 0);
     5998 +
     5999 +        TestUtil.assertException(RuntimeException.class, new Runnable(){
     6000 +            @Override
     6001 +            public void run() {
     6002 +               B.b();
     6003 +            }
     6004 +        });
     6005 +
     6006 +        HotSwapTool.toVersion(EMCPTest.class, 0);
     6007 +
     6008 +        TestUtil.assertException(RuntimeException.class, new Runnable(){
     6009 +            @Override
     6010 +            public void run() {
     6011 +               B.b();
     6012 +            }
     6013 +        });
     6014 +
     6015 +        HotSwapTool.toVersion(EMCPTest.class, 0);
     6016 +    }
     6017 +
     6018 +    @Test
     6019 +    public void testEMCPExceptionInCallee() {
     6020 +        HotSwapTool.toVersion(EMCPTest.class, 0);
     6021 +
     6022 +        TestUtil.assertException(RuntimeException.class, new Runnable(){
     6023 +            @Override
     6024 +            public void run() {
     6025 +               C.c();
     6026 +            }
     6027 +        });
     6028 +
     6029 +        HotSwapTool.toVersion(EMCPTest.class, 0);
     6030 +
     6031 +        TestUtil.assertException(RuntimeException.class, new Runnable(){
     6032 +            @Override
     6033 +            public void run() {
     6034 +               C.c();
     6035 +            }
     6036 +        });
     6037 +
     6038 +        HotSwapTool.toVersion(EMCPTest.class, 0);
     6039 +    }
     6040 +}
     6041 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/FacTest.java
     6042 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6043 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/FacTest.java	Fri Dec 17 13:23:04 2010 +0100
     6044 @@ -0,0 +1,104 @@
     6045 +/*
     6046 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     6047 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6048 + *
     6049 + * This code is free software; you can redistribute it and/or modify it
     6050 + * under the terms of the GNU General Public License version 2 only, as
     6051 + * published by the Free Software Foundation.
     6052 + *
     6053 + * This code is distributed in the hope that it will be useful, but WITHOUT
     6054 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     6055 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     6056 + * version 2 for more details (a copy is included in the LICENSE file that
     6057 + * accompanied this code).
     6058 + *
     6059 + * You should have received a copy of the GNU General Public License version
     6060 + * 2 along with this work; if not, write to the Free Software Foundation,
     6061 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     6062 + *
     6063 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     6064 + * or visit www.oracle.com if you need additional information or have any
     6065 + * questions.
     6066 + *
     6067 + */
     6068 +
     6069 +package at.ssw.hotswap.test.body;
     6070 +
     6071 +import static org.junit.Assert.*;
     6072 +
     6073 +import org.junit.Before;
     6074 +
     6075 +import org.junit.Test;
     6076 +
     6077 +import at.ssw.hotswap.HotSwapTool;
     6078 +
     6079 +/**
     6080 + * Recursive implementation of the factorial function using class redefinition.
     6081 + *
     6082 + * @author Thomas Wuerthinger
     6083 + */
     6084 +public class FacTest {
     6085 +
     6086 +    public static abstract class Base {
     6087 +
     6088 +        protected int calc() {
     6089 +            return calc(HotSwapTool.getCurrentVersion(FacTest.class));
     6090 +        }
     6091 +
     6092 +        public int calcAt(int version) {
     6093 +            HotSwapTool.toVersion(FacTest.class, version);
     6094 +            int result = calc();
     6095 +            HotSwapTool.toVersion(FacTest.class, 0);
     6096 +            return result;
     6097 +        }
     6098 +
     6099 +        protected int calc(int version) {
     6100 +            return calc();
     6101 +        }
     6102 +    }
     6103 +
     6104 +    public static class Factorial extends Base {
     6105 +
     6106 +        @Override
     6107 +        protected int calc(int n) {
     6108 +            return n * calcAt(n - 1);
     6109 +        }
     6110 +    }
     6111 +
     6112 +    public static class Factorial___1 extends Base {
     6113 +
     6114 +        @Override
     6115 +        protected int calc() {
     6116 +            return 1;
     6117 +        }
     6118 +    }
     6119 +
     6120 +    @Before
     6121 +    public void setUp() throws Exception {
     6122 +        HotSwapTool.toVersion(FacTest.class, 0);
     6123 +    }
     6124 +
     6125 +    @Test
     6126 +    public void testFac() {
     6127 +
     6128 +        assert HotSwapTool.getCurrentVersion(FacTest.class) == 0;
     6129 +        Factorial f = new Factorial();
     6130 +
     6131 +        assertEquals(1, f.calcAt(1));
     6132 +
     6133 +        assert HotSwapTool.getCurrentVersion(FacTest.class) == 0;
     6134 +        assertEquals(2, f.calcAt(2));
     6135 +
     6136 +        assert HotSwapTool.getCurrentVersion(FacTest.class) == 0;
     6137 +        assertEquals(6, f.calcAt(3));
     6138 +
     6139 +        assert HotSwapTool.getCurrentVersion(FacTest.class) == 0;
     6140 +        assertEquals(24, f.calcAt(4));
     6141 +
     6142 +        assert HotSwapTool.getCurrentVersion(FacTest.class) == 0;
     6143 +        assertEquals(120, f.calcAt(5));
     6144 +
     6145 +        assert HotSwapTool.getCurrentVersion(FacTest.class) == 0;
     6146 +        assertEquals(479001600, f.calcAt(12));
     6147 +    }
     6148 +}
     6149 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/FibTest.java
     6150 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6151 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/FibTest.java	Fri Dec 17 13:23:04 2010 +0100
     6152 @@ -0,0 +1,111 @@
     6153 +/*
     6154 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     6155 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6156 + *
     6157 + * This code is free software; you can redistribute it and/or modify it
     6158 + * under the terms of the GNU General Public License version 2 only, as
     6159 + * published by the Free Software Foundation.
     6160 + *
     6161 + * This code is distributed in the hope that it will be useful, but WITHOUT
     6162 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     6163 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     6164 + * version 2 for more details (a copy is included in the LICENSE file that
     6165 + * accompanied this code).
     6166 + *
     6167 + * You should have received a copy of the GNU General Public License version
     6168 + * 2 along with this work; if not, write to the Free Software Foundation,
     6169 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     6170 + *
     6171 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     6172 + * or visit www.oracle.com if you need additional information or have any
     6173 + * questions.
     6174 + *
     6175 + */
     6176 +
     6177 +package at.ssw.hotswap.test.body;
     6178 +
     6179 +import static org.junit.Assert.*;
     6180 +
     6181 +import org.junit.Before;
     6182 +
     6183 +import org.junit.Test;
     6184 +
     6185 +import at.ssw.hotswap.HotSwapTool;
     6186 +
     6187 +/**
     6188 + * Recursive implementation of the fibonacci function using class redefinition.
     6189 + *
     6190 + * @author Thomas Wuerthinger
     6191 + */
     6192 +public class FibTest {
     6193 +
     6194 +    public static abstract class Base {
     6195 +
     6196 +        protected int calc() {
     6197 +            return calc(HotSwapTool.getCurrentVersion(FibTest.class));
     6198 +        }
     6199 +
     6200 +        public int calcAt(int version) {
     6201 +            HotSwapTool.toVersion(FibTest.class, version);
     6202 +            int result = calc();
     6203 +            HotSwapTool.toVersion(FibTest.class, 0);
     6204 +            return result;
     6205 +        }
     6206 +
     6207 +        protected int calc(int version) {
     6208 +            return calc();
     6209 +        }
     6210 +    }
     6211 +
     6212 +    public static class Fib extends Base {
     6213 +
     6214 +        @Override
     6215 +        protected int calc(int n) {
     6216 +            return calcAt(n - 1) + calcAt(n - 2);
     6217 +        }
     6218 +    }
     6219 +
     6220 +    public static class Fib___1 extends Base {
     6221 +
     6222 +        @Override
     6223 +        protected int calc() {
     6224 +            return 1;
     6225 +        }
     6226 +    }
     6227 +
     6228 +    public static class Fib___2 extends Base {
     6229 +
     6230 +        @Override
     6231 +        protected int calc() {
     6232 +            return 2;
     6233 +        }
     6234 +    }
     6235 +
     6236 +    @Before
     6237 +    public void setUp() throws Exception {
     6238 +        HotSwapTool.toVersion(FibTest.class, 0);
     6239 +    }
     6240 +
     6241 +    @Test
     6242 +    public void testFib() {
     6243 +
     6244 +        // 0 1 2 3 4 5
     6245 +        // 1 1 2 3 5 8
     6246 +        assert HotSwapTool.getCurrentVersion(FibTest.class) == 0;
     6247 +        Fib f = new Fib();
     6248 +
     6249 +        assertEquals(1, f.calcAt(1));
     6250 +
     6251 +        assert HotSwapTool.getCurrentVersion(FibTest.class) == 0;
     6252 +        assertEquals(2, f.calcAt(2));
     6253 +
     6254 +        assert HotSwapTool.getCurrentVersion(FibTest.class) == 0;
     6255 +        assertEquals(3, f.calcAt(3));
     6256 +
     6257 +        assert HotSwapTool.getCurrentVersion(FibTest.class) == 0;
     6258 +        assertEquals(5, f.calcAt(4));
     6259 +
     6260 +        assert HotSwapTool.getCurrentVersion(FibTest.class) == 0;
     6261 +        assertEquals(8, f.calcAt(5));
     6262 +    }
     6263 +}
     6264 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/MultipleThreadsTest.java
     6265 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6266 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/MultipleThreadsTest.java	Fri Dec 17 13:23:04 2010 +0100
     6267 @@ -0,0 +1,207 @@
     6268 +/*
     6269 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     6270 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6271 + *
     6272 + * This code is free software; you can redistribute it and/or modify it
     6273 + * under the terms of the GNU General Public License version 2 only, as
     6274 + * published by the Free Software Foundation.
     6275 + *
     6276 + * This code is distributed in the hope that it will be useful, but WITHOUT
     6277 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     6278 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     6279 + * version 2 for more details (a copy is included in the LICENSE file that
     6280 + * accompanied this code).
     6281 + *
     6282 + * You should have received a copy of the GNU General Public License version
     6283 + * 2 along with this work; if not, write to the Free Software Foundation,
     6284 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     6285 + *
     6286 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     6287 + * or visit www.oracle.com if you need additional information or have any
     6288 + * questions.
     6289 + *
     6290 + */
     6291 +
     6292 +package at.ssw.hotswap.test.body;
     6293 +
     6294 +import static org.junit.Assert.*;
     6295 +
     6296 +import org.junit.Before;
     6297 +import org.junit.Test;
     6298 +
     6299 +import at.ssw.hotswap.HotSwapTool;
     6300 +import at.ssw.hotswap.test.methods.OverrideMethodTest;
     6301 +
     6302 +/**
     6303 + * Class for testing redefining methods of classes that extend the Thread class. In the test setup the run method
     6304 + * calls the doit method in a loop until this methods returns false.
     6305 + *
     6306 + * @author Thomas Wuerthinger
     6307 + */
     6308 +public class MultipleThreadsTest {
     6309 +
     6310 +    public static final int COUNT = 10;
     6311 +
     6312 +    // Version 0
     6313 +    public static class A extends Thread {
     6314 +
     6315 +        private int value;
     6316 +        private int value2;
     6317 +        private boolean flag = false;
     6318 +
     6319 +        @Override
     6320 +        public void run() {
     6321 +            while (doit()) {
     6322 +                flag = false;
     6323 +            }
     6324 +        }
     6325 +
     6326 +        public boolean doit() {
     6327 +            if (flag) {
     6328 +                throw new RuntimeException("Must not reach here");
     6329 +            }
     6330 +            flag = true;
     6331 +            try {
     6332 +                Thread.sleep(1);
     6333 +            } catch (InterruptedException e) {
     6334 +            }
     6335 +
     6336 +            value++;
     6337 +            return true;
     6338 +        }
     6339 +
     6340 +        public int getValue() {
     6341 +            return value;
     6342 +        }
     6343 +
     6344 +        public int getValue2() {
     6345 +            return value2;
     6346 +        }
     6347 +    }
     6348 +
     6349 +    // Version 1
     6350 +    public static class A___1 extends Thread {
     6351 +
     6352 +        private int value;
     6353 +        private int value2;
     6354 +        private boolean flag = false;
     6355 +
     6356 +        @Override
     6357 +        public void run() {
     6358 +            while (doit()) {
     6359 +                flag = false;
     6360 +            }
     6361 +        }
     6362 +
     6363 +        public boolean doit() {
     6364 +            if (flag) {
     6365 +                throw new RuntimeException("Must not reach here");
     6366 +            }
     6367 +            flag = true;
     6368 +            try {
     6369 +                Thread.sleep(1);
     6370 +            } catch (InterruptedException e) {
     6371 +            }
     6372 +
     6373 +            value2++;
     6374 +            return true;
     6375 +        }
     6376 +
     6377 +        public int getValue() {
     6378 +            return value;
     6379 +        }
     6380 +
     6381 +        public int getValue2() {
     6382 +            return value2;
     6383 +        }
     6384 +    }
     6385 +
     6386 +    // Version 2
     6387 +    public static class A___2 extends Thread {
     6388 +
     6389 +        private int value;
     6390 +        private int value2;
     6391 +        private boolean flag = false;
     6392 +
     6393 +        @Override
     6394 +        public void run() {
     6395 +            while (doit()) {
     6396 +                flag = false;
     6397 +            }
     6398 +        }
     6399 +
     6400 +        public boolean doit() {
     6401 +            return false;
     6402 +        }
     6403 +
     6404 +        public int getValue() {
     6405 +            return value;
     6406 +        }
     6407 +
     6408 +        public int getValue2() {
     6409 +            return value2;
     6410 +        }
     6411 +    }
     6412 +
     6413 +    @Before
     6414 +    public void setUp() throws Exception {
     6415 +        HotSwapTool.toVersion(MultipleThreadsTest.class, 0);
     6416 +    }
     6417 +
     6418 +    @Test
     6419 +    public void testOneThread() {
     6420 +        test(1);
     6421 +    }
     6422 +
     6423 +    @Test
     6424 +    public void testThreads() {
     6425 +        test(COUNT);
     6426 +    }
     6427 +
     6428 +    private void test(int count) {
     6429 +
     6430 +        assert HotSwapTool.getCurrentVersion(MultipleThreadsTest.class) == 0;
     6431 +
     6432 +        A[] arr = new A[count];
     6433 +        for (int i = 0; i < count; i++) {
     6434 +            arr[i] = new A();
     6435 +            arr[i].start();
     6436 +        }
     6437 +
     6438 +        try {
     6439 +            Thread.sleep(500);
     6440 +        } catch (InterruptedException e) {
     6441 +        }
     6442 +
     6443 +        for (int i = 0; i < count; i++) {
     6444 +            //assertTrue(arr[i].getValue() > 0);
     6445 +        }
     6446 +
     6447 +        HotSwapTool.toVersion(MultipleThreadsTest.class, 1);
     6448 +
     6449 +        try {
     6450 +            Thread.sleep(500);
     6451 +        } catch (InterruptedException e) {
     6452 +        }
     6453 +
     6454 +        for (int i = 0; i < count; i++) {
     6455 +            assertTrue(arr[i].getValue2() > 0);
     6456 +        }
     6457 +
     6458 +        HotSwapTool.toVersion(MultipleThreadsTest.class, 2);
     6459 +
     6460 +        try {
     6461 +            Thread.sleep(500);
     6462 +        } catch (InterruptedException e) {
     6463 +        }
     6464 +
     6465 +
     6466 +        for (int i = 0; i < count; i++) {
     6467 +            assertFalse(arr[i].isAlive());
     6468 +        }
     6469 +
     6470 +        HotSwapTool.toVersion(OverrideMethodTest.class, 0);
     6471 +
     6472 +
     6473 +    }
     6474 +}
     6475 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/OldActivationTest.java
     6476 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6477 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/OldActivationTest.java	Fri Dec 17 13:23:04 2010 +0100
     6478 @@ -0,0 +1,158 @@
     6479 +/*
     6480 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     6481 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6482 + *
     6483 + * This code is free software; you can redistribute it and/or modify it
     6484 + * under the terms of the GNU General Public License version 2 only, as
     6485 + * published by the Free Software Foundation.
     6486 + *
     6487 + * This code is distributed in the hope that it will be useful, but WITHOUT
     6488 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     6489 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     6490 + * version 2 for more details (a copy is included in the LICENSE file that
     6491 + * accompanied this code).
     6492 + *
     6493 + * You should have received a copy of the GNU General Public License version
     6494 + * 2 along with this work; if not, write to the Free Software Foundation,
     6495 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     6496 + *
     6497 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     6498 + * or visit www.oracle.com if you need additional information or have any
     6499 + * questions.
     6500 + *
     6501 + */
     6502 +
     6503 +package at.ssw.hotswap.test.body;
     6504 +
     6505 +import static org.junit.Assert.*;
     6506 +
     6507 +import org.junit.Before;
     6508 +import org.junit.Test;
     6509 +
     6510 +import at.ssw.hotswap.HotSwapTool;
     6511 +
     6512 +/**
     6513 + * Stress test for the number of old activations on the stack. In the test setup 10 different versions of the method A.value will be on the stack.
     6514 + *
     6515 + * @author Thomas Wuerthinger
     6516 + */
     6517 +public class OldActivationTest {
     6518 +
     6519 +    // Version 0
     6520 +    public static class A {
     6521 +
     6522 +        public int value() {
     6523 +            HotSwapTool.toVersion(OldActivationTest.class, 1);
     6524 +            return 1 + this.value();
     6525 +        }
     6526 +    }
     6527 +
     6528 +    // Version 1
     6529 +    public static class A___1 {
     6530 +
     6531 +        public int value() {
     6532 +            HotSwapTool.toVersion(OldActivationTest.class, 2);
     6533 +            return 2 + this.value();
     6534 +        }
     6535 +    }
     6536 +
     6537 +    // Version 2
     6538 +    public static class A___2 {
     6539 +
     6540 +        public int value() {
     6541 +            HotSwapTool.toVersion(OldActivationTest.class, 3);
     6542 +            return 3 + this.value();
     6543 +        }
     6544 +    }
     6545 +
     6546 +    // Version 3
     6547 +    public static class A___3 {
     6548 +
     6549 +        public int value() {
     6550 +            HotSwapTool.toVersion(OldActivationTest.class, 4);
     6551 +            return 4 + this.value();
     6552 +        }
     6553 +    }
     6554 +
     6555 +    // Version 4
     6556 +    public static class A___4 {
     6557 +
     6558 +        public int value() {
     6559 +            HotSwapTool.toVersion(OldActivationTest.class, 5);
     6560 +            return 5 + this.value();
     6561 +        }
     6562 +    }
     6563 +
     6564 +    // Version 5
     6565 +    public static class A___5 {
     6566 +
     6567 +        public int value() {
     6568 +            HotSwapTool.toVersion(OldActivationTest.class, 6);
     6569 +            return 6 + this.value();
     6570 +        }
     6571 +    }
     6572 +
     6573 +    // Version 6
     6574 +    public static class A___6 {
     6575 +
     6576 +        public int value() {
     6577 +            HotSwapTool.toVersion(OldActivationTest.class, 7);
     6578 +            return 7 + this.value();
     6579 +        }
     6580 +    }
     6581 +
     6582 +    // Version 7
     6583 +    public static class A___7 {
     6584 +
     6585 +        public int value() {
     6586 +            HotSwapTool.toVersion(OldActivationTest.class, 8);
     6587 +            return 8 + this.value();
     6588 +        }
     6589 +    }
     6590 +
     6591 +    // Version 8
     6592 +    public static class A___8 {
     6593 +
     6594 +        public int value() {
     6595 +            HotSwapTool.toVersion(OldActivationTest.class, 9);
     6596 +            return 9 + this.value();
     6597 +        }
     6598 +    }
     6599 +
     6600 +    // Version 9
     6601 +    public static class A___9 {
     6602 +
     6603 +        public int value() {
     6604 +            HotSwapTool.toVersion(OldActivationTest.class, 0);
     6605 +            return 10;
     6606 +        }
     6607 +    }
     6608 +
     6609 +    @Before
     6610 +    public void setUp() throws Exception {
     6611 +        HotSwapTool.toVersion(OldActivationTest.class, 0);
     6612 +    }
     6613 +
     6614 +    @Test
     6615 +    public void testOldActivationTest() {
     6616 +
     6617 +        assert HotSwapTool.getCurrentVersion(OldActivationTest.class) == 0;
     6618 +
     6619 +        A a = new A();
     6620 +
     6621 +        assertEquals(1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10, a.value());
     6622 +        assert HotSwapTool.getCurrentVersion(OldActivationTest.class) == 0;
     6623 +
     6624 +        HotSwapTool.toVersion(OldActivationTest.class, 1);
     6625 +        assertEquals(2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10, a.value());
     6626 +        assert HotSwapTool.getCurrentVersion(OldActivationTest.class) == 0;
     6627 +
     6628 +        HotSwapTool.toVersion(OldActivationTest.class, 8);
     6629 +        assertEquals(9 + 10, a.value());
     6630 +        assert HotSwapTool.getCurrentVersion(OldActivationTest.class) == 0;
     6631 +
     6632 +        HotSwapTool.toVersion(OldActivationTest.class, 4);
     6633 +        assertEquals(5 + 6 + 7 + 8 + 9 + 10, a.value());
     6634 +        assert HotSwapTool.getCurrentVersion(OldActivationTest.class) == 0;
     6635 +    }
     6636 +}
     6637 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/RedefinePrivateMethodTest.java
     6638 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6639 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/RedefinePrivateMethodTest.java	Fri Dec 17 13:23:04 2010 +0100
     6640 @@ -0,0 +1,96 @@
     6641 +/*
     6642 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     6643 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6644 + *
     6645 + * This code is free software; you can redistribute it and/or modify it
     6646 + * under the terms of the GNU General Public License version 2 only, as
     6647 + * published by the Free Software Foundation.
     6648 + *
     6649 + * This code is distributed in the hope that it will be useful, but WITHOUT
     6650 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     6651 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     6652 + * version 2 for more details (a copy is included in the LICENSE file that
     6653 + * accompanied this code).
     6654 + *
     6655 + * You should have received a copy of the GNU General Public License version
     6656 + * 2 along with this work; if not, write to the Free Software Foundation,
     6657 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     6658 + *
     6659 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     6660 + * or visit www.oracle.com if you need additional information or have any
     6661 + * questions.
     6662 + *
     6663 + */
     6664 +
     6665 +package at.ssw.hotswap.test.body;
     6666 +
     6667 +import static org.junit.Assert.*;
     6668 +
     6669 +import org.junit.Before;
     6670 +import org.junit.Test;
     6671 +
     6672 +import at.ssw.hotswap.HotSwapTool;
     6673 +
     6674 +/**
     6675 + * Tests redefinition of a class such that old code still accesses a redefined private method.
     6676 + *
     6677 + * @author Thomas Wuerthinger
     6678 + */
     6679 +public class RedefinePrivateMethodTest {
     6680 +
     6681 +    // Version 0
     6682 +    public static class A {
     6683 +
     6684 +        public int foo() {
     6685 +            int result = bar();
     6686 +            HotSwapTool.toVersion(RedefinePrivateMethodTest.class, 1);
     6687 +            result += bar();
     6688 +            return result;
     6689 +        }
     6690 +
     6691 +        private int bar() {
     6692 +            return 1;
     6693 +        }
     6694 +    }
     6695 +
     6696 +    // Version 1
     6697 +    public static class A___1 {
     6698 +
     6699 +        public int foo() {
     6700 +            return -1;
     6701 +        }
     6702 +
     6703 +        private int bar() {
     6704 +            return 2;
     6705 +        }
     6706 +    }
     6707 +
     6708 +    @Before
     6709 +    public void setUp() throws Exception {
     6710 +        HotSwapTool.toVersion(RedefinePrivateMethodTest.class, 0);
     6711 +    }
     6712 +
     6713 +    @Test
     6714 +    public void testRedefinePrivateMethod() {
     6715 +
     6716 +        assert HotSwapTool.getCurrentVersion(RedefinePrivateMethodTest.class) == 0;
     6717 +
     6718 +        A a = new A();
     6719 +
     6720 +        assertEquals(3, a.foo());
     6721 +
     6722 +        assert HotSwapTool.getCurrentVersion(RedefinePrivateMethodTest.class) == 1;
     6723 +
     6724 +        assertEquals(-1, a.foo());
     6725 +
     6726 +        HotSwapTool.toVersion(RedefinePrivateMethodTest.class, 0);
     6727 +
     6728 +        assertEquals(3, a.foo());
     6729 +
     6730 +        assert HotSwapTool.getCurrentVersion(RedefinePrivateMethodTest.class) == 1;
     6731 +
     6732 +        assertEquals(-1, a.foo());
     6733 +
     6734 +        HotSwapTool.toVersion(RedefinePrivateMethodTest.class, 0);
     6735 +    }
     6736 +}
     6737 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/RefactorActiveMethodTest.java
     6738 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6739 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/RefactorActiveMethodTest.java	Fri Dec 17 13:23:04 2010 +0100
     6740 @@ -0,0 +1,96 @@
     6741 +/*
     6742 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     6743 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6744 + *
     6745 + * This code is free software; you can redistribute it and/or modify it
     6746 + * under the terms of the GNU General Public License version 2 only, as
     6747 + * published by the Free Software Foundation.
     6748 + *
     6749 + * This code is distributed in the hope that it will be useful, but WITHOUT
     6750 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     6751 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     6752 + * version 2 for more details (a copy is included in the LICENSE file that
     6753 + * accompanied this code).
     6754 + *
     6755 + * You should have received a copy of the GNU General Public License version
     6756 + * 2 along with this work; if not, write to the Free Software Foundation,
     6757 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     6758 + *
     6759 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
     6760 + * or visit www.oracle.com if you need additional information or have any
     6761 + * questions.
     6762 + *
     6763 + */
     6764 +
     6765 +package at.ssw.hotswap.test.body;
     6766 +
     6767 +import static org.junit.Assert.*;
     6768 +
     6769 +import org.junit.Before;
     6770 +import org.junit.Test;
     6771 +
     6772 +import at.ssw.hotswap.HotSwapTool;
     6773 +
     6774 +/**
     6775 + * @author Thomas Wuerthinger
     6776 + */
     6777 +public class RefactorActiveMethodTest {
     6778 +
     6779 +    // Version 0
     6780 +    public static class A {
     6781 +
     6782 +        public int value() {
     6783 +            HotSwapTool.toVersion(RefactorActiveMethodTest.class, 1);
     6784 +            return 5;
     6785 +        }
     6786 +
     6787 +        public int secondValue() {
     6788 +            return 1;
     6789 +        }
     6790 +    }
     6791 +
     6792 +    // Version 1
     6793 +    public static class A___1 {
     6794 +
     6795 +        public int value() {
     6796 +            return secondValue() * 2;
     6797 +        }
     6798 +
     6799 +        public int secondValue() {
     6800 +            return 2;
     6801 +        }
     6802 +    }
     6803 +
     6804 +    @Before
     6805 +    public void setUp() throws Exception {
     6806 +        HotSwapTool.toVersion(RefactorActiveMethodTest.class, 0);
     6807 +    }
     6808 +
     6809 +    @Test
     6810 +    public void testActiveMethodReplacement() {
     6811 +
     6812 +        assert HotSwapTool.getCurrentVersion(RefactorActiveMethodTest.class) == 0;
     6813 +
     6814 +        A a = new A();
     6815 +
     6816 +        assertEquals(5, a.value());
     6817 +
     6818 +        assert HotSwapTool.getCurrentVersion(RefactorActiveMethodTest.class) == 1;
     6819 +
     6820 +        assertEquals(2, a.secondValue());
     6821 +        assertEquals(4, a.value());
     6822 +        assertEquals(2, a.secondValue());
     6823 +
     6824 +        assert HotSwapTool.getCurrentVersion(RefactorActiveMethodTest.class) == 1;
     6825 +
     6826 +        HotSwapTool.toVersion(RefactorActiveMethodTest.class, 0);
     6827 +
     6828 +        assertEquals(1, a.secondValue());
     6829 +        assertEquals(5, a.value());
     6830 +        assertEquals(4, a.value());
     6831 +
     6832 +        HotSwapTool.toVersion(RefactorActiveMethodTest.class, 0);
     6833 +
     6834 +        assertEquals(1, a.secondValue());
     6835 +    }
     6836 +}
     6837 diff -r f5603a6e5042 hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/SimpleStaticTest.java
     6838 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6839 +++ b/hotswaptest/HotSwapTests/src/at/ssw/hotswap/test/body/SimpleStaticTest.java	Fri Dec 17 13:23:04 2010 +0100
     6840 @@ -0,0 +1,125 @@
     6841 +/*
     6842 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     6843 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6844 + *
     6845 + * This code is free software; you can redistribute it and/or modify it
     6846 + * under the terms of the GNU General Public License version 2 only, as
     6847 + * published by the Free Software Foundation.
     6848 + *
     6849 + * This code is distributed in the hope that it will be useful, but WITHOUT
     6850 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
     6851 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
     6852 + * version 2 for more details (a copy is included in the LICENSE file that
     6853 + * accompanied this code).
     6854 + *
     6855 + * You should have received a copy of the GNU General Public License version
     6856 + * 2 along with this work; if not, write to the Free Software Foundation,
     6857 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
     6858 + *
     6859 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA